0
votes

I'm trying to create a user reporting system that automatically sends a message to discord moderators.

And I would like that apart from sending said message, it obtained who was the original creator of that message to prevent possible abuse of the system or to get in touch with the user who made the report.

For now I have the code to send the messages to the moderators with their content, however I can't find the correct way to obtain the invoker of the command.

Thats is my code:

#Commands
@bot.command(pass_context=True)
async def dm(ctx,*, message):
    author = bot.get_user(ctx.author) #This try to get the author of the command
    await ctx.message.delete() #This delete the message from the discord channel in which it was invoked
    mod = bot.get_user(715816993969930311) #The Mod that will receive the message
    await mod.send("Report: " + message + author)
1

1 Answers

0
votes

You can use ctx.author attribute, you don't have to 'get it' because already is a discord.Member object

author = ctx.author

Here are the attributes of context