Image + Ping #6810
-
Is there a way to make it so that if a user inputs the command with a user mentioned after to have the bot send the image and mention the user? Here is the current code for the command, and any help will be much appreciated. if msg.startswith("D$bonk"): |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hey there, It's probably best to use the commands extension as it makes working with arguments much easier. If you did use it, you could pass a This would then allow the library to convert the input to a member/user object (assuming it's valid) so that you can mention them with You can read about commands here: https://discordpy.readthedocs.io/en/latest/ext/commands/commands.html and typehinting to discord models (such as discord.Member) here: https://discordpy.readthedocs.io/en/latest/ext/commands/commands.html#discord-converters Take care, |
Beta Was this translation helpful? Give feedback.
Hey there,
It's probably best to use the commands extension as it makes working with arguments much easier.
If you did use it, you could pass a
user
argument, which you could typehint todiscord.Member
(ordiscord.User
if you wanted to use it outside of guilds).This would then allow the library to convert the input to a member/user object (assuming it's valid) so that you can mention them with
member.mention
along with sending the file.You can read about commands here: https://discordpy.readthedocs.io/en/latest/ext/commands/commands.html and typehinting to discord models (such as discord.Member) here: https://discordpy.readthedocs.io/en/latest/ext/commands/commands.html#discord-converters