#development
1 messages ยท Page 1 of 1 (latest)
Just go wild with it, people need to understand how large and complicated Discord's API is, and making a library to wrap it is nothing easy at all; so don't worry much about the design to make it as easy as possible
If you can't figure out a design principle for some parts, just let it be, it's probably for the best
Mmmm, I see. What do you think I should foucs on working on first?
Should I go straight for handling the gateway or should I build up other parts first
Always go for the important parts first, AKA handling the gateway, caching, ratelimits, etc etc
Alright
I am starting from scratch again
so lets go
I kinda wanna experiment with decorators in this project
DiscordAPIError: Invalid Webhook Token
I am trying to edit my interaction with interaction.editReply({})
printing interaction gives me SelectMenuInteraction object
like what the hell my interaction just worked perfectly fine 20m ago
Discord's side is having issues with those responses since 19 digit snowflakes have hitted.
ooohhh makes sense
oh right when I was doing some memey stuff I noticed it would hit 19 length
Wait what?
That doesn't make sense
idk just guessing i dont work for discord

but some stuff is broken since the change
the only explanation is field length
because snowflakes dont change programatically just cuz its gotten longer
Discord is aware of the situation it seems
Someone said an employee responded to the situation in the large bot dev channel in the discord api server so hopefully it gets fixed soon
hang on
sad, I was just having fun with my bot...
even mee6 is broke
I was taking pictures of my cool bot embeds ( as a preview on the site ) to upload it on my top.gg bot page ๐ญ and then...bam.....interactions boing..

Seems like discord wasn't prepared for the 19 digit ids after all
nothings been said by discord in there
the devs honestly are clowns
I always worshipped them
thought they were ahead and professional in what they do
It happened in a hidden channel apparently
but honestly anyone can contribute it is hilarious
only certain people can see it
yes i know
icic
send invite
we got a server for it anyway
I forgot it
all big bot owners/staff
let's see how many verified bots go offline due to not handling this error or catching any errors for the interactions at all

bam
I saw invite
bet
developer is just an alias for "professional googler"
and even that some devs cant do
true thats how I stopped spoonfeeding myself eventually from discord servers
and actually managed to learn smthing
if ur good at gooling ur good at coding, and thats super easy ๐
like, I dont mean googling for copypaste solutions
but knowing what to google to find answers for your problem
very true
that's where people fail, they think being a dev means memoing all words
I google shit half the time
A lot of times I can remember what things do tho
Some people just don't get that there is no shame in googling and reading docs
right lol
quality assurance goes brr
thats still reading docs!!!!!!
try learn by guessing all the methods and basics
just try toWord() toSentence() maketextlow() ah damn doesnt work...gotta try more
my biggest challenge at the beginning was just simply getting redux to work
How do you think I learned js?
and understanding how it actually worked
tosentence
same i come up with a project and dont stop till ive achieved it
Trying to collect some messages but .on("collect") isn't firing
var response = interaction; if (editResponse) { interaction.editReply({ embeds: [embed] }).then((msg) => { response = msg }) } else { response = interaction.reply({ embeds: [embed], ephemeral: true }).then((msg) => { response = msg }) }
const filter = (msg) => msg.author.id == interaction.user.id
const collector = interaction.channel.createMessageCollector({ filter, time: 300000 })
var collected = []
collector.on("collect", function (message) {
collected.push(message.content)
console.log("True")
if (one && collected.length == 1) {
collector.stop()
events.emit(interaction.id, { collected, response })
} else if (message.content.toLowerCase() == "done") {
collector.stop()
events.emit(interaction.id, { collected, response })
}
})```
ngl, that's one of the reasons I love java and the getter/setter standard
rn im working on a bot web music player that i have absolutely no idea how to build
just going to figure it out as i go along
when I need to find all the properties of something, just type get and ctrl + space
simple
.?
var -> let please
yeah no one uses var anymore
let allows you to declare variables that are limited to the scope of a block statement, or expression on which it is used, unlike the var keyword, which declares a variable globally, or locally to an entire function regardless of block scope.
var is hoisted and gives no shit about the scope
it causes weird errors that are quite hard to debug
also use === for comparison instead of ==
yeah came back from lua coding, I keep switchin'
php also has ===
yes but most the time when i am using it, it doesnt work
Ah yes, Discord broke their own API with their new ID snowflake growing a digit longer
== is a type-casting equals
indeed best quality assurance they definitely saw incoming
like, it casts the right side to whatever the left side is
that explains why then
"1" == 1 is true, because 1 is casted to string before comparison
lmao
was going to ask whether collector requires the intent or partials
collectors and interactions broken
nvm just interactions i think
also just as a note, u don't need function (message), u cant just message =>
meanwhile me, using just { /* code */ } (groovy has auto-params)
yes thats amazing
well, I barely used d.js so I'd be guessing
i can't reply to interactions or edit them with this error, normal MessageChannel.send() still works tho, anyone know why? didn't make any changes that should get me this error since this was working earlier
Known issue with Discord. They broke it due to snowflakes being 19char long
ohh welp
snowflakes became 19 characters long exactly today
they will become 20 characters long in 2090
Snatch a low number 19char bot ID asap ๐
And discord fumbled the bag
Apparently they hard coded 18 digits
y2k22
Wanted to get one earlier today but was busy at work
Snatched 1000011651191406692
i cant believe discord just let that happen
y2k38
Intern* engineer trying to be smart and adding validation without understanding the ID generation ๐
lmao
why would they ever need to hardcode snowflakes character lengths, when they should be storing it and manipulating it as long ints
i mean why expect it to be persistent lenght
theres no need to even think about that if you use long int everywhere
and just convert to string before sending
i also dont understand why they use iso timestamps instead of numeric
sounds like a giant waste of resources
that is just one of the many stories I've heard
i am not entirely sure if it is true
small indie company
Lets make a company called Better Discord
Fork discord but make it bettter

change back
name it tranquility
make it hell to use
aaaahhhahgahgahaghag
LMAO
ah yes, coconut.jpg
mason.jpg
And then there's Mason
discord developers chat going wild
they are planning a rave party with mason as the dj
while the relevant devs sleep
Dont they have any on call engineers that could escalate too? ๐
One message removed from a suspended account.
apparently they are all sleeping because its 5am there
california devs
On call engineers should be there 24/7 tho ๐ญ
Imo guilded is a failed project
hey yall, anyone having 'interaction already replied' issues with their discord.js bots?
i've been getting reports this morning from clients that their unchanged bots have stopped working randomly
oh, guess its just a thing on their side lol
see latest discord announcement
where? on this server?
mucho gracias mi amigo โค๏ธ
what makes you say
Barely anyone uses it, they tried to compete with discord as discord has a monopoly position currently
I don't think we know how many people use it
Failed isnโt meant as in the app is bad, barely any marketing and i never see it come by
Indeed, not exactly. But Iโve asked some people and they had never heard of it
In terms of "marketing", they've actually done well enough that Roblox bought it
Though I personally wouldn't use it.
Maybe marketing for investments, but marketing towards the actual users, barely anything ๐คทโโ๏ธ
Never saw any ads. Maybe they did do some advertising, but it apparently did not work
Neither would I, maybe some people would but they have never heard of it
@earnest phoenix how does this shit code look https://www.toptal.com/developers/hastebin/owepurelod.typescript
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.

I don't even know if the ratelimitting works
๐
ngl I'd love to use guilded...if they had a bot api
One of the many reasons why it hasnโt become as popular as it couldโve become
client.on('message', async (message) => {
is not working for me for some reason
has there been an update i am not aware of
wtf
Ignoring the formatting, it's not bad, but you should definitely use actual private properties and methods using the # modifier on the classes instead of the private keyword, because the ones labeled with the private keyword doesn't actually become private on the JavaScript side
Wait what
example please?
And also you seem to be using template strings without doing any interpolation at some parts
github copilot
I turned it off
Example of the # modifier?
yes never heard of it before
Several proposals expand the existing JavaScript class syntax with new functionality. This article explains the new public class fields syntax in V8 v7.2 and Chrome 72, as well as the upcoming private class fields syntax.
still not working for some reason
Do you have the right intents enabled
yeah i enabled them all
Are you trying to look for messages in a DM channel?
If so you need to enable the appropriate partial
i shall also define em all here?
define all the intents you want there yes
Never knew this was a thing
And try to update to v14 when possible
Hello. I have a problem with my bot. I want to run a slash command but the bot code says missing access. I gave every single permission in every single way to my bot and reinvited it many times and changed the token too but it still says it doesn't have access to use slash commands. Any idea how to fix it?
It's kinda new although (not that new), it's only available since Node.js v16 (excluding the non-LTS releases)
@sharp geyser ty got it to work
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
You need to re-invite the bot using the applications.commands scope
When inviting the bot make sure you have the application.commands scope in the invite url
Yes, but I would recommend removing the _ prefix from them, unnecessary IMO
Also now using prettier so the format is better
Don't remember how to use eslint else I would
You just install ESLint and run npm init @eslint/config in your project directory to create an ESLint config depending on the options you select
And finally run eslint . to lint your entire codebase
do I have to install eslint package side
I reinvited the bot gave permission again but the bot is just thinking when running a slash command and got the same error again.
or can I do it globally?
You can do it globally
Known issue
discord has yet to fix interactions right now forgot to mention
ty qt

@earnest phoenix is there a better way to define the client without it showing up in the logs if someone were to console log the shard https://www.toptal.com/developers/hastebin/oyiqopocej.typescript
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Also eslint fixed my code
๐
Actually I just realized something
If I go this route I wanna set writable and configurable to false since I never wanna change what client is after it is set
unless I read the docs for defineProperty wrong
is discord still broken
yes
ping me when fixed
it is false by default no?
Now would be the perfect time for your guys 'traditional' commands

just don't fuck with anything relying on webhooks
and u good
i believe when you set properties its false by default yes, but when you use regular objects its always true by default
fack
also should I set configurable and writeable to false as well?
I don't really wanna change what client is after it is set
sure
they do work doe
I wouldn't consider interactions traditional
You misread what I said entirely
Right interactions use webhooks
If I go down with traditional commands so does everyone else
It'll be fun to see all bots rely on slash commands that aren't user friendly enough
why would you have slash command one after another lol imagine scrolling from top to bottom
Imagine this with 50 bots u get what I mean, and I don't wanna scroll down the bot icon list
Honestly discord should enforce slash commands more
there is no reason for message based commands anymore
This typically isn't an issue
The only way it would be an issue is if multiple bots have tthe same command names
Do you not type the command name after the / or something?
hell no
but the commands get split between each bot in the view unless you're looking for a specific command
dumb
how am I even supposed to get an overview on all commands and memorize them if I literally have to scroll up and down and do this for every bot
don't complain about a UI issue if you're using it wrong
I don't see why you wouldn't
I'm not gonna use it because it is already retarded
Given you need to with traditional commands
you're using it wrong
No
Im not gonna waste my time scrolling down to find commands or memorizing them all
Then how would you find the command traditionally?
typing just / will give you an overview of all commands in the guild but if you look to the left oh wow look at that, there is a navbar of bot images corresponding to those bots commands
go find a way to spare the scrolling while implementing subcategories as folders and having those in a row
because the UI is retarded, again
It is very simple
you and itsokaybae love complaining
๐
Im not having another "optimized" argument with you
good bye
I personally don't see what's wrong with the UI nor how traditional commands solve the issue you have with it.
You can neither add emotes to the UI nor can you scale the UI
nor do you have subfolders but instead have every single command listed up which is retarded
define subfolder
right
if there's a section for gaming, you click on the folder and you will be visible to gaming commands only
cringe
You can do this with any folder
ah
It gives you more overview
So just categorization
I see no reason for something that indepth
Which is more powerful than having to read all the commands
Stop the trolling
Don't make me write a HTML example to illustrate this
We can make a poll and see which version people prefer
You're annoying as fuck
All your complaining is more annoying
"Oh no, someone has a different opinion than me!"
Either way, you say yyou want it to be optimized, yet you are listing things that would be harder to manage
They'd have to change the api to do everything you said
which would make it more annoying to manage slash command groups
"Stop using traditional commands, all you do is complaining! There are no issues when it comes to slash commands!"
I never said there was no issues
nah I'm done arguing with trolls
No, you're just being overtly aggressive for no rational reason.
^
I can imagine categories being useful (though I'd prefer to call them tags).
He's saying this is an excuse
But outside of that, I think the current UI is fine.
is it really
I do as well
that's their opinion.
are you implying the subfolder suggestion is any worse
There is fundamentally nothing wrong with the UI
it can ofc be improved which we already said they had in the roadmap
Fundamentals aren't the only thing that matter to convince people
As you say "it's all about opinions"
Do acknowledge this and stop the trolling
bro I am not trying to convince anyone
It is my opinion
Idc if you agree to it or not
There's no "fundamentals" to this. There's only preference and what someone finds more intuitive.
no one is forcing yyou
You are arguing against "my opinion"
Okay so what did I just quote
No
You were saying my opinion is invalid
guys, any suggestions for an uptime/status page like those discord and cloudflare use? preferably free
Retarded as fuck
Wow you really hurt mmy feelings ๐
@zinc fable @wet dove can you stop this troll
pings a mod after calling someone retarded makes sense
you're the only one being toxic here
yeah because I am confident in the real issue that caused the trigger in first place and thus has justification for my lil toxicity
x to doubt
Because you're a retard
But you don't seem to acknowledge it
God you must think the world revolves around you huh?
lets not use that word
then stop this troll
Brought up like a spoiled brat
he isnt trolling?
stating opinion != trolling
then you will get my core message
hey lets be nice
and stop arguing or ur both muted
I don't mind if he doesn't seem to stop
Sorry for responding after being called a retard thrice now
I will stop now
then do it
this channel is for helping people out, and giving opinions
are opinions invalid?
History repeats itself
neither of ours is valid but considered an opinion you however are enforcing invalidity over mine, know your shit
uvuvwevwevwe onyetenyevwe ugwemubwem ossas
Classic
hi volty
abalabalhaha
eris
yes!
We chat a lot like this here, nothing uncommon
eris is a discord lib
this is my channel so i can do whayever i want here :^)
facts
all hail tim
So I can just chat in support and say the same or what
the fuck
yeah so I can talk all day about anime in this channel I guess
Sure
general 3 huh
we do
ok
or you could just read the channel topic
not really, here we discuss about dev things
wow this chat is so development related!
yeah, eris is a discord library
so why is this off topic as soon as the argument dropped
tbh lets keep this channel a bit on topic
it litterally was tho
sorry for people wasting ur time taf
Is it against the rules or what
on to other news, has discord.py arisen from its grave yet
yes it is, read the rules #rules-and-info
it has a while ago
or is it still in development
okay and being off topic is as well
they aren't being off-topic
my god shut up
All of them
No one cares
please stop arguing
we are trying to talk about dev stuff now
Yeah
Yes
๐ซข๐ฟ
-m @earnest phoenix
Kolonyaa#6419 was successfully muted
oh thank god
Now then
Barely, mostly still in the grave, half-way through coming out I guess
About my discord lib, I so far have covered making heartbeats and invalid sessions and reconnecting, etc. As far as I know I only have to cover handling errors now, but I am still curious is there anything I am missing?
It has implemented some of the new important features, but most of them are still unimplemented
Well, handling ratelimits is another thing
they finally published the issue on discordstatus
what are you trying to test?
ratelimitting
private _send(data: {
op: number;
d: any;
s?: null | number;
t?: string | null;
}) {
if (!this.#connection)
throw new SocketError('No socket connection found.');
let timer = this.#internal.ratelimit.time;
if (!timer) {
timer = this.#internal.ratelimit.time = setTimeout(() => {
this.#internal.ratelimit.time = null;
}, 6000);
this.#internal.ratelimit.until = Date.now();
}
if (
--this.#internal.ratelimit.left <= 0 &&
![1, 2, 6].includes(data.op)
) {
const error = new SocketError('Socket was hit with a ratelimit');
error.retry_after = this.#internal.ratelimit.until;
return Promise.reject(error);
}
// handle encoding later
this.#connection.send(JSON.stringify(data));
return Promise.resolve();
}
Lovely code
I can easily remove the interval on my set interval when sending a heartbeat
ye I set it to 5
no, but you need to have an id document
So it is uh safe to assume it didn't work
My console got spammed with Sending new Heartbeat...
probably rate limited on discord's end
lel
#send(data: {
op: number;
d: any;
s?: null | number;
t?: string | null;
}) {
if (!this.#connection)
throw new SocketError('No socket connection found.');
let timer = this.#internal.ratelimit.time;
if (!timer) {
timer = this.#internal.ratelimit.time = setTimeout(() => {
this.#internal.ratelimit.time = null;
}, 6000);
this.#internal.ratelimit.until = Date.now();
}
if (
--this.#internal.ratelimit.left <= 0 &&
![1, 2, 6].includes(data.op)
) {
const error = new SocketError('Socket was hit with a ratelimit');
error.retry_after = this.#internal.ratelimit.until;
return Promise.reject(error);
}
// handle encoding later
this.#connection.send(JSON.stringify(data));
return Promise.resolve();
}
tf am I doing wrong
where do you set ratelimit.left? where do yoi decrease it? why is ratelimit.until the current date and not the date + timer?
I decrease it in the if statement
constructor(id: number, client: any) {
super();
this.#internal = {
ratelimit: {
left: 5,
time: null,
until: 0,
},
lastAck: null,
lastHeartbeat: null,
readyAt: null,
sequence: null,
sessionId: null,
heartbeatInterval: null,
heartbeatTimeout: null,
};
this.#connection = null;
Object.defineProperty(this, 'client', {
value: client,
enumerable: true,
configurable: false,
writable: false,
});
}
here is where I set it
and can you add a setTimeout to a Date.now()?
Date.now() + the same number yiu put in the timeout
alright
but yea, I set it there and I decrease this.#internal.ratelimit.left in the second if statement
if(--this.#internal.ratetlimit.left <= 0 && ![1,2,6].includes(data.op){...}
ah didnt notice the --
yea hard to see
I don't see why this shouldn't work though
It decreases the amount left
and I am not doing anything where the op is one of those 3
did you set left back to 5 in the timer?
ah no
discord said they found the issue and are working on a fix
base64 decoding the token was throwing an exception due to incorrect padding, related to the snowflake rollover
Man it takes abnormally long to send my first heartbeat
Also it still is spamming the api
how long? its normal for first heartbeat to take 10-40 seconds
assuming you are using the jitter according to the api
Received Hello. First heartbeat in 33254ms. Heartbeat interval = 41250ms
this is what it said
33s
if you copied the code from my lib then it should be correct
its what the docs say to do
Yea
I am still wondering why it isn't stopping the sending and telling the user they are rate limited tho
๐
first heartbeat should be sent after interval * random float
#send(data: { op: number; d: any; s?: null | number; t?: string | null }) {
if (!this.#connection)
throw new SocketError('No socket connection found.');
let timer = this.#internal.ratelimit.time;
if (!timer) {
timer = this.#internal.ratelimit.time = setTimeout(() => {
this.#internal.ratelimit.time = null;
}, 6000);
this.#internal.ratelimit.until = Date.now() + 60000;
this.#internal.ratelimit.left = 5;
}
if (
--this.#internal.ratelimit.left <= 0 &&
![1, 2, 6].includes(data.op)
) {
const error = new SocketError('Socket was hit with a ratelimit');
error.retry_after = this.#internal.ratelimit.until;
return Promise.reject(error);
}
// handle encoding later
this.#connection.send(JSON.stringify(data));
return Promise.resolve();
}
this is my updated code
I reset left back to 5
Is there anything else I am missing
or is my if statement's logic just wrong
left = 5 should be inside the timer
not outside
you want to reset it after the timer passes
also you added 60000 to until, not 6000
Wait what isnt that what I am doing?
or do you mean inside the set timeout
yes?
What is the best way to do this
export default function getToken(id) {
//encrypt the "id" with a secret key (can be decoded with secret key as well)
return //encryped thing here
}
I want to encrypt a Discord ID to a "token"
and then be able to send it back into another function to get decoded, does anyone know of any tools already for this? I tried crpyot-js but it was adding some randomness to it
What kind of encoding are you looking to do?
You can turn it into a base64 string
or you can encrypt it with the crypto module iirc
if you want encryption, you can use something like aes cypher
but if youre sending via https its redundant because https is already encrypted
wait tim
if (
--this.#internal.ratelimit.left <= 0 &&
![1, 2, 6].includes(data.op)
)
doesn't this tell it that 1,2,6 shouldn't be rate limited?
yes
No wonder the fucking thing isn't working
I am testing the rate limit with sending a heartbeat
heartbeat is ignored by the rate limit
or am I reading this wrong
Heartbeat's opcode is 1 correct?
Ima just remove heartbeat from the array of opcodes
Received Hello. First heartbeat in 10913ms. Heartbeat interval = 41250ms
Sending new Identify Request.
{
v: 10,
user_settings: {},
user: {
verified: true,
username: 'Dungeon',
mfa_enabled: true,
id: '997706195760578621',
flags: 0,
email: null,
discriminator: '0637',
bot: true,
avatar: null
},
session_type: 'normal',
session_id: 'a62a6817561d74814c967845f58caedf',
relationships: [],
private_channels: [],
presences: [],
guilds: [ { unavailable: true, id: '957867801119449109' } ],
guild_join_requests: [],
geo_ordered_rtc_regions: [ 'seattle', 'santa-clara', 'us-west', 'us-south', 'us-central' ],
auth_session_id_hash: '4E20fsvcJ3q0tRFNFB3WYBbg3gjgwpgn0jaX+IX4B2I=',
application: { id: '997706195760578621', flags: 2654208 },
_trace: [
'["gateway-prd-main-8m4c",{"micros":57258,"calls":["discord-sessions-green-prd-2-53",{"micros":54790,"calls"
:["start_session",{"micros":47063,"calls":["discord-api-7dcd4c9d86-hxclx",{"micros":41770,"calls":["get_user",{"
micros":8584},"add_authorized_ip",{"micros":1725},"get_guilds",{"micros":4112},"coros_wait",{"micros":1}]}]},"gu
ilds_connect",{"micros":2,"calls":[]},"presence_connect",{"micros":6385,"calls":[]}]}]}]'
]
}
Ready event fired
Sending new Heartbeat...
Sending new Heartbeat...
Sending new Heartbeat...
C:\Users\dyeaa\Documents\github\misty\typescript\tranquility\dist\ws\WebsocketShard.js:54
const error = new util_1.SocketError('Socket was hit with a ratelimit');
^
SocketError: Socket was hit with a ratelimit
at #send (C:\Users\dyeaa\Documents\github\misty\typescript\tranquility\dist\ws\WebsocketShard.js:54:27)
at Timeout._onTimeout (C:\Users\dyeaa\Documents\github\misty\typescript\tranquility\dist\ws\WebsocketShard.j
s:131:35)
at listOnTimeout (node:internal/timers:564:17)
at process.processTimers (node:internal/timers:507:7) {
retry_after: 1658506461443
}
Well no shit
Tim I am just fucking braindead apparently
lel
could anyone help me find better fonts to use with this?
Current:
- name -> Arial
- attributes & cost -> Staatliches
- description -> Hammersmith One
The bottom is very hard to read
use the same font you did for the name
arial?
aerial
lemme see
tim is it just me or does it seem like this is stopping before it reaches 5 tries
Sending new Heartbeat...
Sending new Heartbeat...
Sending new Heartbeat...
C:\Users\dyeaa\Documents\github\misty\typescript\tranquility\dist\ws\WebsocketShard.js:54
const error = new util_1.SocketError('Socket was hit with a ratelimit');
^
SocketError: Socket was hit with a ratelimit
at #send (C:\Users\dyeaa\Documents\github\misty\typescript\tranquility\dist\ws\WebsocketShard.js:54:27)
at Timeout._onTimeout (C:\Users\dyeaa\Documents\github\misty\typescript\tranquility\dist\ws\WebsocketShard.j
s:131:35)
at listOnTimeout (node:internal/timers:564:17)
at process.processTimers (node:internal/timers:507:7) {
retry_after: 1658506461443
}
Tries sending 3 and stops on the 4th
because ratelimit
Not like it really matters tbh as long as they don't hit the ratelimit
Yes I know it is rate limitting
but they should have 5 tries not 4
identify is likely also being counted
arial is too big
Identify shouldn't be counted
I lose about 10 characters or so
should it?
you are reducing the left value before checking the op type, so everything is counted
lemme try reducing it by 1px and making it bold
depends which limit you want to enforce
if youre gonna go for the official limit, it has to be counted yes
Ima stick to discord's recommendations as much as possible
if you make your limit a bit smaller, you can afford to not count them
I was only thinking it didn't have to be counted cause you only really ever Identify once per session
i made my limit a bit smaller so that there will always be some room reserved for important stuff
mmm well now you are making a valid point here
for example if you send 120 requests and then you need to send a heartbeat before the rate limit resets
the heartbeat will be rate limited
the api limit is 120 per 60s lol
Wait really
plus an adicional limit for presence updates
where can I find the info on rate limits
cause I only see stuff about the rest api
not any gateway rate limits
on the gateway page
I missed that part completely apparently
or I just don't remember reading it
well ty tim
I almost made itt so the spam the api no matter what
kek
xD
๐
open-sans looks fine
at least more readable than hammersmith
maybe I could use the bold variant but idk
?
a
I'm currently migrating my cards to the new system
but adjusting font size to be visible while allowing enough characters is quite hard
especially when the battlefield is huge
battlefield?
What are you making this on?
So it is turn based?
yep
okay good
works just like heartstone or yugioh
that'd be a pain otherwise
I'm actually rewriting it, yk, some sanitization here and there
I am planning on making cards just for visual display
Make it easier to display info on the character
I am going for a dungeon dive rpg bot
nice
don't forget to add a global 10k request limit for all operations
wait what
cloudflare limit
don't remember the exact timeframe
but there's a global 10k request limit before u get ratelimited for a day
that seems like a lot
Is that rest api only or is it also included in the gateway operations
idk
It seems only rest api
receiving status codes of 401, 403, or 429 should be counted to the global ratet limit
IP addresses that make too many invalid HTTP requests are automatically and temporarily restricted from accessing the Discord API. Currently, this limit is 10,000 per 10 minutes. An invalid request is one that results in 401, 403, or 429 statuses.
All applications should make reasonable attempts to avoid making invalid requests. For example:
401 responses are avoided by providing a valid token in the authorization header when required and by stopping further requests after a token becomes invalid
403 responses are avoided by inspecting role or channel permissions and by not making requests that are restricted by such permissions
429 responses are avoided by inspecting the rate limit headers documented above and by not making requests on exhausted buckets until after they have reset. 429 errors returned with X-RateLimit-Scope: shared are not counted against you.
Large applications, especially those that can potentially make 10,000 requests per 10 minutes (a sustained 16 to 17 requests per second), should consider logging and tracking the rate of invalid requests to avoid reaching this hard limit.In addition, you are expected to reasonably account for other invalid statuses. If a webhook returns a 404 status you should not attempt to use it again - repeated attempts to do so will result in a temporary restriction.
I have yet to touch the rest api so no need to worry about that yet
but I will keep it in mind
Is there a good way to to make a vote streak system for daily votes? I don't know where the voter is so idk how to properly check if a vote happened on the next day or if it's still the same day ๐ (since you could vote 2x a day but it shouldn't count towards streak) but maybe it's easier to just count it ยฏ_(ใ)_/ยฏ
store votes for the user in a db
iirc you can only vote every 24h anyway
or is it 12 (can someone confirm?)
Well if you want it to be a daily streak you gotta track votes
2 votes would be 1 days worth but that just sounds dumb way of doing it
also remember to leave some window for the voter
like, if track streaks on 12-hour basis, allow up to 12 hours as a window
so like```
12 - vote (1)
24 - vote (2)
36 - novote (2)
38 - vote (3)
50 - vote (4)
...
tho it's unnecessary if u track daily votes
Doesn't that require them to vote exactly on time?
that's why I said to leave a window
Ah
tbh I think it's cleaner if I just count both votes to the streak
Didn't see that part my bad
like, u can vote twice on a day, so if u make only 1 vote, the streak is broken
I think I'm gonna count every vote and add +1 to the streak for each vote. And I'll give people 36 hours before their streak breaks. That's more chill ๐
36 is too much no?
Well, If I voted in the morning today and want to vote tomorrow in the evening the streak will be lost
so I think I'm even gonna do 48 hours to be on the safe side
ofc people could skip a day then but I don't mind
Is the goal with this just a daily vote tracker basically? Or do the individual votes including if both are done in the same day count?
My original plan was to make it a daily tracker but I couldn't come up with a great way so I'll just count both votes. I think that's fine too.
Can sharded bots still .fetch channels and dm channels?
you should be able to iirc
what kinda songs do yal like
unrelated

goodbye

Thank you โค๏ธ It's been really hard to get advice about this sharding process
I used to have 16 shards on my old bot with only 200 servers 
don't really kno someone told me to shard for better performance n I kinda done a lil too much
the rest api is independent from sharding
you can fetch anything from anywhere
Tim what kinda songs do u listne to?
I don't remember the recommended limit for sharding but I think it is like 1500-2500
I'm curious
1 shard per 1500-2500 servers

Yeah
lately ive been listening to a synthwave radio channel on youtube
That is if you're using djs
you mightt be able to do a bit more with eris
Youโre forced to shard at 2500
Im only at 2600 servers but I have maxed out a single CPU thread
forced?
Yes
Yes
The API forces you to open more gateway connections at 2500 guilds
are you doing music?
Well with the internal sharding feature you don't really have to do anything
Isn't eris a better option when sharding for larger bots tho?
good to know although i doubt my bot will ever even reach 1k at the rate it's growing
it's at 68 I think rn
Mine is at like 35 because I donโt work on it
im using internal sharding with 10k guilds and my cpu usage is pretty low
Mine is at 1 cause I am not done with it
Ah no. just game stuff / image creation/ video/gif creation
popular bot eh
What is the upload limit for bots?
8mb
Is it normal user limit or nitro
normal
sadge
lol will I also have to create separate dbs for each shard cuz I doubt the bot will be happy with 10k servers interacting with 1 enmap 
bots should have nitro perks ngl
Well I think game bots in general are going to be demanding because of all the spam compared to say, a moderation/utility bot
you cant do that
ofc I can
No
no you cant
how can i know what is causing this error?
that pathname thing doesn't exist on my files..
alr
I assume you are using react-router-dom?
yes
i don't think so
sharding is calculated based on guild ids and the number of shards. when you change the numer of shards, all guilds will be recalculated and will not be in the same shards anymore
Show your routes setup
oh I thought guilds stick to their shards
nop

So what happens if a shard goes down
do those guilds in the previous shard move to a new one?
no
those guilds will be down
I got even more confused
It'd have to wait till the shard is reconnected
then they do stick to their shard?
The sharding manager auto-restarts the shards right?
and or re-identified
once started they do iirc

but if you change the number of shards you have they get recalculated like time said
if you have 2 shards with 500 guilds each, if one goes down then those 500 from that shard will be down, until that shard reconnects
if you change to 3 shards, then you have 3 x ~ 330 guilds
so some guilds that were on shards 1 and 2 are now on shard 3
also some that were on shard 2 can go to shard 1, and vice versa
also yoi dont need to connect all shards, and you can use different total shards at the same time
but you will get duplicated guilds if you do that
you can also create a shard that only has 1 guild in it
and guess which guild is it from its id
so its possible to chose which guild
i do that for testing, for example i make a shard that only has my guild in it, so its super fast to connect
It's kinda sad how in the beginning i was taught to never use fetch and only cache.get
and i dont need a test bot token
But fetch also checks cache..?
yep
by default yes
you can use force which makes it skip cache checking and goes straight for the api
Soo... It's unfortunate they taught it that way
Now it is obsolete to get from cache directly tbh
fetch is better as it will check cache first and if it doesn't exist it will go to the api to fetch
the lib was much more cached before
caching is now less connected to the lib, so its easier to control
didn't they used to force cache members and such?
so members were always cached no matter what
they had an option to fetch all members
ah right
Yeah ... ill say something next time I see a new person taught to use cache.get
Funny when I used eris, I always used fetch. But then for d.js, everyone said use cache.get, like fetch wasn't even an option
djs community is a mess
too many people in there, so depending on whos there at the time you will get different answers
Yeah...
sometimes from noobs who think they know it all
But support is soo much better than eris still
yes djs is much bigger than any other js lib
But they did add examples for interaction stuff to the eris github
is abal still the sole dev of eris or does he have a team now?
Even though I was told "no, you don't get any examples. examples are for beginners, and eris is not for beginners"
idk
afaik djs is the only lib maintained by a full team
all other libs are done by sole developers
yeah they tend to overcomplicate stuff
me crying rn
but when I couldn't even get an example for how to make buttons, I switched
how to make buttons in eris?
There's examples on the github now
this?
what can we set as spam parameters .ie how many messages in how much time can be considered as spam ??
by default, discord does not allow more than 5 messages per 5 seconds per channel
Make sure they aren't empty
Wait really?
Oh wait nevermind
That's per user
Thought you were talking about a global limit
I was fixing to question life
Yes, but for bigger bots with a high server count, you can apply for a higher ratelimit
He's talking about user spam
Thatโs a discord limit
I donโt believe your bot is able to bypass that even with higher ratelimits
However interactions are a solution!!
Okay so I have changed the DM functions to fetch
I've set the server count to broadcasteval
Other than the db, that should be it?
When they first vote store the time and date. Then compare it the next time they vote. If its after a day but not after two then its a daily vote and reset time. If its on the same day its not considered a daily vote and doesnโt need to be reset for the time.
Anyone ran (real) sharded bot with sqlite?
i use sqlite on 10k guilds, but i use internal sharding
you shouldnt have any issues running it with the sharding manager
just enable wal mode
and use better-sqlite3
wal mode?
WSL mode m8
write ahead logging
makes writes faster by writing to a separate append-only file instead of the main db file, and also frees the main db file for concurrent reads
@quartz kindle #discord-news message
Has that been your calculation?
I donโt remember any more
Why i use app.delete() it still shows the page
the day when it becomes 19 chars?
Didnโt we bet when you say based on your math skills? 
Didn't he say it would be the 22nd?
gibe mi mรดnoei
Tf
We ate it
with pepperonis and pepsi
so earlyer i had an idea, was messing about with fan speeds on my server and had the watch sensors comand on a terminal. then I thought that if I ran sensors with child_prossess and sent the stdout to discord for a handy host info command to check on my server when im away however it just spits out a bunch of numbers and not actual text when stdout is logged to console. how to i convert the output from raw data to and actual readable format?
Uh guys can somebody help me how to create a normal invite link. And the applications command is necesarry and should I only create 1 or more redirect?
you can set the stream encoding to utf8
or use .toString() on the data packets
stdout
the discord dashboard has an invite generator
std stands for standard, out stands for out/output
same with stderr (exept thats for errors)
that returns info on things
same answer
/tim What is the circumference of ur mother
I know but I give every single permission to the invite link and the the bot is not functioning. I can't even use the commands anymore.
tim bot non-functional
equal to your mother's divided by two
ayo
In the morning the bot was good. But now it wont even show the commands.
i want it so whenever the client is being ratelimited, it runs a kill command (switching its container) -- but this doesn't seem to work:
process.kill(1)
})```
how would i get the stream though? i have no experiance with messing with data streams other than audio
atm im just loging the raw output
mmm thats badly worded
i mean how would i convert it cuz the raw output is the stream im assuming
Okay maybe I wait and try again tomorrow. I can't do anything on the phone.
cool
are you using stdout.on("data"?
yeah
so stdout should have a .setEncoding method
i see
otherwise the data you receive in the data event, you can use .toString() on
mmm ill try that
?
ok nice it worked, cheers tim
bruh are you trying to kill the bot when it gets ratelimited?
the rateLimit event fires when the library protects you from hiting an actual rate limit
its not a real rate limit
oh
also process.kill() just quits node
how would i know when its hitting a 429
it doesnt do anything to tje container
process.kill is not a shell kill
o
process.kill is like doing ctrl+c on node
oh wait nvm, im confusing it with process.exit




