From ef7fc4397af58b450d96ba238666e59fa81d4eaf Mon Sep 17 00:00:00 2001 From: Ske Date: Tue, 18 Dec 2018 18:17:09 +0100 Subject: [PATCH] Add a super sneaky dev debug messaging command --- src/pluralkit/bot/commands/__init__.py | 2 ++ src/pluralkit/bot/commands/misc_commands.py | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/pluralkit/bot/commands/__init__.py b/src/pluralkit/bot/commands/__init__.py index 96972597..09d2deab 100644 --- a/src/pluralkit/bot/commands/__init__.py +++ b/src/pluralkit/bot/commands/__init__.py @@ -181,6 +181,8 @@ async def command_root(ctx: CommandContext): await import_commands.import_root(ctx) elif ctx.match("help"): await misc_commands.help_root(ctx) + elif ctx.match("tell"): + await misc_commands.tell(ctx) else: raise CommandError("Unknown command {}. For a list of commands, type `pk;help commands`.".format(ctx.pop_str())) diff --git a/src/pluralkit/bot/commands/misc_commands.py b/src/pluralkit/bot/commands/misc_commands.py index a19dce71..fc3112d9 100644 --- a/src/pluralkit/bot/commands/misc_commands.py +++ b/src/pluralkit/bot/commands/misc_commands.py @@ -90,3 +90,18 @@ async def export(ctx: CommandContext): f = io.BytesIO(json.dumps(data).encode("utf-8")) await ctx.message.channel.send(content="Here you go!", file=discord.File(fp=f, filename="system.json")) + + +async def tell(ctx: CommandContext): + # Dev command only + # This is used to tell members of servers I'm not in when something is broken so they can contact me with debug info + if ctx.message.author.id != 102083498529026048: + # Just silently fail, not really a public use command + return + + channel = ctx.pop_str() + message = ctx.remaining() + + # lol error handling + await ctx.client.get_channel(int(channel)).send(content="[dev message] " + message) + await ctx.reply_ok("Sent!")