#archive-library-discussion
25085 messages · Page 4 of 26
I just want to point out an issue with User.displayAvatarURL(). If someone has an animated avatar, it still gets a .webp avatar instead of a .gif. Small thing, but I noticed it making an avatar command
not an issue, expected behaviour if you do not provide dynamic: true
this was introduced in a semver minor update, which could not include breaking changes, meaning default had to be the same as before
Oh, ok 
though that being said we could (and probably should) revise that for v13 and let it default to true
I saw that the function was a thing and just used that, I didn't even bother checking the arguments
This used to be the behavior before dyamic was added, fwiw.
https://github.com/discordjs/discord.js/pull/3530/files#diff-1c714d0a8a5ad05fd5427eb604e7666f098bf10ca0105e610a43330c4a5d1e1bL133
waiit, so should it have been defaulted all this time? 
The idea of this option is to be able to specify the non-gif extension, as before it was only webp.
That is poorly worded, I think. Not that I can think of a better way.
yes, but on the other hand if it used to default to display gif if it was animated then shouldn't that behaviour have been there as well after?
Yes
so dynamic = true
No, that would be breaking too.
If you specify webp and not dynamic (or false) it should always be webp (regardles of whether it is animated).
Nothing provided -> webp or gif if animated
extension provided -> always extension
extension and dynamic (true) provided -> extension or gif if animated
If I understood that correctly.
It looks like we lost the first case after introducing it.
aye, that is what i was trying to get to
<Guild>.iconURL() should be gif, if animated, because that's what it was like before and what makes sense (but when introducing this this was changed)
so that commit was a breaking change in minor and a fix for this would be minor? or how does that work
So it is up to us, as usual 
v13 it is i guess, seeing that that should happen soon™️
(esp. keeping in mind that discord will rather likely start introducing the new permissions at some point (as was hinted at with stickers, for example))
Wouldn't that be a rather trivial (although breaking) change?
the v13 thing? ye
bigint bitfields.. bit scared to do that myself, i have no idea how bigints work 
Just BigInt(...), no?
my V8 PR includes a BigInt implementation for the BitFields https://github.com/NotSugden/yeetcord.js/blob/refactor-v8/src/util/BitField.js
UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied parameter is not a User nor a Role.
i think there should be or instead of nor
"nor" is a valid term in the English Grammar: https://www.dictionary.com/browse/nor, and it was meant to sense like that.
oh okay sorry. I am from germany 😄
Was the role#tags thing never merged?
there's not even a discord-api-docs pr for that yet, so it might take a while until it's ready to get merged
Oh, I was under the assumption it was documented, my bad
upstream requirement: https://github.com/discord/discord-api-docs/issues/1537
what do we even want to do about that
would it be ok to release even if it doesn't work in all guilds?
so now users can have both EARLY_VERIFIED_DEVELOPER and VERIFIED_DEVELOPER in <User>.flags.toArray() ?
same for the partnered server owner one
just tested it
don't know if anyone has noticed that already
verified developer is deprecated
you should just switch to relying on the new one
I know but should it be removed?
it will in the next major release, i presume
aswell as DISCORD_PARTNER ?
well, okay, i guess
(ie v13)
Yeah we can't remove things in minor releases
v12.4 seems to bugged when it comes to partial events.
"messageReactionAdd" doesn't work at all for users who are not previously cached.
I've downgraded back to v12.3.1 and it's all working correctly.
Edit:
Looks like someone found the problem. (you need the partial GUILD_MEMBER now):
https://github.com/discordjs/discord.js/issues/4921
If you plan to keep this you might want to note that on the change logs.
If you believe you found a bug please provide a minimal reproducible code sample (plug&play preferable) so we can verify and investigate the issue over on https://github.com/discordjs/discord.js
I dont understand why djs has added cache propriety to all Manager
Well its to get the cache of a manager
It's to get values yes but i think it can be ommited
We can let dev ommit it
It makes sense from a design perspective, .cache to get from the cache
But i think it can be cool to made Manager by default return cache
Exemple: client.guilds return collection of guilds by default
Well if you reallyreally want to do that you can fork discord.js or register your own manager
But thats a stupid decision that only lazy people will take because it's too much effort to add .cache
Now i have explains ly opinion but what is yours ?
(Not only doge)
But thats a stupid decision that only lazy people will take because it's too much effort to add .cache
@left moat in a big bot it can be boring i think
And it permit to peoples who migrated from 11.x to made it easly
c'mon man
It takes like 2 hours at most
The relevant issue explaining the thing a bit further: https://github.com/discordjs/discord.js/issues/3485
In 12.4 channel parent IDs appear to always be null?
On 12.4 I can't find a single channel that has a parent ID
12.2 has them all correct though
Ah, how do I install that, discordjs/discord.js?
ye
Thanks
is there a reason why User#locale exists? its for oauth2 and seems to be always undefined in djs
the property still existing in the library is an oversight
so maybe remove in v13?
Is it undefined for ClientUser too?
yes used to send us for bots, doesn't do that anymore
shouldn't it be null
well it should be en-US
since thats what discord sends
started sending it again?
no point supporting it but ¯_(ツ)_/¯
is that on 12.4 ? @oak quail
waiiit at me is authenticated
@vernal atlas some commit between 12.3.1 and 12.4
ah
on 12.4 its set to null but on <12.4 its undefined 
isn't that technically a breaking change 
even if we want to support it for ClientUser (which imo we shouldnt) it shouldnt be on User
i would be very surprised if that actually manages to break anything lol
yeah i would be too but you never know what type of code someone has 
@oak quail there's a difference between REST get user and the user we get on ready
which is? 
that is news to me
which is missing props
🤣
what the fuck? what props are missing 
locale, for example
ah, so like, the stuff you'd get via oauth identify for a user, that you wouldn't be able to get normally, right?
I think docs need to be updated for <guildMemberUpdate>. It states that this call will be ran when a <user> is also updated, however it does not.
https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=e-guildMemberUpdate
Also emitted when the user's details (e.g. username) change.
i havent seen any mention of it or any PRs (assuming its a problem with the CI script anyway) but the CI seems to be broken 
@ocean wedge it does
well it should
if you can reproduce it not working, make an issue
could this be https://github.com/discordjs/discord.js/issues/4800?
Hey
i find a "bug" (likely)
On version 12.4.x, the shard system is a little broken, and shards themselves do not start if they are disconnected.
On version 12.3.x (specially rolled back) everything works fine. Is this a bug?
Now I don't even know whether to roll back to the old version, or what to do. My bot is quite large.
any more context? does that happen for any reason or randomly? once per day or after 5 minutes from start?
@ornate topaz I deliberately disabled one of the shards in order to test it (so that the all shards are not disabled, but only 1 shard). So I found such a "bug".
soo what exactly did you do?
I also tried to break one of the shards so that it disconnects itself due to an error. The same thing, it did not restart (although respawn: true is set in the ShardingManager parameters).
I manually, through eval, registered disabling the shard (process.exit()). On older versions, it restarted after that, now - no.
did you enable the toggle?
because apparently not doing that can cause the connection to just hang
the guild members intent toggle
the toggle in the dev portal
bot
yeah
intents determine what data discord sends you
partials is a djs thing, not a discord thing
partials was done by djs, intents by discord (entirely different things)
I just tested that config and the debug logs log very clearly that it was closed by Discord with 4014 (Disallowed intent(s)).
So I have no clue why it wasn't logging such.
The process also cleanly (or not, depending on whether the rejection is handled) exits then.
But glad that it's fixed anyway.
no it isnt
partials and intents do completely different things
partials means djs wont drop events if data isnt cached
discord will only send events for the intents you have enabled
voice states
please use support channels if you don't discuss discord.js library development
That bug-report is missing a reproducible code sample. (Something like: https://stackoverflow.com/help/minimal-reproducible-example)
The debug event is working absolutely fine for me in that regard.
@oak quail Are you proposing a top-level option for #reply() to mention the user rather than making people directly specify the allowed_mentions option?
Because message#reply() otherwise follows the standard .send() mechanics of .send(content, options)
So your replied_user PR should already cover it
my pr was to types
yeah i was proposing an option for #reply()
oh
Well I guess it depends, do we just make them specify .reply(content, { allowedMentions: { replyUser: true } })
Cause anything else is essentially a helper option
reply(content, options, boolean)
.reply(content, { replyUser: true }) for ReplyMessageOptions
which is otherwise a direct extension of MessageOptions lol
hmm.. that too is kinda not nice 
.reply(content, { replyUser: true })forReplyMessageOptions
well replyUser doesnt make sense here
that's mixing the options with options it propagates one tier of nesting further down which... seems a bit yucky
putting it in allowed mentions is pretty weird tbh
i mean it is a mention which also needs to be parsed and determined if it should mention, so it does make kinda sense
but fiddling with it and moving it into places where it doesn't belong seems... strange
though i do have to agree that this should probably be documented with at least an info bit and example
also
how would djs behave when theres a mention in the mentions array which isnt in the msg content
i assume it doesnt check the content right?
Message#mentions takes it from the payload
save channels, those are parsed from content
channel_id is now optional on a message reference, meaning the only mandatory field is message_id
You can still only reply to a message within the same guild and channel
If you send channel_id, we will validate it (@meishuu why would anyone do this 🤔 )
- yay
- f

@copper laurel ^
Yeah I uhhh
That refers to a sent one?
So if not provided it assume same channel
yeah
what do you guys think about making guild.owner a promise in v13 and making it fetch the owner instead of get from cache
guild.fetchOwner
is this a bug or something? 
does the bot have admin?
@oak quail yes. Looks like it shows true for admins 
yeah it probably doesn't check if the permission is valid if the member has admin
make a bug report
sure
hm, from what i played around, simply changing order in the return in Permissions.has solves 3 / 5 incorrect true results. Seems like it would need to actually check the flags to solve all cases
@vernal atlas in the v8 update, why not have all bit fields use bigints? why have it inconsistent?
also, the switch to npm ci broke all workflows
all? no
fine
all workflows that use it
Run npm ci
npm ci
shell: /bin/bash -e {0}
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://git@github.com/discordjs/docgen.git
npm ERR!
npm ERR! Warning: Permanently added the RSA host key for IP address '140.82.112.3' to the list of known hosts.
npm ERR! git@github.com: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2020-10-29T09_37_26_682Z-debug.log
Error: Process completed with exit code 1.
@solemn oyster yeah those changes are cool but I think that would be something for an actual new version of djs, like v13 or even v14. removing 'convenience' like that would break a LOT.
That's what this label is for, sir
still
Anything marked as semver: major is to be released in the next major release following semantic versioning's rules, that is, v13 or v14 in our case
oh
I see
yeah in that case I'd fully support this
We can't really break anybody's bots in v12, in fact, my bot updated just fine from v12.3.1 to v12.4.1, not a single error, and that's a huge bot written in maxed strict TypeScript with 57 thousand lines of code.
Not to flex, but it uses almost the entire discord.js interface, and a small change can result on a compiler error, but surprisingly, it didn't this time.
That's because we're using semver (Semantic Versioning), we can't release breaking changes under 12.x.x
alrighty
well then i really have no idea
seems to be more related to the docgen repo than npm ci
since the one i linked doens't touch that
If you ask me, I always found npm ci completely unnecessary
actions cache + yarn completes in milliseconds
wasn't npm ci made to just flat out "restore" from package-lock.json
Yes
instead of building trees etc
But it's still slower than caching node_modules and skipping the entire install step if the lock file is unchanged
@snow crypt i considered that, but then again whats the point in converting it between numbers and bigints if it doesnt need to be converted
Hey
i find a "bug" (likely)
On version 12.4.x, the shard system is a little broken, and shards themselves do not start if they are disconnected.
On version 12.3.x (specially rolled back) everything works fine. Is this a bug?
Now I don't even know whether to roll back to the old version, or what to do. My bot is quite large.
This (<#archive-library-discussion message>) just occured to me also. One of my shards died with no errors or logs about it, and would not restart automatically.
the shard had only been on for ~1h and suddenly died
Even calling ShardClientUtil#respawnAll doesn't respawn that shard
Only thing that brings it back on is restarting the manager
Automatic restarts seem to work fine for me. just ran process.exit on a shard and it cleanly restarted itself
Yeah, the shard had already died when I tried that
Ah, I see the issue on gh
Oh, could you link me?
oh lul what
Oh this is a regression in 12.4.0

where exactly are you pointing to
Oh ew github deeplinks are shit
the undefined being removed from this._exitListener = this._handleExit.bind(this, undefined); ?
yah
i tested that though and it didnt seem to have any effect it being there or not
it definitely does have an effect
w/o it exit codes get passed to _handleExit
w/ it, undefined is passed so the correct respawn bool is used
im confused
const fn = ((param = true) => param).bind(null, undefined);
console.log(fn()); // true, not undefined
yes
thats what was in the comment replying to vlad
thats the behaviour we want
yes but undefined that works the same
it still returns true
undefined was removed
and with undefined it still returns true
except if you call it with a close code
^
im super confused
fn(0)
???
fn2
my dude
oh
class A {
static onExit(respawn = true) {
console.log('should respawn', !!respawn);
}
}
on('exit', A.onExit) // will log false if exit's close code is 0
on('exit', A.onExit.bind(A, undefined)) // will log true since it's defaulted
guess im just an idiot 
see I knew something would break when I asked about the change
but yeah, unless a process exits via an error, a shard wont respawn in 12.4.x at present
creating 2 bugs from the same PR 
2?
yes
Oh was 12.4.1 a regression from that PR too?
f
yes
what the shit is github actions doing
Apparently not working...and it should be working...
i think because it was changed to npm ci its borked
idk i saw someone say that was the issue, but im not sure
no..the git cmd is erroring
even though it shouldn't..
lemme npm i locally
i think i actually made a branch to test around with it but got distracted
ah yeah the lock file is cucked
can you uncuck it
how is it even cucked
yah 2 secs
does my v8 pr just need (extensive) testing now? or is there more i need to add
i'll see if i can test it sometime
looking at the or desc, it's pretty much just drop-in right? no major breaking changes?
Permissions uses bigints and not numbers
so that would be a breaking change there
well yeah but no
since its the internals, the user facing funcs still work the same
Permissions#bitfield is public though
well yeah THAT would be breaking
yeah ik bitfield is a breaking change but like, I doubt many people are using it lol
Directly? Most people fail .has
(obv /s)
Hm
So the current lock file is v2
it would be the only way to check if a role had no permissions right?
I guess I should retain that right
ah someone was using node 15 I see
thats what i use it for
pre node 15 uses v1
Just push updated file
dw about version
Yeah, package.json says node 12+
node 15 with lockfile v2 broke del's gh actions too lol
probs cause actions node is 14 lts by default
options.ws.intents is also removed in favour of options.intents & options.intents is required
so yea def a breaking change
ah, missed that
i should also add an error actually if intents arent passed
what does it do rn
gateway connection error or something?
yeah it just leaves it for the gateway to error
also setPresence and the helpers using it no longer return promises
because there wasnt a need for them to return one anymore
isn't that kinda inconsistent tho
that confused me, are they not API calls?
gateway commands
theres not really anything it waits for
the only reason it was async is so the application could be fetched if you provided assets for the presence
which according to the docs you cant do anymore
only through rpc
that was never possible 🤔
well idk why it was even added then
but theres not really anything it actually waits for so idk what the point is in it returning a promise
Just as an aside, 12.4.x had some nice memory usage improvements (I was running 12.3.1 w/ my message edit limit patched in). No idea what else changed w.r.t to mem usage, but something seems to have done.
12.4 specifically or discords intent changes?
I was using intents prior, so it seems like 12.4 -- the drop in mem usage & the associated annotation is me rolling out 12.4.1 to the bot
that's.. odd
but always welcomed
Hey, using djs 12.4.1, i'm not supposed to have a more complete error thanks to the new async queue? This is after a failed guild.fetchBan(id) (i'm not asking for help, this is a genuine question, because i thought the async queue would give more descriptive error when a promise fails)
DiscordAPIError: Unknown Ban
at RequestHandler.execute (/bot/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at RequestHandler.push (/bot/node_modules/discord.js/src/rest/RequestHandler.js:39:14)```
are you sure you're on v12.4.1? (odd question i know, check the code itself)
looks alright for me
are you sure you're on v12.4.1? (odd question i know, check the code itself)
yep, checked on the node_modules folder...
are you sure your bot is using 12.4.1?
perhaps try evaling / logging require('discord.js').version
well it is in the package.json and on the node_module folder
ok
yep it prints 12.4.1
it is transpiled with babel btw, idk if it changes anything
but i'm not sure if it comes from .fetchBan(id) or .unban(id), because the try/catch is the same for both and... you know i don't have the line ^^
well i can't reproduce this because it being called was a bug anyway, and i fixed it... but it is still weird that it did that
I managed to reproduce it, and yep, still a small stack trace
Same result with Node 14.15.0 and 12.18.3
could it be because the request is being retried?
wdym?
wait was it for me or for the team? 😂
Why does https://discord.js.org/#/docs/main/master/class/GuildChannel?scrollTo=viewable exist ? It doesn't have any sense imo as you can just check if the bot has the VIEW_CHANNEL permission on this channel
That's..the point
We have a bunch of those shortcuts (most are just mere permission checks)
I proposed a getter to know if a channel is set as 'private' with the private icon but it was denied as it is an easy check... Will some getters diseapear in v13 ?
yeah i believe that some of the getters will be removedf
Referring to this: https://github.com/discordjs/discord.js/blob/stable/src/managers/RoleManager.js#L55
Should we remove the id option from RoleManager#fetch? Since under the hood it just grabs from cache if it's there, otherwise just fetches all roles from the guild. This seems misleading, since the doc's description and example make it seem like you're just fetching one role only
@vivid field for your pr (#4935), why don’t you just return the cache itself instead of creating another collection?
because the roles aren't on the cache in case cache is set to false
Good point
that's also what every other manager does 
Is a release gonna be cut soon given the regression fix was merged?
as per usual: no ETA on releases
Will djs 13 provide some mocks or a testing api ?
I would doubt it:
If you are PRing the lib, chances are you are only providing fixes or extending support to a specific endpoint, writing your own tests should be easy enough
no i meant as a djs user, not a djs contributor. To create tests for your bot
because there are some issues that have been opened and provide some snippets but it feels a bit ""cheap"" imo. I would prefer an official API or something, not creating the mocks myself you know https://github.com/discordjs/discord.js/issues/3576
no
@tender field You can try something like this library
https://www.npmjs.com/package/talkback
Unoffical blabla, but it's very useful in recreating behaviour of a 3rd party api (like discord)
thanks
hey, when v13 is coming?
as per usual: no ETA on releases
right, that's how it is
decent ways of implementing pagination will probably be a thing of the far future
Things which exist as complex concepts / multi-step processes (such as pagination) rather than wrapping singular API calls will likely never be a part of discord.js
@oak quail yeah your right, its in there but not in the code
Hi, I have question, when does the v11 will stop working ?
On the guide I says October 2020, but we are in November and my bot stills run on v11 (it's a test bot) 👀
probably sometime in 2021
but people are already having some issues with it
Did discord reschedule domain change?
domain change did happen iirc
Not exactly what i asked about
For now both domains work - that's what i asked about
So most likely in few days, not in 2021
These are the statements, requiring the new domain later this year for third party developers on November the 7th 2020.
While there have been talks about re-directing and keeping discordapp.com alive, that is the public facing information.
In the end: we'll have to wait and see
You definitely should be updating to v12, not only because v11 might break due to the domain change but also because it does not receive new features or bug fixes anymore.
We have moved on from v11, it's an old version, we do not maintain or support it any longer. Please update at your earliest convenience 
Okay I see now.
(PS : As I say it is just a test bot, it doesn't even have commands x))
node 15.1 just dropped and has some interesting new features https://github.com/nodejs/node/releases/tag/v15.1.0
first off is the diagnostics channels, could this change the debug event in the future? djs next?
there's also an event emitter when a child process spawns successfully, maybe relevant to sharding??
Not sure I see the benefit of the diagnostic channel over the existing debug event, unless it happens to be more performant. The spawn event definitely looks useful but again, I'd be hesitant to enforce a minimum Node version of 15.1
why can't the shard resume the connection, if the internet fails, and the connection closes with a 1000 code?
isn't this the point of resuming connections, if the internet fails?
If I normally connect:
[WS => Shard 0] [IDENTIFY] Shard 0/1
[WS => Shard 0] [READY] Session 49b63190f****************** (censored)
[WS => Shard 0] Shard received all its guilds. Marking as fully ready.
if I turn off the network:
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] [CLOSE]
Event Code: 1006
Clean : false
Reason : No reason received
[WS => Shard 0] Clearing the heartbeat interval.
[WS => Shard 0] Session ID is present, attempting an immediate reconnect...
[WS => Shard 0] A connection object was found. Cleaning up before continuing.
State: CLOSED
[WS => Shard 0] [DESTROY]
Close Code : 1000
Reset : false
Emit DESTROYED: false
[WS => Shard 0] WS State: CLOSED
and activate it again after more than 30secs, it doesn't resume the connection, but makes a new identify call, which is very expensive
[WS => Shard 0] [CONNECT]
Gateway : wss://gateway.discord.gg/
Version : 6
Encoding : json
Compression: none
[WS => Shard 0] Setting a HELLO timeout for 20s.
[WS => Shard 0] [CONNECTED] wss://gateway.discord.gg/?v=6&encoding=json in 1489ms
[WS => Shard 0] Clearing the HELLO timeout.
[WS => Shard 0] Setting a heartbeat interval for 41250ms.
[WS => Shard 0] [IDENTIFY] Shard 0/1
...
shards would've been destroyed within 30 seconds, afaik.
because of that, the shard gets destroyed with its sessionID and it does a new identify call (rather than resuming the connection)
is this a bug or a feature?
It looks like the socket closed with 1006 (without close frame), d.js was going to try to reconnect and resume but the socket was closed, so it reconnected and started a new session.
@thorny tree Why do you think starting a new session is expensive?
@surreal geode
because there is a 5s rate limit for identify calls and it needs to build the whole djs structure again
The 5s identify ratelimit applies to resume identify calls, too
The internal d.js structure is already "built" before you log in; the caches are filled but that isn't very expensive
The 5s identify ratelimit applies to resume identify calls, too
@surreal geode no I asked on the offical discord developer, and they said, it doesn't have a rate limit, and I can indeed confirm it after some tests
Huh. Sorry about that. I guess the 5s limit could be a problem but it seems you are only starting a single shard
30 shards reconnect in a few seconds rather than 2,5minutes
(or more extreme: 400 shards reconnect in a few seconds rather than 33minutes)
(at 400 shards you would have higher max concurrency, but that doesn't change much here)
Your session would expire anyways if you don't resume in time
There's like a very short window in which you CAN resume
Hi all. I was looking through the code recently, more specifically the rateLimiting things, and found that (iirc) the ‘rateLimit’ event is called when an event is delayed to avoid ratelimits, rather than when an actual ratelimit is hit - in which case a debug is sent. To me, this seems kind of counterintuitive, and I feel like at least the documentation should clarify this. Is there any particular reason it’s set up this way?
when an event is delayed, you have hit a ratelimit
I can understand that, but I feel like the behaviour should be clarified in some way
There's like a very short window in which you CAN resume
@tacit crypt its more than 5 minutes, so it should be possible to resume all shards in a few seconds
No it's not
Sessions that are DCd last max around 1 minute
Otherwise you'll get an invalid session
wait I'll test it
oh you are right, but a minute should be enough right? @tacit crypt
Without a proper example/test, I don't see how it's a problem
We tried reconnecting with the session ID, failed, so now we're reidentifying since session is aasumed to be expired
why does ClientPresence have all of this when bots can only set name, type, and url
fellas we have got to have a discord js method that implements the formula at https://discord.com/developers/docs/topics/gateway#sharding-sharding-formula
shard_id = (guild_id >> 22) % num_shards
i have the typescript code written and commented n everything
function findShardIDByGuildID(guildID: Snowflake, shardCount: bigint): number
where should i pr this method into
it could make sense to make it a method on Guild, however 99% of the use cases are for finding a shard for a guild where the only data you have is the id
so maybe it should be a static method on Guild or Util or Client???
fellas we have got to have a discord js method that implements the formula ...
no..? we.. don't?
you never specified the need for it 🤔
if you want to find what shard a guild is on you can simply use an if condition inside of broadcastEval
this isn't really particularly useful besides avoiding the use of broadcast and just running the code straight on the target shard (if that's even possible atm)
and I see no need for it inside the library itself.
ok imagine this
imagine i'm mee6 and for whatever reason i'm using discord.js to run my 8660 shards
now imagine im caching data in redis that uses the guild and shard id
now every time i want to fetch that data execute 8660 eval statements to find the 1 shard that matters
this is literally a thing mee6 does, only not with discord.js
it makes sense for the discord library to implement the formula discord gives us to use the discord api
You could just create the function yourself?
i did
Given how it's so simple
and i am offering to PR it
it is easy to make mistakes in the implementation
you could argue that everyone could make their own discord api wrapper and discord.js doesnt need to exist but that is stupid
we are here to make the discord api more accesible to javascript developers
why not make this formula part of that
The purpose of the library is to interact with the api. Using the formula doesn't do that in any way
and yet it is listed on the discord api docs
discordjs has methods for escaping markdown, that isnt api related
is it even really your place to decide if this should or shouldnt be in the library
just tell me where to put the function, i'll pr it, and someone will approve or reject it
ShardClientUtil or the general purpose Util 
i personally feel like the first represents the area of use better
though i'm unsure i understand the use case. if i'm not mistaken (possible, i'm not very involved in sharding internals) you'll need to #broadcastEval it anyways and returning if a guild is on the respective shard or by applying a formula doesn't seem to make much of a difference
the use case is to remove the need to evaluate code on all your shards
it uses a formula thats the inverse of what discord uses for sharding (not big bot sharding)
i understand that. the question is: do we even allow to address a single shard at this time
ehhhh not easily
but having the function in whatever util class would be good
its simple enough its like 20 lines to implement, 20 lines to test, and then forget it forever
ooh and 1 use real world use case i actually have for this is to see how many guilds each shard is allocated for me, where my bot uses each cpu core to handle a bunch of shard IDs
So, I was working on my bot today and when going to test the messageReactionAdd and messageReactionRemove event portion of the code, i am not getting anything that would suggest this event firing. This event has been working for over a month and then all of a sudden stopped working.
I am using partials to grab the message that wasn't cached but the important fact is i am not seeing a console output that i specifically placed at the top of the function. Any ideas what could be causing this?
Bug:
• MessageReactionAdd does not fire despite proper partials enabled
PR in the works,
Temporary fix is to ensure the addition of GUILD_MEMBER partial in the client definition
new Discord.Client({ partials: ['USER', 'GUILD_MEMBER', 'CHANNEL', 'MESSAGE', 'REACTION'] });
(copy from #769862166131245066)
How long has this been going on, because this is the first i have seen this?
Is this bug due to discord changes or is this specifically a Discord.js bug?
Ok, that makes sense! Yeah, probably should too. Thanks for the info. I just found the discord after searching the net for this issue. IS this going be the best place for announcement and changes?
well yes, this is our (discord.js) discord server
Yeah, I just looking or the place where I will get the announcements first. Some API devs like their website to be the front page, others like GitLab or GitHub. I work in the industry, so was just curious where the best place to go is. I appreciate the help!
btw, I think you all are doing a stand up job with Discord.Js...keep up the hard work!!
GitHub is where the issues and new features will be discussed, if we spot things happening regularly in support they'll go into #769862166131245066 , feature releases happen in #announcements
both you can follow if you prefer to get notified on your own server 
btw re the sharding formula, I use it sometimes to see what shard a guild is on when the bot is offline in it
that too
There isn't currently a way to broadcast to a single shard, but that seems like it'd be a super useful change
Will take a look shortly
I have come across a very weird issue i think it;s djs issue.
the clientOption for fetchAllMember get timeout even when server member intent is enabled and bot is in 600 servers with 100K members
to test it properly i tried manually adding all intent double check server member intent
tried on different vps too
this is the error u will get: https://sourceb.in/nZ3b0Nvszj
make sure to on warn and debug event to see it
once it timedout the client will go in ready state but no commands will work
🤔 The websocket is closing
yes which should not be happening
So you're using intents and you have server member intents enabled in the dev portal?
yes
and whats your intent bitfield?
i am using flags: 'GUILDS','GUILD_MEMBERS','GUILD_MESSAGES','GUILD_MESSAGE_REACTIONS'
fetchAllMembers:true,
ws: { intents: ['GUILDS','GUILD_MEMBERS','GUILD_MESSAGES','GUILD_MESSAGE_REACTIONS'] }
});```
d.js version?
12.4.1
ALSO, I'm pretty sure, on recent versions, it was moved outside of ws
Intents doesn't take strings?
It takes a bitfield
it does
oh
🤔
that too
also this is less lib discussion and more djs-help but I'll give you a pass
You forgot the constructor for the Intents class
ws: {
intents: (new Intents()).add(
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MEMBERS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
),
},
new Intents([])```*
you can use an array of strings
I do
what...
vlad, pls
- no, 12.4.1 is still under the ws key
I thought we moved it what
oh
new Intents()is exactly equal tonew Intents(template)where template is an Intentsresolvable representing 0 (including empty array)- ws > intents https://discord.js.org/#/docs/main/stable/typedef/WebsocketOptions takes https://discord.js.org/#/docs/main/stable/typedef/IntentsResolvable can be IntentsResolvable[], can be flag => can be array of flags
Nice, TIL it can take strings
@wide sand Long story short, ws: { intents: new Intents(['GUILDS','GUILD_MEMBERS','GUILD_MESSAGES','GUILD_MESSAGE_REACTIONS']) }
No..thats fine
Doesn't NEED new Intents
since we resolve them
Well.. leaving aside that (@unique axle wasn't it a PR for moving intents up), it should work... Can you log client.options.ws.intents after you create the client instance (aka before logging in)?
tried that too before
Can you log client.options.ws.intents
that one - on the other hand currently doesn't work
Oh wait, does intents itself get resolved too?
same this:
Error [GUILD_MEMBERS_TIMEOUT]: Members didn't arrive in time.
at /root/Node Apps/Menhera Chan/node_modules/discord.js/src/managers/GuildMemberManager.js:317:16
at Timeout._onTimeout (/root/Node Apps/Menhera Chan/node_modules/discord.js/src/client/BaseClient.js:83:7)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
yes, Matt
So much resolving
it works fine for bot that is small in less number of server. but don't for slightly bigger bot. this error i am getting is in 600 server bot
with 100K members
so it's djs issue?
It seems like the library gives a guild 120s to return some members, or that error is thrown
Which feels like it should be given a setting
But also from your logs the WS was dying, so the timeout doesn't seem to be the issue
I assume if you disable fetchAllMembers the bot starts fine without the WS dying?
yes
if fetchAllMember is false(default) bot starts just fine
but when it's set to true the WS closes
and get timeout
so there is no solution right now?
I defer to someone who knows the internals of intents better than I
My only suggestion would be, as the docs note, to avoid using the fetchAllMembers client option
but then i can't cache all members and members.fetch takes time
when the server is huge
you should avoid caching all members
Why does Message#member returns null even if the message is sent in a guild ? Why doesn't it return a partial member if it can't find it ?
it searches the cache for the member, and if it's not found it returns null
This is also technically a question, and belongs in a help channel, not here
I'm talking about how the library behavior that seems weird imo
why doesn't it add automatically the member to the cache if it can't find it (at its creation) ?
With new intents if you disable guild members intents Message#member will be null if you don't fetch it, it's a problem imo
Imo it'd make sense for it to return a partial
Then you'd have to have a partial guild member in the cache
Message#member is a getter
which retrieves from the cache
It is not a problem
I'll make a PR
There already is one regarding that
oops didn't see it
sry
Am I going mad cause I don't see it, unless it was already merged
Yeah, that doesn't actually ensure Message#member can be a partial
Just does a better job of populating the cache with partials
Incoming members from the message payload are already being taken care of: https://github.com/discordjs/discord.js/blob/master/src/structures/Message.js#L195-L199
Right, but if the member/user had since been purged, Message#member will return null, not a partial, I think?
Message itself could store the raw ID, and could then repopulate the partial when Message#member is called
Which feels like it should be given a setting
It is
It seems like the library gives a guild 120s to return some members, or that error is thrown
We refresh the timeout every time we get a GUILD_MEMBERS_CHUNK payload
As for WHY it errors... I don't know...Make triple sure your d.js is at the version you said, try different bot tokens, etc
Which feels like it should be given a setting
It is
https://github.com/discordjs/discord.js/blob/master/src/client/websocket/handlers/GUILD_CREATE.js#L12-L16 no setting, uses the default 120s
doesn't mean we don't provide the option to change it and let's be honest... if payloads don't come in 120 seconds.. We have an issue
Yeah, agreed it shouldn't affect anything, but there isn't a setting for it 😛
ALSO
peculiar notice
..are..we..
double requesting all members
double requesting all members
@tacit crypt Where?
(that wasn't the pr i was talking about btw)
I mean the error Chota reported comes from the WS manager
oh
my god
I think we are
GUILD_MEMBERS_TIMEOUT emits from https://github.com/discordjs/discord.js/blob/master/src/managers/GuildMemberManager.js#L317
No
Not that
look at the prefix
[WS => Manager]
I
..I have some testing to do but I think we're double fetching members
Oh you're totally right we are
wait no
I'm actually a bot
client.ws.status === Status.READY
n v m
is status not ready during the initial fetching?
nop
it's set to NEARLY
Ah yes ic
It..should..work tho
I do this in @signal lintel for now, I'm planning on changing that asap
Are there any situations where you physically cannot request all members from a guild
yeah, if you don't have the guild_members intent
or.. y'know, verified bot without it
@tacit crypt i have guildmember intent enabled and my bot is 600 servers
i tried the same in small bot it worked in that
didn't timeout at all
but in big bot it timedout
are you 100% sure you're on 12.4.1? Some caching issues can cause that
yes
i updated today itself
Oddd
"discord.js": "^12.4.1",
i checked pakage.json just now
to make sure once again
@tacit crypt its gonna be moved out of ws in v13
would be breaking to move it in 12
well yes but no if you just deprecate the ws one
yeah you can add it to top level client options without removing ws
DJs is using V6 right
v7 technically, same API spec as v6 but with better errors
Aah
So it can be added outside ws in current djs version
Or wait till v13 comes out
that has nothing to do with the API itself
We can provide the ability to receive the options wherever we like
Just cant remove the existing placements until v13 because thats breaking changes
unless - horror ensues - we accept both 
- that being said, still not sure i'm personally a fan of moving this specific one at all
I agree, I think it makes sense to keep it inline with the ws section
Given how that's what it affects - the websocket
normally everything the library parses is up in ClientOptions and http and ws are only for advanced settings that are sent directly to discord without modification, which aren't meant for normal users
the planned rewrite to typescript (no release version/roadmap/date estimate, own repository at discordjs/discord.js-next) is planned to be much less monolithic, swapping out cache provider/rest/gateway for own extensions/implementations will be much easier - however no reason for great excitement, it's in a pre-planning phase (very very very early)

👍
I hope you plan on making your event methods easier to work with aswell, I had to go through so much shit to get custom events as a keyof interface in typescript
Extending ClientEvents is "so much shit"?
declare module 'discord.js' {
export interface ClientEvents {
myCoolEvent: [User, WoahAClassOfMineOwO, SoujiIsSuperCute, BlameVlad];
}
}```
that is not so much shit, it's do it once and call it a day
I had so many issues doing that tho
such as?
Within typings of the library, as of 12.4.1, options are mandatory for methods like reply, send or edit. How come that is so? Back in 12.2.0 they were able to be undefined. Why exactly was this change made and how much difference would changing them back to be able to be undefined bring?
Mandatory?
One sec.
Mandatory as unable to be undefined. My bad.
So you say that it screams at you for not passing them to methods?
Yes, for my own overwrites of those methods https://bug-hunters.me/399624330268508160/aab2f7.png
Which used to work in 12.2.0.
Because this is how things looked like in that version of d.js https://bug-hunters.me/399624330268508160/d6fa1c.png
I'm just confused.
The first typing in that list does not have/require options, therefore there is an overload where they arent required
Alright. Still don't understand the desperate need to not make those optional for sake of edge cases but okay. I'm sorry for being irrational or annoying.
...but they are optional
Doesn't look optional in these bottom typings #archive-library-discussion message
Yes, I see the top one that solely has content as argument, I'm aware of it.
But I still think these bottom ones would be nice as optional.
Avoiding a scenario like this whole check https://bug-hunters.me/399624330268508160/40c530.png
You seem to not understand how method overloads work
Okay, credit to @ornate topaz for pointing this out to me, you (and I) were mistaking "optional" for undefined
The overloads do not explicitly support passing undefined in place of an optional parameter, because undefined isnt one of the accepted typings for that field if optionally provided
I messed up testing that with eval because JS doesnt care of course
Only TS does
Yes I kind of mess the two up sometimes during talking but I see now.
As did I, so apologies for being stubborn haha
All good, but guess that clears everything up.
@wispy forum you need to somehow port all overloads those methods have, and then you can do options as any
While any is disgusting to use, it can be used to tell TypeScript that the data is fine
Yeah, there's a lot of times when handling types looks really ugly but has to do the trick ig
So yeah, your issue isn't about it being potentially undefined
But rather about you passing all possible overloads to an overloaded method
I see that now.
TS can't match all the overloads we have as a single one, so that's where this kind of issues happen
bump to this issue https://github.com/discordjs/discord.js/issues/4287
the channel is for discussion, if you have nothing additional to add to the issue that requires discussion refrain from bumping, thanks. We really don't need this to become bump central.
should these error codes be added into djs? i think they're all for store-related things that djs doesn't even have
as well as, should these error codes be removed since they can't be obtained?
Didnt stores die
the store channels did yea
idk if the whole thing went with it
not sure what to name this one, ACCOUNT_VERIFICATION_REQUIRED maybe ?
same for this one, best i came up with is CANNOT_DELETE_COMMUNITY_REQUIRED_CHANNEL but feels a bit too long
the store channels did yea
@vernal atlas no
store channels still exist lol
only the centralized store and nitro games died
ah
but feels a bit too long
RESTPostOAuth2AccessTokenWithBotAndGuildsAndWebhookIncomingScopeResult
CannotDeleteChannelRequiredForCommunityGuilds

https://github.com/discordjs/discord.js/issues/5011 🤔 locked but left open?
Oh right, forgot about that
<Guild>.members.fetch() doesn't seem to work anymore with the new intent requirements ( without guild members ), but the error doesn't seem straightforward and the error page in the guide doesn't mention the intent is needed
You can't fetch members without the members intent, I feel that's pretty obvious, no?
The error is actually an internal timeout, Discord (probably) just ignores the request.
Since there is no way to always know what intents are present (read: you can omit them on gw6, what we use), we couldn't reliably throw an error here.
Not until v13, then we surely can.
couldn't you check <Client>.options.intents ?
oh wait- this is for existing v12
since WebSocketManager is a custom implementation, where is the ws package used?
/src/WebSocket.js, which then is used in /src/client/voice/networking/VoiceWebSocket.js, and src/client/WebSocket/WebSocketShard.js.
oh right, i forgot that each shard has its own ws connection, thanks
Just as an aside, 12.4.x had some nice memory usage improvements (I was running 12.3.1 w/ my message edit limit patched in). No idea what else changed w.r.t to mem usage, but something seems to have done.
@vagrant holly Just to follow up on this, definitely looks like a leak got fixed. No idea what or where, but since updating d.js my memory usage no longer creeps.
are you sure it wasn't the message edits?
Nah I was on a hotfix branch with my PR merged before
Cause that was causing me to oom
why does collection allow a thisArg? what's the difference between collection.find(fn, myCoolObject) and collection.find(fn.bind(myCoolObject))?
arrow functions can't be bound, the same parameter exists on standard js functions
but neither works for arrow functions 
consistency with array methods?
^
why do we have seemingly useless properties such as <Guild>.ownerID even though we have <Guild>.owner? Is this just for ease of use or is there a valid reason? I understand Discord supplies only the owner_id and DJS works out the owner's guildmember object itself but would it not make more sense to have one or the other instead of both?
i feel like just having ownerID would be sufficient
Guild#owner is a getter for this.members.cache.get(this.ownerID)
yes i've seen which is why i kind've see it as useless, the user could simply get the owner with the ID instead of needing two properties for this
They could, but thats also the purpose of getters
I could make the same argument that message.channel shouldnt exist and we should just have message.channelID
true, but if you make that argument:
we could just have <Guild>.owner instead of <Guild>.ownerID
But GuildMembers are not always cached, making ownerID the valid property here
ah
yeah
alright thanks for clearing that up
Which is why <Guild>.owner can be null (getters return null if they cant resolve the data) and thats when the user needs to fetch via ownerID
This issue became significantly more present due to intents
Has the possibility of moving convenience getters like this to their own package in next been considered? Recall someone mentioning it in the past
i feel like removing these types of features has been discussed
thats why i brought it up
and yes intents seem to complicate this sort of thing, guess that adds more reason for the getter
@frank turret their own package? why?
Well that was an example of some method of separating them so the whole conversation of "why do we have X convenience method when a person can just do Y”
yeah i guess we have to find a middle ground
on one hand some developers don't need these methods at all since they know what they are doing (more or less)
on the other changes like this would break lots of people's code, and new developers may find it difficult to wrap their head around the change
although in my opinion if we're going to remove/change conveniences like this we should do it all at once in a major release to get it over with
Removal of a property is semver major so yes
yeah ik, but as in remove all the convenience methods at once, not just remove one or two
that would just confuse people more
I mean.. considering Discord seems to point at serverless and go: this please; I think we should replace a bunch of getters with fetch<X>
Er, stateless
Close enough
Conceptually agreed, but I feel like there are already other solutions for that and discord.js really is the caching model
I believe what nico is referring to is removing stuff like GuildChannel#viewable, the basic permission checks that the user can very easily implement
How are message replies represented in the API/library?
?replies
Discord.js will support inline replies in v13, replacing Message#reply with the new functionality.
If you'd like to try out the feature ahead of time (in a server with it enabled), please install and test this PR: https://github.com/discordjs/discord.js/pull/4874
You can e.g. use NPM to do this: npm i discordjs/discord.js#pull/4874/head (this requires git to be added to PATH)
Like these^
If I enable the mention while replying, then the bot detects the mention in the message.mentions object which breaks a few commands
Okie
Yeah that correct, Discord sends it as a mention. You should be able to check message#reference in 12.4.1 to see if it's a reply
Discord reused the same property crossposts do, so we already support that
Oh, Okie 👍🏻
How are we looking on d.js v13 (specifically the REST package)?
see above
isn't Guild#voice an inferior shortcut for Guild#me#voice? I'm not sure if that's any better to obtain the VoiceState from the Guild#voiceStates (GuildMember#voice does the same there but with a better approach)
@oak quail any update on https://github.com/discordjs/discord-api-types/pull/25 ?
oh, i asked aj something about that and forgot to finish it after he responded, i'll do it now
ok there
Any news on this? It's started occuring again
Because I see the PR was merged yet it still happened
On 12.5 too
Why can't inline replies be added to v12?
because anything that's marked as semver:major goes to the next major releases according to the semantic versioning's rules (https://semver.org/#semantic-versioning-specification-semver). you're still fully free to test it out, install the PR: https://github.com/discordjs/discord.js/pull/4874
they can, but they shouldn't
that can cause confusion
currently message.reply sends a message with a mention, but the name reply suggests that it is the discord reply feature, and calling it discordReply or anything similar is just- no
My PR was Message#inlineReply at one point, and Souji had done one to remove Message#reply in v13
But we decided just to merge the two and make it a v13 release
hi, after the discord.js v13 library exits, will i be able to use discord.js v12 without bot verification?
sorry, my english is not perfect
Bot verification is pretty much unrelated to libraries, as long as v12 is working, you will be able to use it. (Whether its recommend is another thing though)
Do you have any steps to reproduce that, or the like?
A friend told me that I will be able to use the discord.js v12 library until June, after June I need a verified bot to be able to use it
@real jetty tłumacz sie
No, I am not aware of such a thing, especially since verification is only available after your bot is in 76 guilds.
what
I hope discord.js v12 can still be used after June.
@unique temple discord.js v12 will stop working sometime next year
it has nothing to do with whether your bot is verified or not
but updating to v13 will probably not be hard
How will v12 break? Aren't you confusing it with v11?
Oh, wait, api v7
Nvm me
There was more info in my original messages, but it's not any particular cause that I've found; a shard suddenly just dies and doesn't respawn
I'll try something out in a few hours that could find a cause, but can't atm
V4 said that the original issue was caused by a process aborting, not exiting. And the manager would then not restart that
The regression that caused this was fixed in 12.5
https://github.com/discordjs/discord.js/compare/12.3.1...12.5.0#diff-75a4f785c550209a707697c399a87938fad288bbd1c571614808ed8c08edbd04 there are very few changes on Shard between 12.3.1 and 12.5.0, so I'm pretty sure the regression in 12.4.x was fixed
^ just tested on 12.4.1 & 12.5.0, a shard respawns on 12.5.0 when process.exit() is called where it wouldn't on 12.4.1, so I'm confident in saying its fixrd
One of my shards died and was off for 15 hours this morning until I restarted the manager
Hmm, quick question, why is publicUpdatesChannel read-only but publicUpdatesChannelID not?
because publicUpdatesChannelID is a property sent from discord, whereas publicUpdatesChannel is just a getter which returns the channel with that id from the channel cache
Ahh, I see. Thank you
So then i guess that answers the question I was about to ask, "why is it publicUpdatesChannel and not modUpdatesChannel or something", because that's the property name sent from Discord?
correct, most stuff is named according to the discord api
Are you on 12.5.0? Do you have the manager set to respawn dead shards? Did the manager detect the death at all?
Yes, Yes (that's the default), my logs say this (using the posting as that indicates the known guild count)
DATA: [354, 325, 349, 313, 351, 338, 0, 322, 332, 320, 329, 352]
[1d 5m 12.4s ago] - SHARD_RESUME
SHARD: 6
[1d 5m 12.7s ago] - SHARD_RECONNECTING
SHARD: 6
[1d 18m 7.1s ago] - POSTING BLAPI
DATA: [354, 325, 349, 313, 351, 338, 366, 322, 331, 320, 329, 352]```
and I fetch those values via bot.shard.broadcastEval('this.uptime ? this.guilds.cache.size : 0')
so the shard is alive then
broadcastEval will throw if the shard is dead
but apparently not logged in
okay so this is an unrelated bug to before
So you never see a death event in your logs?
I wasn't aware there was a death event
on manager there's only shardCreate
and there's obviously not one on client
Yeah so on shardCreate you then bind to shard events
shard death will trigger a respawn
I do listen to that, no ready events were logged in that time
I'm confused, do you listen for shard death?
only shard ready
Ah right
I'd suggesting listening for shard death/disconnect in your manager
and seeing what you get back
this feels more like some sort of disconnect issue rather that outright shard death
Oh I didn't notice those extra events on the shard
yeah, will do
oh I already listen for disconnect actually (which I've not had since my logs began)
just not death
Added that now. Other than that is there anything you can recommend?
Honestly not, never seen this before in my experience
right now the methods for banning and kicking members/users accept options in 2 ways:
// kicking:
member.kick(reason?: string)
// banning:
member.ban(options?: { reason?: string, days?: number });
would it make sense to have the kick methods also accept an object for options, so that it's easier to reuse code to ban/kick someone and pass a reason?
not in my opinion
Well, that would make sense only if the object would take more than one param. Kick only has one param you can pass in
the way it is is fine imo
yea because of this, its not needed
just following up on @oak quail's question in https://github.com/discordjs/discord.js/pull/4990, it would make sense for User#system to be treated in the same way as User#bot, would it not?
i addressed this in PR #4718 however that was considered semver major, however changes with partials mean this would now be considered semver patch, correct?
How is that major? It's just adding a feature in a backwards compatible way
you could read a few messages below that and as well read the PR description
Have there been any discussions on the github about inlining the documentation in the type definitions? I looked but could not find any.
Disconnecting the docs from the source seems like an odd move imo. When I’m working on the lib source, having all the jsdoc right there is rather helpful
tbh it would be useful to have it in the types
having it in the source is nice for lib devs but having it in the types is much more useful for users
Agreed, but we could probably rig up a system to mirror it.
Like if we include docs links for each method in the typing, we could probably use a small script to populate the comments in the typing
ig
at that point, typings could probably just all be handled automatically?
Not quite. The typeings in TS are much more precise than what is in the jsdoc.
yeah generating the types from the jsdoc would either make the typings inaccurate or the jsdoc super wack
Im not sure what you're looking to achieve here?
Having the docs appear with Intellisense?
@copper laurel yeah like this https://advaith.is-in-hyper.space/c9dcf2b7c8.png
Was decided against because we don't want to maintain two sets of docs
Worth looking into if it can be automated.
If it wasn't said before, that issue will be solved with -next owo
correct me if i'm wrong but, can breaking changes be performed to the voice aspect of discord.js since it depends on @discordjs/opus which doesn't have a defined public api (basically it doesn't have a v1 yet)
No
Semantic versioning is a human thing, there are no technicalities with it, even if you could do that -- it would be very rude.
What means typing count in this method ?
Internally there is counter, while the counter is greater than one, typing will be sent to the channel
so stopTyping needs to be called counter times to actually stop the typing
(e.g. if you use startTyping when a user runs a command, and use stopTyping when the command executes, the counter allows for two commands to be run at the same time in the channel and not break that typing effect)
So when you call startTyping, you can increment that counter by a custom count if you want. So you could pass 2, and then you'd need to call stopTyping twice to actually stop that typing (or use the force flag)
Okay I see I see, thanks for explanation, and it should be more precise in the description in the doc !
Imo its a pretty weird edge case to need to use the count arg, so having more detailed docs might confuse folks into thinking they might actually need to use it more usually
But feel free to create an issue if you want, to log the request for the docs to be improved 👍
are djs' caching issues gonna be addressed in future versions
like the reason djs-light exists
the only thing that lib does is disable caching. It's not an issue that we do what Discord used to tell everyone (aka cache stuff). If the question would be like are there plans on changing how caching works in the future, then the answer can become, say, maybe, or depends or idk
If you have specific caches that are causing you issues, please do say, I'm always looking to add settings to reduce those
But you can just manually sweep most things yourself and D.js will keep working for the most part, esp. if you've got partials enabled
^
right thanks
its just its not very feasible to run djs on large bots, atleast for me with subpar hosting
Sure there is..
What do you consider "big"?
it's called sweeping
a server bot i ran in heroku on one server with 220k members couldnt handle it
it had intents disabled
my other bot reaching 600 servers runs smoothly rn so thats nice
In highlight, I sweep a bunch of things and the bot works just fine
, with little memory too! Course, if there's any cache you notice that eats up a LOT of ram compared to the rest, let us know, preferably with heap dumps
right
Manually sweeping members + users will probably help you in that situation (plus ensuring you're not fetching all on boot etc.)
yeah im not, currently i upscaled the hosts to fix it
using just intents you NEED is also a huge improvement
i turned off all privileged intents too
so then your bot did nothing?
I might look at adding some sort of options into D.js for sweeping users/members, I wonder what folks would think of that
yeah that would be nice too
Eh, I'd rather at that point we get some configurable caches instead of piece by piece
my bot worked when i increased its allocated ram
configurable cache is also nice
If your intents array was empty, then your bot did nothing
if you didn't specify intents, it means you just get all events
does d.js-next plan on allowing us to use our own caching structures? Like if i wanted to use redis for the cache
sorry i mean privileged intents
GUILD_MEMBERS and GUILD_PRESENCES are.. 
depending on each guild, TYPING_START is nightmare, VOICE_STATE_UPDATES, etc
ok
i dont need any voice stuff
ill look into that thanks mate
Discord.js should go back to what it was before datastores and managers, the high level API it exposed made sense, it just needed to be refactored. DataStores broke every basic rule of software design, Managers tried to correct it, but left us with inconsistencies in the API. To me, there doesn't seem to be a good argument for something like channel.messages.fetch over channel.fetchMessage. Just because you replace multiple word methods with multiple single-word object fields doesn't make it better or "more object-oriented".
Slight tangent, but most of the problems caused by bad design could be somewhat mitigated if the library allowed for easy dependency injection through constructors (or some kind of IoC container). This would do away with things like cacheType, cacheOptions, Structures.extend etc which are all ad hoc fixes to the current dependency injection situation.
Just some thoughts I've had for a while...
Short answer: yes.
Long answer: Not quite, no.
You said yourself that Managers adjusted for the shortcomings that DataStores have, but on the same page you say theres no good argument over them? That seems to contradict yourself.
Overall you are not wrong when it comes to dependency injection, but this is far from a "simple" change. It takes quite some time to implement that or even do it correctly.
And even if we do it, there would also be no "going back" to the old structure. With correctly applied DI it would look somewhat similar to what we have now still, just not as inconsistent.
I'm saying there is no good argument for the current API (that uses managers), over the API that v11 exposed (which didn't have managers or datastores). DataStores tried to separate the responsibilities of the old ClientDataManager, but they also changed the API (e.g. channel.messages.fetch) without good reasoning, this side effect resulted in managers to once again separate cache and Discord API calls, v11 already had this separation. Now we are left with things like channel.messages.cache, channel.messages.fetch alongside channel.fetchInvites, which is inconsistent and clunky. Whereas if we stuck with the v11 style we would have channel.messages for the cache, and we would have consistency with API calls like channel.fetchMessage, channel.fetchInvites etc.
Managers adjusted for the some of the shortcomings of DataStores, but not all of them.
Yeah there is enough good arguments. And all of them are listed in the issue that eventually led to managers. If you just completely overlook those for the sake of your "more words bad" argument then I don't know how I else I can help you understand.
The more "oop-ey" approach was not the motivation at all here.
Imo, $0.02, having methods that affect cache inside a manager instead of the parent model is cleaner. Yes, it leads to some inconsistency with model methods that don't have a cache, but I think it provides a clear separation between methods touching cache and those that don't.
Managers adjusted for the some of the shortcomings of DataStores, but not all of them.
And that exactly was the whole point. There is not really any "fixing it all" with the current iterations without a complete rewrite of how the system works. Which would be immensely more time consuming on top of all possible bugs this could introduce. So we are not only talking a new major version increase but also one that has a very high risk associated to it.
I don't know how you write software, whether that be hobby-wise or professionally, but since this is mostly a non-profit open source project you can or rather don't want to take such risks if you are aware that it could lead to hundreds or more hours you need to put into "fixing" while you already pushed it to users out there to use but its in a complete broken state.
There is a huge component that influences all decisions we make that isnt just "writing code" at the end of the day here. Writing code is maybe 30-40% if at all.
I did read the original issue, it lists DI as one of its benefits, but there are other ways of doing DI that would have worked with the old API, its not unique to managers. It also lists separating cache and API as a benefit, but reverting also has this effect. It also says that one of the main reasons is that the data store API is more fluent than the v11 API (the more words bad argument), which is what I disagree with.
I think the risk of removing Managers would be similar to the risk of adding DataStores, which admittedly took a long time if I recall but it did happen eventually, so I would say its possible without a complete rewrite. DI was more of an afterthought I had, that would definitely need a complete re-write (probably in TypeScript) for it to be solid and not hacky.
Feel free to open a PR if you think its the same risk and effort.
The reason Mangers took that long was simply because no one worked on it for a long time, not because it actually did take a long time.
It's also worth pointing out here that DataStores were never released. They were never in v11, and they weren't in 12.0.0
Thoughts on having separate partial events that you could specify in clientOptions? ,
partials will only fire in the events specified in that option so that we dont need to do if(class.partial ) return for all the other events if we decide to use partials
eh
do you mean different events for partial data or selecting which events the client would emit if the data provided is partial
same event, if you enable partialEvents, it only fires partialData if that event is enabled
if you dont give any partial events it doesnt affect anything
say I only want partial data for the reaction event
right now i have to go to each event and add if(partial) return
and use it only in reactionEvent
I can submit a pr if this is a good idea
could use client.ws.on to get the raw MESSAGE_REACTION_ADD event
guess i could
no thanks, the events emitting raw WS data exist on Client#ws
as documented here https://discord.js.org/#/docs/main/stable/class/WebSocketManager - note the info box
is there any chance of bringing back disabledEvents?
Why was it removed tho
cause intents were created
it has pretty much same effect, apart from the fact that intents are groups and are never sent to you, instead of just being dropped by lib upon receiving
that "apart from" matters tho
https://github.com/discordjs/discord.js/pull/3159
This gives a public alternative to the private raw event. (The raw event isn't removed, for the purposes of library testing.) This gives devs the ability to work with d.js in a cacheless way without relying on the private raw event.
Like raw, these event's aren't disabled with ClientOptions#disabledEvents (which isn't very aptly named, since it only disables the internal d.js handlers).
however they are disabled by intents
also you dont get per-event control with intents
^
When I do member.premiumSinceTimestamp, I sometimes get 0, or I get null depending on the user (That aren't boosting), is there a reason why these are sometimes different?
Thats a log of 2 users
When the messageReactionAdd partials fix was done, did that also update/fix messageReactionRemove?
From my super limited test, if I start a bot up and remove a reaction, the event isn't fired
Discord does not seem to provide a member or user there: https://discord.com/developers/docs/topics/gateway#message-reaction-remove
So there isn't really anything we can do.
Huh, there is a user id there?
I wonder if it fires if I enable user partials
Yeah, then it should.
Any specific reason I'mma go ahead and make a PR anyways @discordjs/docgen has eslint as a main dep? Along with using Tsubaki just for a simple Promisify that could be done with Util.Promisify? The engine field in the package.json intends for docgen to be used with Node >=8.0.0 so Tsubaki is kind of useless here. Is it worth opening a PR over just to remove those? Asking cause I intend to use docgen for a personal project.
Shen does discord.js-next will start to be programmed ?
Whenever the maintainers feel like working on it
when can APIMessage#target be a User or a GuildMember?
if I had to guess, DM channels result in it being a user for a start
but they are DMChannel instances ?
huh
ah, it may be because both DMChannel and User implement TextBasedChannel, sug
hm
that's still weird though
i guess if you create your own APIMessage instance maybe
thats like the only place i can see it being a user/guildmember
looks like a legacy of the past tbh
possibly
Im curious, when d.js sends a request to the api and it comes back, does d.js translate the received properties into javascript conventions (like camelCase for example)? Or does it come back already camelCase so there isn't much to do?
i could actually probably check the source couldnt i
interesting, i'm assuming this var instead of let is intentional? smart
So looking through at least the Message structure, it seems that if Discord were to add a property to the message object returned by the API, it wouldn't be seen by the end user (the one using d.js). Why is that?
The library isn't really just an API wrapper, it provides proper custom interfaces, so it doesn't just expose API data automagically
You would also have to manually update the typings to support it anyway.
And as v4 was saying, if you use some JavaScript magic and dynamically rename snake_case properties to camelCase then you lose the ability to choose what kind of abstraction you want to expose to developers. This would make the library very unstable because some people would adopt the new property and now you can't change how its exposed without breaking everything.
- yes we do translate snake_case to camelCase
- yes the structures are custom and don't expose new properties
- unmodified Discord event packets can be listened to via
client.ws.on("MESSAGE", message =>etc
discord.js-commando should have an implemented property that allows the automatic cancel response to be changed or disabled.
Is there a version of this library for Deno ?
no, only node
Oh...
there seems to be a slight issue with the typings for the send method on PartialTextBasedChannelFields, passing something that can be of multiple types results in an error
eg:
const options: string | MessageOptions = ...;
channel.send(options);```
this is perfectly valid code, however results in an error with TS, because none of the overloads technically accept this
i think *more* overloads need to be added here, but it seems like its getting very bulky there are already alot of overloads
Slash Commands:
• PR
https://github.com/discordjs/discord.js/pull/5448
• Docs (Discord): https://discord.com/developers/docs/interactions/slash-commands
• Coming changes (Discord): https://github.com/discord/discord-api-docs/issues/2490
• Arrival in discord.js scheduled for 13.x
• We will not provide support for slash commands before they arrived on the stable branch
@tacit crypt what precisely do i need to update in my v8 PR for the ratelimits? i did a test and on v7 the API sends 5 as the x-ratelimit-reset-after, but on v8 sends 5.000, so i would assume that rather than 4 for 4 seconds being returned now 4.567 would be returned for 4 seconds and 567 milliseconds? the number is already multiplied though so would be 4567 - or am i just being stupid and missing something
retryAfter is in seconds
oh
oh i see now i think
yeah i was being dum dum
applied change
I'm currently working to implement interactions (slash commands being the only interaction for now), based on the last pinned message, should I hold off on my PR?
Yes, probably. The API docs PR is still marked as a WIP with comments off. Given that even Discord doesn't want it open for discussion yet, probably best to hold off
Ok thanks, I was going to mark mine as a draft /WIP as well and keep along with the updates, but I'll just wait until they have finalized their docs
@ruby terrace you have a typo there, Constants.js#L276
https://cdn.discordapp.com/attachments/768863525443338281/786914189893566484/chrome_RXHFezuItQ.png
Whoops, thank you!
the interactions PR needs the v8 api PR https://github.com/discordjs/discord.js/pull/4879
can we expect #4879 to be merged before 2021Q1?
I don't think we get ETA's on that, but I believe the intent was to have gateway v8 be a part of the v13 release.
the switch to v8 is the reason there has to be a v13 in the first place
& reply() being inline replies is a major change
does djs use GH milestones? would be nice if appropriate PRs were tagged with a v13 milestone
due to how we use checkboxes for versioning rather than for progress milestones aren't all that useful
(as milestones accumulate progress based on checkboxes)
oh L
Had a question on a comment on a PR I’m working on, can someone clarify for me? It’s on PR #5026
if you actually ask the question one might be able to answer
Just wanted to make sure I was in the right channel...
There’s a comment asking about the options object of the method, and if it could extend RoleData. I’m not entirely sure what is being asked as a change, I know it’s a documentation related thing but unsure on specifics
I've noticed that when updating a username, guild member update is fired with an identical user object (both of which have the new username). I presume this is unintended behaviour?
unintended but known: https://github.com/discordjs/discord.js/issues/4800
ah that sucks. any workaround?
i'd recommend reading the issue responses
Oh that's interesting, it's apparently caused by presence updates, but I don't use presence intents
It must be from user update arriving shortly before member update then, regardless of presence updates
and if you now read the issue comments again you will realise that userUpdate is a artificial event that's not directly emitted from the API, as USER_UPDATE only emits for the client user and instead created based on the data in GUILD_MEMBER_UPDATE (which also emits on underlying User data) as well as PRESENCE_UPDATE (which also control the initial GuildMember and User caches to be filled) payloads.
Are managers coming to djs-next ?
Oh...
This should be made in a way that you don't have to put .cache everywhere, like a subclass of Collection that have the methods to fetch or resolve
that was DataStores which got replaced with Managers before v12 was officially released
and it is good to have .cache because although it is longer, you know that you are accessing the bot's cache and it will likely not be full
to get it out of the way: "i have to put a word more" is in no phase of the design process a consideration we make. as harsh as it might sound: "deal with it."
the clear separation of cache from API access is a concept we will be moving forward with. we have tried the other approach shortly during the development of v12 with "stores" which we have discarded as it caused more issues than it solved. with the rewrite considering modularity (plugging in own cache implementation) the separation becomes even more worthwhile.
in the current version 12.5.1 managers don't seem to be very useful, however there is a PR which will cover this (likely with v13) #4869 and will expose direct API access (so you don't need to unnecssarily fetch things before operating of them if you have the required data), again putting more value in a clear separation.
a general word about discord.js-next : the rewrite is not a sharp picture yet. we notice issues with the current approaches which can not be solved without a major redesign which we consider for the rewrite. we are aware that mangers in their current iteration are not optimal and have expressed that internally as well as externally, howver we do believe that they are better than the v11 approach of having them on the structure they belong to or the (discarded) v12 in-dev approach of mashing cache and api access together (which seems to be what you propose here)
would the way to fix this be removing ```yaml
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
This is a very strange and unlikely edge case, but currently if you want to edit a message and change suppress embeds (basically if you are editing in an embed, and suppress was currently enabled) the API gets two calls unless the user knows to add the undocumented flags parameter as an option.
Would it be a good idea to clean this up and add a suppressEmbeds option to MessageEditOptions and completely remove suppresEmbeds since it is just a helper method?
@ruby terrace I don't think suppressEmbeds should be removed since there are tons of set__ helper methods which do basically wrap edit
edit should support the flags though if it doesn't already, I agree with that much
edit does support flags, it just wasn't in the MessageEditOptions typedef, and only suppressEmbeds passed it
Valid point, forgot about those set_ ones... this may be a not-right-now thing then with the eventual goal to clean all these helper methods out, maybe evening something for -next
https://github.com/discordjs/discord.js/pull/5122
Useless change. In my opinion, it just breaks code. Using enums is possible now, without renoving string perms support
Devils advocate:
If discord ever decides to again, change something in their naming, we don't need people to change it in all their code because discord decided to rename something or whatever (thought further down the line you prolly still want to rename it, so take that with a grain of salt)
2nd, people already typo those permissions left and right, ive seen stuff from "SNED_MESSAGE" to "GILD_MEMER"
This assures this surely wont happen
So you dont want users to change anything, but change lib api extremely?
However, i think lib should give users choice what to use and how to
2nd, people already typo those permissions left and right, ive seen stuff from "SNED_MESSAGE" to "GILD_MEMER"
this only works in TS where the compiler can actually tell you whether or not you're using a valid value, if you typoPermissions.FLAGS.SNED_MESSAGEin JS it's no better than typoing"SNED_MESSAGE". But it's better than nothing
JS auto-completion should be good enough to pick this up
To at least list you all the possible values
Giving a choice is good, making everything a choice is the same as just writing your own wrapper with the stuff you want
Agree, extremely do
This isn't just a wrapper after all, its a whole library
A wrapper would just expose and let you do all the other stuff, no caching, no nothing at the end of the day
We wouldn't then even need the abstraction for events we have, since you could just listen to .on('MESSAGE_CREATE') yourself for example
Its a tough choice sometimes
The Best choice is change nothing
Thats subjective here
Because as much as you say that, I could argue the best choice is to be as restrictive as possible
Lib must be restrictive from the beginning
I can also change
Thats the purpose of major changes
Hi, why is discord.js not using a transpiler (such as babel)?
It seems the "main" reason to drop support of node 12 is to benefit of the new ES2020 features, but why not just use babel? It will also allow the use of the "import" notation (which I know is only syntactic sugar), and it will not even be, i think, a breaking change, will it ?
is that really necessary to do that when djs-next is being rewritten in typescript and can be transpiled down to a lower es version?
no ofc, but why wasn't it use from the beginning? (sorry for the english btw)
and why increasing the minimum nodejs version, if, with djs-next, it will be possible to bring it down again?
i mean it's not a problem for me, i'm already on 14.5.1, but i'm just curious 😅
We chose to only support the latest (at the time of release) Node LTS version and newer, so there's no point in transpiling to allow use on older versions.
okay
Are the recently-merged Slash commands and Interactions (https://discord.com/developers/docs/interactions/slash-commands)
being actively worked on and is there any ETA?
No ETA, but actively being worked on yes https://github.com/discordjs/discord.js/pull/5106
Alright, ty
Does this will come to djs v12 or v-next ?

