well go back message. that channel that send or we can respond i. think like replying is a little bit. greater so message.reply. and well reply to the user. asserting you must. uh or please enter the amount. of messages that you want to clear
Discord Bot Maker educational #3 - How to apply Variables
Now variables are via some distance the foremost. important aspect in terms of discord. bat maker activities due to the fact what they do. is that they let you take some thing that. you are making an action and represent in a. distinctive movement this is often done in the. context of the command the server or all. being purchased completely so lets get. immediately into things first to begin. lets talk about the 3 distinctive. sorts of variables which is going to be. transitority variables or temp variables. server variables and international variables. temp variables basically exist within the context. of the command so say as an instance I. create a variable in our test command. and once a experiment command is over that. variable no longer exists if I say I. dont know use a experiment command lower back or. use an extra command we wouldnt have. entry to that temp variable server.
Variables having said that will be. accessible throughout 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 the same command. that if it is used in the server of. direction now the ultimate type is international. which as you could assume makes it so the. variable is offered via any potential. so long as the bot is lively thats. the most important part about variables. which is the fact that variables arent. saved so if you switch off your bot and. turn it again on you would not have access. to any earlier variables that were. created in the course of previous runs of the bot. as they are usually intended for just. information transfer or data referencing in the course of. the runtime of the bot itself besides and. it is talking approximately variables lets.
In fact use them so to begin well take. our experiment command it makes so we will. create a channel so what well do is go. to right here channel handle little pass. to create a textual content channel appear all this. textual content channel to be test1 and we are going to just. set it so every thing else is clean now. as you notice here. we needed to store in operate here. it enables us to store the create a textual content. channel right into a variable so lets set it. so the object is going to be stored into. a short lived variable and also that. variables call to be I guess just. channel like that so what is going to. happen is we are going to create a textual content channel in. F server itll be referred to as test1 and. then a connection with this channel we. saved in a short lived variable called. channel right here so lets copy this in. order to remember it now cross and hit. create action now in a second motion.
We will set it so we are going to send a message. to our new channel so we are going to say this is. the style the he new channel oh man. there we pass and so now what we are going to do is. we are going to say right here wherein it says ship. to well send it to a brief variable. so well go right down to temp variable insert. the call of our variable which become a. temp variable and it was called Channel. and now what is going to take place is it will move. uncover our temporary variable called. channel see it is a text Channel and ship. this message to that text Channel. so it create action and we must be. well to go we are going to go to file and hit store. like that aand then without a doubt run the. task a dead ringer for that aand then we are going to. open discord here see the bot is. online and then name our experiment command. right here so lets remember what is. going to occur its going to create a.
New textual content channel then ship a message. into it. so lets pass so once we call test as you. can see our new test one channel will. show up right here and it will send a brand new. message saying its the hot channel. just as we expected so there we pass. that is all it takes use variables surely. store it into one then use it in an additional. one other well exle of variables is. using them to find data so lets. go back to our discord and create 3. channels will create one referred to as test2. and create yet another one known as. test3 just like that now for instance for. exle Rome XR yet specifically sends a. message to check so what well do is. visit our discord bot maker like this. good first delete this crate text. Channel and iinstead replace it with a. new movement referred to as where is it channel. handle find channel so what this does.
Is it reveals a specific channel in line with. its identification call or topic so we will. seek for a channel according to its call. that call being test2 then store it into. a temporary variable called yet again. Channel well then area this on top of. the ship message so it happens first then. this will uncover the channel after which this. will send the message into the channel. so well edit this and say thats the. test to channel similar to that good edit. the motion all over again keep the task. then run the assignment similar to this and. now we are going to go back into our discord right. right here and after we call the command. exclamation factor test. as you will discover it despatched a message into. the test to channel just like that lets. do one ultimate instance lets delete all. these activities and create a brand new motion. 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 send it until we are accomplished. working on it. so well go and provides it a identify along with. God we are going to just name it experiment experiment we are going to. just permit set the URL to be whatever. like I dont know wflw google.com color. I will make it like green or something. so 0 0 FF 0 0 and well simply depart the. remainder of us clean after which without a doubt . we are going to shop this in mattress message right into a I. wager we are going to say server variable and. we are going to name this server variable name. just in mattress just like that and we will. create that aaction now that weve got a. server variable being bed message we can. reference it in a further command so. we are going to create a second command called. send embed the image of that and we are going to have. it in order that this message or this instructions. could have it so well find our um embed.
Message and ship it so well visit of. where is it right here it is send in mattress. message we will discover the server. variable known as embed a dead ringer for that and. ship it to an identical term that we use the. command so we will create that aaction and. then without a doubt keep our assignment and run. the task clone of this so first. matters first we will call the send in bed. command so we are going to do exclamation factor. send in bed yet nothing will occur. because we have not created me in bed. object yet so we are going to pass to check and first. call a test command so we are going to pass down. here will do up will go to popular. do in fact wield a test one will do. exclamation point test and which will. create the embed item then ill use. the send in bed command back like that. and there we pass our embed object is just. to only chillin obtainable now very.
Code your personal Discord Bot - Kick Ban instructions (2021)
whats going on men welcome back to. another discord.js educational in this. academic well be creating a. kick and band. command we did this academic roughly. about a year ago but i feel like its. time to head ahead. and reddo that tutorial since you obtained. manner way easier to enforce. so if youre new right here make sure to watch. the 1st 3 episodes of this sequence. the 1st one is going over how to set up. your discord bots. the second goes over on a way to set. up a simple command handler and the 1. one is the advanced command handler. well be using the advanced. command handler for this. episode so lets move forward and get. all started so well be doing two. instructions so we have to add two extra. documents. to our commands folder the first one is. without a doubt the kick command. and the second is the ban command.
And as were using the advanced command. handler we have to come down here and we. have to upload those commands. so discord.js and pass ahead and. sign up all the instructions were about. to take action we will do kick. first and then we are gonna do customers. the commands. we can actually just cross forward and replica. this here and alter. the clear to of course pick and were. gonna try this one more time. for the band command lets cross ahead and. in fact organize this i do hate seeking. at terrible code. um and then we are gonna do ban. and we are gonna cross ahead and do ban so. a dead ringer for that we further. both our documents to our command handler. and we created the two. our documents so in here of course we do. module.exports. and this goes to be unfolded like. this and we are able to add the name. which is going to be kik. and we may also upload the outline.
Description. sorry its very overdue at the moment it is. actually 5 a.m and ii have not slept so. description. and for the outline we can simply say. uh. this command. i cant kind at the moment this command uh. kicks. a member right that is our description. and then were gonna of course do the. execute method so execute. we are gonna circulate in messages and we are. gonna move in the args and were going. to open. this up and identical to that we had our. module exports lets pass ahead in fact. copy this and paste it. right in our band little dossier right here. so its aactually really easy to do that so. the way you get. a member that was sincerely mentioned in. a specific message so for exle we go. into our discord. server at present what we want to do is. we want to sincerely do. pick and then add a member and essentially. kick him so ill head and.
ill cross into my different discord. account. and iim going to head and join this. discord server so right here we go thats our. little test account here. and we will be banning and. kicking this person right here. with the intention to get this individual from a message. like this all we have to do. is we have to first do a const. and were going to call it member the. const member. and this member goes to be message. that mentions. in clients and well do the 1st. user so it is often going to get the. first consumer mentioned so in case you do. anything like. a multiple kick which is somewhat. more advanced we could try this in a while. so which will kick like two or three. contributors at a time this is not going to. paintings but which will variety of move ahead. and study on how to do it it is. unlikely to be that tough but its going.
To be the first person who you. uh that you point out in that message so. it is going to be. games next well do is wed like. to ascertain that the man. the administration the admin correctly. tagged a member they want to kick. so they did not just randomly say kick. and begin kicking everyone they need to. be a particular member they want 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 thats send and we are. going to ship a message announcing. we or you couldnt. placing i do not care uh kick that member. right just tell the admin that they have been. not able to kick a member because they. did not point out. a member next what were going to do is. we create a const one more const and this.
goes to be like our target so member. goal. and iits going to be equivalent to message. dot guild. dot members dot. coins dot get and right here with. this variable we will get member. that identification because this is an item. this uh little cons that we have here. has a lot and that i suggest plenty. of information about the member that we. simply tagged in the message. and were just getting the identification so as to. cross forward and ban him or. for this command right here kick him so then. we are simply gonna do member.target. thats kick the image 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 saying a. consumer has been kicked simply to allow them to. understand that that consumer. has correctly been kicked and iif you. would not have a specific channel only for. kicking. it is going to message the channel that you should.
now not desire to kick somebody if they are in. a public. channel yet when 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 dead ringer for that if. you go ahead and run the bot. now area dot or however you turn your. bot on line. were gonna go back into discord and. first were simply gonna try doing. the regular kick so we do kick devoid of. stating someone oh anything did. smash. message that mentions the users at the beginning. what occurred here um. let me cross ahead and assess precisely how i. messed this up message. o.k. messages i believe its messages. because we variety messages here it is. actually this. sorry its not alleged to be messages. it is alleged to be a message. because we are getting this uh importance. here so lets go ahead and.
Near the field and open it returned sorry. approximately which you know i did a typo right here. in message so lets move ahead and do that. one other time. if we do kick with out declaring anybody. it is gonna say you couldnt kick that. member. and that i misspelled couldnt but that is. quality. um so now lets pass ahead and take a look at kicking. ourselves so our little dummy account. lets move forward and kick it. the image of that we have been kicked and. hes not. within the server once again you might want. to have this in a. admin textual content channel or something wherein. they could kick persons. additionally be sure to do this with. permissions i do have a permissions. tutorial just add the permissions. right here to examine if they have the. admin permission or the kick. permission since you recognize you do not. want everyone to be kicking and banning. people. so for the particular banning aspect of this.
Its aactually really easy. just cross forward and duplicate all of this and. lets do just this alteration this to band. uh change those to. bands i guess for the outline this. command bench server. and in here what were gonna do is. in place of kick you just desire to do band. and need to simply difference every thing that. says kick just change it to band this. user has been banned. and you could not ban that sir that. member. so in case you go forward and store the file. save everything else ensure. everythings stored. and move forward and run our bot an extra. time and let me add. my experiment account into that server as soon as. extra. there it is so we return in here our. physique is jogging. and if we do ban ben could not ban that. member due to the fact we did not tag someone. but if we do ban. at the last video games. growth weve been bad so now i dont. necessarily understand how to try this but if.
We verify. the server settings and packing containers there its. so our account got banned so it really is how. you create a bot. a dead ringer for this its aactually really easy. the tactic that i did a couple of yr in the past. it is exceedingly old and it turned into sort of. hard. so this is brilliant simple as youll find the. strains of code were in basic terms doing like 14. strains of code. i can have this code in the outline. particularly since i tousled with that. typo. so make sure to take a look at the current. description to determine if every thing matches. with the code that you were typing. throughout this academic with that being. pronounced. that is virtually it that is how you do. kick and ban you can do this up to. you want yet again. with the intention to like do a mass kick and. mass ban. you are gonna have got to be able to get. each of the. members that were mentioned in that.
Message. so not only in basic terms the 1st but for many. persons banning whatever like this. is practically the simplest just ban one. individual at a time if somebody says. something bad somebody. breaks your guidelines just ban them or kick. them. in the subsequent couple tutorials could do. something like a timeout which is. something that is somewhat much less harsh. than a kick and ban uh so that will be. the subsequent educational popping out this friday. also sorry i could not add it last. friday or in fact the day past thats. tuesday. i needed to do a couple matters yet do not. fear im not going away. back uh im just gonna be focusing as. much as i can in this channel. so if you guys enjoyed this video make. guaranteed to cross forward and subscribe i will be. doing plenty. more discord.js tutorials once. were finished with all of the administration. things well be getting started.
Code your personal Discord Bot - Google Pictures Scraper (2021)
What is going on guys welcome back to. a further discord.js educational during this. educational well be creating an. image scraper bot you are going to be. able to ship a few keyword phrases to the bot. the bot goes to take those key terms. into google pictures and uncover get more information the finest. effect. and go back that photograph into a text. channel so. i did plenty of analysis and i discovered. that this kit here referred to as the. pictures scraper. is likely one of the finest one which we can use. so ill depart the link to photographs. scraper down under if you guys desire to. read over the assignment. yet truly here an exle this is. all of the code were going to need to. create a bot. its going to be a really short video it is. going to be roughly around 8 or 9 traces. of code. and we must be well to go so lets go. ahead and get. started open up your assignment and if.
you are new right here and unsure how. every little thing works be sure to watch final. video where we create. a new command handler and event handler. that way we additionally restructured an entire. overall project. so be sure to watch that video open up. your terminal we wish to install pictures. scraper. so do npm install images scraper. and that way weve it in our project. to create a new command with our new. command handler. all we need to do is in our instructions. folder create a new dossier. and name it the call of the command so. it is going to be. photograph dot js for us. now we will do the typical. module.export so module that. exports we will create the name. that is exactly the same name as the dossier. which is photo a description. with a view to description and youll. write whatever you want. for this educational 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. matter what the description is so that you. guys can customise this as much you desire. following this well create the. execute technique so execute were going to. move in purchaser were going to pass in. message and we will flow in args. we even have to ensure that that. execute method right here. is asynchronous so async now we are gonna. import. every little thing that we want so if we. actually open up our assignment. you can form of copy every little thing so we. bought var scraper equals require picture. scraper. pass forward and replica that into our assignment. and that is how were requiring. photograph scraper into this dossier and the. subsequent thing were going to do is truly. create. a const called google if we actually pass. returned into our assignment here.
right here well create a new scraper. well upload a puppeteer. and were going to actually have head. record to genuine as opposed to false. so lets do that so. const google is the same as new. scraper and right here we want to do. pub tier and this goes to be. real sorry no lets open this up one. more time. and do headless real. and identical to that we are able to now start. looking pictures on google. each of the way down here we want to create. a new variable called photo query. and we can actually just use args up. here but were going to create a brand new. variable here so photo quarry equals. args dot become a member of and were gonna open this. up. and do an area identical to that that way. we are correctly. joining each of the arguments down here. and were you recognize. truly joined by way of the spaces just in. case they have distinct areas its.
Going to mix everything. and we are able to use that in our search question. next i will do. is that if that image query would not exist. you also can do if the 1st argument. would not exist yet we have already got an. photograph question in order to simply use that. so if the picture query doesnt exist. we are simply going to return. message you recognize channel that is sent. i will ship please enter an image. name. lower back you could customise all of these. messages on your clients up to you. desire. following this were gonna do const. photograph underscore. outcome thats the outcomes that were. getting from. the scraper up right here so photograph outcome. goes to be equal to a weight. that scrape were gonna scrape that. photograph question that we have been able to get. from our clients. im gonna do one a dead ringer for that the last. element we actually have to do. is ship that photo that we just bought the.
outcome so a message stretch one other. sent. i am gonna do pictures sorry picture. underscore. result and were gonna do is open this. up and get the 1st one because the. results is truly gonna. be a item and really we can actually. investigate this in. this assignment the outcomes thats going to. ship this here. thats going to be two outcome the url. and the source. we wish to get the url because if you. guys didnt know if you send an image. url to discord. this code goes to instantly. convert that url into the picture. of the url so we want to get this from. the outcomes. so in right here we are just going to do dot. url. if we cross ahead and store every little thing cross. into our discord server. be sure we are actually on our discord. server right here. and we are able to do the command thats photo. and lets send anything like computing device.
Wait some time i believe did every thing paintings. actually. i used to be i am so silly run the bot first. then. test the bot or area now not. now lets in fact test the command. machine. photo laptop. and we should always get a outcomes exceedingly quickly. definite we should boom so it searches all of. google. it unearths the finest outcome and it sends. that photograph okay we are able to do anything we. desire. apple um and then the subsequent one we are able to do. anything like. lets think of whatever games oh. it actually despatched the company apple now not. an apple thats crazy. video games there you move so now it works. you can kind whatever you desire it is. gonna search. that query that keywords into google. pictures. find the finest outcome ship the outcomes. into. the text channel that the user sent the. command in. so the image of that its very easy i did. this tutorial like a year ago it turned into way.
Code your individual Discord Bot - Embeds (2021)
What is going on guys welcome back to. one more discord.js. educational during this tutorial i will. be growing some . embeds i know i did an educational approximately. thiis about a 12 months ago but i feel it is. about time. to reddo that tutorial now before we get. began i do favor to give my twitch. channel. a quick shout out there will be a link. in description it is the end of the yr. theres a lot of video games which are coming. out so with a purpose to verify me out on. twitch there will be a hyperlink within the . description. so lets cross ahead and start if. you are totally new right here make sure to. watch the 1st. three videos we bought the basics on a way to. established you know your discord field. we even have the basic instructions so if. you need to create effortless commands. and then during this video well be. utilizing the command handler so there is.
Going to be. a 3rd video youll want to watch to. get everything up and. running so lets correctly get started so. to. clearly get embeds to work with a. command handler we need to flow in. discord right here so in this technique of. execute. just be sure to flow in discord and. clearly that is the variable we created. right here. which is requiring discord.js so in case you. name this anything exclusive. make sure to change it down right here in addition. and then on. our command handler we also want to upload. discord. to boot so were able to use it right here so. to create an embed we will create. a const or a variable and well. name this new embed you can name it. you want. 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 upload plenty.
and that i imply a lot of techniques we can add a. method that units a colour. sets name a url also the writer. description. thumbnail fields its aa lot of loopy. matters that youll be able to do with embeds ill. might be have a link in the description. to each of the techniques that youll use. to customise your embed were gonna do a. bit of a simple embed right here yet. you can essentially customize this as. a lot as you want. on the way to hold our line here in our. code due to the fact all we have to do is upload a. method like. add uh set color but to make this more. organized you may simply. make areas and make this right into a you. comprehend a brand new technique every other line. or every line so to illustrate if you wish. to set a colour we do. have a hash colour so permit me correctly. search for. hash shades to see. or color code text colours so there is a.
Website like this that is the colour hex. colour codes ill might be have this. website to boot in the outline. and these are the hex codes for a gaggle. of colors so lets pass forward and choose one. i admire this one this looks distinctly nice. were going to reproduction the hex colour as. well like this. and again within the code for the you know. setting our colour we will just open this. in parentheses. and upload you recognize the hex colour good you. can do. parentheses or single quotations then. lets do a next method. we will do set title to boot and in our. identify we are able to do. um rules yeah lets do a rules embed why. now not. and then another method you can do is. set a url so if you want . you are able to do units url and here you may upload. a url if you want so im going to do. https. https colon right two backslashes. and we are gonna do youtube.com. scale down code lion one more method we can.
Do is determined the writer if you want in case you. wanna send. you know the writer of the embed i am. simply going to skip this one as well. and in description well do set. description. and then right here im going to do it is. a embed for the. server rules why now not. after which finally were going to start. entering into the fields now the fields. it is whatever that can get loopy. and you do ought to form of go back and. forth between your code. and your discord bots to see if your. fields are very nearly. ready so were gonna do add fields. and here were gonna open it with. parentheses after which were gonna. just open this up that allows you to upload our. fields so a box has a name. so were gonna do call and iin this call. we are going to. simply say rule one. and i am you recognize at the top of the video. ill show you how this looks so.
You may kind of compare the code. to the way it appears after which a name or the. box. also will have a few kind of importance so. we will upload a price. and iin this magnitude we can do something. like a rule so. be nice correct so thats a pretty simple. rule correct and iif you want to add extra. fields. all you should do is do a comma and also you. can just very nearly replica and paste. all of these fields like this after which. just difference it to rule . rule three make sure to add a combination here. and then. lets simply say uh follow twitch right. that has. that has to be a rule and our final rule. would be. to uh no capacity. right there we cross so thats our fields. and once again ill show you. how the fields look in slightly one. last item we can do. is we are able to do an image if you want so we. can do. upload image and we can get a random image. of the internet so im just gonna search.
Cat on. google and search for a cat picture. thats a gorgeous pleasant cat so im gonna. get. this genuine quick open a brand new tab be sure. were all secure. oh upload a blocker this is annoying. uh open photo a brand new tab correct so we obtained. this image here. of a cat and make sure to open this in. both unmarried quotations. or quotation marks. theres actually a pair matters we will. do lets see what else we can do right here. um we may also do the timest as became. the. footer so lets do the footer first set. footer. after which were gonna be last item make. certain. to take a look at the rules. uh channel as protected here. and theres actually a lot more we are able to. do yet i feel thiis sets an outstanding. embed that we will ship to you know a. member if a member does. the command command so to truly send. the embed. by way of this message we are gonna cross.
Ahead and do. message that channel ship and we are. gonna send. the embed right here which we created right. right here and actually this must be. inside the execute technique. right there and then we will send. the recent embed. and we are actually good to go 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. notwithstanding you start your bot. and return into discord and if we do. command. we are going to not get an embed whats. occurring oop. we received an error upload picture. add photo isnt a function sorry. see it really is in which blunders are happening. it is not advert picture. it is set photo so set image. returned all of these techniques would be in. the description lower than. in order to know so sorry about that. its not ad picture it is set. photograph open our bot one other time. and then do command and as you can find.
we have our embed so lets in fact. evaluate our code. to our embed as you will discover it is a nice. cat so. lets go forward and open both of them. right next to each other so im able to. explain. what you are seeing within the code and what. you are seeing in the actual. embed lets close this lets near this. and lets make this a little bit bigger. additionally if you men just like the transparent. this. you recognize visual studio code i type of do. love it. i believe like its more expert or it. feels nicer to code when its. obvious and you will see the things. within the background. so for the name we had a title. which rules and that is the name of the. embed for the color. the color is largely the strip at the. facet the color of the strip. so if we change it to a different color. this strip right here will change. and iin the url its where is the url.
Is it the particular photograph that is really. fascinating do i click this. yeah thats the url so at the title if. you want to do a url. it will send you to whatsoever url you put. so i set it to my code lion. this is truly anything new to me i. didnt know that aat all. but there its that is the url to the. identify. then we have the description is ideal. less than the identify of the embed. after which here we have all of our fields. so weve row one rule two rule 3. there they are as a field you also can. make them stack to one another yet you. may also find that. in the outline lower than to the methods. due to the fact you can also make them not like a. line like this but like throughout each. different if you want . and then of course we acquired the picture. right there weve the url here. and then we got the footer here. that is ensure to check out the.
Guidelines channel. so similar to that youll be able to create a. tremendously nice ambid. its aa pretty brief video its you recognize. incredibly easy to do. there is a lot and i mean a lot of things. that youll create with an embed. most servers have very problematic. embeds and youll go. loopy with these um so be sure to go. all. out you are able to do whatever you want with. embeds. that is basically it so im hoping you guys. loved this video another time. be sure to take a look at my twitch within the . description below. and iill be back on tuesday with my subsequent. academic. i believe im going to be doing perhaps a. member counter today was alleged to be. a reminiscence counter yet there was some . difficulties that i had to figure out so i. determined to do. embeds thats anything that did need . an update particularly when you consider that. we had a command handler to deal with our.