#development
1 messages · Page 221 of 1
_ _
Imagine 3k line Code into 1 line
literally every minified lib ever
Womp womp
I mean
I can make py like it
I will just make my own parser

Did you really say "Womp Womp"?
No
yes
Oh hell no
delete ping, delete commands, delete .env
keep package.json and index.js
delete everything inside your index.js
Why do you need .env at all
You can do it. But its not needed
Oh
just dont publish to a public github repo
and you can put it in your index.js if you want
What even goes in the index.js
code
here is a basic discord.js code for listening to text messages and a basic !ping command:
const { Client, GatewayIntentBits } = require("discord.js");
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] });
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('messageCreate', async message => {
if(message.content === "!ping") {
message.channel.send("pong");
}
});
client.login(TOKEN);
Ik that but
you will need to go into your discord application, in discord's website, and enable the Message Content intent for your bot
For the bottom i put my token token?
yes, you can put your token directly into the login function
client.on('message', message => {
if (message.content === '!ping') {
message.channel.send(`🏓Latency is ${Date.now() - message.createdTimestamp}ms. API Latency is ${Math.round(client.ws.ping)}ms`);
}
});
For ms
timestamp comparing can be very inaccurate btw
I know
Do yoy need the round?
You don't want 6,63963992ms right?
Probably not
You only want 6ms
Mine would be like 100 right? If i am PC hosting
I got a question in your code
Just ask
[] is an array, you use it to create lists of items, for example const numbers = [1, 2, 3, 4]
{} is the initiation of a scope
[] array
() is used for parameters in a function/loops or in conditionals
like if statements
at least thats the most common usage
also math expressions
yea I was going to say that
(1 + 2) * 3
huehuehue
Didnt want to load him too much knowledge at once
also {} for objects
Wdym objects
const myobject = {
a: 10,
b: 20
}
classes, numbers, bools /j
an object is like a list of items, but each item on the list has a label
and you can get the value of the item by its label
think of it like a grocery store checkout.
Everything in your basket has a name, but it also has a price
for example const ten = myobject.a
const basket = {
hotDogs: 1.99,
toiletpaper: 6.99,
water: 1.99
}
to continue my analogy
you can also do something called "destructuring"
If yoy don't add those will there be a error?
const { hotDogs } = {
hotDogs: 1.99,
toiletpaper: 6.99,
water: 1.99
}
console.log(hotDogs) // 1.99
the only time you will get an error in an object is if what you are grabbing doesn't exist
What happens if yoy don't use () [] {}
you will definitely have errors
Ok
How do people make emblems?
Like
Owner: Blissy
Ping : 72727ms
Servers: 373,737k
Users: 77,272m```
But like colorful
like an image?
I'm thinking embeds? 👀
Lol flaze
-needdev
You seem to be asking for something you don't have experience for or something that hasn't been done yet, but really need for your bot/server.
You can hire developers from Fiverr or Freelancer to code the things you need for your bot/server.
^ one of those?
Its a modified client I think
I can't pay anyways
Ermahgerd
Is that what's it called?
Thanks
Yup
Oh
Do yoy know how people get the boxes at the end?
That you can click and it goes to that link
you mean buttons?
Yes
discordjs still?
Yeah
its on the guide iirc
Not going to lie the person who taught me how to spam emotes was jh
no i mean the general layout
like centering and stuff
Thats still a Normal embed
looks weird
Using invis Chars
What's that
Oh
But idk if they did that like that
Do yoy know what a bump bot is?
Yes.
CLONE
Did i just hear a CLONE!!
He's typing 
HR wants a strong talk with you
Gn
We should complain to hr
Not really
Understanding the guidelines makes it really easy

I just wanna make a bot 🙂 that people would like and I can like mostly
If i know I can make a bot I would be happy with that/code
You could get bot in topgg under 100 lines
I won't because there is tons of those
Of code?
Plz no its in my top 3 least fav bots to review
What do you think is the most see bot yoy see category
Ngl that sentence didn't make any sense
Tetris bot is a banger
Clones
They get denied right?
Clones and ai
Shapes 🤪
I wish we still had datadog
Botghost
Datadog?
I only use that for the badge lol
I own 2
It showed all the big overview stats of reviewed bots
like decline rates
How many bots in queue as well
Why did they get rid of it?
6
I love shapes clone
costed a lot
It was really expensive
Oh
datadog was a huge expense
Hosting cost?
Yeah
Couse it be like "hi plz decline me i am shapes here is thr declinr reason"
Not like we hosted it, but it was a lot
Just ask me lmao
Uh
Oh our bill was way more than that
Not sure what it was, but it wasnt their base plan
I dont think you can self host datadog
Dang i can't change my name
Sadly
Sad...
Deploy ads in bots every time someone slap ixz
Are yoy able to make your own?
Sure
I think we would just use an off the shelf thing for time series analytical data. Like timescale.
or you can use my free service
I manually analyze the data in real time and make a graph
hourly updates
Honestly, I doubt we will ever implement something like that these days for public use anyway.
honestly
Ik
The benefit of datadog was the public facing nature
Lmao
and make a metric of how many people declined bots
You'd need to scan logs too for approvals
Spy.gege
Do it, i wanna see
I bet our internal development taskforce would handle that if we pushed for it.
I read decline Reasons because i'm bored
I bet its
1.offline
2.Clone
3.desc
honestly
Honestly
nah I wont
uh no
And tbh, it wouldn't work as well these days anymore. The number of BRs that use custom decline reasons is too high for it to work
hi
240k+ messages in that channel
@solemn latch star this #mod-logs message
no ty
Make ntts do it
I pretty sure he did for auction once
Because datadog would use the preset decline buttons to determine which was which
Or well it was setup that way
Isnt your bot already a thing?
Oh
Just star it
Just make someone fs it
Broken
Only fs can do it
fs?
Force star
Oh
Only mod+ can do it
Hm :(
Bot Advertisement
Ads basicly
Also ads
Funfact i can see all the content in that Channel
Also ads
Mods client?
Then plugins
Nothing modded at all
Oh u mean latest message?
Thats normal for discord
Like i can see all the Stuff from Yesterday etc
Ye thats normal
Untill you refresh your client
Until you close the Channel
No it Still work
Need to be whole client
Never?
Honestly
honestly
how do I make my bot have it too?
they'll eventually appear as more people use your bot's global commands
Ohh, ty
After i make a !ping how do i restart my bot?
node index.js = run the bot
ctrl+C = stop the bot
My !ping still didnt work
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] });
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('messageCreate', async message => {
if(message.content = "!ping") {
message.channel.send("pong");
}
});
client.login("Token");```
I guess you also need MessageContent intent if your want to read content of the messages
this is incorrect
You need to use ===, not =
^
What does === mean vs =
= assigns a value, === compares 2 values
when you run node index.js does it show "Logged in as YOUR BOT NAME"?
and when you type !ping on discord does anything show up in your console?
No
add a new line before if(message.content = "!ping") { and write console.log(message)
like this ```js
client.on('messageCreate', async message => {
console.log(message);
if(message.content === "!ping") {
message.channel.send("pong");
}
});

then restart the bot (press ctrl + C, then run node index.js again)
show the stuff
channelId: '1251190770057220131',
guildId: '1251190770057220128',
id: '1251504694623342592',
createdTimestamp: 1718452371031,
type: 0,
system: false,
content: '',
author: User {
id: '932313912110628894',
bot: false,
system: false,
flags: UserFlagsBitField { bitfield: 4194368 },
username: 'blissy0927',
globalName: '𝑨𝒍𝒑𝒉𝒂 𝑩𝒍𝒊𝒔𝒔𝒚 :eagle:' ,
discriminator: '0',
avatar: '97c5261c6c6f809ec16dc539baaeeb0d',
banner: undefined,
accentColor: undefined,
avatarDecoration: null
},
pinned: false,
tts: false,
nonce: '1251504286412570624',
embeds: [],
components: [],
attachments: Collection(0) [Map] {},
stickers: Collection(0) [Map] {},
position: null,
roleSubscriptionData: null,
resolved: null,
editedTimestamp: null,
reactions: ReactionManager { message: [Circular *1] },
mentions: MessageMentions {
everyone: false,
users: Collection(0) [Map] {},
roles: Collection(0) [Map] {},
_members: null,
_channels: null,
_parsedUsers: null,
crosspostedChannels: Collection(0) [Map] {},
repliedUser: null
},
webhookId: null,
groupActivityApplication: null,
applicationId: null,
activity: null,
flags: MessageFlagsBitField { bitfield: 0 },
reference: null,
interaction: null,
poll: null
}```
Yeah
ah i forgot something
on the second line const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] });
add GatewatIntentBits.MessageContent
like this:
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent] });
you can also space it a bit to make it easier to understand
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent
]
});
Yay it worked
js doesnt care about spaces and newlines, as long as you follow the delimiters for () [] and {}, so you can organzie the code as you prefer
try some string manipulation
for example
message.content contains the message you typed on discord
you can create rules based on what the message content contains
if(message.content === "something") = exact match
if(message.content.startsWith("something")) = start with
if(message.content.endsWith("something")) = ends with
if(message.content.includes("something")) message contains a word
you can also cut, construct and manipulate texts in all kinds of ways
message.content.slice(5, 10) = extract the text between the 5th and the 10th character
const newtext = `add some fixed text before ${message.content}`
``` = mix a fixed text with the text typed
Wow
for this one
if(message.content.includes("something")) message contains a word
djwdawjdawdwjdiwa Blissy
If i put Blissy in the something
I can put anything in it and it would say what it says?
you use if rules to detect whether something matches or not, then inside the {} that follows you decide what to do in those cases
example
if(message.content.includes("Blissy")) {
// do something when message contains "Blissy"
message.channel.send("hi Blissy")
}
if you want to make the bot repeat what you said, you can message.channel.send(message.content)
if(message.content.includes("Blissy")) {
message.channel.send("Hi Blissy");
}
});```
Its not working
did you restart the bot?
did you type Blissy with uppercase B?
Fixed it i accidently didnt save 😭
exdee
When i type Blissy it keeps sending and doesnt end
because the bot can also read its own messages
and sees that they also contain the word Blissy
you can add a rule to ignore bots:
if(message.author.bot) { return; }
Where do i put that?
at the beginning of the messageCreate block
before the other ifs
code always runs from top to bottom, so the order of your rules can be important dependiong on the situation
gj
Ty
For console logs
If you want it to read it
Do you put it above or below the code
console logs are used to show values in your console, so you can see what is going on in your code
the value you want to show has to exists in the location where you put console.log
so it has to be after that value was created, and inside the block where that value exists
I made the !pingapi thingy and bot said
The Sky guy from yesterday
lol
if automod is not letting you paste the code, you can take a print of it and post it as an image lol
if (message.content === '!pingapi') {
message.channel.send(`Latency is ${Date.now() - message.createdTimestamp}ms. API Latency is ${Math.round(client.ws.ping)}ms`);
}
});```
client.ws.ping is correct, but it takes up to 45 seconds for it to be populated, so it will be -1 for a bit when you just start your bot
Now it is 31ms
Date.now() - message.createdTimestamp has an issue where it only works if both your pc and discord's servers are in sync with their clocks
because Date.now() uses your pc's clock time, and message.createdTimestamp uses discord's clock time
and clocks between compouters can be out of sync by several seconds
True
the only correct way to get the message latency is to try to send it first and measure how long it took to send
you will need to split up commands for that, you might not want to display the time stats after every command
then you can either send another message with the result, or edit the first message
I am only gonna do the 31ms one
Not the time
alright
time the await right
the 31ms one is measuring how long it takes for discord's events to reach your bot
yes its pretty good
ok
ye
is it to early to try to make a embed
it would be this if you want to measure how long it took to send
const start = Date.now()
await channel.send(...)
// latency = Date.now() - start
using raw objects, for example ```js
message.channel.send({
embeds: [{
title: "abc",
description: "xyz"
}]
})
or using the discord.js EmbedBuilder
or the embed builder
with said objects
recommended the builder if you want to conditionally add stuffs to the embed
What is it for server guild is it just guild?
const embed = new EmbedBuilder();
embed.setTitle("abc");
embed.setDescription("xyz");
message.channel.send({ embeds: [embed] })
const embed = new EmbedBuilder({
title: "amogus"
})
if (user.sus)
embed.setDescription("you are sussy")
channel.send(...)
you want to get information about your guild?
you can do message.guild
ie: message.guild.id, message.guild.name, etc...
@warm imp do you use vscode
ohhhh
Yeah
because if you do
it can suggest you
press Ctrl + Space after .
eg. type message. then Ctrl + Space
yeah vscode should show you the available options after you type the dot
So how would that work
Ctrl + Space again will make it display full definition
if i type abc it would work or
like what it says on the can
it builds the embed, then you can send it
abc would be the embed title
not related to what you type
I was reading it wrong whoops
I got to go to get a haircut. Ty i'll be on later if to code more
Ty for helping me
you got compressed here
bruh
Do you know how to make a uptime?
So like how long your is up for until you restart it and then it restarts the count?
Is there a way to detect when the voice connection of a bot drops so I can make it reconnect asap?
my server doesn't have this issue but my pi does and its really annoying to have to reconnect the bot every 30 seconds
What's better if I use discord.js
Process uptime is the time your process was started.
IE when you ran node . is process.uptime
client uptime is the time your client is up.
Its when the client.on("ready" ... was last emitted
Then client is the one I should use then ig
Will it go back to 0 when you turn it off and turn it back on
if(message.author.bot) { return; }
if(message.content.includes("!server")) {
message.channel.send("message.guild.name");
}
});```
How do i make this actually say the server name and not message.guild.name
message.channel.send(message.guild.name)
or
message.channel.send({ content: message.guild.name })
or
message.channel.send(`Server name: ${message.guild.name}`)
Ty it worked
The last option is probably the most frequently used if you want to put some value along with the text
Commands are the basis of the bot's functioning, to be honest
I just dont understand the handling
It's hard to do anything without them
And what to do in the index.js after
So i just make a folder called commands and a file called handlers or?
How you do it really depends only on you. You could just as easily write everything in one file, but yes, creating a separate folder for commands and handlers is a good, although slightly more advanced option
For handlers would it be a folder and then a file for every command?
Depends on what you want to handle in them. Personally, I have a separate handler for each type of interaction (buttons and slash commands)
Yeah thats what i was thinking too
For handler folder do i just put ping.js?
Because i just made a ping command
Just dont know what to do in the handler
Um Is it bad if Ctrl + C doesnt turn off my bot?
just means you prpbably have another instance running somewhere
check top to see if the prosses is still running and kill it from there
also what endpoint is this and how do I use it? bot stops playing not cuz my internet is trash for once but for some reason the audio stream I am using dies and this pops up on the debug output.
I already have this, as this is what would normally detect audio that has stopped playing but it never gets run.
Not sure the point of this log if its rather useless
Any errors?
Also, its likely a bot since only bots have discrims now, iirc users get null on their discrims. (might be wrong)
I made a slash command how do you make it so it pops up. Someone said node src/ping.js
For a command to be available on Discord, you must first register it in the Discord API
module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies With Bot Latency!'),
async execute(interaction) {
await interaction.reply('Ping: ${Math.round(client.ws.ping)}ms!');
},
};
client.on('interactionCreate', (interaction)); {
if (interaction.isChatInputCommand ()) return;
console.log(interacton);
}```
I did register it right?
Not really
Oh
Can the whole code go in my commands/ping.js
no
Or should i make a handlers/ping.js
you should not be registering commands in the command file itself
So should i do this?
there are no errors, this log comes from the built in debug event that I am logging to the console for extra info.
at this point I think I am just gonna regex the log and use that as any of the normal voice channel disconnect/idle/whatever things never actually run.
apparently under the bot object or whatever there is a voice state update thing that does fire so I am trying to make something of that now
well only god knows whats wrong at this point. this all works fin on my server but is fucked on my pi and my pc. even after updating everything and compleatly using different hardware still doesn not work.
What exactly is going on
next time I can get to turn on my derver I will just coppy the files from it and use that but since they where built from the ones I am trying to get to work now I don't see what the differance is at all
as the screenshot you provided told nothing
Basically my bot joins the vc, it starts streaming audio from the mic jack on the pi/server/whatever. It works perfectly for about 40 seconds and then the green ring goes out and then I cant get it to do anything else unless I manually run the leave command and make it join again.
it never used to do this and on my actual server pc which I cant use right now it still works. but on my pi it does not.
ther is no audio artifacting from my junk internet it just stops playing
Are you using lavalink or is this purely through djs or whatever lib you are using
d.js voice
what version
used to be this but I updated it all through npm so should all be up to date now.
updating made no differance
My internet is slow yes but its not cutting out
if its slow it could cause some issues depending on how slow it is
also if there is anything else running on it using the wifi connection
I mean I have 0.5Mb/s up but since the voice connection is 64Kb that still has alot of head room
I'm connected via ethernet
ic hm
and nobody but me is on the internet rn
yea I have no idea what could be causing it then.
lol
Voice is a bit out of my range now adays
fair
I am just fustrated cuz this used to all work fine
but then cuz power got so expensive I ccouldn't run my server 24/7 anymore so I moved it all to the pi
and thats when all this started acting up
you know what fuck it I am just gonna turn my server on and rip the files off of it.

i'd run servers even if the power bill was high ngl
it's so much nicer than a pi
😭
I know but I live with my parents still and still looking for a job so I would feel bad if I was just using 300 quid a year for pretty much no reason.
I just don't like turning it on and off cuz the hdd is struggling and I cba to take the whole thing apart.
discordjs is notorious for breaking stuff every new version
if it used to work on old versions but doesnt on new versions, then they broke something and you need to find out the "new" way of doing it
bruh this has peen broken on my pi for the last 2 years almost I just never bothered to fix it
also I love finding the few comments I have in my code
if it cuts out always at the same time delay or theres a pattern then thats probably a clue
yeah
its not exactly the same time but feels close enough
just in the prosses of comparing it with the code on my server rn
i have a bot and i did make an outside cluster,sharding manager how do i post the status to top gg using that client since it says unsupported client
What language are you using
node js
are you using discord.js?
yeah but for sharding am using another pkg
discord js sharding not good
What package...?
discord-hybrid-sharding
OK so touch wood..... I think I have fixed it. the only real differance I found was on the PI the sample rate was lower. only 1600 instead of 3200. So only thing I can think was the issue is since discord takes a bit to connect there was a bit of a buffer and that just ran out as the data rates where misss mached.
@sharp geyser
don't really see how that would have made much of a differance cuz if one was running at the wrond rate it should have sounded like it was playing at 2x speed or something. idk but after all this its working so idc at this point.
ok sir
Right so
let size = client.cluster
.broadcastEval(`this.guilds.cache.size`)
.then(results => {
return results.reduce((prev, val) => prev + val, 0);
});
Using discord-hybrid-manager this is how you get all the servers of your bot in every shard
You would then install this package: https://www.npmjs.com/package/@top-gg/sdk and do
const {Api} = require('@top-gg/sdk')
const api = new Api("your top.gg token")
api.postStats({
serverCount: size,
shardCount: getshardssomehow
})
Official Top.gg Node SDK. Latest version: 3.1.6, last published: 9 months ago. Start using @top-gg/sdk in your project by running npm i @top-gg/sdk. There are 15 other projects in the npm registry using @top-gg/sdk.
note you have to post these stats periodically
but since you are using discord-hybrid-manager you can't use the autoposter
you will have to set an interval yourself
am using it like this one minute
oh
post them every hour
but like that i can say my bot is in 1m server lol
or every 30m
actually you should be able to do it lower if. you want
just don't exceed 60 requests / minute
ok thank u bro
but i can do this also XD
If you do, then you will get your bot banned from top.gg iirc
not worth it
Unless you don't care

THANK U
np
1 last question
now i have like 40 shards and 4 clusters
if i need to access the client i need to do it in the bot file not in the sharding manager
like that it will be boosted 40 times right?
@sharp geyser
since the bot file called 40 times or 4 am not sure in the hybrid pkg but in the discord js it will be called 40 times
if i set an interval in the bot file it will be executed 40 times
What, why is the file being ran 40 times
every shard run the file 1 time in discord js sharding manager
No way thats what discord-hybrid-manager tells you to do
every shard = 1 process
in the hybrid pkg every cluster = 1 process
Remind me again what package are you using
The first package which combines sharding manager & internal sharding to save a lot of resources, which allows clustering!. Latest version: 2.2.0, last published: 2 months ago. Start using discord-hybrid-sharding in your project by running npm i discord-hybrid-sharding. There are 8 other projects in the npm registry using discord-hybrid-sharding.
yeah
that mean the interval will be executed 4 times
const manager = new ClusterManager(`${__dirname}/bot.js`, {
totalShards: 'auto', // or numeric shard count
/// Check below for more options
shardsPerClusters: 2, // 2 shards per process
// totalClusters: 7,
mode: 'process', // you can also choose "worker"
token: 'YOUR_TOKEN',
});```
shardsPerClusters: 2, // 2 shards per process
i have it like this shardsPerClusters: 10, // 2 shards per process

so i have 4 processes
I mean ig it's starting the cluster on its own process
that mean 4 intervals
but not the shards
If it was starting each shard on tis own process that would be a BITCH to manage
either way
do this in your main file
not the cluster.js file (or whatever you called it)
in discord js the sharding manager do this but hybrid make it clusters means less processes
as you will be able to call cluster.client.broadcastEval()
u cant access the client out side its main process
btw i will find a way to do it using discord api thanks for help
yes you can
when you instantiate teh discord client
it has you do client.cluster = new ClusterClient()
in that same file
just auto post your stats in an interval
@little cosmos ^
the sharding manager called index.js
the bot file where u const the client called bot.js
so bot .js is called 4 times
4 child process
I am confused on how the hell you are setting this up
an interval inside it will be executed 4 times
I am starting to think your setup is entirely wrong
no all the bots like this
bots above 2k server
u cant run a bot over 2k server inside 1 process
Yes but you should still be able to access the cluster
no u cant

u can make 1 thing
XD
tahts fine
const {Api} = require('@top-gg/sdk')
const api = new Api("your top.gg token")
api.postStats({
serverCount: size,
shardCount: getshardssomehow
})
you helped me with this though
thanks
Im just telling you now
you wont be able to use the discord api to get your server size
you HAVE to get that from the client
So what you are saying is entirely incorrect, and it IS possible to get this information.
i can set a json file and count inside it the times that bot .js file called
and set an express server to it
that will work
or hear me out, just post the stats on bot ready
it will post just the guilds count inside the cluster
and it will post it 4 times

Whatever you are doing is incorrect, or you've just never tested any of this before
bro
Big bots are able to post their stats rather easily
i will take a pic
It's not that hard
1 sic
u can in the discord js sharding manager
but in the hybrid u cant
Then don't use discord-hybrid-sharding, or don't post your stats

but the fact that the docs for discord-hybrid-sharding shows that you CAN get the guild count of your cluster
if i use discord js sharding it will use 16 gb ram
then it is definitely possible
in hybrid it uses just 6
XD
I've said all I could
i can get the guilds count but it will be posted 4 times
u helped alot thanks really
you are supposed to post it from the manager
not from the clients
Queue {
queue: [],
options: { auto: true, timeout: 7000 },
paused: false
}```
thats my manager object
yeah it says unsupported client and there is no way to get the guild count from the manager
you dont use the autoposter
you post manually
yes there is
how?
_eventsCount: 2,
_maxListeners: undefined,
THREAD: [class Child],
manager: ClusterManager {
_events: [Object: null prototype] { clusterCreate: [Function (anonymous)] },
_eventsCount: 1,
_maxListeners: undefined,
respawn: true,
restarts: { max: 3, interval: 3600000, current: 0 },
clusterData: {},
clusterOptions: {},
file: '/home/container/bot.js',
totalShards: 40,
totalClusters: 4,
shardsPerClusters: 10,
mode: 'process',
shardArgs: [],
execArgv: [],
shardList: [
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
30, 31, 32, 33, 34, 35, 36, 37, 38, 39
],
token: '',
clusters: Map(2) { 0 => [Cluster], 1 => [Circular *1] },
shardClusterList: [ [Array], [Array], [Array], [Array] ],
clusterList: [],
spawnOptions: { delay: 7000, timeout: -1 },
queue: Queue { queue: [Array], options: [Object], paused: false },
promise: PromiseHandler { nonce: Map(0) {} },
heartbeat: undefined,
recluster: undefined,
hooks: ClusterManagerHooks {},
[Symbol(kCapture)]: false
},
id: 1,
args: [],
execArgv: [],
shardList: [
10, 11, 12, 13, 14,
15, 16, 17, 18, 19
],
totalShards: 40,```
manager.fetchClientValues('guilds.cache.size')
.then(results => console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`))
.catch(console.error);
results should be an array, one item for each cluster
iwill try ty
what point do you guys reccomend sharding? i'm in about 1600 servers right now and i still only use like .2 gb of ram.
thats a good point to start
its recommended to start at around 1500
Sharding is probably recommended from 1500 servers and required at 2500 if I remember correctly 
does ur code works for discord-hybrid-sharding
i got it from their source code
since i couldnt find docs
oh does discord actually require it?
i didnt even know lol
oh
yes, at 2500 it becomes mandatory
my bot has 40k u cant run it with out sharding
why?
so its REQUIRED to have it in the code?
yes lol
because single process cant handle all this servers
login will fail with error "sharding required"
alr
makes sense
and i cant run it if the ram is below 10 gb (for now) in the future it will require more
bots like pro bot uses 1t ram
@little cosmos what would happen if you tried to use internal sharding
where did tyou get that info from?
lmao
math
x doubt

i dont think that a bot needs 1TB RAM
large bots have custom/modded libs
they dont use raw discord.js
that would be suicidal
1 shard uses at least 300mb
pro bot uses eris.js
did you ask them how much ram they use?
because ram usage can be tweaked by configuring caching
my bot is in 10k servers and uses 150mb ram
i know
but at least 1 shard needs 200mb of ram
10m server needs at least 7000 shard
7000 * 200
i will show u a bot for dyno owner and he has status page with ram info
i mean, i dont doubt it, i have seen a bot use 50gb ram at 150k servers
but a bot using 1tb ram is simply a massive waste of resources and the team behind it sucks
go to
/status
260 gb for 1.5m
how about 10m
i mean their bot is also streaming music
Why
You are only in like 800 servers right?
You're just adding more complexity for no reason
39830 total guilds it worked @quartz kindle
it wasnt that hard....
Well no
wrong reply
but there's literally 0 reason to shard rn
sharding too early is pointless
as you don't benefit
yeah i dont doubt it, but there are ways to control resourse usage, and most big bots employ something for that
or they are rich and dont care
there is a pkg
for discord api
named dbb i think
a bot with 300k uses only 100mb ram
but the bad thing its in c++
how tf
disk caching
you can pretty much scale indefinitely if you use webhook interactions and stick with slash commands only
it wouldnt be any different from running a website with a few hundred hits per second
yeah but in this way u need to make ur own pkg with out caching just api fetch
what normally causes an “unknown interaction” error? never got it before but i randomly did just now
yeah thats what i did
i have my own raw lib
Most often when you do not respond to an interaction within 3 seconds
u will lose some futures though
not really losing anything if i dont need it
message commands
imo, every big bot should make their own lib
its a huge waste of resources running on top of a big ass lib with a ton of features you will never use
and a structure that is not optimal for your exact use case
imo big bots should be engineered from the ground up for their specific use case
cant have message commands without the intent anyway
i have it
and my bot uses message commands
yea no, any bot that is even in 250k servers should start using their own lib imo
Once you start seeing growth like that discord.js will hold you back more than it will help
If not making your own lib, swap to a more memory efficient language if you really want a library to use
yeah at some point it would be very much worth it to engineer the bot from ground up
the difference in hosting costs would be absurd
especially in a new language that's more memory efficient like C++
I bet if dyno used C++ it's ram usage would be cut in half
if they coded it properly
Oh yea for sure
a lot of what djs does for you is stuff you wont need when you are a larger bot
probot uses eris.js though
and its in 10m server
eris is abandoned, has been for a few years already
most big bots who use eris use a modified version of it
unless they fork eris themselves
or maintain their own forks
Anyone know any gfx guy?
fiverr
Too lazy
And sleepy rn

Btw is dyno ded or something?
It’s not working in my server
all shards are operational
What’s the problem
tcp LISTEN 0 50 [::ffff:127.0.0.1]:35712 *:*
tcp LISTEN 0 4096 [::ffff:127.0.0.1]:53121 *:*
tcp LISTEN 0 50 [::ffff:127.0.0.1]:34147 *:*
tcp LISTEN 0 50 [::ffff:127.0.0.1]:5990 *:*
tcp LISTEN 0 4096 [::ffff:127.0.0.1]:63342 *:*
I have no fucking clue what these ports are for
it doesn't tell me the process either
so I am not sure
figured it out with netstat
but idfk what ld-linux-x8 is
right so @oak cliff is there anyway to stop automod for certain channels?
Because sometimes it blocks actually getting help
well then people could post the thing we dont want posted in here 
we need a better phone number regex
indeed
because as it stands now it's getting rather annoying to ask for help with anything network or linux related 😭
Anyway, this is what I was trying to post
I have no idea what any of this is
It just randomly popped up in my used ports
Okay nvm
I found out what it is
it's just jetbrains ssh remote server
How can I properly do ```ts
type Something = Record<string, string | Record<string, string | Record...
context: i18n json
well well well...
Uh
Do
string | { [x: string]: Test }
Am on phone sir
thx though!
do people actually post phone numbers?
i've never seen it happen ever lol
"dox" kids do something like that
nope
its actually kind of sick
this is how you'd fetch data between table relations
bff.nickname is basically a join
but without all the annoying SQL inner join, outer join bullshit
it's kind of neat
it can also be schemafull or schemaless too
or both
pretty much
you connect to it via WS
you send your query and it responds back in json
or you can use the rest api
like fireship is doing in that screenshot
SQL join statements arent even that annoying?
It can be in complex relations
I've written some pretty annoying join statements since i've learned how to use em

mainly because I always get tripped up over INNER/OUTER or RIGHT/LEFT
SELECT table1.property1, table2.property2 FROM table1 INNER JOIN table2 ON table1.property3 = table2.property3;
My problem is
I had times where I was needing data from 2-3 tables all joined in relation
idk
I think surreal is rather neat either way
it looks promising for what it supposedly offers
This was a fun query
Just to get a playlist's info and its tracks by name
oh wait I was about to ask why you are storing playlist info
but its probably custom playlists for users


Was. She was at 10k before I pulled the plug for personal reasons. She's since restarted but is only at ~100 servers now
you're probably thinking of Ayana
also with surreal you can just keep going as deep as you need.
Say you had 3 tables
- Person
- Cars
- Parts
SELECT cars.parts.somefield FROM person:someid or SELECT cars.parts FROM person:someid
idk how much control you have in terms of other kinds of statements you can do like ORDER or COUNT or whatever, but that still seems more convienent than a long INNER JOIN / LEFT JOIN chain
its still a fairly new db tbf
what if you need to cross-compare with the same table?
I'll use a recent case as example
SELECT cd1.id
, cd1.description AS description_en
, cd2.description AS description_pt
FROM card_descriptions cd1
INNER JOIN card_descriptions cd2 ON cd1.id = cd2.id AND cd2.locale = 'PT'
WHERE cd1.locale = 'EN'
this makes a result like ```
id | description_en | description_pt
blabla1 | | something
blabla2 | translated | somedesc
blabla3 | smth else | abc
Not entirely sure on that one. I myself have just started checking out the docs for it.
Im just relaying what i've learned

I think its still possible to achieve something like that tho
let me check
right so
you can definitely do this
you just have to set a relation
RELATE table:id->something->table:id CONTENT {...};
SELECT * FROM table:id->something;
Is the best way I can see how to do it after skimming the docs
that's join with extra steps
yea fair
I also just found this https://surrealdb.com/blog/understanding-surrealql-and-how-it-is-different-from-postgresql#the-relate-statement
not going to lie, this syntax is kinda weird after using it a bit
I like that it's schemaless so when I feel like adding a new field I can simply do so 
DEFINE TABLE profile schemafull;
DEFINE FIELD balance ON TABLE profile TYPE number DEFAULT 0;
DEFINE TABLE clan schemafull;
DEFINE FIELD balance ON TABLE profile TYPE number DEFAULT 0;
DEFINE TABLE joined schemafull;
DEFINE FIELD in ON TABLE joined TYPE record<profile>;
DEFINE FIELD out ON TABLE joined TYPE record<clan>;
CREATE profile:1234;
CREATE profile:12345;
CREATE clan:1234;
// We will use graphs to setup relations
// user joins a clan
RELATE profile:1234->joined->clan:1234;
RELATE profile:12345->joined->clan:1234;
// Say we want to fetch all users in a clan
SELECT <-joined<-profile FROM clan;
// Say we wanted to fetch the clan of a user
SELECT ->joined->clan FROM profile:1234;
This is how you'd do relations in SerrealDB if you were to use graphs
that's weird
DEFINE TABLE profile schemafull;
DEFINE INDEX profileUserIndex ON TABLE profile COLUMNS id UNIQUE;
DEFINE FIELD balance ON TABLE profile TYPE number DEFAULT 0;
DEFINE TABLE clan schemafull;
DEFINE INDEX clanIdIndex ON TABLE clan COLUMNS id UNIQUE;
DEFINE FIELD balance ON TABLE profile TYPE number DEFAULT 0;
DEFINE TABLE joined schemafull;
DEFINE FIELD in ON TABLE joined TYPE record<profile>;
DEFINE INDEX joinedProfileIndex ON TABLE joined COLUMNS in UNIQUE;
DEFINE FIELD out ON TABLE joined TYPE record<clan>;
CREATE profile:1234 SET user_id = 1234;
CREATE profile:12345 SET user_id = 1234;
CREATE clan:1234 SET clan_id = 1234;
-- We will use graphs to setup relations
-- user joins a clan
RELATE profile:1234->joined->clan:1234;
RELATE profile:12345->joined->clan:1234;
-- Say we want to fetch all users in a clan
SELECT <-joined<-profile FROM clan;
-- Say we wanted to fetch the clan of a user
SELECT ->joined->clan FROM profile:1234;
This is how you make things unique
as far as I know there is no other way as of rn
I wonder
actually don't even need to specify a separate field for uniqueness
you can just use the id field
since you can set the id field to whatever you want
LOL
I admit I kind of hate the syntax for making fields, kind of dumb you can't do it all in the DEFINE TABLE (as far as I know)
Do you need a Events folder and a handler folder for your commands you made?
no
organising code is a matter of personal preference
you expect it to run on power?
💔
my laptop turns on by pressing the button that says power
its weird it wont turn on otherwise

weird
does anyone use contabo?
hosting service? i was wondering what machines do they provide. intel or amd? cause i bought a 16gb 6cpu machine and its so slow
Have you tried using lscpu command? 






