Skip to content

Tag: discord

Discord.py how do I send a DM to anyone I want through a command

Someone asked me to make a bot for him that sends a DM to anyone he specifies through a command, like *send_dm @Jess#6461 hello. I’ve searched alot and I came across this code: but then I got the error: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: ‘B…

Print online users to console, Discord.py

When I execute the command using my current code, I get the error NameError: name ‘offline’ is not defined. I can’t find the correct variables to make it work properly. Answer According to the API reference, you could use PS. I know nothing about this library, yet I tried searching the docs.…

Finding author of a message

If someone writes “?name (arg)” I want my bot to say the author of the message + “, your name is” + arg. I can’t find of the author of the message though. Answer To get the name of the author of the message, you will need to use context

Deleting User Messages in Discord.py

Is there any way to delete a message sent by anyone other than the bot itself, the documentation seems to indicate that it is possible Your own messages could be deleted without any proper permissions. However to delete other people’s messages, you need the proper permissions to do so. But I can’t find …