#development
1 messages ยท Page 887 of 1
since you are sharding, you are spawning multiple instances of index.js
and that means you are also trying to spawn multiple express.js servers
but im not sure if thats the original problem
you were only spawning one shard right?
I'm going to try switching to sharding.js and I'll see if it prints "online" on the webpage
also, can you check if you are able to log down to client.login or something
Just running the bot normally works like a charm-
Wait
https://im.farfrom.world/lhhohradov.png in index.js
I think it's trying to run the file twice
uh, thats weird?
what is?
O_O
woah
So now it works
It was something so simple; the debugger
bruh im so dumb
But uh also I do have another issue
debugger
But uh also another issue lmao
As soon as I pressed the stop debugger button and restarted Node
It worked
yeap
Do you use Discord.js? You said earlier that u didnt know how js works
webserver was probably running, trying to run another instance of it would error it out causing the program to not run anymore.
i use discord.net
i use eris
Do you have experience with DJS, @restive furnace?
yes, i was using it until wanted to get ram usage lower
yeah so you probably know v11
yes i know even v10
would client.shard.fetchClientValues(clientvalue) fetch the values for all of the shards
how would i add them together? simple js question but yea
Returns: Promise<Array<*>>
for() total += value
How do you shard on discord.js I am really confused by it.
do you need an example sir
wow we just finished talking about that
https://discordjs.guide/sharding/#when-to-shard @golden condor
Ok thanks
ArrayReturnedFromTheFunction.reduce((prev, guildCount) => prev + guildCount, 0)``` @green vale
btw danny, you might want to change up even more things in your bot whilst sharding
things that are single-instance
what do you mean
i mean your webserver and logging.
since right now, having a second shard will basically give you the same error as before
and probably command handler too? if you eventually get 10k guilds, whats the point scanning the commands dir 10 times?
Hm
command handler is already handled by that isnt it?
since sharding should automatically do that for you wouldnt it?
im not sure exactly what your webserver is needed for so that it is required to have it
Well my host automatically puts projects to sleep if they aren't accessed within five minutes of the last visit
oh, its for heroku
yeah ik
yeah i just had heroku in my head even when i read glitch
Heroku and glitch :TM:
lol
I have it now so sharding.js has the require for keepOnline
So that won't be a problem
Logging is fine I'll probably just remove logging at some point
ok then its fine
So I'm trying to make it so that my bot accepts the mention as a command prefix, but it doesnt like this
if (!message.content.startsWith(prefix) || !message.content.startsWith("@thorny beacon")) return;
not really sure what I would need to change for it to work
which language?
js
JS
why does everyone use js lol
idk
it's the most popular lang
y not
It's also easy to learn because websites
I'm checking rn
alr
yeah
nope
My bot is so different
if you console log the message content when you mention a bot, its <@!botid>
doing \ botmention doesnt show it correctly
also when the bot does not have a nickname?
well you would want it at the start right
i found an example
const prefixRegex = new RegExp(`^(<@!?${client.user.id}>|${escapeRegex(prefix)})\\s*`);
if (!prefixRegex.test(message.content)) return;```
I'm being seriously compact here so would this be correct client.shard.fetchClientValues('guilds.size').reduce((prev, guildCount) => prev + guildCount, 0).toLocaleString()
It says that it isn't a function soo lol
anyway here is the link https://discordjs.guide/popular-topics/miscellaneous-examples.html#mention-prefix
from the official docs
Cxllm dude can you help me
11.5
What's the error
Oh no I need help with making the code
What code
I tried doing something like client.shard.fetchClientValues('guilds.size').reduce((prev, guildCount) => prev + guildCount, 0).toLocaleString()
What error?
I need serious help shardinh
It says that it isn't a function
I want to get the results from fetching client values and then add them together
It's in the guide
Yeah ik
you don't that even need to shard yet
https://discordjs.guide/sharding/#getting-started-2 use the v11.5 guide
Yes I'm using that
I am not even sure how to set up shards atm
What's your host?
Local
Well on a server
It should be easy as pie to do it
Ok thanks
,
Do you put a number inside manager.spawn?
If you don't put one then Discord decides what's best for you
why are you guys sharding
because we're preparing
why is it making it worse by sharding?
yeah but like you can still have one shard.
One shard is practically the same as no shard
yeah
and me?":\
my bot was already bad before sharding lol
it had like one second of delay each request
I just wanna know how to shard for the future
I'm sharding just not sharding with multiple shards
ty @turbid bough : )
It's basically the same as without shards in that cade
@green vale you don't need the broadcast eval then
I am doing it just to prep
But anyway the command did work but it ended up just showing "Object promise"
i want to test out my bot to see how bad it is at handling traffic
are you coding on your phone?
https://im.farfrom.world/niiooaorcr.png imagine "hi" users
Why would you ever
It's just a placeholder
@turbid bough lol cos there is only one =
Now be I back
@turbid bough imagine setting the users value instead of checking it
@golden condor that should work even only one =, but yeah.... ur linter/IDE might give errors.
it doesnt
one =: set the value of variable x, which returns true, always
Two ='s: Check if the value is equal to annother

Three ='s: check if value and type of variable are equal to annother
but yeah jade i want to have my handler read for just all shards instead of one
One = is an assignment
Two = is comparing
Three = is comparing in crack
Three is comparing but with steroids
@green vale there's no way to do it with d.js unless you use a different shard handler that does cache per cluster
As d.js has cache per shard
Is there such shard handler that does that that is compatible with DJS?
What's it called?
Is Kurasuta compatible with existing d.js broadcastEval and fetchClientValues functions?
It says that Kurasuta's version of ShardClientUtil replaces DJS
So I wouldn't have to change code much outside of the cluster setup
Yeah
How would I set it up then?
I can't understand why ????
any1 uses discord.py?
yes]
Don't use the guild name as an identifier, the id is sufficient
@robust moth https://i.lumap.me/n31mjdu0.png what an idea to store prefixes with guild name : guildid
just store them with guild id
coz names can change
when ID cant
I dunno how
Guys, does why doesn't this work?
var nekoavatar = async() => await sfw.sfw.avatar()
read docs
Help?
I want to eventually switch over to a library like Eris
I have removed every package I can
Which docs
@green vale dont, except if youre basically forced to
done everything I can to omptimize
nekos.life docs
@tight plinth
@golden condor if you're using d.js, then you need to get bigger vps or switch to eris
What the heck is nekos.life
The hosting is fine
@golden condor How many guilds is the bot in?
Uhmm, I'm not talking about that, I'm talking about the async await
@robust moth just use ID
I'm not worried about mem usage
It isn't affecting my bot
Ok
kk but its cuz d.js caching
How can I lower it
Uhmm, I'm not talking about that, I'm talking about the async await
@high bough @tight plinth
I am in 161 servers @hasty sparrow
@high bough read the docs and look how they do
you cant lower if youre using d.js, only by switching to some ex discord.js-light or something. or just remove pointless caching
@golden condor the more servers, the ore ram
ik
It didn't help @tight plinth I tried it, but it only works for one command
u can just edit discord.js files and use r own modded version @golden condor
show me code @high bough
me?
@slim prawn
You can reduce cache amounts/times for messages to save a little RAM
show me code @high bough
@tight plinth It's fine, but if I try to async the command on client.ready and on client.message, it shows different pics
a sec

const clientneko = require('nekos.life');
const sfw = new clientneko();
var nekoavatar = await sfw.sfw.avatar()
var avatarURL = nekoavatar.url
```And basically repeat the variables on every client.on async functions
I want it outside of the client.on function, instead of in it
so i can generate just one link and use it for all of them
well just put it outside of it
Guys,~~ does~~ why doesn't this work?
var nekoavatar = async() => await sfw.sfw.avatar()
@high bough This is what I came up with
Didn't work
//code
var nekoavatar;
async function f () {
nekoavatar = await sfw.sfw.avatar
}
f()
//code```
not sure it will work
oof
/home/kayuimineko/devindex.js:24
var avatarURL = nekoavatar.url
^
TypeError: Cannot read property 'url' of undefined
at Object.<anonymous> (/home/kayuimineko/devindex.js:24:28)
at Module._compile (internal/modules/cjs/loader.js:1123:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
at Module.load (internal/modules/cjs/loader.js:972:32)
at Function.Module._load (internal/modules/cjs/loader.js:872:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
[nodemon] app crashed - waiting for file changes before starting...
f().then(() => {
//all ur code
})
idk
no idea
cant u just do ```js
var nekoavatar = sfw.sfw.avatar().then(res => res)
?
why tho
any of y'all have used kurasuta before?
timo have
yes
why tho
@tight plinth To generate a random avatar everytime the bot loads
but beesides him
ak him
"beesides"
@high bough thats completely useless and can maybe lead to api abuse
Umm, I mean, I won't reboot every 5 secs
@icy crane i just checked and my bot always crashes on trying to get the owner tag of this server
still
Only once every reboot
,-,
i just checked and my bot always crashes on trying to get the owner tag of this server
@versed narwhal owner is not cached
it's oliy's alt
and its always offline
i tried caching but it then gives me an error
ez as go fetch
try to fetch it first
@tight plinth LMAO your f() code works well thanks
hm

no .cache needed in v12
so it should be like this?
message.guild.members.fetch(message.guild.owner.user.username)}#${message.guild.members.fetch(message.guild.owner.user.discriminator)
https://im.farfrom.world/vjcybqauyk.png this entire thing is confusing
Eh I won't get too many guilds any time soon
I get Cannot read property 'map' of undefined error on: js let arr = [] bot.commands.map(x => {arr.push(x.help.name)})
bot.commands is undefined
hi
.includes(string), whats the equivalent for an array? like .something(array) ? If that makes sense
with javascript
.includes()
how would i make this correct:
music(client, ({
});
Oh, an array as parameter
I'm doing so many things wrong
wdym?
how can i do more commander example: play, p, joinjs if (command === 'play') {
nvm i figured it out
You can use ||, check whether the command is in an array of aliases, etc.
if (command === 'play' || command === 'p' || commmand === 'join') {
//
}
o thanks
dk!serverinfo
i know
it wont work
here
it was just to see if it will crash or not
is this normal?, only happens in this guild
Im trying to get user tag instead but the bot then crashes
owner is not cached
which library do you use
you can fetch it from guild members
Guys, quick question, if I use setInterval, will it be run once the bot starts or just after the interval has passed?
how so? i really cant get around the fetch thingie
bcs this is the only server it happens
@versed narwhal that is problem of large guilds
noticed that
<Guild>.members.fetch(<Guild>.ownerID)
object promise with it
const guildid = message.guild.id
const guilds = await <client>.guilds.cache.get(guildid)
message.channel.send("<@" + guilds.owner.user.id + ">")
@versed narwhal
hm?
Try this
im using MessageEmbed
i can try doing eval on it 1 second
cache.get
dk!e const guildid = message.guild.id
const guilds = await <client>.guilds.cache.get(guildid)
message.channel.send("<@" + guilds.owner.user.id + ">")
Not here lmao
object promise with it
@versed narwhal resolve promise
await/async
const guildid = message.guild.id
const guilds = await <client>.guilds.cache.get(guildid)
message.channel.send("<@" + guilds.owner.user.id + ">")
@high bough owner is not cached in large guilds
Oh, I always use this ```js
const client = new Discord.Client({fetchAllMembers: true});
lmao CPU usage 60%
ยฏ_(ใ)_/ยฏ
Iโve been trying to find a documentation on how to log how many guilds a bot is in but canโt find one. Does anyone know how I could log how many guilds my bot is in when it is started?
๐ in ๐ what ๐ language ๐
Iโve been trying to find a documentation on how to log how many guilds a bot is in but canโt find one. Does anyone know how I could log how many guilds my bot is in when it is started?
@sacred mountain client.guilds.cache.size
djs v12
lmao
Thanks
NP
module.exports.run = async (bot, message, client, args, guild) => {
console.log(message.author.tag, 'used the serverinfo command.')
let sEmbed = new Discord.MessageEmbed()
.setColor()
.setThumbnail(message.guild.iconURL())
.setAuthor(`${message.guild.name} Info`, message.guild.iconURL())
.addField("**Guild Name:**", `${message.guild.name}`, true)
.addField("**Guild Owner:**", `${"<@" + message.guild.ownerID + ">"}`, true)
.addField("**Member Count:**", `${message.guild.memberCount}`, true)
.addField("**Role Count:**", `${message.guild.roles.cache.size}`, true)
.setTimestamp()
.setFooter(`darkness`, bot.user.displayAvatarURL());
message.channel.send({embed: sEmbed}).catch(console.error);
}
this is the code that shows up here the mention id
without fetch
which i dont really know how to get it going, my friend tried to explain but it was a complete mess
why
ยฏ_(ใ)_/ยฏ
on v11 i could just use message.guild.owner
and it woud give me the tag or something
v12 is dumb tbh so
idr and i have no backup
npm i discord.js@11.5.1
and if i try the tag way on v12 it will be a pain in the ass
lol nope
already did mass replace
with embeds and stuff
oof
i needed caching
v11 does too
usure
ye
then why i was never able to get it going by cache
you just dont have access to the .cache property
but it does caching
you just dont see it
and i dont have access to node_modules if you mean editing something there
Does anybody know how to solve the Segmentataion fault error on npm?
When i do any command of the npm module it returns Segmentation fault
Which version of npm?
npm version to check
Lemme try
Even when i try to check the version it gives me the same error
Tried reinstalling?
I tried
npm -v
I did that
Still segmentation fault
npm cache clear -f
try clearing cache
(The npm was working and after i updated my phone to android 10 it caused this to happen)
..
phone
what
Wait what
(I code on Termux basically)
if u tell me u use npm on phone
hgfjkadgfh
whats funny?
Try a fresh install of everything node after completely purging the old one
Why u not using a host?
Cuz self-hosting is a true man of culture move
:/
w h a t
I wouldn't recommend doing such a thing on mobile
So how do you purge the thing or whatever you talking about i forgot @hasty sparrow
hi hello
Completely uninstall it, but it seems you already are by using apt
how can i use something like .includes for an array?
like, .includes(string), whats .includes(array) ?
ik its not .includes for array, in javascript
@hasty sparrow so any ideas? I'm confused
array.some(element => {annotherarray.includes(element)})
i think
hm
Unfortunately no
ah fuck
wait
return statement
im dumb
yeh boi
array.some(el=>{return annotherarray.includes(el)})
let oof = ['hi', 'how', 'are', 'ya', '?'];
let hi = [];
hi.some((e) => { oof.includes(oof) });
the last line makes no sense to me
return oof.includes(e)*
confusiion
let oof = ['hi', 'how', 'are', 'ya', '?'];
let hi = [];
hi.some((e) => { return oof.includes(e) });
lets say hi is ["hi"]
the last line will return true
hi is ["H"] and the last line will return false
yeah, it returns false
is that the correct way to go on making an auto mod sort of system?
Welp i think Rip npm for me...
i'd use message.content.toLowerCase().includes for that but
its a way
but then i'd have to hard code every word?
like
if (args.join(' ').includes('ur mom').toLowerCase()) { message.delete(); }
if (args.join(' ').includes('ur dad').toLowerCase()) { message.delete(); }
or not?
badwords.some(w => {return message.content.toLowerCase().includes(w.toLowerCase())})?(function() {message.delete().catch()}()):null
oneliner
or two with the bad words defined
what would badwords type be?
array
hm, ok, thank you
np
i'll look into it more
if I lauch one shard my bot works just fine, but if I launch 2 this happens https://i.lumap.me/pk94nzz1.gif . why
discordjs v12
cool, js a!e let badwords = ['hi']; badwords.some(w => {return message.content.toLowerCase().includes(w.toLowerCase())})?(function() {message.delete().catch()}()):null
deletes the message
thank u
np
you don't need function ()
and you can just put w in lowercase and omit the toLowerCase for w
make life easier Lumap
even I moved to eris
its not lol
Eris is good
i 100 % recommend it
docs r shit
no, you're shit
they're not that bad
docs are okay
if u can read docs, u can read eris docs
I tried using it with ytdl, I got some eris ffmpeg compilation error
eris doesnt seem that bad tho
its just very different
did you install py and some other stuff?
yes
also, there's no dispatcher, we use connection straight away
ofo
pog
I dont started js with djs
d.js is good too though

you'll have to convert numbers to decimal and stuff on eris
but it was worth it for me
good 4 beginner 13 year old devs yeah
even if I switch to eris I dont have a good reason to do it
what about sharding?
wym
like, djs' sharding manager bs
how does that even work tho?
When using shards
like, the sharding manager
i understand what shards are for and how they work, just confused what djs' sharding manager duz
Error: input stream: Error parsing config: Unexpected token ; in JSON at position 51669```aah, I love ytdl
imma try youtube-dl over ytdl
How can i track the times the commands from my bot got used?
he wants to track them
what
so probably a counter for every commands
u need a db
@tight plinth youtube-dl is much better
o
Join music 1
k
2
Like in the status
sounds tons better
Like 500 messages
til it breaks
@raven urchin updating status after each command executed can lead to api abuse
Yikes
bad idea
It's like the zira bot
I still haven't figured out how to fix the segmentation fault of npm...
Any ideas?
no, sorry
Ok so i have the status part to watching but it has the playing
Might that warning be the issue that i can't remove nodejs completely?... I'm CONFUSION
dont host ur bot on phone
Ik... I'll get a pc soon so don't worry
try sudo
#rootOnly
(My phone is not rooted to use sudo)
well rip
well rip
F
Like i got this issue after updating my phone to android 10... I wonder how did that cause the issue
never update if not needed
Hmm... It was needed tho but anyways lemme try
Maybe some os restrictions?
Dont know what android you on but I just installed what you installed and it works fine
On mobile of course
@split hazel you on Android 10?
android 10 must have some strange memory management
Hmm... Might be... But thank God that i'll be getting a pc soon lol
I might have fixed this segmentation fault issue if my phone was rooted to use sudo but whatever
Hey
const channels = guild.channels.cache.filter(c => c.type == 'text' && c.permissionsFor(guild.me).has('SEND_MESSAGES') && c.permissionsFor(guild.me).has('VIEW_CHANNEL')).array();```
This code should work without errors, am I right? Lately this gave an error, I thought it was a `GET` error. But what is going wrong?
After this it will fetch 1 message in each of these channels, that should be possible without errors right?
you could do
array is cached btw
well, that doesn't change anything sadly ;) but
my bot will send a welcome message if it joins a server (it has some conditions though)
ytdl-core
message.guild.me.permissions.has
@golden condor but I want to check channel perms, so permissionsFor or permissionsIn is needed
try
yeah because permissions are global
^
no? Permissions are not always global
admin, kick/ban and nickname things etc. are global, this isn't
who are you talking to
to Cxllm
yeah he was contradicting
yes but doesn't matter
what kind of error did you get, specifically?
it was a messages get error, so I guess it was with this line: js const messages = await channel.messages.fetch({ limit: 1 });
it's doing that for each of the previously cached channels
const messages except that it's actually a message lol
oh yes ๐
will change that
wait maybe it's missing READ_MESSAGE_HISTORY so it can't fetch the message
maybe
but you should've gotten permission error
like i said what's the full error?
"GET error" is not enough
it will send a welcome message to 1 channel, in which the last message was sent less than a minute ago
I don't have the error anymore (bot restarted for some vague reason) but I know it was an error caused by message fetching
like this: path: '/api/v7/channels/aChannelId/messages/limit=1 (or something)', code: idkthisone, method: 'GET'
try ```js
const channels = guild.channels.cache.filter(c => c.type == 'text' && c.permissionsFor(guild.me).has(['SEND_MESSAGES', 'VIEW_CHANNEL', 'READ_MESSAGE_HISTORY'])).array();
oh can I just make an array of the perms? Thanks
I have my dbl stuff
When sharding
how can I stop it doing it again
const DBL = require('dblapi.js');
const discord = require('discord.js')
const client = new discord.Client()
const { TOKEN, dbltoken } = require('./config.json')
const dbl = new DBL(dbltoken, { webhookPort: 3000, webhookAuth: '' }, client);
let channel;
client.on('ready', () => {
channel = client.channels.cache.get('683615385920077871')
})
dbl.webhook.on('ready', hook => {
console.log(`Discord Bot List Webhook is running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`)
const embed = new Discord.MessageEmbed()
.setTitle("New vote!")
.setDescription(`<@${vote.user}> just voted on [top.gg](https://top.gg/bot/660818351638970370) and they have recieved vote locked features!`)
.setFooter("User ID: " + vote.user)
.setColor('#00AAFF')
channel.send(embed);
client.shard.broadcastEval(`this.users.cache.get(${vote.user}).send("Thank you for voting Corynth, you have now unlocked vote locked features for 12 hours.")`)
});
client.login(TOKEN)
module.exports = { dbl }```
read message history, mb
@pale vessel oh oops np.
This noob just copied it ๐
const DBL = require('dblapi.js');
const discord = require('discord.js')
const client = new discord.Client()
const { TOKEN, dbltoken } = require('./config.json')
const dbl = new DBL(dbltoken, { webhookPort: 3000, webhookAuth: '' }, client);
let channel;
client.on('ready', () => {
channel = client.channels.cache.get('683615385920077871')
})
dbl.webhook.on('ready', hook => {
console.log(`Discord Bot List Webhook is running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`)
const embed = new Discord.MessageEmbed()
.setTitle("New vote!")
.setDescription(`<@${vote.user}> just voted on [top.gg](https://top.gg/bot/660818351638970370) and they have recieved vote locked features!`)
.setFooter("User ID: " + vote.user)
.setColor('#00AAFF')
channel.send(embed);
client.shard.broadcastEval(`this.users.cache.get(${vote.user}).send("Thank you for voting Corynth, you have now unlocked vote locked features for 12 hours.")`)
});
client.login(TOKEN)
module.exports = { dbl }```
Please I need to fix the sharding issues with the dbl webhook
dont send it twice
If I could help you I would, but I don't know anything about that
Honestly please it hurts seeing that code
Firstly on the broadcast eval, other shards will think you're passing in an integer this.users.cache.get(ID)
Your console will also be spammed with errors if someone votes
Why client isnt working on broadcast eval ?
Since the users don't exist on all shards
My console gets spammed with errors atm
And do you even need sharding?
Saying that 3000 is already in use
he doesn't
How many servers is the bot in
e CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 254)
0|index | events.js:288
0|index | throw er; // Unhandled 'error' event
0|index | ^
0|index | Error: listen EADDRINUSE: address already in use :::3000
0|index | at Server.setupListenHandle [as _listen2] (net.js:1309:16)
0|index | at listenInCluster (net.js:1357:12)
0|index | at Server.listen (net.js:1445:7)
0|index | at DBLWebhook._startWebhook (/home/cxllm/Bots/Corynth/node_modules/dblapi.js/src/webhook.js:45:18)
0|index | at new DBLWebhook (/home/cxllm/Bots/Corynth/node_modules/dblapi.js/src/webhook.js:27:12)
0|index | at new DBLAPI (/home/cxllm/Bots/Corynth/node_modules/dblapi.js/src/index.js:69:22)
0|index | at Object.<anonymous> (/home/cxllm/Bots/Corynth/dbl.js:6:14)
0|index | at Module._compile (internal/modules/cjs/loader.js:1158:30)
0|index | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
0|index | at Module.load (internal/modules/cjs/loader.js:1002:32)
0|index | at Function.Module._load (internal/modules/cjs/loader.js:901:14)
0|index | at Module.require (internal/modules/cjs/loader.js:1044:19)
0|index | at require (internal/modules/cjs/helpers.js:77:18)
0|index | at Object.<anonymous> (/home/cxllm/Bots/Corynth/events/ready.js:2:17)
0|index | at Module._compile (internal/modules/cjs/loader.js:1158:30)
0|index | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
0|index | Emitted 'error' event on Server instance at:
0|index | at emitErrorNT (net.js:1336:8)
0|index | at processTicksAndRejections (internal/process/task_queues.js:84:21) {
0|index | code: 'EADDRINUSE',
0|index | errno: 'EADDRINUSE',
0|index | syscall: 'listen',
0|index | address: '::',
0|index | port: 3000
0|index | }```
it was working
Spare yourself the troubles of sharding for the future, when you don't need sharding, you will just get increased memory usage, more headaches and etc
Your performance will barely improve
it'll get worse in fact
Having a sharded bot is a pain ๐ญ
No
On my bots features it indeed is
When pretty much every feature relies on communicating with other shards/clusters
Clusters?
Yes, each cluster gets assigned a couple of shards to handle
Which are on different processes
clusters are packed up shards
which makes half of a mirror

they manage multiple shards at a time
how do you make clusters?
So there isn't a need to start a new process for every shard
Internal sharding instantly crashes my bot
Not suitable
It's best used as a quick sharding
Until you can install proper sharding for the future
@golden condor if you are sharding that bot you cant launch a server within that shard.
const dbl = new DBL(dbltoken, { webhookPort: 3000, webhookAuth: '' }, client);
Error: listen EADDRINUSE: address already in use :::3000
I am making a very simple bot that serves one purpose, I need a database for storing different prefixes for servers but I dont think I need a sqlite server just for that, Do you think it would be acceptable to use JSON in this situation?
it would not
json is never acceptable
@turbid bough then what should I do
ik That's what I meant
no its not
What is the problem with an sqlite file?
thats just saying something wrong
Just use sqlite if you can, if you have no clue about sql use something like keyv, sequelize etc
idk how js work, but you can try making an instance before you create the shards
I tried
u cant
uh, do you have something running already then?
No
like, a bot
Error: listen EADDRINUSE: address already in use :::3002
1|dbl | at Server.setupListenHandle [as _listen2] (net.js:1309:16)
1|dbl | at listenInCluster (net.js:1357:12)
1|dbl | at Server.listen (net.js:1445:7)
1|dbl | at DBLWebhook._startWebhook (/home/cxllm/Bots/Corynth/node_modules/dblapi.js/src/webhook.js:45:18)
1|dbl | at new DBLWebhook (/home/cxllm/Bots/Corynth/node_modules/dblapi.js/src/webhook.js:27:12)
1|dbl | at new DBLAPI (/home/cxllm/Bots/Corynth/node_modules/dblapi.js/src/index.js:69:22)
1|dbl | at Object.<anonymous> (/home/cxllm/Bots/Corynth/dbl.js:5:13)
1|dbl | at Module._compile (internal/modules/cjs/loader.js:1158:30)
1|dbl | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
1|dbl | at Module.load (internal/modules/cjs/loader.js:1002:32) {
1|dbl | code: 'EADDRINUSE',
1|dbl | errno: 'EADDRINUSE',
1|dbl | syscall: 'listen',
1|dbl | address: '::',
1|dbl | port: 3002
1|dbl | }
1|dbl | Error: listen EADDRINUSE: address already in use :::3002
1|dbl | at Server.setupListenHandle [as _listen2] (net.js:1309:16)
1|dbl | at listenInCluster (net.js:1357:12)
1|dbl | at Server.listen (net.js:1445:7)
1|dbl | at DBLWebhook._startWebhook (/home/cxllm/Bots/Corynth/node_modules/dblapi.js/src/webhook.js:45:18)
1|dbl | at new DBLWebhook (/home/cxllm/Bots/Corynth/node_modules/dblapi.js/src/webhook.js:27:12)
1|dbl | at new DBLAPI (/home/cxllm/Bots/Corynth/node_modules/dblapi.js/src/index.js:69:22)
1|dbl | at Object.<anonymous> (/home/cxllm/Bots/Corynth/dbl.js:5:13)
1|dbl | at Module._compile (internal/modules/cjs/loader.js:1158:30)
1|dbl | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
1|dbl | at Module.load (internal/modules/cjs/loader.js:1002:32) {
1|dbl | code: 'EADDRINUSE',
1|dbl | errno: 'EADDRINUSE',
1|dbl | syscall: 'listen',
1|dbl | address: '::',
1|dbl | port: 3002
1|dbl | }```
No I don't
then maybe the port is already used by another application 
thats what i just said lol
no
It says 3000 is in use when I know it isn't
Sometimes happens to me too when I listen to a port and restart
I rebooting
You need to kill the port
Hey, so i was wondering something, My bot is made with
(Python) so if i wanted to make a dashboard/website for it in the future and as we know a websites requires HTML, CSS & JS so will that be possible or i'll have to remake it with
(JavaScript) ? 
Ping on response
And what exactly is that?
I need answers
like php or nodejs
Aha
take on me
Alr ty.
@golden condor this is probably caused because your thing keeps restarting/crashing and the os doesn't clean the dead port listeners quick enough, so this error will occur. If you need it now, kill the listening port, Google OSNAME kill specific port
hi
i'm setting up auto mod for my bot and uh, for now, it shud delete every message which contains a swear i added
let badwords = [ 'hi', 'bye' ];
badwords.some((e) => {
return message.content.toLowerCase().includes(e.toLowerCase());
})
? (function() {
message.delete().catch();
})()
: null;
``` does anyone know why the message is not getting deleted?
i'm using eris
try js let badwords = ['hi', 'bye']; badwords.some(e => message.content.toLowerCase().includes(e.toLowerCase())) ? message.delete().catch(e => { return; }) : null;
ok, thank u
@pale vessel python has good webserver libraries too like flask or django
i'm a php guy 
nope, doesn't delete
nope, doesn't delete and there are no errors
i added console.log(e) in the .catch
thing
but still no errors?
no errors
bot has admin, my alt has no permissions
if this makes a difference, i'm doing it here
by the way, why did you check whether the channel type was a category channel?
just make it guild text channel only, which is 0
because there's like group dms and stuff
kk
so != 0
i got it
did you try putting the bad word inside a command
the bot wouldn't respond otherwise
oh, no
wait, wdym put the bad words inside a command?
before you defined command and args
kk
because the bot wouldn't respond to non-commands
so it can't see anything (because it didn't detect a command)
ohh
oo, that'd be why
works, thank u
how can i ignore members who have a certain permission?
add it to the condition
like, if (!message.member.permission.has('oof') { the code i just had? }
message.content.toLowerCase().includes(e.toLowerCase()) && message.member.permission(etc etc)```
oh, ok
i'll add it to a higher role so like, the higher staff can
that sounds unfair, does it not?
and yeh, i'd also leave it but shrug
well anyway, now that it worked, you can do your thing now
not really, the only reason y i'm doing it is because i'd have it like that configured for my server
1 othe rthing
something liek hilo would also get deleted
how can i make it, if the content of the message includes it, just hi then delete
like
- hiall <----- dont delete
+ hi all <---- delete
split message content
message.content.split(' ').. ?
.split(" ") creating an array with words of string
for example
"hi all".split(" ") // ["hi", "all"]```
I'd suggest using a regex to ensure that there are no empty strings
i'm shit at regex
For example if you had 2 spaces next to each other you'd get an empty string in between them
You'd use \\s+
meaning "any amount of whitespaces"
split(/\s+/).includes(e)
I can't change this font-size
.blob p {
font-size: 15px !important;
}
<div class="blob">
<span class="subtitle"><b>what is videonet?</b></span><br>
<p class="textblobz">videonet is a new discord bot that allows you to create a simulation of a YouTube Channel on Discord! It's a simulation game that allows you to manage your very own virtual youtube channel! Upload videos, earn money and find your way through the leaderboard!</p>
</div>
thats what Im using
ignore the missing style tags
i didnt want to paste everything
badwords.some((e) => message.content.toLowerCase().includes(e.toLowerCase()) && message.member.permission.has('manageGuild')
//not above
message.content.split(/\s+/).includes(e) && message.member.permission.has('manageGuild')
like, i can use the bottom one instead?
any idea why it doesnt change?
yeah
try p.textblobz
textblobx
let badwords = [ 'hi', 'bye' ];
message.content.split(/\s+/).includes(badwords) && message.member.permission.has('manageGuild')
? message.delete().catch((e) => {
console.log(e);
return;
})
: null;
``` like this?
kk
So i'm trying to get rid of songs in the song list to app||ear like this because they use 2 of these |'s which|| is actually ||very annoying|| to read..
I was told to use .replace(/\|/g, '\|') but this is not fixing anything
Why is it not fixing the spoiler tags, and how do i get them fixed?
Text still appears as
.replace("||", "\|\|") ?
.replace(/\|/g, '\\|')
cause if you have | d | and | nothing | will happen right?
nothing gets escaped tho
that won't even be executed because its not replacing anything
You could also use .replace(/\|\|/g, '\|\u200B\|') which will add the zero width space character and "preserve" the song name
/\|\|/g doesnt let the embed be sent at all tho, it seems to replace everything
can anyone tell me why .replace("||", "\|\|") this would work?
You need two backslashes on one | to escape the spoiler markdown like Cyber showed. You'd need to replace it twice.
That won't work because replace will only do it once in a string.
oh so .replace(/\|/g, '\\|')
as in if the same character sequence occurs, the second one won't be replaced.
if you use regex with the global flag, it'll replace all sequences in the string
oh, so js wont replace all || ?
Wow..
| is a special character in regexes
@turbid bough thats why you need the global flag ๐ฉ
So you escape the escaping ๐
^
@"" would ignore escapings woulnt it?
I escape the escaping.. which escapes the escape.. which escapes the character that has to be escaped...
correct
Something like that
Well thanks it finally works now
oh, so js wont replace all || ?
@turbid bough not unless you use a regex with the global flag.
good
'\|' will result in '|', which is still the same character so discord wont escape it
regex is cool once you get to know it
yeah well in normal messages \| does get escaped, doesn't it?
well, in c# it replaces all lol
no yes actually
yes, but you are doing extra string parsing in js
Guess thats how i f*ed up
yeah
thats.. a regex
wait what
yeah i know
it's not
/text/flags literally denotes a regular expression..
im used to having regular expressions in a string.
for once thats not js being weird, its expect behavior when writing regex
what
then stay to your RegExp()
what language?
c#
yeah use RegExp() instead
you can use both
literally no difference
i mean if you want to pass a variable
idk Regex still inputs a string when i search for it
with regex on it
unless you are talking js right now
ah yeah, you are, with that docs
How to add catagories in the help command. (discord.py)
Are you using plain on_message or commands.Bot?
commands.Bot
Ah okay thank you!
Hi I made this stopwatch code but instead of a time it's spitting out NaN heres the code function stopwatch(arguments, receivedMessage){
if(arguments == "start"){
receivedMessage.createdTimestamp
}
if(arguments == "stopw"){
let i = receivedMessage.createdTimestamp - Date.now
receivedMessage.channel.send("Elapsed time:"+i)
}
}
this is what it's spitting out- Elapsed time:NaN
what is wroong with it
Date.now is a function @earnest phoenix
^
Ik
also to keep it clean and easier to read please send the code like this
function stopwatch(arguments, receivedMessage){
if(arguments == "start"){
receivedMessage.createdTimestamp
}
if(arguments == "stopw"){
let i = receivedMessage.createdTimestamp - Date.now
receivedMessage.channel.send("Elapsed time:"+i)
}
}```
how u do that
i dont think you want to take lower date - higher date
did you change Date.now into a function like speedy said?
umm no
you said you know
Date.now()```
thats spoonfeeding
oh ya changed that
ok lol
lol
told you we shouldnt spoonfeed
now he fixed it without learning anything at all, and we did all the work
The URL to your website


