PluralKit/src/pluralkit/bot/commands/message_commands.py

19 lines
607 B
Python
Raw Normal View History

from pluralkit.bot.commands import *
2018-09-07 17:34:38 +02:00
async def message_info(ctx: CommandContext):
mid_str = ctx.pop_str(CommandError("You must pass a message ID."))
try:
2018-09-07 17:34:38 +02:00
mid = int(mid_str)
except ValueError:
raise CommandError("You must pass a valid number as a message ID.")
# Find the message in the DB
message = await db.get_message(ctx.conn, mid)
if not message:
raise CommandError(
"Message with ID '{}' not found. Are you sure it's a message proxied by PluralKit?".format(mid))
await ctx.reply(embed=await embeds.message_card(ctx.client, message))