'Nextcord: I want to mention the sender of the slash command I made. How would I go about that?
I'm trying to make this command notify my admins of a bot test and need it to mention the user who called the command. How would I go about that? I don't fully understand how to get that information with slash commands.
@client.slash_command(name= "test", description="(For Deputies or Leader only) Checks the operational state of the client.", guild_ids=[806043206030589952])
@has_any_role(leader_id, deputy_id)
async def test(interaction:Interaction):
bot_log = channel_up(940125176723554394)
await bot_log.send(f'<@&806045254834847776>,{} has started diagnostics for the bot. Please ignore any possible disturbances for the next minute or so.')
Thanks in advance for the advice, it's the first discord bot I've ever created.
EDIT:
In documentation, I found the solution. I have to use interaction.user.mention
to get it to mention the user who sent the command. Or at least in theory, I'm dealing with a different issue now. Hopefully this helps people who also were as confused as me out.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|