were going to return message. that channel that send or we will respond i. feel like replying is slightly. bigger so message.reply. and we will reply to the user. saying you need to. uh or please enter the quantity. of messages that you want to clean
Discord Bot Maker educational #3 - How to apply Variables
Now variables are by way of some distance the foremost. important aspect when it comes to discord. bat maker actions due to the fact what they do. is they let you take one thing that. youre making an action and represent in a. unique motion this can be completed in the. context of the command the server or all. being purchased completely so lets get. immediately into things first to initiate. lets talk about the three exclusive. forms of variables that is going to be. transitority variables or temp variables. server variables and international variables. temp variables merely exist in the context. of the command so say as an instance I. create a variable in our test command. and as soon as a experiment command is over that. variable no longer exists if I say I. do not know use a experiment command again or. use one more command we shouldnt have. entry to that temp variable server.
Variables even so would be. available across all the server so. if i exploit this experiment command and i create. a serve variable in that server variable. can be accessed from different instructions. using that server or a similar command. that if it is used in the server of. course now the final sort is worldwide. which as you can suppose makes it so the. variable is offered by means of any ability. so long as the bot is lively thats. the most important aspect about variables. thats the undeniable fact that variables arent. stored so if you turn off your bot and. turn it again on you dont have entry. to any earlier variables that have been. created in the course of earlier runs of the bot. as they tend to be intended for just. information move or data referencing during. the runtime of the bot itself anyway and. it is speaking about variables lets.
actually use them so to start we will take. our experiment command it makes so we are going to. create a channel so what we are going to do is cross. to right here channel handle little go. to create a text channel look all this. text channel to be test1 and well just. set it so everything else is clean now. as you spot here. we needed to shop in operate right here. it enables us to store the create a textual content. channel into a variable so lets set it. so the item goes to be stored into. a temporary variable and likewise that. variables name to be I guess simply. channel like that so what is going to. ensue is we are going to create a text channel in. F server it is going to be called test1 and. then a connection with this channel we. stored in a short lived variable called. channel right here so lets replica this in. order to recollect it now move and hit. create movement now in a second action.
we are going to set it so we will send a message. to our new channel so we are going to say it is. the way the he new channel oh guy. there we move and so now what we will do is. we are going to say right here in which it says send. to we will send it to a temporary variable. so we are going to go right down to temp variable insert. the name of our variable which become a. temp variable and it become known as Channel. and now whats going to take place is itll cross. uncover our temporary variable known as. channel see it is a text Channel and send. this message to that textual content Channel. so it create action and we ought to be. good to move we will visit dossier and hit keep. like that aand then without a doubt run the. project the image of that aand then well. open discord right here see the bot is. on-line and then call our experiment command. here so lets keep in mind what is. going to happen it is going to create a.
New textual content channel then ship a message. into it. so lets go so once we call test as you. can see our new test one channel will. show up here and it will ship a new. message asserting it really is the hot channel. just as we expected so there we cross. thats all it takes use variables honestly. shop it into one then use it in a further. yet another well instance of variables is. using them to find information so lets. go back to our discord and create 3. channels will create one known as test2. and create a further one called. test3 identical to that now as an instance for. instance Rome XR but specifically sends a. message to check so what we are going to do is. go to our discord bot maker like this. good first delete this crate text. Channel and iinstead replace it with a. new movement known as where is it channel. control uncover channel so what this does.
Is it finds a specific channel in response to. its Identity call or subject so well. look for a channel in accordance with its call. that name being test2 then shop it into. a temporary variable called over again. Channel well then place this on top of. the send message so it happens first then. this would find the channel after which this. will ship the message into the channel. so well edit this and say it is the. test to channel a twin of that good edit. the action all over again save the task. then run the project identical to this and. now well return into our discord right. right here and when we call the command. exclamation factor experiment. as you will see it despatched a message into. the test to channel the image of that lets. do one final instance lets delete all. those activities and create a brand new movement. this action being the lets see create.
And mattress message so what this would do is. allow us to create an embed message yet. it wont ship it until we are finished. engaged on it. so we will pass and provides it a title which include. God well just name it experiment experiment well. simply allow set the URL to be something. like I do not know wflw google.com colour. I will make it like green or something. so 0 0 FF 0 0 and well just go away the. remainder of us clean and then without a doubt . we will shop this in bed message right into a I. bet we are going to say server variable and. well name this server variable call. simply in bed the image of that and well. create that aaction now that weve got a. server variable being bed message we can. reference it in one more command so. we are going to create a second command called. ship embed identical to that and we are going to have. it so that this message or this commands. can have it so well find our um embed.
Message and ship it so well go to of. where is it here it is send in bed. message were going to find the server. variable called embed identical to that and. ship it to an identical time period that we use the. command so we are going to create that aaction and. then without a doubt keep our project and run. the assignment clone of this so first. matters first we will call the send in bed. command so well do exclamation point. send in mattress yet nothing will happen. due to the fact weve not created me in mattress. item yet so well pass to check and primary. name a experiment command so we will go down. right here will do up will visit preferred. do actually wield a experiment one will do. exclamation point test and that will. create the embed object then I will use. the send in bed command back like that. and there we pass our embed object is simply. to just chillin available now very.
Code Your own Discord Bot - Kick Ban instructions (2021)
whats going on guys welcome back to. a further discord.js academic in this. educational were going to be making a. kick and band. command we did this tutorial approximately. about a 12 months ago but i feel like its. time to move ahead. and reddo that academic since you bought. manner way easier to enforce. so when you are new here be sure to watch. the first 3 episodes of this series. the first one is going over how to set up. your discord bots. the second is going over on how to set. up a elementary command handler and the 1. one is the advanced command handler. we will be utilizing the advanced. command handler for this. episode so lets pass forward and get. started so were going to be doing two. commands so we have to add extra. files. to our commands folder the 1st one is. without a doubt the kick command. and the second is the ban command.
And as were utilizing the advanced command. handler we need to come down right here and we. need to upload these instructions. so discord.js and pass ahead and. check in all of the instructions we are about. to take action were going to do kick. first and then we are gonna do clients. the commands. we can actually simply move forward and replica. this right here and alter. the clean to without a doubt prefer and were. gonna try this an extra time. for the band command lets pass ahead and. actually manage this i do hate seeking. at terrible code. um after which were gonna do ban. and were gonna cross forward and do ban so. the image of that we further. both our files to our command handler. and we created the two. our documents so in right here of course we do. module.exports. and this is going to be opened up like. this and we will upload the name. which is going to be kik. and we could also upload the outline.
Description. sorry its very overdue today it is. actually 5 a.m and ii have not slept so. description. and for the description we are able to simply say. uh. this command. i cant variety today this command uh. kicks. a member correct thats our description. after which were gonna without a doubt do the. execute technique so execute. we are gonna flow in messages and were. gonna pass in the args and were going. to open. this up and similar to that we had our. module exports lets go forward correctly. copy this and paste it. right in our band little dossier here. so its aactually very easy to try this so. the way you get. a member that was essentially mentioned in. a particular message so for exle we pass. into our discord. server right this moment what we wish to do is. we want to basically do. choose and then add a member and basically. kick him so i will head and.
Im going to move into my other discord. account. and iim going to head and join this. discord server so here we pass it really is our. little test account here. and well be banning and. kicking this person right here. so to get this person from a message. like this all we need to do. is we need to first do a const. and we will name it member the. const member. and this member is going to be message. that mentions. in users and well do the 1st. person so it is usually going to get the. first person mentioned so if you do. whatever like. a distinctive kick which is slightly. more progressed we could do this in a while. so so as to kick like two or 3. individuals at a time this will not. work yet which will style of move forward. and research on how to do it its. not likely to be that tough but its going.
To be the 1st person that you. uh that you point out in that message so. its going to be. games next were going to do is we need. to examine that the man. the administration the admin in fact. tagged a member they want to kick. so they did not simply randomly say kick. and start kicking everyone they need to. be a specific member they want to kick. so its aactually really easy you simply do. if member so in actual fact if the member. exists. and then were also going to do an else. and iin this else were simply going to do. message.channel that is send and were. going to ship a message announcing. we or you could not. putting i dont care uh kick that member. correct just tell the admin that they were. unable to kick a member because they. didnt point out. a member subsequent what well do is. we create a const an additional const and this.
goes to be like our goal so member. target. and iits going to be equal to message. dot guild. dot participants dot. cash dot get and here with. this variable we will get member. that identity due to the fact this is an object. this uh little cons that weve got right here. has a lot and i mean plenty. of information regarding the member that we. just tagged within the message. and were just getting the id that will. cross ahead and ban him or. for this command here kick him so then. were simply gonna do member.target. that is kick clone of that were gonna. do the kick method. after which were gonna message the admin. that simply kicked him. and we are gonna message him asserting a. consumer has been kicked simply to let them. comprehend that that user. has actually been kicked and iif you. will not have a specific channel just for. kicking. it will message the channel that you can.
not desire to kick someone if they are in. a public. channel yet when youve got a personal. channel for like admins where they could. kind this message. and then start kicking people who you. know failed the. rules of the server so identical to that if. you move ahead and run the bot. now space dot or notwithstanding you switch your. bot on-line. we are gonna go back into discord and. first we are simply gonna test doing. the regular kick so we do kick without. mentioning someone oh anything did. ruin. message that mentions the users at the start. what occurred right here um. permit me pass forward and examine exactly how i. messed this up message. o.k. messages i believe its messages. because we type messages here its. correctly this. sorry its not presupposed to be messages. it is presupposed to be a message. because were getting this uh value. here so lets pass ahead and.
close the field and open it lower back sorry. about that you be aware of i did a typo right here. in message so lets pass ahead and do this. a further time. if we do kick without pointing out anybody. it is gonna say you could not kick that. member. and i misspelled could not but that is. exceptional. um so now lets go forward and try kicking. ourselves so our little dummy account. lets go ahead and kick it. a dead ringer for that weve got been kicked and. he is no longer. in the server another time you might want. to have this in a. admin text channel or something where. they are able to kick persons. also make sure to try this with. permissions i do have a permissions. educational just add the permissions. here to ascertain if theyve the. admin permission or the kick. permission since you recognize you do not. prefer everybody to be kicking and banning. persons. so for the actual banning aspect of this.
Its aactually really easy. just move ahead and replica all of this and. lets just do this change this to band. uh change these to. bands i guess for the outline this. command bench server. and in here what were gonna do is. in preference to kick you simply desire to do band. and want to only change everything that. says kick just difference it to band this. consumer has been banned. and you could not ban that sir that. member. so if you cross forward and keep the file. shop every little thing else be sure. everythings saved. and pass ahead and run our bot an additional. time and let me upload. my experiment account into that server once. extra. there its so we go back in right here our. body is jogging. and if we do ban ben could not ban that. member due to the fact we didnt tag someone. but if we do ban. at the last video games. boom we have been undesirable so now i dont. always understand how to try this but if.
We determine. the server settings and containers there it is. so our account got banned so this is how. you create a bot. the image of this its aactually very easy. the strategy that i did a couple of 12 months in the past. it is notably outdated and it was sort of. hard. so it truly is tremendous easy as you will see that the. strains of code we are simply doing like 14. lines of code. i could have this code in the description. particularly on the grounds that i messed up with that. typo. so be sure to take a look at the current. description to work out if everything matches. with the code which you have been typing. throughout this educational with that being. stated. that is essentially you can check here it that is how you do. kick and ban you can do this up to. you want once again. in order to like do a mass kick and. mass ban. you are gonna have to find a way to get. each of the. members that were outlined in that.
Message. so not just in basic terms the 1st yet for most. people banning something like this. is practically the easiest simply ban one. person at a time if somebody says. something bad someone. breaks your rules simply ban them or kick. them. in the next couple tutorials might do. whatever like a timeout that is. whatever thats a bit of less harsh. than a kick and ban uh so which will be. the subsequent educational coming out this friday. also sorry i could not add it last. friday or in fact the day past which is. tuesday. i had to do a couple matters yet do not. fear i am unlikely away. back uh im just gonna be focusing as. much as i will on this channel. so if you men loved this video make. certain to move ahead and subscribe ill be. doing plenty. more discord.js tutorials as soon as. we are performed with all of the administration. things were going to be getting started.
Code Your own Discord Bot - Google images Scraper (2021)
whats going on men welcome back to. a further discord.js tutorial during this. academic we will be creating an. image scraper bot youre going to be. able to ship some key terms to the bot. the bot goes to take these keyword phrases. into google pictures and discover the finest. effect. and go back that photo right into a text. channel so. i did a lot of study and i found out. that this package here known as the. pictures scraper. is among the best one which we can use. so im going to go away the hyperlink to pictures. scraper down less than in case you men desire to. study over the project. yet clearly right here an exle it truly is. all the code well have to. create a bot. it is going to be an exceptionally quick video it is. going to be roughly round 8 or 9 traces. of code. and we should be good to move so lets cross. forward and get. began open up your project and if.
Youre new right here and uncertain how. every little thing works be sure to watch last. video wherein we create. a brand new command handler and event handler. that way we also restructured an entire. entire 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 manner weve it in our task. to create a brand new command with our new. command handler. all we need to do is in our instructions. folder create a brand new dossier. and call it the call of the command so. its going to be. picture dot js for us. now we will do the common. module.export so module that. exports well create the name. which is exactly the same name as the dossier. thats image an outline. so that it will description and you can. write whatsoever you want. for this tutorial we are simply going to.
Create a random description so this. sends. an image to a discord. channel or textual content channel it does not. topic what the outline is so that you. guys can customise this as a lot you desire. following this we will create the. execute method so execute well. move in client were going to flow in. message and were going to flow in args. we even have to ensure that that. execute method here. is asynchronous so async now we are gonna. import. everything that wed like so if we. correctly open up our project. you could form of replica everything so we. received var scraper equals require photo. scraper. go ahead and replica that into our assignment. and that is how were requiring. photograph scraper into this dossier and the. subsequent element we will do is actually. create. a const called google if we actually go. again into our project here.
right here we will create a new scraper. well upload a puppeteer. and well actually have head. record to genuine as opposed to fake. so lets try this so. const google is equal to new. scraper and here we wish to do. pub tier and this goes to be. actual sorry no lets open this up one. more time. and do headless genuine. and just like that we will now start. searching images on google. all the manner down here we want to create. a brand new variable called picture question. and we can actually simply use args up. here but we will create a brand new. variable here so photo quarry equals. args dot become a member of and we are gonna open this. up. and do a space a twin of that that way. were in fact. becoming a member of all of the arguments down right here. and were you recognize. essentially joined by means of the spaces simply in. case theyve assorted areas thats.
Going to mix everything. and we can use that in our search question. next ill do. is that if that picture query does not exist. you can also do if the first argument. would not exist but we already have an. image query for you to just use that. so if the image query doesnt exist. we are just going to come. message you recognize channel thats sent. i will send please input a picture. name. back you can customise all of these. messages on your users as much as you. favor. following this we are gonna do const. image underscore. outcome that is the outcomes that we are. getting from. the scraper up here so photograph outcome. goes to be equivalent to a weight. that scrape were gonna scrape that. picture question that we have been ready to get. from our clients. i am gonna do one clone of that the last. thing we even have to do. is ship that photo that we just got the.
Results so a message stretch a different. despatched. i am gonna do pictures sorry photograph. underscore. effect and we are gonna do is open this. up and get the first one since the. outcome is actually gonna. be a item and really we can actually. verify this in. this task the results thats going to. send this here. thats going to be results the url. and the resource. we wish to get the url because if you. guys didnt recognize in case you send a picture. url to discord. this code is going to automatically. convert that url into the picture. of the url so we wish to get this from. the outcomes. so in right here were simply going to do dot. url. if we cross forward and save every thing move. into our discord server. make sure were correctly on our discord. server here. and we will do the command which is photograph. and lets ship anything like computing device.
Wait some time i believe did everything paintings. actually. i used to be i am so silly run the bot first. then. test the bot or area no longer. now lets in fact test the command. laptop. image computing device. and we should get a effect fantastically quickly. definite we must always growth so it searches all of. google. it finds the finest results and it sends. that photo okay we will do whatever we. desire. apple um after which the next one we can do. anything like. lets contemplate something games oh. it actually despatched the company apple no longer. an apple that is crazy. video games there you move so now it works. you can variety whatsoever you want its. gonna search. that query that key phrases into google. pictures. discover the finest results ship the results. into. the text channel that the user sent the. command in. so identical to that its very simple i did. this tutorial like a year in the past it was way.
Code your personal Discord Bot - Embeds (2021)
whats going on guys welcome back to. an additional discord.js. tutorial in this academic im going to. be creating a few. embeds i know i did an instructional about. thiis about a year ago but i think its. about time. to reddo that academic now before we get. began i do prefer to present my twitch. channel. a quick shout out therell be a hyperlink. in description it is the conclusion of the yr. theres a lot of video games which are coming. out so in order to assess me out on. twitch there will be a link within the . description. so lets go ahead and get started if. youre completely new here be sure to. watch the first. three videos we acquired the fundamentals on the way to. mounted you recognize your discord field. we even have the fundamental instructions so if. you need to create undemanding instructions. after which during this video we will be. using the command handler so theres.
Going to be. a 3rd video that you must watch to. get everything up and. running so lets actually get started so. to. basically get embeds to paintings with a. command handler we have to pass in. discord here so in this system of. execute. simply be sure to circulate in discord and. sincerely thats the variable we created. right here. thats requiring discord.js so if you. name this something distinctive. be sure to change it down here besides. after which on. our command handler we also want to upload. discord. besides so we are ready to use it here so. to create an embed were going to create. a const or a variable and we will. call this new embed you may name it. you desire. and iits going to be equivalent to a new. discord embed. uh sorry discord.message embed. and thats how we are creating an embed. now we can actually add plenty.
And i mean a lot of methods we can add a. technique that units a color. sets name a url additionally the author. description. thumbnail fields its aa lot of crazy. things that youll do with embeds i will. might be have a link in the outline. to all the methods that youll use. to customize your embed were gonna do a. little bit of an easy embed right here yet. you can almost customise this as. much as you want. so that you can continue our line right here in our. code because all we have to do is add a. technique like. add uh set colour yet to make this more. prepared you can actually simply. make areas and make this into a you. comprehend a brand new method some other line. or each line so as an instance if you wish. to set a colour we do. have a hash color so let me in fact. look for. hash colors to work out. or colour code text colorations so there is a.
Website like this which is the color hex. color codes ill probably have this. web site to boot in the description. and those are the hex codes for a bunch. of colours so lets pass ahead and choose one. i admire this one this looks particularly nice. we will reproduction the hex color as. well like this. and returned in the code for the you recognize. placing our colour we can simply open this. in parentheses. and upload you recognize the hex color well you. can do. parentheses or unmarried quotations then. lets do a subsequent technique. we are able to do set name to boot and in our. identify we are able to do. um guidelines yeah lets do a rules embed why. no longer. after which a further method you can do is. set a url so if you want . you are able to do units url and here you could upload. a url if you wish so ill do. https. https colon right two backslashes. and we are gonna do youtube.com. lower code lion one more method we will.
Do is set the author if you want if you. wanna send. you know the author of the embed im. just going to skip this one in addition. and in description well do set. description. and then right here ill do thats. a embed for the. server rules why now not. and then finally we will begin. moving into the fields now the fields. it is something which can get crazy. and you do have got to style of go back and. forth between your code. and your discord bots to determine in case your. fields are well-nigh. all set so we are gonna do add fields. and right here were gonna open it with. parentheses after which were gonna. simply open this up so we can add our. fields so a box has a reputation. so we are gonna do name and iin this call. we are going to. simply say rule one. and i am you recognize at the end of the video. ill show you how this looks so.
you can style of compare the code. to how it appears and then a name or the. field. also will have a few style of magnitude so. we will add a cost. and iin this magnitude we can do whatever. like a rule so. be nice right so thats a stunning easy. rule correct and iif you want to add more. fields. all you ought to do is do a comma and you. can just pretty much replica and paste. all of these fields like this after which. simply difference it to rule . rule 3 be sure to upload a combo right here. after which. lets just say uh follow twitch right. that has. that needs to be a rule and our ultimate rule. will be. to uh no ability. right there we move so thats our fields. and once again ill show you. how the fields seem in a little one. last item we can do. is we will do an image if you want so we. can do. upload picture and we are able to get a random picture. of the web so i am simply gonna seek.
Cat on. google and seek for a cat image. that is an exquisite pleasant cat so im gonna. get. this real rapid open a brand new tab make sure. we are all secure. oh add a blocker this is annoying. uh open photograph a brand new tab correct so we bought. this picture here. of a cat and ensure to open this in. both single quotations. or citation marks. theres actually a pair matters we will. do lets see what else we can do right here. um we could also do the timest as become. the. footer so lets do the footer first set. footer. and then were gonna be final thing make. certain. to take a look at the rules. uh channel as protected right here. and theres actually much more we are able to. do yet i think thiis sets a superb. embed that we can ship to you know a. member if a member does. the command command so to really ship. the embed. by means of this message were gonna cross.
forward and do. message that channel ship and were. gonna ship. the embed here which we created correct. right here and truly this has to be. within the execute technique. correct there after which we will ship. the recent embed. and we are actually well to head be sure. it really is good this is all. well now open up your thermal and. thermal. terminal and then do node space dots or. however you begin your bot. and go back into discord and if we do. command. we are going not to get an embed whats. taking place oop. we bought an errors add image. add photo isnt a function sorry. see that is wherein errors are going on. it isnt advert picture. it is set photo so set photo. again all of these techniques will be in. the description under. which will know so sorry about that. it isnt ad picture it is set. picture open our bot a further time. and then do command and as you will see.
we have our embed so lets correctly. evaluate our code. to our embed as you can see it is a nice. cat so. lets go forward and open both of them. right next to one another so i can. explain. what youre seeing in the code and what. youre seeing in the particular. embed lets near this lets close this. and lets make this just a little bigger. additionally if you men just like the obvious. this. you recognize visible studio code i form of do. like it. i feel like its more expert or it. feels nicer to code when its. obvious and you will see that the things. in the heritage. so for the title we had a identify. which guidelines and thats the identify of the. embed for the color. the color is largely the strip at the. facet the color of the strip. so if we alter it to another colour. this strip here will change. and iin the url it is where is the url.
Is it the actual photograph that is really. fascinating do i click this. yeah that is the url so at the name if. you want to do a url. it will ship you to url you put. so i set it to my code lion. this is truly something new to me i. didnt be aware of that aat all. but there it is thats the url to the. identify. then we have the outline is good. under the name of the embed. after which here weve all of our fields. so we have row one rule two rule 3. there they are as a box you also can. make them stack to each other but you. could also discover that. in the description lower than to the methods. due to the fact you can make them in contrast to a. line like this but like across each. different if you wish. and then of course we got the picture. correct there we have the url right here. and then we acquired the footer here. which is ensure to check out the.
Guidelines channel. so similar to that youll be able to create a. particularly pleasant ambid. its aa pretty short video it is you know. exceedingly easy to do. theres a lot and i mean a lot of things. that you can create with an embed. most servers have very problematic. embeds and you can pass. loopy with these um so be sure to go. all. out you can do whatever you want with. embeds. thats almost it so i hope you guys. loved this video a further time. ensure to take a look at my twitch within the . description less than. and iill be again on tuesday with my subsequent. tutorial . i feel i will be doing perhaps a. member counter at present was purported to be. a memory counter but there has been some . problems that i had to determine so i. determined to do. embeds thats anything that did desire. an update especially given that. we had a command handler to deal with our.