a way to make a Discord Bot ? utilizing Python 2021! ? (Discord.py)<iframe src="https://www.youtube.com/embed/nTGtiCC3iQM" width="560" height="315" frameborder="0" allowfullscreen></iframe>Yeah welcome back guys to another. youtube academic it is your boy sam and. today yep we're making a discord. bot so use this code as a messaging. program and you suspect to your self. hi there maybe i should make a bot now. optimistically this academic will get you. began. on the correct route to constructing your individual. discord bot. using python now the workflow of this. video is that we will start with. installation discord.pi after that we'll. create a discord software and bot. so when we're accomplished with that what we are going to. do is which will create a. discord aid and that may be. known as the discord server. now when we're done with the discord. server then we will upload. the bot into the server and when we've. further the bot to the server. ultimately we will code the bot so it's. the total workflow of this tutorial . with any luck you loved if you are new to. https://wefx.info/welcomer-bot-discord-see-here/ please. enroll in the channel like the video. guys to aid me with the youtube. set of rules and. yeah let's start there are several. libraries obtainable to hit discord's api. each with their very own developments but. finally they'll obtain the same. factor. now considering the fact that we're concentrating on python. discord.pi is essentially the mostsome of the most. popular wrapper for python i am assuming. that you already have python and pip. installed so the subsequent thing you're going. to run is that this command that is. pip set up discord dot pi now you will. be during this category in which you do not know. in case you have pip installed or. you for sure comprehend that you don't have. pip established i'll leave a card above. where. i clarify how to convert a dot pi dossier. a python dossier to an executtable file and. in the beginning of this academic. correctly clarify every little thing that has to.Do with pip in the beginning of this. video i explained every thing approximately. pippin how to grasp in case you have pip. and if you do not have pip i also exhibit. you ways to put in it. so if you do not know when you've got paper. or no longer or you know of course that you do. not have pip. cross ahead and click the card above get to. that video. watch the intro and every thing be sure. you've paper and comply with each of the. directions. then come again to this video and. retain perhaps you've checked out the. video i simply pointed out on your lower back. or you have already got pip established the. subsequent thing we'll do is that. we will have to install discord.pi so. the way we do that is we write. pip install discord dot pi. now you i am sure you guys are asking. what is this code right here. it really is i will depart a card for thiis too. you can inspect this academic it really is.just the way to make a mobile program. with television. utilizing python without a doubt so yeah i am going to. leave a card for that. but that isn't what we're doing at present so. i will click on new task. and in right here i am going to call my project as. discord discord bots. then we create create on this window i. can use any identification you want i a dead ringer for. pycharm because i admire the style the. terminal the python consoler and also. the interpreter are because it's very. easy for me to install. any libraries i would like. now that we have created our discord bot. the next aspect i'm simply going to right. right here create a. python dossier i'm going to name this file. just leading.pi. nothing too serious yeah leading.hi. now the next side is we will visit this. terminal. and lower than here that's wherein i'm. gonna positioned pip. set up discord. dot pi click input. and now we will see it is setting up.And you will find additionally everything has been. efficaciously mounted. now with any luck you've established. discord.pi effectively and. right now you have entry to discord's. api but before we start. moving into coding a discord bot's. version of whats up global. and we all know howdy world we need to. installed some other things men. now earlier than we get into coding we need to. create a discord application. this is basically an application that. holds a bot. and this can be accessed on discord and. if you do not have a discord account. then you are going to have got to create one. and please guys look into the hyperlink in. the outline below. you will see the link to this location. where i am that's discord.com. developer program so i will leave a. hyperlink for that so you can simply click. it. like subscribe to the channel help me. out with the youtube set of rules attempting to.develop this platform attempting to develop this. channel with you guys so. i really might appreciate any assist you . could accomplish that. yeah whatever is favored. and hopefully you're following alongside. because if you are then you'll have. precisely what i have in the front of me. the subsequent component we do is we simply click on. new program. we deliver it a name you may name it. whatever you want i am simply going gonna. name it my first. bot you can name it whatsoever you desire we. click on create. and now we've created our discord pod. and ii know guys there is a lot of. data and settings right here. yet as of right this moment all we have to care. about is the bot placing on the left. hand aspect. so we are going to pass forward and click that we. then desire to click on the add forums. button. a popup will arise asking all people to. tie a bot in your software. and you larger spoil that convinced do it.Button now a bot has been created and it. has been attached. to the applying we'll desire. to create a new discord server. or aid as the api loves to name it so. we can drop the bot in to mess around. with it. now we have our bot up and strolling we. are going to need to create a new server. that will have a sandbox for the bot. you can even add it to an present. server to debris with people if that is. what you desire and you know what you could. be my visitor if it comes to doing that. making a server is very simple just. click the plus button at the left. hand facet. when iinside of discord you will get. prompted with a menu to call your server. and you'll call your server anything. you want but i. characteristically call it after the bot and. deal with it like a progress surroundings. we just need to add the bot to the.Server and then we will finally dig into. the code. in order for us to play around with the. bot we will must upload it to a. server. this is also a beautiful easy step now men. we need to go to the oauth 2. area within our discord software. when we input the oauth 2 section. we will see a display with a gaggle of verify. field and you need to just remember to. click on the box labelled. bot when we click on the check box a. url will show up. directly below that so what you ought to. do is you need to copy the url. and paste it into your browser this hyperlink. enables your bot to affix. any server that your consumer has permission. to hitch. utilizing ooz2 so now you should get precisely. what i have here. very similar to what i have here. now i would like you to go ahead and choose. the server you only made from the.Drop down. and click on authorize this will drop. the bot into your server. a message will show up on your server. indicating that the bot has joined. you will additionally see the bot on the users. record on the correct hand facet of your. discord interface. now that the bot has entered the server. we will finally. get into coding a straightforward bot. we'll begin this with importing. discord.pi. this permits us entry to discords api. import discord. after that we get the. client object. from discord.pi. so the way we try this we say bought is. equivalent to. discord dot. purchaser. after that we add occasion. listener. from when the bot. has. has switched from. offline to. on-line. so we use the adds bought. dot occasion. and then we use a sync. def on underscore already. next we are saying guild underscore count number. is the same as 0 and now we glance through. guild.In the two dots. guilds no longer bits but. i will print. oh yeah we are utilizing like a strangletrol. guild.id. name. guild.name and this is not a curly. bracket. it's just aa normal bracket. after which we are saying guild. kill underscore count number is equal to. gil underscore count plus one. so we're incrementing here and outdoors. the loop we print. within right here we print. my first bot. is in. plus sdr we'd like to transform the guild. count number. from integer to thread so one can. concatenate it. guilds. so yeah permit me just put some reviews to. clarify it right here what we are doing. is we create a counter to maintain track of. what percentage guilds slash server the bot is. related to. now here we leaf through each of the guild. servers. i'm just going to name this server so. now we look through each of the servers. that the bot is associated with so. that's why we have this for loop correct.Here. after that we print the server identity and. additionally the server call. and here we increment the guild. counter. after our print how many. after print what number guild server that. the bot is in. when we occasion listen. add an event listener for now we are. going to feature an event listener for while. a message. is sent to the channel after we do that. we simply say upload. board dot occasion. say async. def underscore message. on message. message now we're going to assess if the. message that has been sent is the same as. what is up. so we simply write if message. dot content material. is the same as what is up. then watch for. message.channel. the send. here we say whats up homie. so what we're doing basically this is we. ship lower back a message to the channel. so here we'll execute. we'll execute the bots with the. unique token. so we positioned bots.run.Now here https://mega-dance.info/pomodoro-discord-bot/ have to get our. discord token and you may get. yours here you only click to. reveal token. and that is mine so i replica it. and ii will run it. you will discover now we get this right here. which says it suggests this it says the. call my first bot after which. it says my first board is in. one guild it shows you my first bot is. in one guild. you will find the message here my first. board is in. so we're counting it. you will discover the bot is online it is no. more offline. and if i write. what is up. you spot it says hiya homie so they can see. that it exactly. does what we need i will swap it up you. can upload a few more messages. you can upload whatever you desire but this. is strictly what we needed our. discord bot to do and it's done that so. and yeah guys that is it for this. academic optimistically you learned from it. if you did please depart a like that still.


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2022-01-19 (水) 01:34:37 (829d)