Re-implement shortcuts (#29)
parent
773efe0606
commit
12e41ce9b7
|
@ -55,7 +55,14 @@ class Commands(commands.Cog):
|
||||||
if ctx.invoked_subcommand is None:
|
if ctx.invoked_subcommand is None:
|
||||||
await self.bot.discord_message(ctx.message.channel, "No sub-command supplied. Info, Search, Accept, or Deny.")
|
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")
|
@app.command("info")
|
||||||
|
async def app_info(self, ctx, *args):
|
||||||
|
await self._info(ctx, *args)
|
||||||
|
|
||||||
async def _info(self, ctx, *args):
|
async def _info(self, ctx, *args):
|
||||||
if len(args) == 0:
|
if len(args) == 0:
|
||||||
await self.bot.discord_message(ctx.message.channel, "Info requires an application ID or username.")
|
await self.bot.discord_message(ctx.message.channel, "Info requires an application ID or username.")
|
||||||
|
@ -89,7 +96,14 @@ class Commands(commands.Cog):
|
||||||
return
|
return
|
||||||
await self.bot.discord_message(ctx.message.channel, build_info(application))
|
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")
|
@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):
|
async def _accept(self, ctx, app_id: int):
|
||||||
application = get_application(app_id)
|
application = get_application(app_id)
|
||||||
if not application:
|
if not application:
|
||||||
|
@ -107,7 +121,14 @@ class Commands(commands.Cog):
|
||||||
if not api.plugin(api.PLUGIN_ACCEPT, application.username):
|
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?")
|
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")
|
@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):
|
async def _deny(self, ctx, app_id: int):
|
||||||
application = get_application(app_id)
|
application = get_application(app_id)
|
||||||
if not application:
|
if not application:
|
||||||
|
@ -125,7 +146,14 @@ class Commands(commands.Cog):
|
||||||
if not api.plugin(api.PLUGIN_DENY, application.username):
|
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?")
|
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")
|
@app.command("search")
|
||||||
|
async def app_search(self, ctx, search: str):
|
||||||
|
await self._search(ctx, search)
|
||||||
|
|
||||||
async def _search(self, ctx, search: str):
|
async def _search(self, ctx, search: str):
|
||||||
applications = Application.objects.filter(username__icontains=search)[:10]
|
applications = Application.objects.filter(username__icontains=search)[:10]
|
||||||
count = Application.objects.filter(username__icontains=search).count()
|
count = Application.objects.filter(username__icontains=search).count()
|
||||||
|
|
Loading…
Reference in New Issue