Add message count to export file. Closes #43.

This commit is contained in:
Ske 2019-02-16 14:38:44 +01:00
parent 3e7800971b
commit a5265b318f

View File

@ -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):