About starmakeup6

    Description

    FiveM Scripting 24 - Discord Bot in FiveM [1] - Show and replace participant Count.
    come to be a patreon gentleman today and. be given a ton of perks including just. college rose early access content material confidential. aid channels code snippets and extra. join today at patreon.com jjs very well. what is it wager my call is Xue er from. Java at present we are gonna be creating a. discord not that runs with FX server so. yeah that's actually what we are gonna. do today the code that we are gonna write. is in the description lower than this hyperlink. you can access it there i'll positioned it down. there and all the other links that we are. gonna need i'll put these too. so let's in fact get started let's open. up a server let's open our server folder. go to assets i will create a. new folder and the resource referred to as. discord bot and in right here I'm going to. open this and vs i am gonna create a dossier. right here called so recently or I believe like.
    4 months in the past they changed or I. haven't executed this later on. yet they changed five em modified the manner. that you write your source Louis so. in preference to underscore underscore. resource that Lua they changed it to FX. manifest occur there we move dot Lua. a dead ringer for that aand then in here we've. to do some new things so we are gonna. have to claim the FX edition as the. VOD ACA us bodacious I believe and then. the games that it runs on its gta5. and then we also desire to do our server. underscore script so the service script. we are gonna be writing out the server. script is gonna be bot J s clone of. that and now let's correctly make our bot. Jess here a dead ringer for that we're not gonna. do anything here cuz we have to in. provoke and p.m. so by the way you. should have node established nodejs. mooji's org be sure it's set up.
    on your machine I will put this link in. the description as soon as that is mounted it. also installs NPM that's the node. package supervisor so open up your command. prompt i'll do just it like this. let's open up command immediate after which we. ought to CD. click on here copy this and click CD. after which right click input your in that. director just CD into this directory and. what we want to do is do NPM in it and. then the kit call we're just gonna. call it discord bot the version 1 I'm. best you may just click on input for all. those it genuinely doesn't topic. ensure the entry factor is the same. call as this bot Jess your same call as. your JS dossier so i'm gonna click input. test command does not matter just doesn't. subject that this doesn't subject this. doesn't topic now that really matters. but we've this kit Jason now.
    What we want to do is we have to set up. this Fork of discord GS due to ice. axe right here he made a version of this. gorgeous that really works with 5m. natively the original version of this. chord is like the traditional library that. does not work with FX server because of. problems i assume yet he made a fork. that really does make it paintings on 5m so. we're gonna be installing his fork. in place of the conventional discord jeaious. matters so to try this we are gonna do. right here i am gonna do NPM set up NPM. set up I'm just gonna copy his name I. don't desire to sort that out. oh I'm gonna do this i am going to just try this. NPM megastar scale down discord is rather like that. you need to enter this command right here and. I'm click on enter. okay so as soon as that's established and yeah. as soon as that is established you need to see a. new folder pop up called node modules.
    and that is capability it worked i assume it. must have discord adieus in there. so yeah we very nearly simply did that we. hooked up discord ah yes so now what we. desire to do is open up the bot j/s and. now what we want to do is really we're. gonna be writing the code for therefore for the. bot we have to start up with getting. them so if you're not used to no js' I'm. sorry I'm gonna attempt my finest to explain. how it really works so we are gonna have a. fixed and it's gonna require the. module that we just set up so it's. when you require just scourge a s simply. like that aand then in right here we are gonna. want to take just aa client item from. here after which um. we want to make a console client with a. lowercase C not i'm not an uppercase C. but we're gonna do new clients so we. actually use this variable from correct. right here don't don't forget approximately this bit.
    Like we're gonna be using this client. you are not chuckles pleasant and here. clone of that and now what we wanted to. is we are gonna do global config is equal. to require dot reduce config dot JSON so. what that is we are gonna we have the desire to make. a config JSON dossier so i'm gonna click on. new dossier a brand new convict that is a solar and. then in here we are gonna have an item. and the hot button is gonna be token and then. the value will be clean for now we'd like. to truly so the total point of this. is simply to place it placed our lot token in a. distinctive file just so like it is not in. the most factor right here this file we're. gonna be used to. placed our Bach token with a purpose to log into. the bot and really use it we are gonna. let's make that really later I desire to. write all this first so I must with the intention to. correctly begin the bot or when it.
    In fact starts offevolved along with your client dot on. and then on all set the all set occasion we. desire to have a function right here it's with a. new narrow operate we want this. operate to console.log with these those. one of a kind characters here it is on. the tilde key here after which we. want to shop this chord. we're simply logging thiis just just you. can see that the bot logs in so discord. logged just what approximately logged in as. purchaser user tag after which yeah meaning. it's logged in and then we would have liked to. correctly now log in to it so to try this. we do purchaser login and we are gonna do. config dot token like so when we take. this config variable. it'll take its token estate and we. want to actually set that so let's do. that right this moment correct you are gonna need. this link here i'll placed this in. the description under make sure you're.
    Logged in to discord so I'm logged in in. my leading account which is um it's fine. and now we wish to do if it is your first. time you are probably not gonna have any. applications that's excellent i feel i've. executed this earlier than yet we're simply gonna. click on new program I'm gonna type in. Java that's what I desire to call the bot. be sure cuz you cannot difference this I. be aware of you can make a new one yet just. ensure you name it whatever you desire. so I called mine Java I'm gonna placed an. icon which I myself do have right here units. i am just form of gonna have to do this. laptop emblem there we pass after which that's. set as the Java logo and now what i want. to do is click this field section then. I want to click on at bot then do convinced so. then here we actually spawned in. the bot and we not spawn did not but we. made the bot so now what we wish to do.
    discord bot chat is. what we'd like do not deliver this to anybody. by the way i am going to regenerate this after. yet yeah. so paste that in instantly like the way you. copied it and let's store that now we. desire to go back into our physique is and now. what we wish to do is let's make it loop. we are gonna make it continuously loop the. participant count number of the server or whoever's. within the server so to do that we are gonna. make it folder and we are gonna call it. utils there's merely gonna be one software. and i'm during this folder i am gonna do. index J s similar to that if you do not if. you can not really visualize the constitution. it truly is it utils and index J s and then. in this index step in XS J's dossier we. desire to do module exports is the same as. item and then the only object in right here. we are gonna have it is gonna be a. function it is gonna be update update.

    Player. after which we wish to do purchaser , seconds. so this function we are having it is gonna. have parameters that's the client. item that we're gonna go through so. we can actually set the bots repute if. you are not acquainted with the discord. digest API i'll link that below there's. very good they have extraordinary. documentation for that aand then seconds. we are gonna use this to put what number. seconds you desire for it to update so. like that refresh cost i assume so in. here let's make a variable known as Const. interval interval and then it's equal to. a operate that's set interval and. then this operate inside of here is. gonna have a further operate known as set. popularity the image of this it's complicated. sorry after which inside the correct after. the set fame function we wish to placed a. comma or no we need to placed yet another.
    Parenthesis and a comma and then we need. to do seconds time instances a thousand due to the fact. set interval uses milliseconds so this. is just gonna convert it there's a. thousand seconds via what percentage seconds you. prefer so it'll simply multiply that'll. go back how a lot how many seconds you. want to loop it anytime so in right here we. desire to do repute it's aactually yeah I'm. gonna do let's reputation is people or. actually do not have the desire to make it do it. every time i am just gonna do this. yet status equivalent to I did not actually do. this in the code here we are just gonna. let repute actually no i do know I in no way. intellect just forget me so I'm gonna do permit. fame fame is the same as those identical. keys lower back tilde it's on the tilde but. here this after which we want to use. a native motion so we are gonna do get. numb participant in dices so this would this.
    This native here this is a 5 . emanated this isn't a discord chess. native and all it truly is straight from 5m. server which is really it is is marvelous. that you'll be able to use that just you can use a. bunch of server natives now because. you are utilizing the Jas version of this. splendid edition on FX server so that's. amazing so you don't actually have to love. request it from a backend server you. can actually just run it and use the FX. server natives that's marvelous so we. want to do get quantity gamers we want. gamers after which we wish to have it like. that so it'll be like that's the status. of your bot after which it'll look like. like in case you had like 20 people on that's. what the display gave the impression of will be. like 20 players that's what that is what. that want return if there were 20. persons on and now what we wish to do is.
    Do client it really is what we are utilizing the. client object right here that we're gonna move. it will definitely client dot consumer dot set. exercise set recreation similar to that. after which we wish to set it as that. string that we set after which you are able to do. we have to positioned an item right here and do. kind after which I want to make it seem. like it's looking 20 gamers rather than. like gambling like as like a standard. reputation that could be like looking. rather and there is like two others or. you can also make it appear as if it's streaming. or it is looking or listening or playing. in order to simply make it appear as if. it is. simply get rid of that but I need to make. sure it feels like that aand then we'd like. to come set status because we want it. to start before everything of the. period so it doesn't have to attend so. that is that is basically it for this.
    This dossier now we wish to name it into. right here so what I desire to do correctly is to. name this file so to do that we're just. going to be fixed replace or require. so we're going to require the new util. this issue so dot minimize info and an. index you do not have to place that during. there because it's the index clone of. that aand then we are gonna do update. participant account like that correct there and. then now we can actually use this. function in here oops I want to copy. that i am gonna use this function replace. participant account after which we want to do. client we wish to flow the client object. in and then we also prefer it to do it I'm. gonna do it every 5 seconds be sure. you do it if you are gonna change the. seconds you I intend to make it refresh. the player counter or update every 5 . seconds yet do not do it we do not do it.
    greater than requests every second. due to the fact that is abusing that's. interestingly abusing the discord API so. make sure you're doing when you are doing. greater than like requests a second. that's bad don't do that i'm simply gonna. do it every five seconds it will do one. request to the discord API that's fine. so yeah that's essentially it for this. here i am gonna run thiis now so i've. the bot token i actually I forgot to now. what we wish to do actually I forgot to. we've to truly invite the bots so. i am in my discourse server right here and to. correctly invite your physique you wish this. hyperlink here i'll put this is like a. template hyperlink here I will positioned this. hyperlink so what we need correctly is right. here so it says your client Identity when it. says purchaser identification is equal to your purchaser. id I'm gonna backspace that. to Chrome right here for a moment there is.
    Chrome there it is yeah and i am gonna go. back to my general data there. where it says client Identity I'm going to. reproduction that aand I'm gonna paste that in which. it says purchaser Identity is equal to that importance. after which ensure that's right here scope is. equal to BA after which permissions is. equivalent to eight this practically signifies that. the bot is gonna have an inherited admin. position in your server. there's actually a permissions. calculator i am going to put them in the. description if you want it to love not. have admin or just in simple terms if you wish it. to only to send messages it doesn't. topic i am going to positioned that during there if you. desire to set this variety as anything. else and make it now not have admin but I. do not really care so i am gonna when I. even have that setup I'm gonna open. it yeah now it says linked Sheva to. discord the article so I'm gonna visit it.
    Sue a server a hive to sua servers there. we pass I'm going to click on connect. with a bit of luck that is the right one it is the. right one I do not know why I must do. a servers but there we pass says Java is. joining the carrier so it's aactually. offline now to make it on-line what we. want to do is I am getting out of here at 11:00. i am gonna start the server. and then it says started resourced it's. called started source disgorge but and. then it says discord bot logged in as. java hash six eight to seven then it. says it is called neo Java to stick I. cannot even see the article yet you'll find. that it's on-line now and it says it's. looking 0 gamers i am gonna cross into. the server and I'll show you that it'll. say one players once I'm in there okay. so I'm in 5m now sorry approximately my computer. but I'm gonna connect with my server here.
    And then it is gonna discord it may. already say that i am at one players. there it is going it changed and it's gonna. investigate that each 5 seconds which is. great that is like perfect and that is. practically it for this video thanks . guys for looking if I stop you will discover. that it is gonna bounce all the way down to 0. gamers it is relatively quick about it which. is awesome i hope you guys benefit from the. video i am in fact gonna make extra of. those movies with this score digest with. this Fork because there's plenty you may. do with this and yeah that is yeah make. certain to LIKE and permit me be aware of if you wish. extra of these videos too because there. you may have commands and make it. interact together with your server this is like. there's such a lot of possibilities so I am hoping. you guys benefit from the video and yeah see. you guys later. additionally I forgot to mention that once the.

    Listing

    Sorry, no listings were found.