2018-07-24 22:47:57 +02:00
|
|
|
from pluralkit.bot.commands import *
|
|
|
|
|
|
2018-09-16 13:59:37 +02:00
|
|
|
|
2018-09-07 17:34:38 +02:00
|
|
|
async def message_info(ctx: CommandContext):
|
2018-12-05 11:44:10 +01:00
|
|
|
mid_str = ctx.pop_str(CommandError("You must pass a message ID."))
|
2018-07-24 22:47:57 +02:00
|
|
|
|
|
|
|
|
try:
|
2018-09-07 17:34:38 +02:00
|
|
|
mid = int(mid_str)
|
2018-07-24 22:47:57 +02:00
|
|
|
except ValueError:
|
2018-12-05 11:44:10 +01:00
|
|
|
raise CommandError("You must pass a valid number as a message ID.")
|
2018-07-24 22:47:57 +02:00
|
|
|
|
|
|
|
|
# Find the message in the DB
|
2018-10-27 23:30:12 +02:00
|
|
|
message = await db.get_message(ctx.conn, mid)
|
2018-07-24 22:47:57 +02:00
|
|
|
if not message:
|
2018-12-05 11:44:10 +01:00
|
|
|
raise CommandError(
|
|
|
|
|
"Message with ID '{}' not found. Are you sure it's a message proxied by PluralKit?".format(mid))
|
2018-07-24 22:47:57 +02:00
|
|
|
|
2018-12-05 11:44:10 +01:00
|
|
|
await ctx.reply_ok(embed=await embeds.message_card(ctx.client, message))
|