From 12e41ce9b7533e60f093f9090926b7a44f151270 Mon Sep 17 00:00:00 2001 From: Etzelia Date: Tue, 27 Aug 2019 23:16:44 +0200 Subject: [PATCH] Re-implement shortcuts (#29) --- bot/commands.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/bot/commands.py b/bot/commands.py index 0a3140c..ef7fae5 100644 --- a/bot/commands.py +++ b/bot/commands.py @@ -55,7 +55,14 @@ class Commands(commands.Cog): if ctx.invoked_subcommand is None: await self.bot.discord_message(ctx.message.channel, "No sub-command supplied. Info, Search, Accept, or Deny.") + @commands.command() + async def info(self, ctx, *args): + await self._info(ctx, *args) + @app.command("info") + async def app_info(self, ctx, *args): + await self._info(ctx, *args) + async def _info(self, ctx, *args): if len(args) == 0: await self.bot.discord_message(ctx.message.channel, "Info requires an application ID or username.") @@ -89,7 +96,14 @@ class Commands(commands.Cog): return await self.bot.discord_message(ctx.message.channel, build_info(application)) + @commands.command() + async def accept(self, ctx, app_id: int): + await self._accept(ctx, app_id) + @app.command("accept") + async def app_accept(self, ctx, app_id: int): + await self._accept(ctx, app_id) + async def _accept(self, ctx, app_id: int): application = get_application(app_id) if not application: @@ -107,7 +121,14 @@ class Commands(commands.Cog): if not api.plugin(api.PLUGIN_ACCEPT, application.username): await self.bot.discord_message(ctx.message.channel, "Could not accept in-game, is the server running?") + @commands.command() + async def deny(self, ctx, app_id: int): + await self._deny(ctx, app_id) + @app.command("deny") + async def app_deny(self, ctx, app_id: int): + await self._deny(ctx, app_id) + async def _deny(self, ctx, app_id: int): application = get_application(app_id) if not application: @@ -125,7 +146,14 @@ class Commands(commands.Cog): if not api.plugin(api.PLUGIN_DENY, application.username): await self.bot.discord_message(ctx.message.channel, "Could not deny in-game, is the server running?") + @commands.command() + async def search(self, ctx, search: str): + await self._search(ctx, search) + @app.command("search") + async def app_search(self, ctx, search: str): + await self._search(ctx, search) + async def _search(self, ctx, search: str): applications = Application.objects.filter(username__icontains=search)[:10] count = Application.objects.filter(username__icontains=search).count()