Build a DISCORD BOT with Node JS | Discord JS v13 #1<br/>What's going fellow web developers. my call is tyler potts and in ultra-modern. video we'll be. starting a brand new series on discord js. edition 13 with scale back commands so i would like. a discord uh bot for my surfer currently. i purely have me six uh fabulous awesome. bop but i am very restrained to what i will. do devoid of paying extra and ii could pay. additional to help the developers who have. executed a awesome task and i perhaps. will oversurface but for my server and. for the. the love of getting to know and teaching others. i will be growing. my very own bot to do everything every thing. we needed to do it will be. leveling up it is going to be. giving me. updates it could do quizzes i do not know. we came up with a big list of factors we. desired to do on a move any other day. and they're now within idea and i. will show you these as we are going.<br/>by way of and what we're working on but. state-of-the-art video goes to be targeting. getting the rules laaid the bottom. mounted we'll get our bot all set. from discords uh we will get our. token we're gonna clearly hooked up a. node.js program and we're gonna. install uh. clearly get our bot in our server. ready to cross maybe with one command just. to test out with a purpose to comprehend it is operating. great so men if you are prepared for this. don't forget to depart a thumbs up and. we're about to start on a brand new. journey in discord js. okay men so. now we need to go to the discord. developer portal to actually create our. program now to try this what you want. to do is head over to for. decrease builders for shrink functions. if you are not logged in it will ask you. to log into your discord account once.<br/>you are logged in you can see. the display screen icon with out strelexia as an. software without a doubt . now to create our application what we. have to do is visit new software and. deliver it a name i'm going to name mine pass. ct but you give yours any call you. favor click on create and right here you may. difference the icon or you may get the name. or for now we don't desire any of. this that is all pleasant we don't need to cross. to off to. and we need to clearly select bot. and down here we will select the. permissions we'd like and we will. supply it administrator that is eight. which is great then let's go over to. backside we really need to. create a bot so let's click on upload. sure do it and then it is going to create. us a bot now we can present the bot a. distinctive username if we'd like yet i am. going to go away it an analogous we're going.<br/>To need this token for later but for now. just forget about it i am going to flip off. public field i basically favor it that allows you to. move directly to surface i invite it to for now. and then if we cross down here you can see. there's two matters right here this one. presents severe which may track the. presence information and then surfer contributors so. we need it we're probably going to wish. the two of these later on down the road so. simply click on these on and turn them on. however in case you don't think you are going. to want them then you do not have to open. one now let's return to oauth2 and i. simply realized i have to click this again. and click administrator because um i've. i forgot that resets when you click on away. and then we need to reproduction this link and. that is going to ask our bot to our. discord floor so let's replica . open up a new tab and paste.<br/><iframe src="" width="560" height="315" frameborder="0" allowfullscreen></iframe><br/>Hit input and now you will discover it says pass. ct bot hook up with discord and we are. going to choose our potsy coding cafe. i will click on preserve and it's. going to ask me what are the permissions. i would like i want an administrator i trust. my very own bot i mean as long as no one else. packs it which i doubt they are going to we. must be well let's click authorize now. this is incredibly ironic it's asking me if. i am a human when i am creating a bot um. i am human thanks thank you for. noticing. after which here we're so. you will now near this window is now. achieved look how cool the little stars look. anyway so if we pass over to here bot. checking out you will discover on the right we. actually have ghost ct who is within our. inside um our offline stairs so he's. currently offline so we need to get them. on-line i am additionally going to provide him the.<br/>function of bot boys in my surfer there isn't any. real want you do not have to do this it is. just because. that's wherein my bots cross so bop boy is. here and he is currently ready to. be validated but we want to truly set up. a node.js software so let's close. this. and let's move down into a folder so i. have an empty folder here i'm going to. open up with legitimate studio code you. can use any textual content editor respectable sewer. codes as my choice. and before i do whatever in right here what i. must do is open up the terminal. and write. npm. init. hyphen y and now this is going to create. as a kit.json dossier definitely in case you. do npm and it says this does not exist. you should set up node and npm. you must just install node sixteen edition. sixteen or above because it has each of the. features that discord price 13 uses. so once we have our kit.json you can.<br/>See in here i'm just going to rename. this to bot because i admire naming my bot. it is sensible to me after which we are able to. simply delete these scripts for now um. we are going to add. a customized one in there soon and there you. pass that is what we need in our kit so. i am just going to open up my terminal. back and what i will do is say. npm. set up or just i and ii'm going to. install discord.js and emf i will. clarify what these do after we come. around to them obviously discord.js is. the. um the package we're using and dot e and. fee is definitely. dot e and v. so i'll see you on process ok now that. it's executed what i will do is also. run npm i yet this time hyphen d to. install a depth dependency and it's. going to be node 1. now node 1 goes. to allow us to restart our surfer. without needing to restart our server it. basically restarts our server whenever.<br/>We make a change to our documents so there. we pass if we just clean this that should. now be finished so let's close that down go. into our kit and you'll see right here we. have two dependencies and one intensity. dependency so now that's performed we're. going to go in here and we'll. create a bot.js dossier and we're going to. get a client and some motive so i am. going to claim client. intents. from. or sorry. is equal to require. and we are just going to say discord.js. so we'll get purchaser and iintent. from discord.js. we then want to additionally . do require. dot ianfee. dot config so what this may do it's. going to establish procedure dot ian in your. technique. approach. dot e and fee dot token or we. want to use so we can actually get stuff. from a dot emp dossier. and there you pass we don't need to established. our precise client so i'm just going to.<br/>Use lowercase purchaser and we're going to. say it is equivalent to a new. dot. a brand new purchaser after which the choices. would be. in here and we will say motive and we. need seven contents now what are motive. so it is new in discord. edition 13 i feel and iintents are. basically the functionality your bot has. so right here we will say intents. dot flags dot guilt and what that does. is basically say we want access to. guilds which are surface so we want to. have surfer functionality we then favor. to assert extreme dot flags. dot guild. messages now what that is going to do is. provide us access to the messages inside of. our client and the client is our bot so. within a guild we will be capable of get. the guild messages. and there we pass. so we've those 3 matters we now. want to really. go browsing we'd like on the way to pass here so. we have to say purchaser.<br/>Dot. login and this will log us in but as you. can see. this calls for a token. um which is a string and obviously the. token is from our. bots and you will see right here now i go. to click to fill up this so you'll discover. it but i'm going to refresh this and. regenerate after so you can't use this. token don't ever let anybody get entry. for your token because if they do they. can control your bot and do god is familiar with. what with it. so i'm going to hit replica and ii'm going. to go back in right here and ii'm going to. create a brand new dossier called dot env and in. here i'm just going to assert token. and ii'm going to set that equal to. the token similar to that aand then near. that down after which this dot ian price will. now be. we are going to be able to entry it so what we. can say is process. dot e and price. dot token. identical to that and which will give us.<br/><a href="">poll bot discord</a> to our token now if we visit our. kit.json. we are able to now established a new script and this. script goes to be referred to as defeat for. development. and we are basically simply going to say. nodemon so the package we installed. earlier. bob.js now what this may do is it is. going to essentially each time we make a. change in right here it's going to replace. immediately for our server so we do. no longer ought to preserve strolling it over and. once more so as an instance npm run dev. and that is going to start our bot just. like that now how do we know if that is. operating well if we get back into our. bot checking out or our surfer you'll see. our bot is now on line he's now not. offline he is on line but if we want a. extra respectable within the terminal we can. actually do something referred to as on prepared so. we are able to say client dot on. and you need to use as soon as which we will call it.<br/>as soon as which is definitely one of the better choice. to use so we're gonna say on. once all set. um we'll call an arrow function. that announces console.log. ghost is online. the image of that and now if we return. where's the mistake unexpected token. that's fine if we store it may fix. that issue and there you move now you can. see it says ghost is on-line. and if we go back to our place definitely. notes modified right here but ghost continues to be. on line meaning he's nonetheless working which. is excellent but ghost cannot presently do. whatever he cannot respond to us he can't. message and i am not going to go away this. educational without displaying you how to at. least get a message so let's move in right here. and for example. client. dot on and now we are able to say message. create so when a new message is created. we can pass through a message that will. be the message that has been created and.<br/>we are able to say if. message. dot contents content dot begins with and. now we may give a prefix here which i am. going to apply this little returned tick. or no longer little lower back tick this little. arrow uh the greater than sign i think. or under one of them is less than. one's fantastic fan and that i just know it's one. of them yet we're gonna have that sign. after which we are just gonna say if. message dot content material. dot sub string and we are gonna say one. which is going to remove the um this. element this prefix from our message. it is equal to and let's simply try this. default ping or pong. ping as ping is not it so if we are doing. a ping message we are gonna say message. dot respond. and we'll simply say pong. a dead ringer for that and there we pass that. ought to now provide us an excellent message to go. on so let's go back to discord. oh i just refreshed discord don't know.<br/>Why hopefully it would not take too lengthy. to refresh i i felt like i was. refreshing my brows so i'm obviously so. used to internet development and right here we are. so now if we just said ping. nothing's gonna work but if we now do. this and ping and hit input you will see. we get pong so we went ping experiment. you can see be aware works since it purely. works with the first importance which is satisfactory. but i'll assist you to. in fact adequately handle. both uh text messages or message uh. instructions and likewise shrink commands so. we are gonna add minimize instructions to this. later video um so yeah guys if you. found out whatever new during this video. please go away a thumbs up definitely we are. going to be doing a lot more of these. series we'll be doing a gaggle. of other functions we will be. doing even voice capabilities so i want to.<br/>

painasia9 has no followers.