surely seen plenty.Either. oh ok good i can


discord bot list
Code your individual Discord Bot - Member Counter (2021)
whats going on guys welcome back to. a further discord.js tutorial in latest. tutorial we will be coding a. member counter how were going to be. doing it really is having a particular. voice channel that is going to track the. amount of participants that we presently have. on our server so it is going to say complete. contributors. whatever like 5 due to the fact weve five. individuals so the very first thing we are gonna. do is actually create. a voice channel so pass forward and create a. voice channel you may name it whatever. you desire were gonna name it total. participants with a colon and we have to edit. some of the permissions. due to the fact we dont desire to permit people. input the voice channel. so to voice connector permissions. attach lets disable that youll be able to. disable every little thing yet the only factor. you truly do need to disable. is the attach permission okay.
were also going to pull. the channel all of the manner up right here so whilst. persons join this is the article they are. going to see up top. and lets cross ahead and get started if. you are new here be sure to watch. the first video of this playlist which. is how to establish your discord bots and. established all of your environments. yet thats pretty much all youre going. to wish alright so what we have to do. is we currently have a folder for our. commands. but we also desire to have a folder for. events and. counters so what im gonna do is. actually create a brand new folder in our. complete entire assignment. and this folder is gonna named counters. now you can call it you desire. yet were gonna have distinctive counters. so were gonna code. later on like a youtube counter or like. a subscriber counter. whatsoever you can do im just gonna name.
This folder counter if you want to hold all. of our counters. within this folder so were gonna. name it counters. and iinside the counters folder we are. gonna create a javascript file for our. member counter. so it is gonna be member sprint counter. and it needs to be js so let me rename. that member counter dot. js in our main dossier. we even have to require this. particular file here. so we will do const and were. going to call this member. counter it will equivalent require. and we will require that express. dossier now we did it in. the counters folder so we will do. interval backslash or. shrink and were going to cross into the. counters folder. and well get the member. counter file. now to actually truly run this. entire file we even have to head down. into our client.on. ready and iinside this occasion we want to.
Get our member counter. open it up with parentheses and pass in. client. because well need to use. client inside of this file. okay so lets go ahead and get. began so were going to do a module. exports how we do with every single. command. so module exports and iits going to be. equal to an async. so well do an asynchronous. command here or event. or counter and were going to open up. with parentheses and well flow. in. that client that we received from our main. dossier so lets open this up. and in here the very first thing we are gonna. want is the guild or the quote unquote. server. so pass into your discord and copy your. guild identity. just come up here to the name of your. server correct click copy id. so well be doing const guild. equals purchaser dot guilds. that cache that get and right here.
well paste in our guild id. so theres actually a couple ways you. can actually do this the style were going. to be doing it during this tutorial is by way of. having a set. period so each as an exle five seconds. it is gonna assess the amount of members. on your discord server. and then update that file or replace that. channel so we do set interval . and in right here we will do an arrow. operate. the code will be in the outline if. you guys want to replica the code. and in here well do const and. we will get the member count number and. the manner we get the member count number. is we will do guild dot member. account. the subsequent element we will do is get. our channel the channel thats going to. be up-to-date when somebody joins. or leaves the server so we are gonna name. the cons channel. and this is going to equal to guild dot.
Channels. cache i am getting. and right here we wanna get the channel id so. go into your discord. right click on the channel and copy id. there it is rather like that and now we. simply desire to simply set. the channel name to anything specific. so channel. thats set name and in here we want to. do. a backtick that is the key subsequent to one. and we want to name our channel so we. named it complete individuals. complete contributors colon so lets do that. first total. individuals colon and then in right here we need. to do a space. with a cash sign brackets and in here. we want to do. member count dot to nearby. string now the explanation were doing two. regional string. is because to illustrate youve more than. one thousand participants. and you dont need to send 1000. like this you desire the bot. to label or send the thousand as you. would be able to examine it. or write it in genuine existence so with a comma.
So that is what two local string does. in preference to just having this number. itll send it with the commas. o.k. and the last thing were simply. going to console.log due to the fact we wish to. examine. every time and it is updating so we are. just going to console.log updating. member debts. and then in among the brackets and the. parentheses down right here let me just make. this slightly bigger. in among the bracket and the. parentheses we want to do a comma. and we wish to set the period of time so. lets do 5000 ms. that really should be it so im gonna. move ahead and run. our bot and we should not get any errors. and every five milliseconds or ms we. should be capable of get or. its probably not every five its more. like any 5 seconds we must be. getting um. the updating member count now back. 5000 milliseconds is five seconds.
So lets move into our discord server. were presently a complete 5 participants so. im gonna get my dummy account. genuine quick permit me log in. and we are going to show up on line in a. second. excellent now lets cross ahead and depart the. server. this could drop all the way down to four there it. is. and thats how you do a member counter. so lets go ahead and join an additional time. now it should be updated to five the. subsequent time it does it. and it didnt replace to 5 now why. isnt it updating to. five now like i suggested at the beginning of. the video there is this new like system. that discord applied and it made it. pretty tough for bots to get a lot of. information. from a discord server so allow me show you. what is in fact happening. im gonna pass into my other account and. as you will discover it actually says there is. already five individuals. within the discord server even though i left.
It. its gonna take some time for this to. update and once it updates this. goes to update so typically it is going to. make an effort. due to new strategies that discord. added into. their developer you recognize tools and. portal so i will show you. what they further i confirmed thiis about two. tutorials in the past. and that is the privilege gateway. intents. you are gonna must have this on so move. for your discord developer portal. there will be a link in the outline. you should have this on in case your bot. tracks. the presence purpose given that we are. tracking the presss intent were. checking how many people are current. in the server its going to take a protracted. time for it to observe. as they have like a bit threshold. that they further so move forward and go into. your. developer portal and confirm to have. method purpose on. and server members intent on and iif you.
Do have. 100 or extra servers that your bot. is in then youre gonna have got to get your. bot demonstrated. and whitelisted so that they further this. fantastically lately. and it makes it a bit tougher to. code bots a twin of this one. so you are gonna have to work with this. system as you can find. it just up to date to five it took a while. but. that is just the way it has to work there is. in fact a pair things that i do wanna. tell you or one thing that i wanna tell. you. is that you truly dont want to have. the set interval at 5 seconds it. really doesnt make sense i basically did it. due to video. yet you will want to have it a minimum of. whatever like. 15 maybe 10 minutes you do not need to. replace this every moment. lower back its not really gonna work. you are still gonna must look forward to the. gateway intents to are available in.

Leave a Reply

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