How to construct a Loose Discord bot with Autocodewhats up i am jacqueline and today we're gonna. be constructing and deploying a discord bot. for absolutely unfastened utilizing autocode in. somewhat bit more than 10 minutes. now to finish this tutorial you are. gonna need aa couple of matters these are. a discord account which you possibly. already have if you are looking this. video. a discord server you could experiment your bot. on due to the fact you have to be able to see. what your bot is doing if you don't. already have your individual discord server to. experiment things in determine the hyperlink out down. under that's going to let you know all. about how to go and set one up it's a. pleasant little aid you should move and get. your self a free autocode account too you. can move and get one at autocode.com. and that is where we are gonna be. building and web hosting our discord bot and. finally you just ought to have the ability to.gain knowledge of you should have passion for. learning and don't be afraid if i am. gonna throw some things at you during this. video which you've under no circumstances noticeable earlier than you. know it's gonna be a little bit a studying. curve yet hi there we are gonna get via it. collectively so pass get those matters and while. you have got all of them all set get back to. this video we're gonna maintain going in an effort to. get started you ought to go and head over. to reserve code.com and iit should take you. to a page that looks a little like. this. if it would not seem like this you're. not likely signed in but so pass check in. and when you're right here you should see a. big blue new project button so move deliver. that a click on due to the fact we're making a new. task a new bot. and iit should take you to a code editor. that looks just like this. if. code is somewhat overwhelming do not worry. because this code editor is magic and.it's going to help us make matters a. little bit less difficult than regular. now the very first thing we will be. building is the command which once we. ship scale back ping makes our bot reply with. pong and in vehicle code matters work a. little bit differently to how you may. have seen them in different code editors. so we need to go until order code to move. and run a few code whilst a command iis run. how will we do that well you must see up. right here there's an selection to choose what. triggers our code so let's give it a. click. and we want to trigger on discord so if. we kind discord in here and then we. click it. it's going to let us cross and choose an. event. well we are creating a command we're making. it to be scale back ping so let's kind in. command and good day it is giving us the. option to say hello. run this code when a discord command. occurs.And iit's going to ask us what command we. want to run well we want it to be diminish. ping so let's pass and sort ping into this. field. and eventually we'll click on this. blue okay button so now. each time the scale back ping command iis used. it is going to go and run the code within. this file. now rather than making you write each. unmarried line of code in this video. because that is going to take continually. we'll provide you with a few snippets. you could pass and replica paste and the 1st. this type of is the bit of code which. replies with pong you are welcome after. this academic to head and change any of. this to do whatever you desire it is. just a good commencing step and so you could. cross and try this link to get all. the bits of code that you need it is also. in the outline down below. so let's replace everything that is.Currently in this dossier with what we just. reproduction pasted. see slightly less yet whats up super. incredible simple. now if you are new to programming this. could look just a little difficult so permit. me simply surely quickly explain what it. all does. so online three you can find that we're. obtaining lib. and in certainly easy phrases it is simply. somewhat code that makes order code paintings. it makes use of this lib kit to go and communicate. to all of different people searching for products which. you can use within automobile code for instance. this lib package is how autocode talks. to discord so this line of code always. ought to be here cool then have a look. at line 5 you'll find that we are. utilizing that lip package we just talked. about to refer to a discord and in a. channel good we wish to get a message. and create it or in english we wish to. cross and create a message in a discord.Channel move examine it backwards if you are a. little bit stressed. and well good day we can see our content material of. our message is going to be pong it's. going to go and placed pong within the channel. but it needs a channel id and a channel. id is how discord understands which channel. you want to move and publish your message in. but. how do we know. well you can find it says. context.params.occasion.channel identification. context.params incorporates a load of data. approximately what made this code run so for. instance it contains all information concerning the. command that was ran. we're unlikely to dive brilliant deep into. it during this video yet have a look in the. order code guide in order to study a. little bit more approximately how thiis works. so cool we have a little code that. is going and posts the message pong into a. channel whilst you are going to use the. lower ping command awesome let's move and.Hit this shop button then. and well i need to go and mounted a. assignment you should pass and save it and. i'm going to cross and contact this my marvelous. bot because it's distinctly magnificent in case you. ask me that's going to avoid wasting that new. assignment. but. hello. we have long past and set this up we've made it. so our bot runs on a command in discord. yet we certainly not have in fact long gone. and connected it to discord so let's go. and do this in the present day. and with a bit of luck at the sidebar you ought to. see approximately one resource is needed in a. large pink box so let's cross and provides the massive. pink field a little bit a click on. and good day it is saying hiya please hyperlink a. discord resource good we will do this now. so let's pass and click hyperlink. and for instance we have not long gone and. created this spot on discord yet we're. creating aa brand new bot how will we do. that good let's pass and do that now let's.Create a brand new source link a brand new. source that we have not made yet and. autocode goes to make our existence. certainly very easy it's aactually going. to offer us a guide and if we comply with this. guide we're gonna be able to cross and set. up our bot on discord now what this step. does. is it lets us say hey discord this bot. we just coded it exists you want to know. approximately this due to the fact i desire to run somewhat. of code utilizing it. so let's click on for discord developer. portal link it gives me and we want to. cross and create a brand new software inside. of here. you can now call your software. whatever yet i'm simply going to go and. name mine my marvelous bot and i am gonna. cross and click create. and funky we will see all of the settings for. our bot which we just created. and if we now return to order code. and we scroll. down it says hi there once you've carried out this.click on the next move so let's click on subsequent. step. and it wants us to get the customer identity and. the client mystery well let's go back to. discord and get that and it says we are able to. get it from this off to section at the. sidebar so let's move copy this purchaser identity. and let's go and paste it in here. after which let's also go and copy the. client secret and paste it in here as. well. magnificent and when we've done that pass on. to the next move cool we now have to cross. and tell discord hi there we wish to go and. authenticate using order code and to do. that we move and duplicate this hyperlink right here. and we cross and paste it in the oauth 2. section so head lower back to discord. scroll down wherein it says off to reader. x i desire to pass and upload a redirect onto. paces in right here. and then we wish to hit shop adjustments. phew that become numerous stuff to do yet. we're nearly carried out let's head back into.Order code see what it wants us to do. next we're going to hit next step. good finally we have to cross and create a. bot person. so. let's move and do this at the moment let's hop. back over to discord. let's click bot. and we're going to pass and upload our bot so. this is asserting hey discord you know this. application we simply created it is going. to be a bot it will be whatever. you could refer to and engage with over. on discord so yeah let's go and add a. bot to this app mine's still going to be. called my magnificent bot if you really need. you could add a custom picture here you. can cross and decide anything you desire for. your username. so what you are going to do is you desire. to head and replica this token and then paste. it into a field on order code that appears. if you scroll each of the manner down. amazing good we have done that so let's. https://mega-dance.info/therapy-discord-bot/ conclude. and iit's going to move and say hiya let's. go and get matters hooked up my magnificent bot. desires to access your account that's. amazing news. and it wants me to go and upload it to a. discord server that i have already created. which we noted earlier it really is. going to be your test server. good my experiment server believe it or now not is. referred to as. my test server yet you need to go and. click the name of this test survey you. created earlier otherwise you already had set. up so go and do this then click keep. it will give you a large lengthy record. of factors our bot wants to do during this. case we are simply going to move and permit our. bot do anything yet when you are creating. a real bot not only a test one you just. want to present the bot permissions that it. correctly really needs so for now we are. gonna move and scroll down and we are gonna.<iframe src="https://www.youtube.com/embed/6r3lFcDFnus" width="560" height="315" frameborder="0" allowfullscreen></iframe>click on authorize. ultimately we're gonna move and say howdy i am. a human i am obviously a human final time. i checked. magnificent good if we head back into order. code now you should see good our marvelous. bot is now linked and so for instance hi there. we are finished linking we simply did a. lot of steps yet what we've just done is. we have advised discord.exists and we have long past. and created a command which is amazing. news. so we have written our code we've got to. make it so it replies with pong if. somebody uses the ping command we've. created our bot on discord but there's. one last thing we have to do we have to. go and inform discord hey. this ping command it exists and by chance. autocode has a manner that makes it surely. simple. so head over to the hyperlink on your display screen. now it is also in the outline and also you. desire to go over to order codes discord.decrease command builder i will use. this to tell discord in regards to the command. exists remember this is our shrink ping. command. so first up let's cross and comply with the. directions on here we want to pass and. link an account and that's the source. we simply created subsequently it is my. magnificent bot. and iit's going to link so we are just. going to offer it a second awesome. so let's pass and established our command our. command's call is easily. ping because it replies when we use the. cut down ping command and let's just write. a short description in addition since the. description is simply going to be responds. with. pong. obviously you could go and write whatsoever. you want on your description. magnificent good when we've done that all. you gotta do is hit thiis big save all. button and seriously that's all we've. received to do. seriously if i now jump over to discord.And i try to use my minimize pin command. well my box can have a think and it's. going to reply with pong heavily we. just created a bot. that actually works in only a few. mins. yet howdy let's move and make it do extra. things. i have the desire to make it so our discord bot. replies to us after we say hello or good day or. hi there or permit the cool kids genuinely say now. sup. so let's hop into order code and let's. have a go at doing that. but. hiya i simply understand how to make a command. how do i make it so it replies to a. individual. well. so as code we try this by means of making a. new dossier and telling autocode what event. we want to run that dossier on. so let's click thiis big plus icon to. create a brand new endpoint. and good we want to run this on. something that's discord associated. yet. we want it to reply we need it to reply. to while someone sends a message.In this field. let's try typing message. well we need not run when the bot. creates the message we'd like it to run. when an individual creates a message i ponder. if we scroll down oh message create so. while a message is created in a discord. channel presumably by way of a human. it is going to run the code in here that. feels like what we'd like so let's click on. message create. and let's hit okay. so this code is going to ensue. while someone creates a message in a. discord channel or when they send a. message. well i'm not likely to make you write. that code all over again let's just cross. and paste what's within the hyperlink on your. display screen in the description as we speak. so i am not gonna dive superb deep into. how all of this code works because it's. a bit of extra improved but permit me. just provide you with an exceedingly rapid evaluate. well we cross and say howdy if this message.involves hi or good day or hi there or sup. then we want to move and reply. with a message that asserts good day or hi or. hi there us up to you too. and we wish to move and respond in a similar. channel that the message became despatched and. it's a respond it replies to a message. rather than just posting it within the . channel in addition. now we inform if a message comprises hi or. hi there or hi there or sup using whatever. known as a regular expression i am not. gonna dive exquisite deep into what they are. or how they paintings but if you are. attracted to getting to know extra inspect. this hyperlink. and you may change this you can make. it respond to somebody announcing purchase or see it. or gotta go you know you can change this. notwithstanding you want it really is just an instance. but let's try jogging our instance let's. just go and hit store. and iit's going to pass and installation our. adjustments it is going to pass and save our.changes and make it so our discord bot. is strolling these adjustments. so let's pass and allow it save its changes. and then we're gonna go and head returned. over to discord and. well let's provide it a pass let's pass and say. howdy bots and. good with any luck it replies oh there it's. hey to you too how nice is that and i. wager if i say. hey it is going to move and say hiya. back in addition what a polite bot. so you recognize in only a few minutes. we've got to made a bot with a command. and one that could respond to us which is. really really cool. let's do one thing more with a bot. earlier than we name it a day endure because wow. we've just done so much already yet i. imagine we can go somewhat bit. further so i intend to make it so when a. new consumer is going and joins our server that. the bot goes and says whats up how are you. doing additionally here is a hyperlink to our rules.And iit's going to tag them but i would like. these guidelines to seem pleasant so in preference to. simply going and putting all of these. guidelines into a large terrible. big lengthy message. rather i'll use discords in. beds and they give the impression of being just like thiis this. goes in mattress to help you maintain things a. little bit purifier a bit of nicer. seeking and a little more prepared. so they are surely really magnificent. now for this to work our bot needs to. comprehend who's in our discord server. and discord calls is something referred to as a. privileged gateway intent. it is something that they do not want. every bot to have entry to and so that you. intend to make it so your bot explicitly. asks for it so how can we try this. head back over to the discord developer. portal return on your bot hopefully you. didn't near the tab. and you must see if you scroll down on.Your bot page this option that's. referred to as privileged gateway intents. and all we need to do is switch on this. server member's intent and hit shop. what we are saying is hi there discord i want. to find out about my list of server individuals. to make my bot work which is how we ship. a message when somebody joins our server. cool now let's head again over to order. code and let's go. and create our latest. issue . oh cling on it is a new piece of code. this is not happening after we pass and. create a message and iit's not going on. once we run a command it's occurring. whilst somebody joins the server after we. get a brand new member. good let's click add anyway we're going. to create a new endpoint i'll. say hey this endpoint happens when on. discord. good. let's see member. oh guild member upload when someone joins. our guild or our server that sounds.about correct we want to run our code whilst. somebody joins our server. so let's provide it a click. and click on ok. also my list code is now going to run. when we join the server or whilst anybody. joins the server. now i do not know the way to make an embed by using. myself it is notably difficult and it. takes really many years but fortunately. order code has a very good discord embed. and builder we are able to move and use rather. you can get to it using this hyperlink so. let's hop over there and have a move at. utilizing it so we are within the embed builder. and it really is in which we pass and established an. embed well let's cross and do this now the. very first thing i would like my bot to do is say. hello welcome to my server it is a well mannered. bot so it is going to say howdy. welcome to my test server. we can probably be just a little extra. clever with that in a bit of bit. and you recognize let's move and notice the name.Of my embed is going to be. here's the rules. and well what are our rules let's pass and. ponder a few guidelines well as an example. hmm. let's make a box and iit's going to say. you know rule one. and our role is going to be do not consume. pie. eating pioneers known as serve is an incredibly. bad suggestion if you don't you do not need to. be in a voice channel with somebody whose. mouth is open it sucks. ok let's move and create an extra box. let's pass and say hello rule . is be sure you sleep since you recognize. sleep is very very important. and eventually our third rule. and its primary rule is to have. enjoyable your rules may well be whatsoever you want. well i am distinctly happy with how this. embed looks. so let's go and scroll down. and let's pass and duplicate the code to make. this embed paintings. magnificent now let's head returned over to. fiona code editor and we're gonna use.The most powerful significant portion of this. workshop certain. we are gonna move and paste it so let's pass. and select all of this. and let's move and paste and you will see that. now hello you know this message while a brand new. consumer joins. it is gonna cross and say hello welcome to my. test server. and. well we did it marvelous. yet wait there's a few adjustments we need. to occur right here. we will not just cross and use channel identification from. the event you know once we ship a. message into the channel lets simply. respond in an analogous channel yet this. person is joining our entire server no longer. only a channel. so we have to move and alter our channel. id on-line 4. let's return to my discord server and. let's cross and ship it into my preferred. channel this message. well. how will we get the channel identity on discord. i don't know how to do that good first. up we need to move and turn discord.Developer mode on so. listen up. on the bottom corner of your discord you. ought to see a touch cog icon. move supply that a click on. and then click improved. then you ought to see this little assess. field in which you can move and switch developer. mode on so pass and give that a click it is. going to give you many of beneficial matters. that's going to help us make bots and. make your lifestyles somewhat easier. cool good now we near out of here if we. pass and right click popular we will now cross. and say copy identification if you don't see this. reproduction identification button you probably didn't flip. developer mode on properly so cross examine. cool so let's pass reproduction this identity. after which if we head back into autocode. we will move and replace this channel id. with the single we simply copied and now this. message is gonna be sent immediately into. my wellknown channel okay one thing more.Let's make it so our bot is super. custom-made and it says hello to the. genuine individual that simply joined our server. so let's move and say you stated whats up we are. going to go and say good day. to our specific user good to move and tag. a person we need to cross and use these. little variety of greater than lesson. symbols. and we want to go and do at in an effort to. tag them. and then it is a little bit of. javascript so this looks unfamiliar. don't fret simply follow along we are. going to do dollar sign after which. open and close those curly brackets. and iinside these curly brackets. good we want to move and tag the user id. and to do this we use. context.params.occasion.consumer.identification. now i just went wonderful rapid right here on how. to do that yet i promise it will. paintings so permit me simply run it and i'll just. certainly quickly clarify how this actually. works so let's move and hit thiis big.Orange keep button. we will deliver our bot a moment to save lots of. so now we're gonna go hop again over to. discord and whilst nestor goes and joins. our server you can see that good day it is. long gone and said whats up nestor welcome to my. experiment server and here are the guidelines so in. a space of no longer very lengthy at all we've. just gone and constructed a bot that has a. command can reply to messages and. greets new persons becoming a member of our server. is not that aawesome good you can use. order code to do manner more than that yet. you know i would not allow you to pass and. find out that all by yourself but if you. want aa bit of more assist and you want to. see a few code snippets which are going to. help you get there inspect this link. it's going to pass and tell you all about. about a alternative ways which you'll be able to pass. and make your bot marvelous. and that is it i obviously go and.


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