Add basic HTTP API

This commit is contained in:
Ske
2018-08-02 00:36:50 +02:00
parent e831ef5921
commit 944f0093a9
13 changed files with 238 additions and 51 deletions

View File

@@ -4,6 +4,7 @@ from urllib.parse import urlparse
import humanize
import pluralkit.utils
from pluralkit.bot import utils
from pluralkit.bot.commands import *
@@ -153,7 +154,7 @@ async def system_fronter(ctx: CommandContext, args: List[str]):
if system is None:
raise CommandError("Can't find system \"{}\".".format(args[0]))
fronters, timestamp = await utils.get_fronters(ctx.conn, system_id=system.id)
fronters, timestamp = await pluralkit.utils.get_fronters(ctx.conn, system_id=system.id)
fronter_names = [member.name for member in fronters]
embed = utils.make_default_embed(None)
@@ -182,7 +183,7 @@ async def system_fronthistory(ctx: CommandContext, args: List[str]):
raise CommandError("Can't find system \"{}\".".format(args[0]))
lines = []
front_history = await utils.get_front_history(ctx.conn, system.id, count=10)
front_history = await pluralkit.utils.get_front_history(ctx.conn, system.id, count=10)
for i, (timestamp, members) in enumerate(front_history):
# Special case when no one's fronting
if len(members) == 0: