#development
1 messages · Page 804 of 1
and how would i do that?
yikes
bye
I'm facing error
if (format.isHLS || format.isDashMPD) {
^
TypeError: Cannot read property 'isHLS' of null
@honest perch he means you're using console.log(token) to check if it's really available
when I play music and then I add bassboost it throws that error
this.current = this.queue.shift();
const format = this.current.src === 'youtube' ? 'webm' : null;
voiceConnection.play(ytdl(this.current.id, {
filter: 'audioonly',
quality: 'highestaudio',
encoderArgs: this.bassBoost,
format: this.bassBoost ? null : format,
highWaterMark: 1<<25,
}));```
it doesnt print anything
which means that your token, in fact, isn't correct - because it isn't there in the first place
and of course, I don't know how you called your token variable
hope you understood that
lol
hello i have a probleme with my bot:
at new MessageEmbed (C:\Users\Administrateur\Desktop\Neotux\node_modules\discord.js\src\structures\MessageEmbed.js:13:60)
at Object.run (C:\Users\Administrateur\Desktop\Neotux\commands\help.js:10:27)
at module.exports (C:\Users\Administrateur\Desktop\Neotux\event\message.js:9:20)
at Client.emit (events.js:311:20)
at MessageCreateHandler.handle (C:\Users\Administrateur\Desktop\Neotux\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\Administrateur\Desktop\Neotux\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:108:65)
at WebSocketConnection.onPacket (C:\Users\Administrateur\Desktop\Neotux\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:336:35)
at WebSocketConnection.onMessage (C:\Users\Administrateur\Desktop\Neotux\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:299:17)
at WebSocket.onMessage (C:\Users\Administrateur\Desktop\Neotux\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:311:20)
(node:4056) 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:4056) [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.
@honest perch show your client.login
now do console.log(process.env)
@earnest phoenix show help.js 10th line
This ? var commandList = new MessageEmbed()
what is "MessageEmbed"
My bot is in discord.js v12
its v12's version of RichEmbed
yes thanks you
i know
It's my help.js:
MessageEmbed
} = require('discord.js');
module.exports = {
name: 'help',
category: 'bot',
async run(client, message) {
var commands = client.commands;
var commandList = new MessageEmbed()
.setAuthor(message.author.username, await message.author.displayAvatarURL(), client.opt.url)
.setDescription(`Voici la liste de mes commandes | prefix: ${client.opt.prefix}`)
.setThumbnail(await client.user.displayAvatarURL())
.setColor(client.opt.color)
.addField('Bot', '`' + commands.filter(e => e.category === 'bot').map(c => c.name).join('`, `', true) + '`')
.addField('Music', '`' + commands.filter(e => e.category === 'music').map(c => c.name).join('`, `', true) + '`');
message.channel.send({
embed: commandList
}).catch(console.error);
}
}```
this is a pretty shiny command ngl
most people here are beginners and they don't do it this clean
@quartz kindle does nothing
anyway you sure it's run(client, message)?
Umh... yes ?
can you console.log(client) right after run()
@honest perch does your console show nothing?
and you don't need await there, it's not a problem but just saying
What ?
await message.author.displayAvatarURL() here
@earnest phoenix is that all the error says? because MessageEmbed doesnt event have anything on line 13. is your discord.js updated?
nvm its fcked anyway
Bad when I try to download discord.js v12 there is an error so I download discord.js in another file and it works
2 minut
npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno ENOENT
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://git@github.com/discordjs/discord.js.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrateur\AppData\Roaming\npm-cache\_logs\2020-03-01T15_01_16_217Z-debug.log```
I don't understand this error
you need to install git

Umh bruh :/
anyone know how to change bass when using discord.js-lavalink?
I have this error
npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t ssh://git@github.com/discord/discord.js.git
npm ERR!
npm ERR! Host key verification failed.
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrateur\AppData\Roaming\npm-cache\_logs\2020-03-01T15_15_48_392Z-debug.log```
oh oki sorry
It's normal that freeze ? The download don't move
i have this error
npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t ssh://git@github.com/discord/discord.js.git
npm ERR!
npm ERR! Host key verification failed.
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrateur\AppData\Roaming\npm-cache\_logs\2020-03-01T15_17_05_421Z-debug.log
C:\Users\Administrateur\Desktop\Neotux>npm i discordjs/discord.js
npm ERR! Unexpected token } in JSON at position 8336 while parsing near '..."
npm ERR! }
npm ERR! }
npm ERR! }
npm ERR! }
npm ERR! '
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrateur\AppData\Roaming\npm-cache\_logs\2020-03-01T15_17_53_677Z-debug.log```
You hosting you bot cmd?
T'es fr ?
Nani?
Sorry i failed the discord
Yes in the server pc
cmd is not a host
one equal symbol?
nintendo
im getting yandere dev flashbacks
^
I have this error ```npm ERR! Unexpected token } in JSON at position 8336 while parsing near '..."
npm ERR! }
npm ERR! }
npm ERR! }
npm ERR! }
npm ERR! '
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrateur\AppData\Roaming\npm-cache_logs\2020-03-01T15_22_21_710Z-debug.log```
show full
n v m
anybody uses contabo ? idk is my third month where my bot lags like hell.cpu usage is low, ram usage low, but when sending a command, it takes 4-5 seconds to respond during the day, but at night is ultra fast.
what did you fix
(before you got that error)
oh
the answer is none of them
you didn't put else
so it returns undefined
@woven sundial switch case for this. else if is not really good. also define as let and use the variable rar =
el.rarity is something other than those
hol up
maybe capitalization?
Is anyone going to mention that var shouldn't be used in this case?
oof
use switch case just like tuty4amxx mentioned
let rar;
switch(el.rarity){ // your code says rarety and rarity, which one is it?
case "Quality":
// something
break;
default:
}
google exists
And for my error ? ```C:\Users\Administrateur\Desktop\Neotux>npm install discordjs/discord.js
npm ERR! Unexpected token } in JSON at position 8336 while parsing near '..."
npm ERR! }
npm ERR! }
npm ERR! }
npm ERR! }
npm ERR! '
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrateur\AppData\Roaming\npm-cache_logs\2020-03-01T15_23_43_551Z-debug.log```
i feel in the mood today
@earnest phoenix you have some weird } stuff in your json leading to a syntax err
not here you gonna spam hard
pm maybe
oky
that foreach hurts XD
hol up lemme open vscode
what the heck is going on here
forgot a bracket?
is stripIndents a variable? you can't just have a variable with a string..?
you can't just have a variable with a string, you have to do + or something in between it
?
did you refer to the module doc
rest is up to him/her
wow
chill a bit?
Okay after my bot start and when send "n!play music" :
TypeError: Cannot convert "null" to int
C:\Users\Administrateur\Desktop\Neotux\node_modules\opusscript\build\opusscript_native_wasm.js:8
var Module=typeof Module!=="undefined"?Module:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module["arguments"]=[];Module["thisProgram"]="./this.program";Module["quit"]=function(status,toThrow){throw toThrow};Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_HAS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_HAS_NODE=typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string";ENVIRONMENT_IS_NODE=ENVIRONMENT_HAS_NODE&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;var scriptDirectory="";function locateFile(path){if(M
abort(TypeError: Cannot convert "null" to int). Build with -s ASSERTIONS=1 for more info.
(Use `node --trace-uncaught ...` to show where the exception was thrown)```
something is trying to convert something that doesn't exist to an integer
anyway
since you did not respond to pm, i have no clue what the heck is coming from store but your else ifs are ugly. try this perhaps
let storeRarity = "";
store.forEach(el =>
{
switch(el.rarity)
{
case "Quality":
storeRarity = "Epique";
break;
case "Fine":
storeRarity = "Légendaire";
break;
case "Rare":
case "Sturdy":
storeRarity = "Rare";
break;
case "Handmade":
storeRarity = "Atypique";
break;
case "Sturdy":
storeRarity = "Rare";
break;
}
embed.addField(el.name, stripIndents`**- Rareté:** ${storeRarity} **- Prix:** ${el.vbucks} v-bucks **- Image:** [Clique Ici](${el.image})`, true)
});```
fuck discord indentation btw
all good
just try it
case sturdy is defined twice
but the bottom
let storeRarity = "";
store.forEach(el =>
{
switch(el.rarity)
{
case "Quality":
storeRarity = "Epique";
break;
case "Fine":
storeRarity = "Légendaire";
break;
case "Rare":
case "Sturdy":
storeRarity = "Rare";
break;
case "Handmade":
storeRarity = "Atypique";
break;
}
embed.addField(el.name, stripIndents`**- Rareté:** ${storeRarity} **- Prix:** ${el.vbucks} v-bucks **- Image:** [Clique Ici](${el.image})`, true)
});
add js to the codeblock
fixed ^
well yeah
still a good code even if you were rushing
that terrible if else if else crap will make your code slow
yea
you should know
and google a bit
when is the case for if elses
and where is the case for switches
^
people hate switches (at work at least they do)
but fucking hell is so easier to read and works just fine the last edit of mine
@woven sundial screenshot of command working?
me needs png's
XD
sends in an svg screenshot
dunno if that's a thing
yeah. i use them for some logo and webfont
lots of companies still use em


also could be a default in switch statement
in case your store returns random shizzle
let storeRarity = "";
store.forEach(el =>
{
switch(el.rarity)
{
case "Quality":
storeRarity = "Epique";
break;
case "Fine":
storeRarity = "Légendaire";
break;
case "Rare":
case "Sturdy":
storeRarity = "Rare";
break;
case "Handmade":
storeRarity = "Atypique";
break;
default:
storeRarity = "Unknown";
break;
}
embed.addField(el.name, stripIndents`**- Rareté:** ${storeRarity} **- Prix:** ${el.vbucks} v-bucks **- Image:** [Clique Ici](${el.image})`, true)
});
or you can just
define it on top
let storeRarity = "Unknown";
and not use default
but whatever up to you
@pale vessel
wut
you own a bot? i do own it on contabo but idk man is slowwwwwwwww. like it takes about 4-5 seconds to respond on day time, and night time is fast.
i use a ssd vps :\
i perhaps have tos witch
sure
i pinged contabo vps all good.
i used to host it on a vps
api is good, ram usage low
and cpu is fine, yet it just doesn't respond
i think contabo is a bit bad :\
maybe try out another alternative?
i already paid this month. could you recommend something else?
bang for buck though.
When i send n!play music the bot crash and:
TypeError: Cannot convert "null" to int
C:\Users\Administrateur\Desktop\Neotux\node_modules\opusscript\build\opusscript_native_wasm.js:8
var Module=typeof Module!=="undefined"?Module:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module["arguments"]=[];Module["thisProgram"]="./this.program";Module["quit"]=function(status,toThrow){throw toThrow};Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_HAS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_HAS_NODE=typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string";ENVIRONMENT_IS_NODE=ENVIRONMENT_HAS_NODE&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;var scriptDirectory="";function locateFile(path){if(M
abort(TypeError: Cannot convert "null" to int). Build with -s ASSERTIONS=1 for more info.
(Use `node --trace-uncaught ...` to show where the exception was thrown)``````
yea but 25 a month
o.O
for 8gb ram and quad cores
@earnest phoenix it does say TypeError: Cannot convert "null" to int google it? not enough code to figure it out
Anyone know why I'm getting very high ping on my bot?
only you should know
You doesnt help me ? @vernal yoke
Usage stats look fine on the console so I wondered if it was something more widespread?
@earnest phoenix look at your code
@earnest phoenix u doesnt help u, because i don't see a relevant code to help, plus that console log unformatted hurts my feelings
your server sucks maybe
I'm rebooting it so I'll see what that does
is it a specific server or is the entire bot just lagging in all servers
My vps sucks as well, @spare goblet just a question, any good vps providers that i might want to take a look at?
I mean it's only in one I can access and isn't muted in
i use vultr, it's fine for me
its possible the location idk
it's possible that it's cuz of the *
It's on an AWS server located in ohio
Not sure then?
@woven sundial all good?

light theme
a much better way to do it would be to store rarities in an object but oh well
¯_(ツ)_/¯
¯_(ツ)_/¯
True
honestly in programming nobody is wrong when it comes to ideas. code refractoring is always daily based XD
hold my beer while i refactor my code for the 20th time
im in the middle of refactoring something right now lol
lol
i always just go to take a massive dunk, and while on the toilet, some wild ideas come in mind of how to improve my code
toilet and shower are the best places to brainstorm
hey aren't you the dude who made Cookie Monsta?
i am
nice
xd
also
i've been wondering
almost every popular bot website
has the same font and stuff..
do they make it themselves and host it on github or
do they make it with a web tool stuff
ah
lol
i make my own websites but im still trying to learn CSS
ok
i have my own bot kermicord with only like
hmm
3 commands xd
cuz i started yesterday
i'm planning to add ban and kick
thanks xd
i actually got rid of needle and get-json and used axios for all my commands
i updated the hell out of it in last 5 days
oh
but my vps is a poopoo... need to change it
lol
do u think u can help me with a meme command
cuz i've been trying to make one for the last 3 days
but i eventually stopped trying to make one
i have about 30+ meme commands lol, take a look at github? XD
honestly i made it open source for a reason XD
kekw
where did you learn to do all of this?
reading docs, not sleeping, learning, studying?
ok
Mood
oof
xD
duckduckgo is your friend
true though
eh
yeah
i mean if you don't want your info to be sold to advertising agencies
or whatever
i often avoid posting my work on sites that integrate google
yuck
Opera VPN isn't a VPN ftr
vpn*
opera is a nono
It's a proxy
it doesnt really matter honestly
It does
pihole takes care of whatever
XD
i avoided putting my bot on top.gg for a while because they use google's adsense and they milk your data for money
yeah
🙄
paranoid hackers here
it's hard to avoid those these days
lol
Is it really paranoia nowadays
use some regex wildcards for pihole and some nice lists and youre done with spying
it isn't paranoia - because it's true lol
Exactly
Discord actually looks out for anybody that trys to take your bots token
And then they take that info down from the site
yeah they collaborated with github
and they email u or something
which is really nice
vpns
yep
yeah same tuty, ublock origin + anti adblock killer script
and firefox to kill off most of trackers
= profit
i actually made a shell script for adding wildcards, a lot of them in one tap
or you can use the teleporter
but whatever
@earnest phoenix yup
it will not block
youtube ads and fb ads
because they come from same dns
yeah i saw
but i know a script with about 40k youtube ads
i watched linus' video on it
blocked daily
it is a crontab basically
but it sucks
i can deal with youtube ads on my youtube vanced laughs
i saw a new version of it came out
ok finished a kick command
but it's apparently
much much poor(er?) in features
is this really a #development topic, guys
yes
i honestly use opera without vpn, and i use their built in adblocker for youtube, works like a charm
no?
@earnest phoenix shit :\
aww yeah kick command works
y e et
How would I go about preventing a cascade effect when a role's position is modified?
If you modified it using a library more than likely it'll handle that for you
I am logging it
Funnily enough if you update a single role's position my bot ends up logging every single role position change
I really don't want that to happen any further
I was thinking of caching the role's server ID and comparing it to execute only once

You know some servers have well over 100 channels...
you mean in the roles update event?
ye
when a role is updated, discord sends you the entire list again. then your library gives it to you together with the old one, if the roles are cached, for you filter them out
what you can do is compare the position changes of all roles, and find the one whose change was different
its a bit complicated but doable
How can I get the votes of my bot and then send it to a channel
It could work. Thx
yes now
yeet
it's not message.content anymore
it's msg.content
xd
makes programming easier
Home electricity is down wtf
@viral vector that has nothing to do with discord version? lol
HOW
i meant discord.js
:/
how what?
i mean my discord bot still uses the previous version
It's back
Luma
oh lol
this is #development 👀
client.on("message", HOUAHOUAHE => {
console.log(HOUAHOUAHE.content)
})```
you can literally do that
Oh lol
you decide how you name the message object, not discord.js
async def on_message(A_RANDOM_MESSAGE_OBJECT_I_GET_FROM_MY_LIBRARY):```
ok
https://github.com/discordjs/discord.js/releases/tag/12.0.0
v12 released :3
yeah we know
the previous version still works so dont be so worried
tho it is recommended to rewrite the code
we are surprised because v12 has been in development for over 2 years and it was never released
lol
yes
time to v13
this is a historic day
lol
time to v13
time to v13
@summer torrent nice one
Cannot read property setAttributr
@summer torrent I know how to take a screenshot thanks 😅
then do it, i cant see shit
oof
that means a <video> element was not found
https://prnt.sc/r9y87f woooooooow
i just hardcode them lol
@sick apex that means your webpage does not have a <video> element
There is no element that had the query selector video
so i have to rewrite 90% of my commands? nice! thx v12
em ?
@sick apex are you creating that tag? or does your html file have it?
do you ever delete that tag?
no
theres no security issues in discord.js
d.js v12 breaks a lot of v11 things
which is why I chose to refactor when it was still in beta
i've been rewriting my bot with v12 for about 6 months now
my bot is still running on v11.3 i think
but now that it's officially release nothing will change
https://prnt.sc/r9yabf fuck
@tight plinth lmao
til newt update
🐍 python lurks
That's not what I mean
@sick apex show your html
I'm saying most of the shit you did in v11 isn't the same as the stuff in v12
typescript
ok
i'll stay with v12 thanks
specially now that i have my v12 framework finally ready
I'll stay with jda thanks
oh I found that problem :DDD
I get script hygher then video so script runs 1st 😄
xD
👍
hey
case 'play':
function play(connection, message){
var server = servers[message.guild.id];
server.dispatcher = connection.playStream(ytdl(server.queue[0], {filter:"audioonly"}));
server.queue.shift();
server.dispatcher.on("end", function(){
if(server.queue[0]){
play(connection, message);
}else {
connection.disconnect();
}
});
}
if(!args[1]){
message.channel.send("in order to play i need you to provide a link");
return;
}
if(!message.member.voiceChannel){
message.channel.send("you must be in a channel to play the bot!");
return;
}
if(!servers[message.guild.id]) servers[message.guild.id]={
queue: []
}
var server = servers[message.guild.id];
server.queue.push(args[1]);
if(!message.guild.voiceConnection) message.member.voiceChannel.join().then(function(connection){
play(connection, message);
})
break;
}
}); ```
my bots not connecting to vc but everything else seems to be working
any error?
add a catch to .join()
message.member.voiceChannel.join().then().catch()
ok
append .catch(console.log) to the end of the .then()
you still have RichEmbed
fuck
its MessageEmbed in v12
im the single on v11?
did i do it right?
yes, they released v12 officially @earnest phoenix
v12 is best

like half an hour ago
FUCK!
@quartz kindle
Rewrite tommorow
good luck for rewrite lol
you too!
its awful at first
but the more i look, the more i realise that its actually better
i'd rerwite but i need to finish another update first 
@main badge i said at the end of the .then()
thats where the .then() starts and ends
https://hastebin.com/jotecaciju.js this command works fine, but how could i make it so instead of having to name your kickChannel logs, you can set it to whatever you want for that specific server
and have it set to any command that uses the logs channel
you need a database to store channel ids
i mean
addField was not removed, you can still use it
of course addFields is neater
also, you could make use of ternary operators and array.map/array.reduce in many things
would make your code even neater
for example: .addField("is this server verified", server.verified ? "Yes" : "No")
why do I get an error for using the latest discord.js version
what error?
/rbd/pnpm-volume/034599ea-c1c3-422b-9783-c3b2bb2163b1/node_modules/.registry.npmjs.org/discord.js/12.0.0/node_modules/discord.js/src/client/Client.js:40
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/rbd/pnpm-volume/034599ea-c1c3-422b-9783-c3b2bb2163b1/node_modules/.registry.npmjs.org/discord.js/12.0.0/node_modules/discord.js/src/index.js:8:11)
whats your node.js version?
one of your commands doesn't have props.help
@finite bough thats very weird, try updating your node.js
like my command files?
yeah
tried
none of them do
and they didnt do that until now
but that line of code has always been there
what file is after prefix.js
what was the issue
@finite bough you could try asking on the discord.js server
lmao those guys over there are being flooded with people asking how to fix their broken stuff in v12
LMAO
ok
I downloaded some modules
to get more info on the stuff
I get
module not found discord.js
lol

show your package.json
ok so ive almost perfected this
the prefix command
theres just one issue
any prefix can be used, whether its set or not. I want to make it so only the set prefix can be used
https://hastebin.com/japegodaju.js prefix.js file
https://hastebin.com/naruvozuha.js index.js file
well i can only help if you show the stuff as they are when the error happens lol
me?
no
ok
@distant hawk your code is terrible
ik
you're loading the file over and over again on ever single message
that will destroy your bot
hm
and you're never checking if the message contains the prefix
thats an issue
lmao
most of it is an issue
and your prefix.js is also loading the file again, and then never saving it
i should probably just not do that
ideally you should use a database, but if you prefer using json files, the correct way to use them would be like this
// top of your main file
let prefixes = JSON.parse(fs.readFileSync(...))
..
..
..
client.on("message", message => {
if(message.content.startsWith(prefixes[message.guild.id])) {
// run command here
}
})```
bot*
and then i your prefix command, you edit the prefixes variable and save the file
bot.on
you should never read the file multiple times
^
I just use a different json file for each server
kinda storage consuming
but eh easy to mess around with
tim is balling today, boys.
wat
I dont only save prefix ya know
is there a glitch plugin for Studio code? and how do you use it?
yeah thats why it's time to stop, shiemi
i am saving all data in one file.
stop it
my people
get some help
^
pls help glitch 1st
you're the one that needs jesus 👀
it doesnt like editing json files
👏 Use 👏 a 👏 Data 👏 base 👏
no jesus today 
my way to save data:
http://prntscr.com/r9z4r8
try 👏 using 👏 glitch
2 files for any server my bot is on
writing to json/any other type of files is not only expensive on memory, but it's also expensive on storage
pretty sure glitch supports DBs
pretty sure one ORM would do everything aswell
not only that, but writing to files is not concurrent
IT DOESNT UPDATE THEM
@finite bough ^^ lies
a
JSON is HORRIBLE FOR DBs
JSON ISNT A DB
It's a bad attempt at a DB
thats the point.........................
you're reading and writing
fucking loads
if you like objects use databases like mongodb or graphsql?
JavaScript Object Notation
i dont know about yall but i dont see the word database in that
Me either lol
question why r we fighting on DBS again?
lets just say it's
It happens 🤷🏻♂️😂
bullying you into using a proper database so you don't encounter data loss and corruption
yup
Mhm
that hurt to read
.... Lol
not like sql is the type of db and sqlite is just a wrapper but yhhhhhhhhhhhhhhhhhhh
This is all I got so far
discussing json vs db again?
is yml saving good?
XD
or should i save data in sql or mongo db?
although i am rewriting it to sqlite as we speak
but its holding quite well at 2k servers
yml holding well at 1k servers
my 1.2gb img folder is a bigger problem
Djs v12 is nice lmao
Bad wifi maybe?
My wifi is fine and my bot isn't hosted on my computer
The service I'm using doesn't have any service status issues either
oh ok
33k ms lmao
idk, its normal for me
Someone else on here was getting a 30 second ping so idk
No
Oh I see
I've tried regening my token, rebooting ubuntu, commenting out everything to do with the DBL api and still nothing
Tis borken
Oh okay
@true ravine do you have any outdated modules?
I'm not on djs v12 and other than that idk
Yeah that shouldn't be bad that's newest for d.js
How do you check if modules are outdated?
If you're asking if there is like an actual command for it honestly I'm not sure. But usually the bot will read the versions from your package.JSON
If you don't have a lot of them installed you could just look at them there and reference them on the NPM Site.
Oh alright thanks
For example I know snekfetch is deprecated now
They recommend using node-fetch instead
I don't use that but I'll have a look for others
Found a deprecated ting
Thanks for the suggestion 👍
Np
Still getting high latency although its down to 1-3k ms so I guess that's an improvement lol
Better then nothing you basically just have to find what else is causing high load on the bot
Could be functions that you don't have updated
Could be lots of stuff
Np
Im having same latency issues
If you use mysql in your bot and call them a lot
It causes latency
Because mysql servers ramp up the cpu
If you use them both in same vps
i have yet to have that 🤔
on any of the db's ive used being Sqlite, Postgresql, mysql etc...
Every time i read for example a query based bot command mysql tanks the cpu
and like some of them can and are working with somtimes thousands of calls a second
i mean i havent rlly got any issues with the systems
If you type a command that calls sql is having latency?
thinking bout it like we have 100ms latency on a DB that is nearly 50GB and that latency is round trip with everything else
like
On my end for example
you shouldnt be having a large latency
hey so
my discord bot shows the green ring like its talking
but no music is being played
so
the db call itself is muchhhh lower
I use mysql but my cpu is sitting around 2% and my network usage is a couple of kb up and down
our datomic DB is using about 20GB Ram and 20% CPU atm but thats cuz its just given as much as it wants
because Java and Clojure is ram munchers
Pinging discordapp.com from my server results in a sub 15ms ping so the issue clearly isn't there
And I can also assume that there is no network issue in general with the server
you will hit cloudflare
the api and pinging the website is not the same
Oh right I see
But anyway I can assume that there isn't a slow connection to/from my server
Wdym?
blocking code will fuck you in the ass with latency
Yeah I know I meant that I can discount the issue being with my host itself
There seems to be a longer than normal time between starting my script and the ready event firing
Guys help wit the set this
i change custom status to {client.guilds.size} he no say in the guilds on i delet {} he no say in the guilds on
There seems to be a longer than normal time between starting my script and the ready event firing
But the only code that isn't a function definition is requiring modules and opening my sql connection
i change custom status to {client.guilds.size} he no say in the guilds on i delet {} he no say in the guilds on
Show us what is happening and the code you are using
anyone aware of a simple analytics tracker for discord.js ?
i've been writing out my own
but it'd be easier to just use one
analytics for what
What things
yeah but what things
the format of commands
how many spawns a server is getting (my bot is rpg)
how many users are actively using my bot
at what times
you know, analytics.
There's that influx thing
who dat?
influxdb + cronograph
That does stuff
nah see, there are a ton of services that i can basically send my anal data to them to house
but ive already got databases and such setup within my project
be easier to just use that
but if there was a single module that could help
i'd be looking into it 🙂
this code was just working....
If you want some charts then use charts.js but that assumes you have the data in the right formats
now its not
yea idm about charting the data atm, ill worry about that when i plan to send it to the front end
atm im just looking into like, seeing what commands people are using the most
and the format of them
so i can optimize
np, ty. will look out for him 🙂
👍
You should consider having the bot login
PlayerManager Created.
C:\Users\jnsho\node_modules\discord.js\src\structures\MessageEmbed.js:433
.flat(2)
^
TypeError: fields.flat is not a function
at Function.normalizeFields (C:\Users\jnsho\node_modules\discord.js\src\structures\MessageEmbed.js:433:8)
at MessageEmbed.setup (C:\Users\jnsho\node_modules\discord.js\src\structures\MessageEmbed.js:68:50)
at new MessageEmbed (C:\Users\jnsho\node_modules\discord.js\src\structures\MessageEmbed.js:11:10)
at embeds.map.e (C:\Users\jnsho\node_modules\discord.js\src\structures\Message.js:101:48)
at Array.map (<anonymous>)
at Message._patch (C:\Users\jnsho\node_modules\discord.js\src\structures\Message.js:101:39)
at new Message (C:\Users\jnsho\node_modules\discord.js\src\structures\Message.js:43:20)
at MessageManager.add (C:\Users\jnsho\node_modules\discord.js\src\managers\BaseManager.js:49:32)
at MessageManager.add (C:\Users\jnsho\node_modules\discord.js\src\managers\MessageManager.js:29:18)
at MessageCreateAction.handle (C:\Users\jnsho\node_modules\discord.js\src\client\actions\MessageCreate.js:13:40)```
Im so confused
Just updated to newest version of Discord.js
Not even creating an embed
whats the kick command?
<member>.kick(reason)
for discord.js
im pretty sure
unless they changed it in v12
I think it changed
thats what it is
they changed it in v12
More of a TOS question than code but how often are you allowed to change the color of a role and remove/give roles to users?? @ me thx
What did I do wrong in this code?
What's command
You need the member object and you're not getting the user in the first place
Wait why is the statement not in the message event lol
imo it's safe to say 1/1s for role assigning/removing is safe
unless it's constant
I think I read somewhere the absolute minimum time for repeated actions is 5 seconds but they don't advise anything less than 120 seconds
Big range but I guess they don't want to overload themselves
Only vague definition was given tbh
Yeah ik
Shivaco I was thinking about every 5 mins??
ehh wouldn't recommend
Okay thx
here's a simple flowchart:
are you worried you're
going to get banned?
Yes <= No =>
-> Don't do it -> Respect ratelimits and do
it if you have to
ok im just gonna ask this, cause of that quote there @earnest phoenix. my bot spawns enemies based on recent user activity, but it could happen as much as 5 minutes after they stop talking. thats still user input tho, so that'd be A-ok, right?
oh wth i didnt mean to tag you shiva, i puut a dot to stop it takking shivaco as well lmao
sorries 😗
i mean, my thing will never spawn a mob if no ones talking
but if someone says a thing and goes offline, with no one talking after, it will spawn a thing after at most 5 minutes
DuckHunt does a similar thing and that's been going for ages so I assume it's okay
And that keeps going even if no one talks at all
plz update dblapi.js
Is it borken?
Probably talking about the new d.js v12 update
Wish I could answer that
I think Tim mentioned it so it must be true
@earnest phoenix don't copy & paste code
theres no need though
all you post are numbers
unless the api gets data based off of objects you send
It's the apocalypse nothing works anymore
I like it so far tho :))
Blame corona
wait some days for updates
It only officially released a few hours ago so the best is yet to come
I was updating my bot to V12, then I realized lavalink didn't work so I re-downgraded it
or dont use lavalink
No not the lavalink!
(lavalink works on djs v12, see how @robust trellis works)
It didn't when I check earlier lmao
i didnt notice discord.js removed the disabledEvents client option
that completely broke my library lmao
the workaround for it is quite ugly lul
is it possible for my bot to use custom emotes from my bot server in other servers?
yes
How do I have the whole "follow" option in my server, like y'all have here?
😮 awesome
@hybrid geode you buy a $25 dev license
Lol
yea announcements thing 😄
yea
im curious, if you follow multiple, do they all get fed into the same channel in your server, or diff channels?
like, its always the announcements channel right?
i think when you click follow, you can chose which channel it goes to
so up to you
i guess? lol
Do any of you think that a bot that gives you xp in a discord server based on your Fitbit steps would be good? I know for many people that would involve going outside which they don't like, but it's just an idea
that would require their permission to give your bot access to their data
many people will probably not like that
True
I don't get this whole data thing tho? I don't care if people know I didn't move all day or that I searched up a recipe for pasta - does it really matter?
Also I don't care if people know that I went to a certain shop
Like who cares?
people don't trust each other ig
plus you'd have to be bothered with GDPR compliance etc etc which is just annoying
Uuf

nice emoji
