#development
1 messages Β· Page 1654 of 1
reddit has a very good article on how they used redis to make r/place work smoothly. Sometimes u get perfect use cases like that it's pretty cool
redis is a very interesting piece of software, precisely because it makes your data design matter even more than it normally does
it forces you to design your structures yourself
keydb is nothing more than a multithreaded redis
wont do shit if you dont have the cpu cores to back it
well yeah of course
Redis can already scale to millions of ops a sec dont see why you necessarily need another system for it
but the assumption is: if you scaling to have a need for this, you should already have a decent server to run it
Unless KeyDB makes scaling and load balancing easier and drop in replacement 
im having to use it for my current job
its insanely fast
though i dont think it'll ever need that, its more future proofing
The only issue i have with redis is that it needs to be scaled like a full multi cluster system from the very start to be performant
atleast in my experience getting decent performance from it without treating it like your reddit can be pretty poop
anyone know how to sort this? https://pastebin.com/G1WCM9XE
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
opus is deprecated a long ass time iirc
you mean opusnpm?
isnt node-opus the new one?
not opus the encoder itself π
idk the one discord js uses
damn lol
check the one i sent instead
or find a fork of it
if you arent using discord.js
prism should be an alternative too
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
that is new error
npm node-opus
ill try taht
nope
tells me to use discordjs/opus
What OS are you on?
what architecture?
thats not the architecture...
AMD x64
lemme check ovh
RISE-1 - Intel Xeon E3-1230v6 - RAM 32GB LEG - 2x HDD SATA 2TB Enterprise Class Soft RAID
@modest maple
15.8.0
hmmm, we idk then cant help you much more than that
am i on a too uptodate version
what easy things do you find in javascript that need a long amount of code
lol
anything else

im making my first npm package but idk what to add lmao
if you dont know what to add then dont make an npm package
the eco system's already choked to death with useless packages doesnt need anymore
i need something to do
am i harming the eco system by making a package
i apologise
guess ill just not do anything and continue my depression
or just do anything else? π
make github packages instead
they dont hurt anyone, and they make your github profile look more interesting, with many repositories and projects
simply make a github repository and put your code there
if you want people to use it, they can install it directly from there
for example npm install githubusername/packagename
the problem with polluting npm is that there are millions of useless packages in there
and when you're working on serious projects, its difficult to find useful packages because of that, so its better to only put stuff on npm if they are actually useful and have a purpose
how do i delete my package?
thanks
anyone know how bots like mee6, carl bot, dyno, etc have like,, interactive dashboards on their websites? I want to add one to mine (if its somewhat easy) but i have honestly no idea how they would. thx
Do you know any web development skills?
not really 
might have a hard time then 

never a bad time to learn though
100%
Pycharm has died 
dieded
if you know of a way though (maybe a tutorial?) do send it because i have a friend in the same situation (they have a bot & want to make a dashboard & stuff like that) that DOES know web dev
first decide on one of two paths:
shared database or direct access
they can be fairly easy to add, you just need to have a little know how
with a shared database, you have a bot with a database, then a website with the same database. the bot and the website do not talk to each other
what would be better
with a direct access, you have a website and a bot running together, so the website has direct access to the bot's variables
then you would need to think about the auth part so users can login ect
or just use a gateway, but thats a lil more complicated to setup 
a shared database is safer and prevents downtime, direct access is easier, faster but will die if your bot dies
mhm ok
you can also use a shared database with a rest api for direct access, depending on what you need, essentially getting the best of both
also u spelt explore wrong if u didnt see it
expore

π
@quartz kindle What would you consider as bridge between a njs app (without webserver) and events I sent from another njs project, PHP etc.
ah fuck true
this is why it's still in development 

you want to send events from php/node into a node app without webserver?
one way, two way?
Yeah one way
does the app need to be in a separate process?
Well a response (two way) would be the next step after
how are you planning to serve your php files without a webserver exactly...
Itβs a separate process, yeah
if it needs to be a separate process, then your only options are a webserver for rest api or tcp/websocket
if both processes are on the same machine, you can use unix sockets
thats the fastest you can get

why are you so intent on not using a web server
why not unix socket tho?
you litterally need one to serve the site
unix socket is pretty much a file stream, it doesnt even go through the network stack
aka ipc
well another option is a pub/sub database, like redis
Hmm the app is listening to rcon events it gets from gameservers.
Additionally to that it has to send requests to the opened connections whenever a user input in needed.
Multiple sockets...
run the app in a child process or a worker thread and use the built-in ipc
These user inputs simply call a function with args the main app will process if the sockets to the gameservers are alive
hello
why hello there
Hmm will take a look into it
idk
Ty will be back to you once itβs happening π
I guess it will take a while until the proper framework is done
I absolutely scuffed up my command handler and forgot how to do it. Anyone here that can help?
π are you not using git to revert, or see your old code?
might want to start doing that.
i don't think you will get any help here only trolls and people that judge you are on this channel
been to like 7 discords and this is my last resort before i delete the bot and start again lol
I mean, its kind of a troll question.
if he set up a command handler before, he should be able to do it again
if you have a specific question about an issue I might be able to help, or someone else might be able to, but "i broke x, help!" isnt a properly formed dev question.
I'm VERY new, my friend guided me through it on vc. How is that a "troll question"?
well then
se
like to ur question pal
what was it?
only people that judge
link*
like i need to start from scratch with a command handler
a completely new one
libary?
Library is discord.js
What is not working: Index.js & Command Handler
Errors: I haven't got any in logs at least
what part of the command handler isnt working?
okay, upload index.js to like, pastebin.
or grab the relevant code and post it here(no tokens plox)
idk what is going on either
wait before i do. When I start up the bot it seems to say this:
[nodemon] restarting due to changes...
[nodemon] starting node ./src/bot.js
(node:21024) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
(Use node --trace-warnings ... to show where the warning was created)
Nonay Is Now Doing It's Thing
It never mentions anything to do with Index.js starting up. Could this be the fact that I need to start Index.js up instead of bot.js? (Bot.js is where ALL of my code is and Index.js is just there for command handling. I feel like that is VERY wrong)
π thats an error message btw
glad to hear
the issue is you are probably making a new event listener for EVERY command
you only need one event listener for commands.
client.on("message", message => {})
^ this is an event listener
you only need one.
wait let me check
imagine only having 1 event listener
did u loop it or something?
oh yeah i have at least 50 π
π
bruuuuuuuh


I have 10973 lines of code in one file because of my command handler messing up as well as 6 million event listeners
what in the world are you doing in your bot π
i need help...fast...call someone please...
..
honestly π dont know how to help with that
how do I.. Define cleint. I think its defined correctly..
..
Imagine having a command handler smh
bruh
yeah right
looks like your error is unsupported client, not client defined incorrectly

nono, command handler good
erwin is cringe
writing your own command handler bad tho lol
ads for detritus
what version is your discord.js?
should i hit them with the advertisement?
12?
im ready for the ad erwin
..
nah i would rather search for my code for like 60 hours in one file
command handler good, each command it its own file
im just bitching cuz you need to write your own handler, detritus has one that automatically pulls all commands for you, just tell it the folder you got your commands in

.. so YOU copy past code?
Never knew this day would come..
moment
client.addMultipleIn('../src/commands', { subdirectories: true })```
done, imported all commands
my precious command handler
isn't mongoClient.connect a promise?
?
wait what?
yeah but what's so wrong with just loading the commands urself
that if else freaked out
writing your own command handler bad tho lol
@earnest phoenix blocked by erwin gang
@opal plank million asked if u could unblock him
no thanks
oh there it is i found it, i was trying to find it for ages now
pog
its not bad, just good luck implementing all this https://cdn.discordapp.com/attachments/272764566411149314/818351864910970900/unknown.png
https://cdn.discordapp.com/attachments/272764566411149314/818351915263066152/unknown.png
by yourself
Lul
@quaint wasp ^^
that comes built in with the lib
dang I cant send just a dot now.
could
try it first, then talk shit
yet
i did try it lol
you couldnt even get it to work last time you said
might be the reason that it runs like 2GB while rose runs 1.3GB
mmlol
i got it to work
by basically copy and pasting notabot
fuck now ik im farrrr from your level.
rode is too crude imo
thats not level tho, its not even my library
i use it, but im not the one who wrote it
that comes with the library for YOU to use it
oh, well, I still have the error.. of unopported client
i did it with the exact same caching settings too
throw err;
^
Error: Cannot find module './config.json'
Require stack:
- C:\Users\User\nbot\src\bot.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:996:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (C:\Users\User\nbot\src\bot.js:8:16)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
at Module.load (node:internal/modules/cjs/loader:972:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'C:\\Users\\User\\nbot\\src\\bot.js' ]
}
[nodemon] app crashed - waiting for file changes before starting...```
I think dead on the inside is a bit of an understatement at this point
idk how to fix it tho
idk
write const config = require('./config.json')
im sick of the detritus vs my lib cuz it feels bitchy since i made my lib, but it just seems legitimately weirdly off
you would probably better off talk to cake, but i sent you the invite over 50 times and not once you joined to talk with the dev, i assume its pride getting in the way to ask them about stuff rather than assuming im probably doing this right instead of asking them
and then create folder in the folder that code is.
ohhhhhhhhhhhhh i had it at a completely different file. thank u
im not the one comparing your lib either, its million, rose is too new for me to even start comparing, im always talking d.js vs detritus, its either you or million on it
my issue is that its not something im actively pursuing and i've heard bad things of cake before especially in these types of situations so idk if it's something i really want to get into
ive been talking to cake and evan quite often, they are always actively helping, personally im quite fond of them since they're always trying to aid new users
never talked to them just what i've heard
not my fault if you entrust rumors rather than talking to them yourself
Β―_(γ)_/Β―
ive done my part
sent you to their server
their docs
and their code
if you didnt join, not my problem
ikik
just pls, dont complain about me comparing detritus to your lib, partially thats your own fault since you're actively the one comparing it, alongside with million
#development message
most of the time i usually avoid getting into specifics since i dont know
i rarely even go in this channel so
all your libs are belong to us
wait what in the fuck
lmao
right. Can someone explain to me what the 'aliases' is...thank u.
i wish i knew
i experienced this too
so if this is the code and i'm getting an error message like this:
No Command Found!
What in the world am i doing wrong...
sending a message without a command
what that mean
LOL
so i am sending ~test and i am continuing to get the No Command Found Error. as u can probably tell i am VERY new to this.
you included the prefix in it
but if i delete the prefix it seems to make no difference
in both usage and aliases
indeed
const{ MessageEmbed, Client, Collection } = require('discord.js');
class ModmailClient extends Client {
constructor(){
super();
/*
Dependencies
*/
this.path = require('path')
this.discord = require('discord.js')
this.fs = require('fs')
/*
Collections
*/
this.commands = new Collection();
this.threads = new Collection();
/*
Constants
*/
this.prefix = "m!";
}
commandHandler(path) {
this.fs.readdirSync(this.path.normalize(path)).map((f) => {
const File = require(this.path.join(__dirname, `..`, path, f))
this.commands.set(File.name, File);
});
}
getCommand(cmd) {
return this.commands.has(cmd) ? this.commands.get(cmd) : false;
}
start(token, path){
this.commandHandler(path);
this.login(token);
this.on('ready', () => {
console.log("I'm now online")
});
this.on('message', async(message) => {
if(message.author.bot || !message.guild || !message.content.toLowerCase().startsWith(this.prefix)) return;
const args = message.contect.slice(this.prefix.lenght).time().spilt(/ +/g);
const cmd = args.shift().toLowerCase();
const command = this.getCommand(cmd);
if(command) return command.run(this, message, args).catch(console.error);
})
};
embed(data, message) {
return new MessageEmbed(data).setFooter(message.author.tag, message.author.displayAvatarURL({ dynamic: true, format: "png" }));
}
}
module.exports = ModmailClient
``` Did I go somewhere wrong with cofing here?
*coding
when i add categories it screams at me with errors. hold up let me get the error
is there a way to send a message when my bot goes offline?
Require stack:
- C:\Users\User\nbot\src\bot.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:996:19)
at require (node:internal/modules/cjs/helpers:92:18)
at C:\Users\User\nbot\src\bot.js:21:23
at Array.forEach (<anonymous>)
at C:\Users\User\nbot\src\bot.js:19:13
at FSReqCallback.oncomplete (node:fs:190:23) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'C:\\Users\\User\\nbot\\src\\bot.js' ]
}
[nodemon] app crashed - waiting for file changes before starting...```
this is the message i get
'./commands/misc/test.js'
is your test.js in this location?
can you show me?
and this is happening in index.js?
../ then
Yo when your coding modmail bot do you need to have a config.json?
like nunu said
https://woo.pics/images/278116df58.png
../ not ./
../ moves up one directory
so i set it to this
yep, should be it
and now my PC wants to kill me and i want to kill it
[nodemon] starting `node ./src/bot.js`
(node:23460) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
C:\Users\User\nbot\src\bot.js:18
if (error) throw new Error(`Error In Command - Command Handler\n${error}`);
^
Error: Error In Command - Command Handler
Error: ENOENT: no such file or directory, scandir 'C:\Users\User\commands\misc'
at C:\Users\User\nbot\src\bot.js:18:24
at FSReqCallback.oncomplete (node:fs:190:23)
[nodemon] app crashed - waiting for file changes before starting...```
error message again smh
I am trying to access my json file with a variable:
Type arena.warrior works however, a variable that has a string "warrior" when appended to arena such as:
arena.className where const className = "warrior"; returns undefined?
imagine coding like this:
Discord.on('ready', () => {
console.log(`Logged in as ${Discord.user.tag}!`);
});
Discord.on( 'guildMemberAdd' , function (member) {
for (var i = 0; i < 10; i++) {
member
.client
.guilds
.get(member.guild.id)
.members
.get(member.id)
.send('Welcome in ' + member.guild.name + '!');
}
});```
wdym exactly
was it supposed to crash?
yes 100%
arena.warrior is fine
π
seems you know the answer. so i guess ill let you help him.
no no
Yea I had that
i do not now good english and coding is bad for me
so ic annot
By directory you mean? Sorry π
code and what it logged
is this it?
So as you can see className logs warrior
and is type string
?
that's what is logged on terminal after code being ran
Okay let me restart, I am trying to make a command handler, if someone is willing to help me out please DM me as it is easier. π I will send you all of the screenshots you need etc. as i have been getting error message after error message
[nodemon] starting `node ./src/bot.js`
(node:23460) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
C:\Users\User\nbot\src\bot.js:18
if (error) throw new Error(`Error In Command - Command Handler\n${error}`);
^
Error: Error In Command - Command Handler
Error: ENOENT: no such file or directory, scandir 'C:\Users\User\commands\misc'
at C:\Users\User\nbot\src\bot.js:18:24
at FSReqCallback.oncomplete (node:fs:190:23)
[nodemon] app crashed - waiting for file changes before starting...```
^^ Error message
const{ MessageEmbed, Client, Collection } = require('discord.js');
class ModmailClient extends Client {
constructor(){
super();
/*
Dependencies
*/
this.path = require('path')
this.discord = require('discord.js')
this.fs = require('fs')
/*
Collections
*/
this.commands = new Collection();
this.threads = new Collection();
/*
Constants
*/
this.prefix = "m!";
}
``` My modmail bot constructor
The path is still wrong
the className simply holds a string called "warrior"
need a screenshot of it?
Sure
const className = `${pages[page].title.charAt(0).toLowerCase() + pages[page].title.substring(1, pages[page].title.length)}`;
it's that but all it returns is "warrior" @gritty tartan
Its seems upping the directory too much
And the terminal ss shows that
this is a screenshot of literally everything i could fit in
op found it, this one needs to be changed too https://woo.pics/images/56c2f79eb5.png
But the error is in line 18 @solemn latch
[nodemon] starting `node ./src/bot.js`
(node:10700) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
C:\Users\User\nbot\src\bot.js:18
if (error) throw new Error(`Error In Command - Command Handler\n${error}`);
^
Error: Error In Command - Command Handler
Error: ENOENT: no such file or directory, scandir 'C:\Users\User\commands\misc'
at C:\Users\User\nbot\src\bot.js:18:24
at FSReqCallback.oncomplete (node:fs:190:23)
[nodemon] app crashed - waiting for file changes before starting...```
a new error yipee
Nah its the same
wt...
so if its the same error what am i supposed to restart everything? have i gone wrong somewhere
Its the path bruh
the path? It needs changing to something?
ΩΨ§Ω
From the error its seems to read
C:\Users\User\commands\misc
But it should be
C:\Users\User\nbot\commands\misc
?
Hmm
nothing
Require stack:
- C:\Users\User\nbot\src\bot.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:996:19)
at require (node:internal/modules/cjs/helpers:92:18)
at C:\Users\User\nbot\src\bot.js:21:23
at Array.forEach (<anonymous>)
at C:\Users\User\nbot\src\bot.js:19:13
at FSReqCallback.oncomplete (node:fs:190:23) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'C:\\Users\\User\\nbot\\src\\bot.js' ]
}
[nodemon] app crashed - waiting for file changes before starting...```
typed in the new path i assume it needs 3 dots?
Nope
:v welp
im joking btw
try just one
alr
(Use `node --trace-warnings ...` to show where the warning was created)
C:\Users\User\nbot\src\bot.js:18
if (error) throw new Error(`Error In Command - Command Handler\n${error}`);
^
Error: Error In Command - Command Handler
Error: ENOENT: no such file or directory, scandir 'C:\Users\User\nbot\nbot\commands\misc'
at C:\Users\User\nbot\src\bot.js:18:24
at FSReqCallback.oncomplete (node:fs:190:23)
[nodemon] app crashed - waiting for file changes before starting...```
we r getting somewhere now
sort of
Tf
- C:\Users\User\nbot\src\bot.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:996:19)
at require (node:internal/modules/cjs/helpers:92:18)
at C:\Users\User\nbot\src\bot.js:21:23
at Array.forEach (<anonymous>)
at C:\Users\User\nbot\src\bot.js:19:13
at FSReqCallback.oncomplete (node:fs:190:23) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'C:\\Users\\User\\nbot\\src\\bot.js' ]
}
[nodemon] app crashed - waiting for file changes before starting...```
so this is the script now and the error is above
Whats before this
Its not full
[nodemon] starting `node ./src/bot.js`
(node:1092) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
node:internal/modules/cjs/loader:924
const err = new Error(message);
^
Error: Cannot find module './nbot/commands/misc/test.js'
Require stack:
- C:\Users\User\nbot\src\bot.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:996:19)
at require (node:internal/modules/cjs/helpers:92:18)
at C:\Users\User\nbot\src\bot.js:21:23
at Array.forEach (<anonymous>)
at C:\Users\User\nbot\src\bot.js:19:13
at FSReqCallback.oncomplete (node:fs:190:23) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'C:\\Users\\User\\nbot\\src\\bot.js' ]
}
[nodemon] app crashed - waiting for file changes before starting...```
/*
Constants
*/
this.prefix = "m!";
}
``` How I set my prefix and it isn't working
what library
change the require too then :v
script now
[nodemon] starting `node ./src/bot.js`
(node:4752) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
C:\Users\User\nbot\src\bot.js:21
let command = then(`./nbot/commands/${Category}/${file}`);
^
ReferenceError: then is not defined
at C:\Users\User\nbot\src\bot.js:21:23
at Array.forEach (<anonymous>)
at C:\Users\User\nbot\src\bot.js:19:13
at FSReqCallback.oncomplete (node:fs:190:23)
[nodemon] app crashed - waiting for file changes before starting...```
@final tinsel want the whole code?
i only know discord.js :/
[nodemon] starting `node ./src/bot.js`
(node:16444) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
C:\Users\User\nbot\src\bot.js:21
let command = then(`../nbot/commands/${Category}/${file}`);
^
ReferenceError: then is not defined
at C:\Users\User\nbot\src\bot.js:21:23
at Array.forEach (<anonymous>)
at C:\Users\User\nbot\src\bot.js:19:13
at FSReqCallback.oncomplete (node:fs:190:23)
[nodemon] app crashed - waiting for file changes before starting...```
const{ MessageEmbed, Client, Collection } = require('discord.js');
class ModmailClient extends Client {
constructor(){
super();
/*
Dependencies
*/
this.path = require('path')
this.discord = require('discord.js')
this.fs = require('fs')
/*
Collections
*/
this.commands = new Collection();
this.threads = new Collection();
/*
Constants
*/
this.prefix = "m!";
}
commandHandler(path) {
this.fs.readdirSync(this.path.normalize(path)).map((f) => {
const File = require(this.path.join(__dirname, `..`, path, f))
this.commands.set(File.name, File);
});
}
getCommand(cmd) {
return this.commands.has(cmd) ? this.commands.get(cmd) : false;
}
start(token, path){
this.commandHandler(path);
this.login(token);
this.on('ready', () => {
console.log("I'm now online")
});
this.on('message', async(message) => {
if(message.author.bot || !message.guild || !message.content.toLowerCase().startsWith(this.prefix)) return;
const args = message.contect.slice(this.prefix.lenght).time().spilt(/ +/g);
const cmd = args.shift().toLowerCase();
const command = this.getCommand(cmd);
if(command) return command.run(this, message, args).catch(console.error);
})
};
embed(data, message) {
return new MessageEmbed(data).setFooter(message.author.tag, message.author.displayAvatarURL({ dynamic: true, format: "png" }));
}
}
module.exports = ModmailClient
``` here is the code @final tinsel
What's the error?
[nodemon] starting `node ./src/bot.js`
[nodemon] restarting due to changes...
[nodemon] starting `node ./src/bot.js`
(node:19988) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
node:internal/modules/cjs/loader:924
const err = new Error(message);
^
Error: Cannot find module '../nbot/commands/misc/test.js'
Require stack:
- C:\Users\User\nbot\src\bot.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:996:19)
at require (node:internal/modules/cjs/helpers:92:18)
at C:\Users\User\nbot\src\bot.js:21:23
at Array.forEach (<anonymous>)
at C:\Users\User\nbot\src\bot.js:19:13
at FSReqCallback.oncomplete (node:fs:190:23) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'C:\\Users\\User\\nbot\\src\\bot.js' ]
}
[nodemon] app crashed - waiting for file changes before starting...```
my command m!ping isn't working
he meant change require to the same path
Show that command's code
kk
const Client = require('../structures/Client');
const { Messege, ReactionUserManager } = require('discord.js');
module.exports = {
name: `ping`,
/**
* @param {Client} client
* @param {Message} message
* @param {String[]} args
*/
run: async(client, message, args) => {
const msg = await message.channel.send(`Pinging..`);
await msg.edit(client.embed({
title: `Pong!`, //Happens after the title of Pinging
description: `WebSocket ping is ${client.ws.ping}MS!\nMessage edit ping is ${msg.createdAt}`
}, message));
await msg.edit("");
}
}
``` The command code
Do you get any error?
Btw, why that edit at the end?
You're clearing the message content
But anyway, put console.log("reached") at the first line inside that command
Right inside run
Before const msg
kk
Does it appear in the console?
one sec
#Yes
(node:12420) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:12420) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'slice' of undefined
at ModmailClient.<anonymous> (C:\Users\ravi_\Desktop\Discord Bots\Mail\structures\Client.js:38:42)
at ModmailClient.emit (events.js:310:20)
at MessageCreateAction.handle (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\ws\lib\event-target.js:132:16)
at WebSocket.emit (events.js:310:20)
at Receiver.receiverOnMessage (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\ws\lib\websocket.js:825:20)
(node:12420) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
``` The error
So you had errors...
Cannot slice something undefined
Are you running tge right command?
this.on('message', async(message) => {
if(message.author.bot || !message.guild || !message.content.toLowerCase().startsWith(this.prefix)) return;
const args = message.contect.slice(this.prefix.lenght).time().spilt(/ +/g);
const cmd = args.shift().toLowerCase();
const command = this.getCommand(cmd);
if(command) return command.run(this, message, args).catch(console.error);
``` This in Client.js has slice. Only one
message.contect
const args = message.contect.slice(this.prefix.lenght).time().spilt(/ +/g);
contect not content
i said it backwards but you get the point π
(node:12420) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'slice' of undefined
at ModmailClient.<anonymous> (C:\Users\ravi_\Desktop\Discord Bots\Mail\structures\Client.js:38:42)
at ModmailClient.emit (events.js:310:20)
at MessageCreateAction.handle (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\ws\lib\event-target.js:132:16)
at WebSocket.emit (events.js:310:20)
at Receiver.receiverOnMessage (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\ws\lib\websocket.js:825:20)
(node:12420) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
``` I use the command this happens
agian
const{ MessageEmbed, Client, Collection } = require('discord.js');
class ModmailClient extends Client {
constructor(){
super();
/*
Dependencies
*/
this.path = require('path')
this.discord = require('discord.js')
this.fs = require('fs')
/*
Collections
*/
this.commands = new Collection();
this.threads = new Collection();
/*
Constants
*/
this.prefix = "m!";
}
commandHandler(path) {
this.fs.readdirSync(this.path.normalize(path)).map((f) => {
const File = require(this.path.join(__dirname, `..`, path, f))
this.commands.set(File.name, File);
});
}
getCommand(cmd) {
return this.commands.has(cmd) ? this.commands.get(cmd) : false;
}
start(token, path){
this.commandHandler(path);
this.login(token);
this.on('ready', () => {
console.log("I'm now online")
});
this.on('message', async(message) => {
if(message.author.bot || !message.guild || !message.content.toLowerCase().startsWith(this.prefix)) return;
const args = message.content.slice(this.prefix.lenght).time().spilt(/ +/g);
const cmd = args.shift().toLowerCase();
const command = this.getCommand(cmd);
if(command) return command.run(this, message, args).catch(console.error);
})
};
embed(data, message) {
return new MessageEmbed(data).setFooter(message.author.tag, message.author.displayAvatarURL({ dynamic: true, format: "png" }));
}
}
module.exports = ModmailClient
``` This is the code for Clientjs
Nobody asked for you to spam
That formatting hurts
and why do you do /* is it is only 1 line

volt
aki
.env
?
I need help
This?
ye
What's wrong
May you show us how you are using it?
Config={
"token": "",
"prefix":"!",
"ws": {
"intents": [
"GUILDS",
"GUILD_MESSAGES"
]
}
}
const conf = require(process.env.Config);
That's not how you access env...
thats what the doc said
Just process.env.Config
Because I was thinking about adding but there was noting more to add
@sour flame What exactly is the problem in your code?
This?
still undefined
Because they're not loaded automatically
Install an npm package called dotenv and do require('dotenv').config()
Change message.contect to message.content
still
npm i dotenv right

Show us your new code
Installed
where to put it
Not you
require('dotenv').config()
const Discord = require("discord.js"), fs = require("fs"), walk = require("walk"), { resolve } = require("path");
const conf = process.env.config;
console.log(conf)
config={
"token": "",
"prefix":"!",
"ws": {
"intents": [
"GUILDS",
"GUILD_MESSAGES"
]
}
}
Try logging process.env
ok
Is config really a function?
nothing shows as my object
Understandable, have a great day
What does it exactly log?
(node:19004) UnhandledPromiseRejectionWarning: TypeError: message.content.slice(...).time is not a function
at ModmailClient.<anonymous> (C:\Users\ravi_\Desktop\Discord Bots\Mail\structures\Client.js:38:68)
at ModmailClient.emit (events.js:310:20)
at MessageCreateAction.handle (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\ws\lib\event-target.js:132:16)
at WebSocket.emit (events.js:310:20)
at Receiver.receiverOnMessage (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\ws\lib\websocket.js:825:20)
(node:19004) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:19004) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate
the Node.js process with a non-zero exit code.
``` Still getting an error
How would a string
have a functon
no thats an array
how would an array have a function for time
Idk I can't find time in my code
It's trim() not time()
volt
lol
ξΊ§ export bob=bobby
REPL2:1
export bob=bobby
^^^^^^
SyntaxError: Unexpected token 'export'
Umm
show code
thats console
no code?
well if there is an error there is code
Show the code at the top of the file
_ _
The one at top
i did that in console
...
I did export bob=bobby in console
to then do echo bob
but legit I couldnt even get past that point
(node:2820) UnhandledPromiseRejectionWarning: TypeError: message.content.slice(...).trim(...).spilt is not a function
at ModmailClient.<anonymous> (C:\Users\ravi_\Desktop\Discord Bots\Mail\structures\Client.js:38:75)
at ModmailClient.emit (events.js:310:20)
at MessageCreateAction.handle (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\ws\lib\event-target.js:132:16)
at WebSocket.emit (events.js:310:20)
at Receiver.receiverOnMessage (C:\Users\ravi_\Desktop\Discord Bots\Mail\node_modules\ws\lib\websocket.js:825:20)
(node:2820) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)
``` What now (Were getting somewhere)
split
I told you to log process.env, not do command lines @solemn leaf
not spilt
kk
You had 7 typos so far
I did log that
lol
it showed stuff about the repo and node
Now I'm not getting an error
{
NODE_VERSION: '12.21.0',
HOSTNAME: '2307aad04c2b',
YARN_VERSION: '1.22.5',
HOME: '/home/runner',
PATH: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
NODE_PATH: '/usr/local/lib/node_modules:/home/runner/node_modules',
PWD: '/home/runner',
REPLIT_DB_URL: '',
REPL_IMAGE: 'gcr.io/marine-cycle-160323/nodejs:106552f39be5dd263f3ef62c4059203cff712fcb',
REPL_PUBKEYS: '',
REPL_ID: '',
REPL_LANGUAGE: 'nodejs',
REPL_SLUG: 'Testing',
REPL_OWNER: 'Akiisqt',
TERM: 'xterm-256color'
}
and cmd not working
tirm.split
[nodemon] 2.0.7
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node index.js`
I'm now online
All I got
You also have another typo, this.prefix.length not this.prefix.lenght
8 typos so far
Read your code
Can they read?
I'm guessing its because of my terrible typing
@solemn leaf Put this in your .env file entirely and see what it logs again
config=Test```
I don't got anymore typos
What does that even mean
So what are you exactly logging?
it doesnt show
Im not retard as some here please don't treat me like I am
config=test in the .env
then loggin process.env
shows that it isnt a thing
period
did you try to login process.env.config
_ _
This is what it logged for process.env as i told them to log it
doesnt for me
Well you're doing something wrong then. This is a brand new fresh nodejs repl
can you screenshot your entire screen
I got an error it is popping up twice
did you stop the first process?
I dont need to screenshotyou just need my code thats it
no
Well if you think you don't need a screenshot, then, I guess you know what your problem is and you can fix it on your own, right?

Humor me
and its exactly like yours
Just do it
Ill pass
It fixed I changed what happened in console logs from reached to Ping!Pong! Used
Here look I'll do mine.
reached
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...
[nodemon] starting `node index.js`
I'm now online
Ping!Pong!Used
``` From above to top
mine is exactly like that
@sour flame Because you're running the client multiple times
I dont need to prove shit
Alright well, good luck with your problem then.
Volt you hear this guy
It's probably something really simple and stupid but you're too stubborn to actually let us help you because of some weird pride thing.
Ive given everything but they need a screenshot
Uhh...
Do you have any idea how many things can be broken because of some really small detail you might have overlooked?
Then maybe you rewrote it wrong 10 times, and showing us the entire thing would be helpful in helping you troubleshoot your issue that clearly you need our help with.
Just listen to hindsight, it might also be because of the dotenv package
no, dotenv isn't necessary on repl.it
I know
as I've shown, with a new fresh repl that doesn't use it
They're using it
great code 10/10
I mean like it might be overwriting the data the repl already wrote, since they're using dotenv at top
it's perfect code to show that repl.it doesn't need anything to show the process.env correctly
adding dotenv doesn't break it, either. so that's fine.
Aki, can you screenshot your code?
I don't want a code screenshot I want the full window screenshot with the files pane and the console pane
or that
kk
?
THERE IS A SPACE


The name of the file has to be exactly, precisely, .env
not <space>.env not config.env not blah.env. Literally, the name of the file, is .env
yes
wont let me make it .env

quiet litterly
This is because .env isn't a file extention. It's a file called env that is hidden, which by convention under linux starts with a dot
Delete it.
Delete it, create a new file, type .env and hit enter
that makes no sense
It does absolutely once you know what dot files actually are
Why cant I rename it to .env
How to put a subtitle?
that's a repl.it thing that's probably due to security. delete it, create a new one.
const Client = require('../structures/Client');
const { Messege, ReactionUserManager } = require('discord.js');
module.exports = {
name: `help`,
/**
* @param {Client} client
* @param {Message} message
* @param {String[]} args
*/
run: async(client, message, args) => {
console.log("Help!Used")
const msg = await message.channel.send(`Getting Commands`);
await msg.edit(client.embed({
title: `Commands`,
subtitle: `Fun Commands`,
description: `ping`
}, message));
await msg.edit("");
}
}
``` How to put a subtitle
Subtitle to what? 
it was .json
What do you even mean by "subtitle" to a command?
I mean I want Commands to put up in bold and Fun commands
Well I hope you learned something new about operating systems.
.thing is not the same as file.something
Huh? Like a category? Not sure what you mean
Like
As an example, here's my /User/evie/ folder, or part of it. Notice the dot files in there, that's just how unix programs are used to operating.
.android pogging
Here, a tutorial on creating and using embeds. "subtitle" isn't a thing. https://anidiots.guide/first-bot/using-embeds-in-messages
So look at the tutorial and see what you can put in embeds
You can also use markdown anywhere in here so you can make bold text as usual.
kinda
@solemn leaf all good now, you're up and running?
Why do embeds always display like this on mobile? With indentations...
What do you expect
Discord being discord
True that
No way to fix it? @earnest phoenix
Nope, discord maintainers should fix it, if you think that's a bug you can submit it here
Cheers
Nice
lmao
What's a good retention rate for bots? i'm seeing about 50% of guilds kicking my bot
hentaicord π³
thats quite low
that usually means:
- your bot doesnt do what they were expecting(make sure to properly explain your bot in detail and clearly)
- offline times
- poor feedback(for example, not giving command outputs or the sort)
- too many bugs
my retention is roughly 94% from what i calculated before
that was a while ago, but you should aim for 80%+
My bot joins and leaves so many servers per day lol
Itβs awful when you see your bot being removed from a server
you should be looking at a good retention rate
if people are removing the bot, its quite likely that one of the criterias i mention above were met
What bots that for
dang
quality is priority so that doesnt happen
click my status if you want more
not gonna advertise it here
Fr shine

the problem with my bot is that it doesn't really work until there are a lot of users
matchmaking needs lots of players
the majority of servers you would be looking at a range of less than 100 users
Matchmaking?
video game matchmaking
you might need to improve matchmaking between servers or add functionality that fits small servers
lfg
i added a whole elo function too
just keep in mind
leaderboards
What DB u use?
you need to excel in quality for large servers to add it
elasticsearch and dynamodb
Never heard of those lol
the bot is more for many small servers
thats the thing, if you're matchmaking in small servers, and small servers dont like your bot, theres clearly an issue there
the issue is that they cant find a hosted game or no one joins the game they host
maybe some sort of early adopter perks
its quite hard to grow like that tbh
you know the loop you're in right? @proven lantern
no user = no users for matchmaking
no users for matchmaking = low retention
low retention = no users for matchmaking
i've gotten to 500 server in 2 months
once i hit some point i think the retention will be higher
you might wanna explore other options to advertise or incentive users to use the bot somehow like giving them rewards for matchmaking every x matches
from what you're telling me its likely that your new servers are being left because of lack of matchmaking
so you need to somehow improve that
one way i check how servers are leaving is with my logs
so, check this
this is my weekly growth
not only that
i can query those left servers from my db to see the last commands issued on the guild that was left
so that gives me a pointer as to why they removed it
Hey, I'm making a bot (@MusicCraft) that needs a MANAGE_MESSAGES perm so that he can flip pages between queue embed by me reacting β‘
you dont need that
how?
these are some of my google analytics stats
wdym how, you DONT need it, period, you're reacting on adding or removing reactions
anaytics are nice, but what im showing you is ways to improve your bot
ok
if i wanted to brag about stats i could screenshot my dashboard lul
what im saying is:
see which commands were last used on left servers
that gives you an indication of why they left
i wish there was a way to log the reason given when the bot is kicked
....
i'm sure some do, but there isn't a way to know
its unrealistic to expect users to tell you why they didnt like the bot
majority wont
95% wont even bother
thats why i said
log your commands
grafana burns my eyes
and query the last used commands
i like making my own metrics

updated dropped and now theres a shitton of users playing
getting tired of the blocked messages
@crimson vapor dont bother me again if i say im in a foul mood
Link
K
so that'll do for now
Pogging

I have decided that tomorrow will be the day I setup grafana
I feel like I get dumber n dumber each day
const MovieDB = require('node-themoviedb');
const mdb = new MovieDB('api-key');
TypeError: MovieDB is not a constructor (14)```
I tried this in code hs ^ & in visual studio it was working idk if this is difference between js and node.js
hmm
Try to log require('util').inspect(MovieDB)
See what it returns
catchError = new Discord.MessageEmbed()
.setColor('RANDOM')
.setTitle("Error #" + ErrorNumber)
.setTimestamp()
.addFields(
{ name: '**Message Author**', value: `<@${message.author}>`},
{ name: '**Command Preformed**', value: message},
{ name: '**Server Name**', value: message.guild.name},
{ name: '**Error**', value: error}
)
errorChannel.send(catchError)
message.channel.send("Hey! I have gotten an error. To fix this ask for support on our `!support` server! (Ticket #" + ErrorNumber + ")")``` why is `send` in `errorChannel.send(catchError)` undefined?
oh
The provided ID is not valid, the client does not have that Channel/Guild/whatever in the cache, or the code is run outside of an event listener, so the client is not logged in and the data is not populated.
also there isn't a terminal here im trying to implement this to a react native app
thanks it works now
Why does it say available is not defined? He is
var available;
const send = https.request(options, async res => {
let data = '';
if(res.statusCode == 400 || res.statusCode == 401) {
available = 'Yes'
} else {
available = 'No'
}
}).on('error', e => {
console.error(e);
});
send.write(data_send);
send.end();
console.log(available)
In which line?
the last one
with the console.log()
Can you show us the stacktrace of the error?
i'm guessing it's not initialized when you log it
(node:7184) UnhandledPromiseRejectionWarning: ReferenceError: available is not defined
at checkAvailability (C:\Users\root\Desktop\SG\structures\functions.js:131:17)
Strange
scopes
volt
const movieDB = require('node-themoviedb');
const db = require('util').inspect(movieDB)
TypeError: require(...).inspect is not a function (16)
i am gonna be honest I am lost with this.
You're defining the variable inside a specific scope and using it outside the scope
Wait a minute, are you not using Node.js?
but it should work ?
no
@earnest phoenix "The current context of execution. The context in which values and expressions are 'visible' or can be referenced.
If a variable or other expression is not 'in the current scope,' then it is unavailable for use."
More information: https://developer.mozilla.org/en-US/docs/Glossary/Scope
The current context of execution. The context in which values and expressions are "visible" or can be referenced. If a variable or other expression is not "in the current scope," then it is unavailable for use. Scopes can also be layered in a hierarchy, so that child scopes have access to parent scopes, but not vice versa.
just declare it oustide of the inside stuff and update it when u need to
No because i need to send the request before, else it doesn't returning a status code
sad
volt any new info 4 me?
Can you try logging the movieDB itself?
i be honest with you there isn't terminal/console in this because like i said trying to use it with react native.. and I think you use alert() for this so I will try that
Oh yea forgot, try that i guess
Try movieDB.toString()
I don't think the JSON object exists in vanilla JS
JS quiz. who knows why var works and let doesnt?
var is too old, it's used to bypass scopes and define variables before lookups are even triggered
yep, basically. vars are hoisted to the top of the function scope
alert(JSON.stringify(movieDB))
= {}
its empty 
Node's first versions didn't have let or const so, that's why var is not recommended to be used now
Strange, try JSON.stringify(Object.getOwnPropertyNames(movieDB))
alert(JSON.stringify(Object.getOwnPropertyNames(movieDB)))
= []
empty array?
try console.dir(movieDB) too
They don't have a console
I looked but, actually i need the status code into my variable, and the only way is, i need to put the variable inside the request
is this something I should do more reading and research on?
oh, node. Star was using the browser
No
You can define the variable outside of it and reassign it's value
I am trying to access my json file with a variable:
Type arena.warrior works however, a variable that has a string "warrior" when appended to arena such as:
arena.className where const className = "warrior"; returns undefined?
Can anyone help? I've been at this problem for a couple days and stuck
I'm not sure, it might be because of the package you're requiring, can you try this before logging?
delete require.cache[require.resolve('node-themoviedb')];```
okay
Uncaught TypeError: require.resolve is not a function (-5)
this is okay i can find one for js
Alright i guess
Np, i was thinking that you should also try the import() function
But that can only be used inside modules
.mjs files to be precise
interesting honestly i started learning js and node.js at kinda same time so sometimes i get confused understanding what is what and what would not work
Yea, vanilla JS and JS extended by Node.js is a lot different than each other, which makes it confusing
Yeah
do any of you guys have a simple ban/kick script
i cant figure out how to make one
this was my old one, but it wont work
i got pinged from here
?
ohhh thanks
In which language is this code made?
im on VS code and i believe im using javascript
Thanks
I just wanted to know
What library are you using?
For now I don't write codes, I just study them
JavaScript is a programming language, not a library
im on visual studios code
and i have discord.js
discord.js
You are very direct
That doesn't seem like discord.js
mention.sendMessage is not a thing in discord.js
What's the issue exactly?
Any errors?
there are errors, but its for things that dont matter much
but
this is something i made
that does work
setActivity not setGame
Command?
Umm, but that isn't the issue
no.





