were going to return message. that channel that send or we can respond i. suppose like replying is a bit. better so message.reply. and well reply to the user. announcing you should. uh or please input the amount. of messages that you want to clean



Discord Bot Maker tutorial #3 - How to use Variables
Now variables are by using a long way the foremost. important side in terms of discord. bat maker activities due to the fact what they do. is they allow you to take some thing that. you are making an movement and represent in a. one of a kind action this can be carried out within the . context of the command the server or all. being bought totally so lets get. straight into things first to start up. lets talk about the three special. kinds of variables that is going to be. temporary variables or temp variables. server variables and international variables. temp variables only exist in the context. of the command so say as an instance I. create a variable in our experiment command. and once a test command is over that. variable not exists if I say I. dont know use a experiment command again or. use another command we wouldnt have. access to that temp variable server.
Variables however would be. accessible across all the server so. if i exploit this experiment command and that i create. a serve variable in that server variable. can be accessed from other commands. using that server or an identical command. that if its used in the server of. course now the final variety is worldwide. which as you may suppose makes it so the. variable is obtainable by way of any means. as long as the bot is active which is. the most important aspect approximately variables. which is the indisputable fact that variables arent. saved so if you switch off your bot and. flip it lower back on you would not have entry. to any earlier variables that were. created during earlier runs of the bot. as they are typically intended for just. data move or data referencing in the course of. the runtime of the bot itself besides and. its talking about variables lets.
correctly use them so to start we are going to take. our test command it makes so we are going to. create a channel so what we will do is pass. to right here channel manage little cross. to create a text channel appear all this. textual content channel to be test1 and we will just. set it so every little thing else is clean now. as you spot right here. we had to store in operate here. it enables us to shop the create a text. channel right into a variable so lets set it. so the thing is going to be saved into. a brief variable and also that. variables name to be i assume simply. channel like that so what will. take place is we are going to create a text channel in. F server itll be known as test1 and. then a reference to this channel we. saved in a temporary variable referred to as. channel here so lets copy this in. order to recollect it now go and hit. create movement now in a second motion.
we are going to set it so we will ship a message. to our new channel so we are going to say thats. the way the he new channel oh man. there we move and so now what we are going to do is. we will say here in which it says send. to we will ship it to a temporary variable. so we will pass all the way down to temp variable insert. the call of our variable which became a. temp variable and it changed into known as Channel. and now what will ensue is it will move. uncover our transitority variable referred to as. channel see it is a textual content Channel and send. this message to that textual content Channel. so it create motion and we ought to be. well to move well visit dossier and hit keep. like that aand then without a doubt run the. assignment a dead ringer for that aand then well. open discord here see the bot is. on line after which name our test command. here so lets remember what is. going to ensue it will create a.
New text channel then send a message. into it. so lets move so after we call test as you. can see our new test one channel will. appear here and it will ship a brand new. message saying this is the hot channel. just as we expected so there we move. that is all it takes use variables really. shop it into one then use it in another. a different good exle of variables is. utilizing them to locate data so lets. return to our discord and create 3. channels will create one referred to as test2. and create a further one known as. test3 the image of that now as an exle for. instance Rome XR yet specifically sends a. message to test so what well do is. go to our discord bot maker like this. good first delete this crate textual content. Channel and iinstead update it with a. new motion referred to as where is it channel. handle find channel so what this does.
Is it reveals a particular channel in accordance with. its Identity name or topic so were going to. seek for a channel according to its name. that call being test2 then shop it into. a temporary variable known as yet again. Channel well then location this on top of. the ship message so it occurs first then. this would uncover the channel and then this. will send the message into the channel. so we are going to edit this and say this is the. experiment to channel a dead ringer for that good edit. the motion another time keep the project. then run the project clone of this and. now we are going to go back into our discord correct. right here and when we call the command. exclamation factor experiment. as you can see it sent a message into. the test to channel just like that lets. do one final exle lets delete all. these actions and create a new action. this movement being the lets see create.
And bed message so what this will do is. allow us to create an embed message yet. it wont ship it until were executed. working on it. so we are going to move and provides it a name such as. God well just call it experiment experiment well. simply let set the URL to be anything. like I do not know wflw google.com colour. I will make it like eco-friendly or whatever. so 0 0 FF 0 0 and well just leave the. remainder of us blank after which without a doubt . we will shop this in bed message right into a I. guess we will say server variable and. we are going to name this server variable call. simply in mattress a twin of that and well. create that aaction now that we have a. server variable being mattress message we are able to. reference it in yet another command so. well create a second command called. ship embed a twin of that and well have. it so that this message or this commands. can have it so we are going to uncover our um embed.
Message and send it so we will visit of. where is it here it is send in mattress. message were going to find the server. variable called embed similar to that and. send it to an identical time period that we use the. command so well create that aaction and. then of course keep our project and run. the assignment a dead ringer for this so first. matters first we will call the send in mattress. command so we are going to do exclamation point. send in mattress but not anything will take place. due to the fact weve not created me in mattress. object yet so we will pass to check and primary. name a test command so we will cross down. here will do up will go to wellknown. do in fact wield a test one will do. exclamation point test and which will. create the embed item then I will use. the send in mattress command returned like that. and there we go our embed item is just. to just chillin available now very.


Code Your own Discord Bot - Kick Ban Commands (2021)
whats going on men welcome back to. an extra discord.js academic in this. tutorial we will be making a. kick and band. command we did this academic roughly. a few yr in the past but i feel like its. time to go ahead. and reddo that tutorial since you acquired. manner manner easier to implement. so if you are new right here be sure to watch. the 1st 3 episodes of this sequence. the 1st one goes over how to establish. your discord bots. the second one goes over on how to set. up a basic command handler and the 0.33. one is the advanced command handler. were going to be using the advanced. command handler for this. episode so lets pass forward and get. all started so well be doing . commands so we need to upload additional. documents. to our commands folder the 1st one is. without a doubt the kick command. and the second one is the ban command.
And as were utilizing the advanced command. handler we have to come down right here and we. have to upload these commands. so discord.js and pass forward and. sign up all the instructions were about. to take action we will do kick. first and then we are gonna do clients. the instructions. we can actually just cross ahead and duplicate. this here and alter. the clean to without a doubt decide on and we are. gonna try this a further time. for the band command lets pass ahead and. actually arrange this i do hate seeking. at terrible code. um and then were gonna do ban. and we are gonna go forward and do ban so. a dead ringer for that we added. the two our documents to our command handler. and we created the two. our documents so in here without a doubt we do. module.exports. and this is going to be opened up like. this and we will upload the name. that is going to be kik. and we can also upload the description.
Description. sorry its very overdue right this moment its. correctly 5 a.m and ii have not slept so. description. and for the description we can just say. uh. this command. i cannot sort today this command uh. kicks. a member correct thats our description. after which were gonna of course do the. execute method so execute. were gonna pass in messages and were. gonna circulate in the args and were going. to open. this up and the image of that we had our. module exports lets go forward in fact. replica this and paste it. correct in our band little dossier here. so its aactually really easy to do this so. how you get. a member that become sincerely outlined in. a specific message so as an instance we go. into our discord. server at this time what we want to do is. we want to basically do. prefer and then upload a member and essentially. kick him so i will head and.
i will move into my different discord. account. and iim going to head and join this. discord server so right here we move this is our. little test account here. and well be banning and. kicking this person right here. so that you can get this individual from a message. like this all we have to do. is we need to first do a const. and well name it member the. const member. and this member is going to be message. that mentions. in users and we will do the 1st. consumer so it is usually going to get the. first consumer outlined so if you do. whatever like. a distinct kick that is a little. more stepped forward lets do this in a while. so as a way to kick like two or three. members at a time this should not. paintings but so that it will kind of cross forward. and examine on how to do it its. not likely to be that onerous but its going.
To be the 1st person who you. uh that you point out in that message so. its going to be. video games next we will do is wed like. to examine that the man. the administration the admin in fact. tagged a member they need to kick. so they did not just randomly say kick. and start kicking all people they have to. be a particular member they need to kick. so its aactually really easy you simply do. if member so basically if the member. exists. after which we are additionally going to do an else. and iin this else we are just going to do. message.channel that is ship and we are. going to ship a message saying. we or you could not. putting i do not care uh kick that member. right simply tell the admin that they were. unable to kick a member because they. didnt mention. a member subsequent what were going to do is. we create a const one more const and this.
goes to be like our target so member. target. and iits going to be equal to message. dot guild. dot participants dot. coins dot get and here with. this variable well get member. that identity due to the fact this is an object. this uh little cons that we have got right here. has plenty and that i mean plenty. of information about the member that we. simply tagged within the message. and were simply getting the id on the way to. go ahead and ban him or. for this command right here kick him so then. were simply gonna do member.target. thats kick the image of that were gonna. do the kick technique. and then we are gonna message the admin. that simply kicked him. and were gonna message him asserting a. person has been kicked just to let them. be aware of that that user. has actually been kicked and iif you. do not have a particular channel only for. kicking. its going to message the channel that you can.
not want to kick somebody if theyre in. a public. channel but in case you have a private. channel for like admins in which they could. sort this message. after which begin kicking those who you. be aware of failed the. rules of the server so a twin of that if. you cross ahead and run the bot. now area dot or however you turn your. bot on line. were gonna return into discord and. first we are just gonna try out doing. the steady kick so we do kick with out. mentioning somebody oh whatever did. damage. message that mentions the users at the beginning. what occurred here um. let me cross ahead and check precisely how i. messed this up message. very well messages i believe it is messages. due to the fact we type messages right here its. correctly this. sorry it isnt alleged to be messages. its purported to be a message. due to the fact we are getting this uh significance. right here so lets go ahead and.
close the box and open it lower back sorry. about which you understand i did a typo here. in message so lets move ahead and do that. another time. if we do kick with out stating anybody. its gonna say you could not kick that. member. and that i misspelled couldnt but thats. nice. um so now lets pass ahead and check out kicking. ourselves so our little dummy account. lets cross ahead and kick it. similar to that we have been kicked and. hes now not. in the server over again you may want. to have this in a. admin text channel or something in which. they are able to kick persons. additionally make sure to try this with. permissions i do have a permissions. tutorial just add the permissions. right here to envision if theyve the. admin permission or the kick. permission because you comprehend you dont. prefer all people to be kicking and banning. people. so for the particular banning facet of this.
Its aactually really easy. just move forward and duplicate all of this and. lets do exactly this variation this to band. uh difference these to. bands i guess for the outline this. command bench server. and in here what we are gonna do is. in preference to kick you simply want to do band. and wish to only change everything that. says kick simply difference it to band this. user has been banned. and you couldnt ban that sir that. member. so in case you move ahead and save the dossier. shop every little thing else be sure. everythings stored. and move ahead and run our bot an additional. time and let me upload. my test account into that server as soon as. more. there its so we return in here our. body is going for walks. and if we do ban ben couldnt ban that. member because we didnt tag somebody. but when we do ban. at the last video games. increase we have been bad so now i dont. always know how to try this but when.
We examine. the server settings and boxes there its. so our account received banned so it truly is how. you create a bot. a dead ringer for this its aactually very easy. the strategy that i did a couple of 12 months in the past. it is tremendously old and it become kind of. hard. so thats splendid simple as you will find the. lines of code we are simply doing like 14. lines of code. i will have this code in the description. especially on account that i messed up with that. typo. so be sure to take a look at the current. description to determine if every thing matches. with the code that you have been typing. throughout this educational with that being. mentioned. that is pretty much it that is how you do. kick and ban you can do this up to. you desire once more. in order to like do a mass kick and. mass ban. youre gonna must give you the option to get. each of the. members that have been outlined in that.
Message. so not just merely the 1st but for many. people banning whatever like this. is well-nigh the simplest just ban one. person at a time if someone says. something bad someone. breaks your guidelines simply ban them or kick. them. in the next couple tutorials could do. anything like a timeout which is. anything that is a little less harsh. than a kick and ban uh so which will be. the next tutorial coming out this friday. additionally sorry i could not add it final. friday or actually the day past thats. tuesday. i had to do a pair things yet do not. fear im not going away. returned uh im just gonna be focusing as. a lot as im able to on this channel. so in case you guys loved this video make. bound to move forward and subscribe ill be. doing a lot. more discord.js tutorials as soon as. we are done with each of the management. things we will be getting began.


Code Your own Discord Bot - Google Pictures Scraper (2021)
whats going on men welcome back to. an extra discord.js tutorial during this. academic well be creating an. photo scraper bot youre going to be. able to send some keywords to the bot. the bot goes to take these keyword phrases. into google images and discover the best. result. and return that photo into a textual content. channel so. i did plenty of analysis and that i discovered. that this package right here referred to as the. pictures scraper. is definitely one of the finest one which we are able to use. so ill go away the link to photographs. scraper down less than if you guys desire to. study over the project. yet sincerely right here an instance it truly is. all of the code were going to have to. create a bot. its going to be an exceptionally quick video it is. going to be approximately around 8 or 9 lines. of code. and we ought to be well to move so lets cross. forward and get. started open up your task and if.
you are new right here and uncertain how. everything works be sure to watch final. video wherein we create. a new command handler and event handler. that way we additionally restructured an entire. overall task. so make sure to watch that video open up. your terminal we want to install pictures. scraper. so do npm install pictures scraper. and that way we have it in our project. to create a new command with our new. command handler. all we need to do is in our commands. folder create a new file. and name it the name of the command so. it will be. image dot js for us. now we will do the typical. module.export so module that. exports were going to create the call. that is exactly the same call as the file. which is image a description. on the way to description and you may. write whatever you want. for this tutorial were simply going to.
Create a random description so this. sends. a picture to a discord. channel or textual content channel it doesnt. topic what the description is so you. guys can customize this as a lot you desire. following this we will create the. execute technique so execute were going to. move in client we will flow in. message and well pass in args. we also have to ensure that that. execute technique right here. is asynchronous so async now we are gonna. import. every thing that we want so if we. in fact open up our task. you may style of copy everything so we. got var scraper equals require photograph. scraper. move forward and replica that into our project. and thats how were requiring. image scraper into this file and the. next aspect were going to do is really. create. a const called google if we really go. returned into our project here.
right here we will create a brand new scraper. were going to upload a puppeteer. and we will even have head. list to real instead of false. so lets do that so. const google is equal to new. scraper and right here we want to do. pub tier and this is going to be. authentic sorry no lets open this up one. more time. and do headless actual. and clone of that we are able to now begin. searching images on google. each of the manner down right here we want to create. a new variable referred to as photo question. and we can actually just use args up. right here but we will create a brand new. variable right here so image quarry equals. args dot become a member of and we are gonna open this. up. and do an area identical to that that manner. we are correctly. joining all of the arguments down right here. and were you know. truly joined by way of the spaces just in. case theyve assorted spaces thats.
Going to mix everything. and we will use that in our search query. subsequent im going to do. is if that photo query doesnt exist. you also can do if the 1st argument. does not exist yet we have already got an. photo question so that you can simply use that. so if the image question doesnt exist. we are just going to come back. message you recognize channel thats sent. im going to ship please enter an image. name. again you can customise all of these. messages in your users as much as you. desire. following this were gonna do const. photograph underscore. results that is the outcomes that were. getting from. the scraper up here so photo outcome. is going to be equivalent to a weight. that scrape we are gonna scrape that. photograph query that we have been able to get. from our users. im gonna do one the image of that the last. component we even have to do. is ship that photograph that we just acquired the.
outcome so a message stretch an additional. sent. i am gonna do images sorry picture. underscore. outcomes and we are gonna do is open this. up and get the first one since the. results is actually gonna. be a object and actually we can actually. verify this in. this project the results that is going to. send this here. that is going to be two outcome the url. and the source. we want to get the url because if you. men did not recognize if you send a picture. url to discord. this code is going to immediately. convert that url into the picture. of the url so we wish to get this from. the results. so in right here we are just going to do dot. url. if we cross forward and shop every thing cross. into our discord server. ensure were actually on our discord. server right here. and we are able to do the command thats picture. and lets send whatever like desktop.
Wait a while i think did every thing work. correctly. i was im so silly run the bot first. then. experiment the bot or space no longer. now lets actually experiment the command. desktop. image laptop. and we should always get a effect tremendously soon. convinced we should growth so it searches all of. google. it reveals the best results and it sends. that picture okay we can do whatever we. want. apple um and then the next one we can do. whatever like. lets consider whatever video games oh. it actually sent the company apple now not. an apple thats crazy. games there you pass so now it works. you could kind whatever you desire it is. gonna seek. that question that key phrases into google. pictures. discover the best outcome ship the outcomes. into. the text channel that the user sent the. command in. so a dead ringer for that its totally simple i did. this educational like a yr in the past it become manner.

Code your personal Discord Bot - Embeds (2021)
whats going on men welcome back to. a different discord.js. academic in this tutorial ill. be growing some . embeds i know i did an instructional about. thiis about a yr in the past yet i think it is. about time. to reddo that academic now earlier than we get. started i do favor to offer my twitch. channel. a quick shout out therell be a link. in description its the end of the yr. there is a lot of video games that are coming. out so so one can check me out on. twitch there will be a link in the. description. so lets go forward and get started if. youre completely new here be sure to. watch the first. three videos we received the basics on a way to. set up you know your discord field. we even have the basic instructions so if. you want to create basic instructions. and then during this video were going to be. using the command handler so there is.
Going to be. a third video youll want to watch to. get every little thing up and. running so lets correctly start so. to. in actual fact get embeds to paintings with a. command handler we have to pass in. discord right here so in this method of. execute. simply be sure to move in discord and. clearly that is the variable we created. here. that is requiring discord.js so if you. name this anything different. be sure to change it down right here to boot. and then on. our command handler we also want to upload. discord. in addition so were able to use it right here so. to create an embed we will create. a const or a variable and well. call this new embed you may call it. you desire. and iits going to be equal to a brand new. discord embed. uh sorry discord.message embed. and thats how we are creating an embed. now we can actually add a lot.
And i imply lots of techniques we are able to add a. method that units a colour. sets title a url additionally the writer. description. thumbnail fields its aa lot of loopy. things that youll be able to do with embeds i will. maybe have a hyperlink in the outline. to each of the techniques that youll be able to use. to customize your embed were gonna do a. little bit of a simple embed right here yet. you may virtually customize this as. a lot as you desire. so that it will preserve our line here in our. code because all we have to do is upload a. technique like. add uh set color but to make this more. organized you could simply. make areas and make this into a you. know a new method another line. or each line so for instance if you want . to set a colour we do. have a hash color so let me in fact. look for. hash colours to determine. or colour code textual content colors so theres a.
web site like this thats the colour hex. color codes ill maybe have this. website besides in the description. and these are the hex codes for a group. of colors so lets cross forward and select one. i love this one this looks particularly nice. were going to reproduction the hex colour as. good like this. and back in the code for the you recognize. putting our colour we will just open this. in parentheses. and add you recognize the hex colour good you. can do. parentheses or unmarried quotations then. lets do a subsequent technique. we can do set title to boot and in our. name we are able to do. um rules yeah lets do a rules embed why. now not. and then one more technique you can do is. set a url so if you wish. you are able to do units url and right here you could upload. a url if you want so im going to do. https. https colon right backslashes. and were gonna do youtube.com. curb code lion a different method we will.
Do is determined the author if you want if you. wanna ship. you know the writer of the embed i am. just going to skip this one to boot. and in description were going to do set. description. after which here im going to do it really is. a embed for the. server rules why not. and then finally well begin. getting into the fields now the fields. it is something which could get loopy. and also you do need to style of go back and. forth between your code. and your discord bots to determine in case your. fields are well-nigh. prepared so were gonna do upload fields. and right here we are gonna open it with. parentheses after which were gonna. simply open this up so that it will upload our. fields so a box has a name. so we are gonna do call and iin this call. we will. just say rule one. and i am you recognize at the top of the video. im going to show you how this looks so.
you can type of compare the code. to the way it looks after which a name or the. box. will also have some kind of importance so. we will add a cost. and iin this value we can do something. like a rule so. be nice correct so thats a fine looking simple. rule right and iif you want to add extra. fields. all you should do is do a comma and you. can just basically reproduction and paste. all of these fields like this after which. just difference it to rule two. rule three make sure to upload a combination right here. and then. lets just say uh follow twitch correct. that has. that needs to be a rule and our ultimate rule. will be. to uh no capacity. right there we move so thats our fields. and once again i am going to show you. how the fields seem in a bit one. last item we are able to do. is we will do an image if you wish so we. can do. upload photo and we can get a random photograph. of the net so i am simply gonna seek.
Cat on. google and seek for a cat photo. that is an exquisite pleasant cat so im gonna. get. this genuine quick open a new tab ensure. were all safe. oh add a blocker this is annoying. uh open photo a new tab correct so we got. this photo right here. of a cat and confirm to open this in. either single quotations. or citation marks. theres actually a pair things we are able to. do lets have a look at what else we will do here. um we can also do the timest as changed into. the. footer so lets do the footer first set. footer. after which we are gonna be very last thing make. certain. to check out the guidelines. uh channel as included here. and theres actually a lot more we can. do yet i think thiis sets a very good. embed that we can send to you recognize a. member if a member does. the command command so to truly send. the embed. via this message we are gonna cross.
Ahead and do. message that channel send and we are. gonna send. the embed right here which we created correct. here and really this has to be. inside of the execute technique. right there after which we will ship. the hot embed. and we are literally good to go ensure. that is well this is all. good now open up your thermal and. thermal. terminal and then do node area dots or. notwithstanding you begin your bot. and return into discord and if we do. command. were going not to get an embed what is. happening oop. we acquired an error upload picture. add image is not a function sorry. see that is where mistakes are occurring. it is not ad photo. it is set picture so set photograph. again all of these techniques will be in. the description less than. so that it will know so sorry about that. it is not ad photograph its set. image open our bot one more time. and then do command and as youll discover.
we have our embed so lets correctly. examine our code. to our embed as youll find it is a pleasant. cat so. lets pass ahead and open both of them. right next to each other so im able to. explain. what youre seeing within the code and what. you are seeing in the actual. embed lets near this lets near this. and lets make this slightly larger. additionally in case you guys just like the obvious. this. you know visible studio code i sort of do. love it. i feel like its extra professional or it. feels nicer to code when its. obvious and you can see the things. in the heritage. so for the title we had a title. which rules and that is the title of the. embed for the colour. the colour is largely the strip at the. facet the colour of the strip. so if we alter it to a different color. this strip right here will change. and iin the url it is where is the url.
Is it the actual image that is truly. interesting do i click this. yeah thats the url so at the title if. you must do a url. it will send you to url you put. so i set it to my code lion. this is really anything new to me i. didnt be aware of that aat all. but there its that is the url to the. name. then weve the outline is good. below the title of the embed. after which here weve all of our fields. so weve row one rule rule three. there they are as a box you can also. lead them to stack to one another but you. could also discover that. in the description lower than to the methods. because you can also make them not like a. line like this but like throughout every. other if you want . and then of course we received the image. right there we have the url right here. and then we received the footer right here. which is be sure to take a look at the.
rules channel. so a dead ringer for that you can create a. relatively pleasant ambid. its aa pretty short video its you recognize. particularly easy to do. theres a lot and i suggest plenty of things. that youll create with an embed. maximum servers have very complex. embeds and youll cross. crazy with those um so be sure to go. all. out you are able to do whatever you desire with. embeds. that is almost it so i am hoping you men. enjoyed find this this video another time. make sure to take a look at my twitch in the. description lower than. and iill be again on tuesday with my subsequent. educational. i think im going to be doing perhaps a. member counter today became supposed to be. a reminiscence counter yet there has been a few. difficulties that i had to determine so i. decided to do. embeds which is something that did want. an update especially given that. we had a command handler to deal with our.

Leave a Reply

Your email address will not be published. Required fields are marked *