From a5265b318f825f5b784a5e967e222a1c253658ab Mon Sep 17 00:00:00 2001 From: Ske Date: Sat, 16 Feb 2019 14:38:44 +0100 Subject: [PATCH] Add message count to export file. Closes #43. --- src/pluralkit/bot/commands/misc_commands.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pluralkit/bot/commands/misc_commands.py b/src/pluralkit/bot/commands/misc_commands.py index fc3112d9..ee28836c 100644 --- a/src/pluralkit/bot/commands/misc_commands.py +++ b/src/pluralkit/bot/commands/misc_commands.py @@ -52,6 +52,8 @@ async def invite_link(ctx: CommandContext): async def export(ctx: CommandContext): + working_msg = await ctx.message.channel.send("Working...") + system = await ctx.ensure_system() members = await system.get_members(ctx.conn) @@ -76,7 +78,8 @@ async def export(ctx: CommandContext): "description": member.description, "prefix": member.prefix, "suffix": member.suffix, - "created": member.created.isoformat() + "created": member.created.isoformat(), + "message_count": await member.message_count(ctx.conn) } for member in members ], "accounts": [str(uid) for uid in accounts], @@ -88,8 +91,10 @@ async def export(ctx: CommandContext): ] # TODO: messages } + await working_msg.delete() + 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")) + await ctx.message.channel.send(content="Here you go!", file=discord.File(fp=f, filename="pluralkit_system.json")) async def tell(ctx: CommandContext):