Send direct messages using discord python bot.

preview_player
Показать описание
*Watch @ 1.75x or 2x*

Music Name: "The Green Orbs- Springtime Family Band"

If you want to send Anonymous DM to server members, then check this code:

So what the heck is actually going on in this video?
Let's do the breakdown...

1. We first imported all the necessary libraries and modules
2. on line 7, we set our bot's prefix to "!"
3. After that we created 2 new functions:


Function 1:
async def on_ready():
print('Bot online!')

:: This function is called automatically when we run our client and prints 'Bot online!' on the console and is just for our information that the bot is now up and running.

Function 2:
async def dm(ctx):

:: This is the function that sends the DM to the author(the one who types the command) along with the message in the parenthesis.

NOTE: This can only be set by the CREATOR of the bot. You can use it as a "help" command, which sends all the functionality/commands of your bot to someone who calls this function. Check the above-mentioned code link to let users send anonymous and non-anonymous messages to anyone on the server.

Thanks!
Комментарии
Автор

I was caught off guard from the first second. I can't stop laughing, coding is so much harder like this.

Dinhjason
Автор

can i write direct message to people from list (using id or maybe their names)?

klkeeperer
Автор

Hey Astrix, i need sone help. Im trying to make a bot where when you do a command, it shows a tutorial in a dm. I have been able ot make it so that it sends a single dm, but i need it ot then take messages from the dm and only the dm. For example after one part of the lesson, someone would say next, and it would edit the message to make it the next part of the lesson. Or someone could say skip if they arent interested in that particular part. Ive been trying to do this for a while and cant find any good resources so im just gonna ask you. Please help me, ive sent you a f request on the discord you told someone else btw. (xFail)

grayintentions
Автор

Wait, Does It Dm Everyone In The Server Or Just You?

un
Автор

Thanks so much mate, the code you showed me is the only code that actually worked after 20 minutes of searching

toasterofbread
Автор

I want to write a script that notifies (sends a DM) to a chosen friend every time a minute passes (planning to somehow check if time changes -> send DM with current time stored in a variable) however i am completely new to this :D Is there a way to extend the shown code for my purpose?

fear
Автор

This great, how could I send a dm message with the rules, every time a user enters my server?

naysayer
Автор

Is there a way to set 2 messages that can be DM'd? I'm using the code as shown in the video for the !dm command, but if I want to add like !form command to send a form to DM's, is that possible?

mitchellhepburn
Автор

Nice video!
Also could you please tell me the name of the song?

pranavh.p
Автор

i 've got one question: how can i send private message for person using the tag and name? I am creating Mafia bot, where all people in voice channel should get a personal role.

ruchey
Автор

Hey, I just had a question. If you wanted to send a dm to a server member, lets say by using the !reply @name WHATEVER THE MESSAGE IS, how would you do that and get a message to send to the person saying who the message was by and their response.

kkts
Автор

hello!
I just coded as same as yours but I got this TypeError:
'module' object is not callable
at line 7.. can I get some tips for this problem?

nyancat
Автор

A suggestion is dont play music too loud and if you can use subtitles.

spnge
Автор

Nice video, but music is a little bit gay.

commandsnow
Автор

What does the line of code look like where you would normally input your bot token?

Conor_-ekgk
Автор

Could you make another comment on messaging specific people? The pinned message you mentioned is not there.

jackjoseph
Автор

i’m trying to make a report function, how do you send a dm to the owner of the server?

deebah
Автор

Can't we send more than 1k dms using python ? i used loop but discord token gets changed everytime automatically

Bhatura-OP
Автор

AttributeError: 'Bot' object has no attribute 'commend' what is this ?!?!

aeaeyer
Автор

thanks a lot usually i don't watching youtube videos when i get an error but i didnt have to cause the code was in the description. Also this isn't 2009 use obs to record your videos

cat
visit shbcf.ru