B
B
Beeskee42021-01-24 09:06:30
Python
Beeskee4, 2021-01-24 09:06:30

How to get the content of a message that has been replied to?

In general, I want to make a reporting system. The point is simple. If a person sends a message to a text channel, another can use the response to write the !report command, after which an embed message is sent to a special channel with a message that was answered with the !report command, everything works, except how to pull out the message and get its author. Please help.
There is no code, because I erased it for now.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Nevzorov, 2021-01-24
@Beeskee4

Message.reference > MessageReference.resolved

@commands.command()
async def cmd(ctx):
    if ctx.message.reference and isinstance(ctx.message.reference.resolved, discord.Message):
        await ctx.send(ctx.message.reference.resolved.content)
    else:
        await ctx.send("You need to reply to message")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question