#archive-library-discussion
1 messages · Page 3 of 1
Hey there I want to put a suggestion over here that is can't we introduce something system in the library like choosing some items from a big list. I mean there is Google app called Google sheets where we can choose items by checkmarking ✅ that item can't we use that same UI on the bot so that we can choose something from a big list after choosing that the choosed items will appear on a new embed
not a library feature, you'd have to implement that yourself
More importantly not an API feature
We can just implement things for the API wrapper (discord.js) that discord actually allows in their API
So far check lists are simply not a thing in Discord. They have however shown plans for the future to introduce this behaviour.
Edit: In case you have not yet seen the mock-ups for this: https://medium.com/@mason_33545/the-future-of-bots-c1c574e92ecc has a list of links. If you do want to discuss these features please do so in #archive-offtopic, as they're not yet even close to being implemented, so on a library level everything is yet way too uncertain to plan anything around that feature set.
Ik discord api has some limitations but what we can do over here is we can take some idea from what we did on embed. We can just create almost the same scenario in the checklist thing basically checklist will have some limitations also I mean either you can put data on the checklist function or you can connect that to a database from where we can fetch those data's which needed to be checked the only thing we are adding on this suggestion is adding a extra checkbox column before those datas and those checkbox need to be checked on that embed and the rest thing will be the same
There is no way to feasibly implement a checkbox into discord.js if discord does not offer that functionality.
We can't just freely implement fields users can interact with (checkboxes) without that being a thing with how discord works.
I'm not too sure why you bring this here or how you expect us to do this. Embeds are not some element we can freely style, they're very very strictly only displaying what discord allows and how they allow it.
As said earlier that will (maybe) become a feature one day and then discord.js will discuss how we tackle it and how we implement it. At this point there is nothing we (discord.js) can do about this.
Ok, but I think this is a good idea isn't ? Maybe you guys can note this idea on the idea list or where ever you guys record it. Discord the developers knows someone from here right or maybe about this community or library. I will love appreciate if you guys from here can pass this idea to the discord dev team if someone from here have a good relation with them.
this is like talking to the people who make iphone screen protectors that you want apple to add a new camera to iphones. we have no control of discord features and you need to talk someone that isn't us
I have heard someone from this server have good relation with the discord dev team but do not know who he is if I can find him I will surely pass my idea to him ☺
please stop this conversation. those rumors are groundless
This channel is for discussion about library features and how we implement them.
The feature you request (selection) is not yet in discord. As i said above https://discordapp.com/channels/222078108977594368/682166281826598932/723170134222438452 there are plans to introduce this that discord has voiced in their "the future of bots" blog post, which are just interactable design mock-ups so far.
Once they have announced how they plan on implementing this feature we (discord.js) will discuss how we plan on providing this functionality through the interface of our library. However this is in no way yet clear to anyone (not even discord) so it is way too early to make any assumptions or plans for when it may finally be implemented. Please be patient.
Please also understand that, despite library developers having a contact for API questions we can not act as short-cut for feedback you wish to give to discord. This channel is for discussing library internals not for what you wish discord would allow in the future.
Will the discord api / discord.js ever support custom statuses for bots?
That wholly depends on discord, if it becomes a feature discord.js will support it
@marsh patio discord said its planned but low priority
That was said over half a year ago
https://github.com/discordjs/discord.js/blob/master/src/structures/Message.js#L23-L35 (and https://github.com/discordjs/discord.js/blob/master/typings/index.d.ts#L914) are not listing NewsChannel as a possible type for message.channel, did this just not get added after Discord introduced them or is there some reasoning behind it
NewsChannel extends TextChannel, and so any NewsChannel without a change in the TextChannel interface (same method name with different use), TS will accept it.
TS playground demo: https://www.staging-typescript.org/play?#code/MYGwhgzhAEBiCWAnCAXaBvAsAKGn6EApgHYAmAFAJQYC+Od2OokMAsgPaKELJqEAeKEqRg9UtHE3BRoAZULB2ZDDnzRFxVIgCuwFJ3IAHbQCMQ8YNABmSVAC44tlNXQMGOYoQDuchUoqePmIoVJQA3B7evhoBURxcwaFhQA
oh thanks, i didn't notice that it just extends textchannel
wouldn't this also make it redundant at https://github.com/discordjs/discord.js/blob/master/typings/index.d.ts#L922?
yes
gotcha
is it intentional that Guild doesnt have a setPublicUpdatesChannel or setRulesChannel method? or was that just an oversight
Pretty sure Discord released those after v12.2.0, but I also don't recall seeing a PR for them to master
does guilds.cache, users,cache etc gets cleared overtime? 🤔
cuz it seems its taking up memory somewhat
well yes, objects take up memory, cache is updated over time according to events like leaving guilds, members leaving, etc, but other than that its not cleared, except for message cache which is occasionally sweeped
Pretty sure Discord released those after v12.2.0, but I also don't recall seeing a PR for them to master
@copper laurel there are properties to read them but not methods to set them
@vernal atlas looks like u added the properties, any reason why u didnt add methods to set them?
(also, you put <info>This is only available on guilds with the `PUBLIC` feature</info>, but that shouldn't be relied on, as they can be set for any guild via the api)
not sure why i didnt add the methods, guess i just overlooked that
thought so
and iirc i assumed they were only available on guilds with the public feature
should i make a pr adding the set methods and removing that note?
sure
looks like preferred_locale isnt supported, i'll add that too
Hello, I have an idea for User class. Discord sends premium type of user, I think it is need to implement in User class. I think that will be useful in some cases.
that's a misconception on your end, discord does not send the premium type
premium_type? integer the type of Nitro subscription on a user's account identify
premium type is only sent if you make a request in the name of the user with theidentifyscope through oauth2
We keep getting 429 errors with sharding login attempts. Are there plans to do anything about this, as y'all have open issues about it 👀
Why does GuildChannelManager not include a fetch function like ChannelManager does?
async fetch(id, cache = true) {
const existing = this.cache.get(id);
if (existing && !existing.partial) return existing;
const data = await this.client.api.channels(id).get();
return this.add(data, null, cache);
}
Further, why do most fetch() functions (e.g. in Channel.js and Message.js) have no ability to specify whether to use cache or not? Internally they force cache=true:
fetch() {
return this.client.channels.fetch(this.id, true);
}
It would be helpful sometimes to bypass the cache for guild channels and such.
1: its rendundant, can do the same thing on the channel manager
2: because its meant for use by users, there is no reason why someone would want to bypass cache unless they invalidated it themselves
if you really need to bypass cache you can just call client.api yourself
@unique axle why not just .pin(reason)?
sure
then the same should probably also be applied to all other methods where this is the case (e.g. GuildMember#kick)
that'd be semver major, so earliest in v13/next which will very likely have a complete rewrite of internals
could be deprecated and applied with a lot of code mess, i suppose (similarly to how we did with channel creation options in v11 https://discord.js.org/#/docs/main/v11/class/Guild?scrollTo=createChannel)
@vernal atlas
heyo
what is the purpose of this line? https://github.com/discordjs/discord.js/commit/15b53509daa43e223186dd8eddad7742977a996f#diff-3916ea503ae839d34e6dd447ef035977R194
if that's just (as the PR title suggests) to make sure "only pass allowedMentions if content is defined" then it should rather be a truthy check than a typeof
if split options are supplied content will be an array, causing it to fully ignore mention options
(or are there any other problems with that approach?)
oh right i didnt notice that it could be an array
the reason it was a typeof check and not truthy was because of an empty string
oh damn, right
has this broken split behaviour with allowedMentions 
yup
couldn't you just use a truthy check & that it has length?
that's (one of, if not the sole) problem causing https://github.com/discordjs/discord.js/issues/4300
i have applied other things, but they didn't do shit, due to that spot
@lofty birch well at the time i didnt notice that it could be an array, so it made more sense for just a string check
content && content.length
that feels weird
ig all it needs is changing to typeof content !== 'undefined'
yeah, and since it's in a ternary swapping that around to not have unnecessary negation, thanks, will see if that's already fixing it or if the other stuff i did is needed too 

weird, after applying that fix i now get the behaviour the issue OP describes, before just everything mentioned, now only the last one
(and that's fixed with "the other stuff", or maybe not... anyways, back to the debugger i guess)
did you switch the allowedMentions & undefined places after the new typeof check i suggested?
(i might have misread what you said before about swapping it around)
ye, it's at another point that it all goes haywire at now, but i might have done something wrong in "the other stuff"
edit: fixed
Hey,
I wonder is there any way to check bot "activity" with this library iike for example, how many messages he send this week or so?
if this is a wrong channel to ask this question just mention me.
only if you will track it yourself. library doens't add anything else except for ways of interacting with the API
sure. Maybe discord api provide something like I said, I dont think so but just asking to make sure
It doesn't
definitely won't. there is no point
Hey guys, facing a weird issue with library when trying to add roles to members. Discord.JS doesn't throw any errors but periodically (and seemingly without commonality) does the following:
- shows the roles (2) being added in the audit log
- user does not have those roles upon inspection
e.g. for user rbn#9312 audit log shows that "Role A" and "Role B" were added to rbn'9312 by bot but if I look at rbn#9312 in discord those roles are just not assigned to the person. No errors being thrown or caught
if an audit log for it was created the *call arrived, so nothing wrong from a library perspective
there should however also be another log for role removal or deletion
Is audit log separate call? or is it all handled by discord api
e.g. does audit log entry made by discord
or is it a separate call made by d.js
(assuming its the former)
But also there are no logs showing the roles are removed/deleted?
Has anybody had any similar experience with discord failing to set roles in this manner?
audit logs are handled by discord server side
and no, i have not heard of or experienced that happening
should message.reply automatically add the user you're replying to to allowedMentions?
Is there a reason why GuildMemberRoleManager and GuildEmojiRoleManager don't have a valueOf method?
seeing as they dont extend BaseManager, and thats where the valueOf is inherited from on the other managers, likely an oversight
Found out about it since Util#flatten used valueOf to convert a Collection into a key array
its not an oversight, both of those managers are "pseudomagers", because their cache is a getter
could and shouldn't they still return the cache collection for .valueOf ?
yes and imo yes
on another note: should valueOf of managers even return their cache? according to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/valueOf #valueOf is supposed to return a primitive (!) value
which a Collection quite definitely is not
(this would be semver major, so for now returning the cache for consistency is preferable anyways (minor), i still got curious)
an on another note: is there a good reason for #valueOf to not be typed on either BaseManager nor the pseudo managers?
affirmative, but since we return a collection i believe it should be typed as such public valueOf(): Collection<K, Holds>;
Ahhh, I see what you mean
though the point that collections aren't primitives to begin with stands, but that's a v13 (major) concern, not for what i'm applying now (minor)
oh wait, actually... changes a return value, maybe this is major anyways 
I made valueOf equal the Collection because Util.toJSON was expecting to find Collections there
It then extracts the array of IDs and stuff when needed for things like broadcastEval etc
or fetchClientValues or whatever
so we currently have inconsistent behaviour between BaseManager extensions and pseudo managers which we can not tackle until next major

I guess so yeah
so I guess i'll just PR the proper typing for BaseManager#valueOf, since that's currently typed as :Object but could be typed based on K and Holds
I recall asking why valueOf returned a non-primitive (during datastore era) for some stores. I couldn’t find a suitable primitive that’d best fit those stores tho so I never bothered PRing
https://discordapp.com/channels/222078108977594368/222078374472843266/617949461360017428
couldn't think of anything fitting either, but monbreys approach makes sense (i also looked at Util#toJSON today for some issue)
i have split the two issues for now
- patch: properly type BaseManager#valueOf
- patch/major: implement #valueOf for pseudo managers
the decision on which to merge when will happen internally
My approach was to patch broken Util#toJSON(), and I pointed that out here because if you're planning on changing the valueOf Managers, it will have flow on impacts to other methods like that which has specific expectations
to be fair Util#toJSON is a bit of a mess in itself
i don't quite agree with serializing an array as object either (for example)
The most primitive approach I could suggest would be that BaseManager#valueOf() return BaseManager#cache#keyArray(), given that Array#valueOf() in JS returns the array itself, so there is precedent for doing that
and even that very technically wouldn't be a primitive, would it?
Well no, but JS itself doesnt maintain that rule 😛
More to the point - stop using valueOf() for this
If we want Util methods they should have purpose built Util functions
And let valueOf() be the primitive
agreed, but that's all a semver major concern anyways, so for now what i did was the best i could do, i guess
(including the empty array* being util'd to [{}] which is multiple levels of
but consistent with [{1:"value_here"}] for ["value_here"])
semver constraints 
I disagree with returning an array for valueOf().
Any JS object that doesn’t have a custom valueOf() method returns this. However, when implementing the function, it should return a primitive
technically, if we're to add a Symbol.toPrimitive key that returns the proper value, then the valueOf would stay the same, and it would return a primitive value when being coerced into a primitive (such as with == or String)
but I don't know what that classifies it under semver
discord.js's userUpdate event triggers on Discord's USER_UPDATE (updates for the bot user), PRESENCE_UPDATE, and GUILD_MEMBER_UPDATE events, right?
Nop
userUpdate is emitted only by USER_UPDATE
presenceUpdate (and apparently guildMemberAvailable?) are emitted by PRESENCE_UPDATE
and guildMemberUpdate by GUILD_MEMBER_UPDATE
and that can be causing issues in terms of data availability compared to what the API* offers
@tacit crypt well djs's docs for userUpdate say
Emitted whenever a user's details (e.g. username) are changed.
but the discord user_update event only triggers when the bot user itself is updated
but this looks like presence update triggers it? https://advaith.is-in-hyper.space/51bd7b9239.png
The API sends the USER_UPDATE event payload on client user update, but ours listen to the PRESENCE_UPDATE event payload which allows us to listen on all user updates. Therefore, if you disabled the PRESENCE_UPDATE event via ClientOptions.disabledEvents, it would not emit user updates on all users but only in the client user.
looks like the note was removed though? probably by accident
imo it would be best to trigger it on all 3 events, instead of the 2 it currently triggers on
Fairly certain it triggers for self updates and seems to trigger on presence_updates too
If anything tho, that's more of a Discord thing than us..
wdym?
Ok my brain has shut down at that reply. Yeah I suppose the note is missing..but also, doesn't Discord emit a GUILD_MEMBER_UPDATE AND PRESENCE_UPDATE
yeah
should Util.escapeMarkdown escape quote blocks too?
Why not add a MessageEmojiManager? 

its not like theres any api stuff that it could do either
message.emojis.cache.map(x => x.name).join(" xd ")```
i disagree with adding something like that, even if there was something like that it would not be a manager
the issue with that is the regex for unicode emojis is well, absolutely gigantic, and djs would have to keep updating it, and its not exactly something that should be up to djs
you also run into the issue of "invalid" emojis which match the layout of an emoji, but have a wrong/uncached id, what do you do then? do you give a "partial" emoji?
pretty sure this has been brought up before, @copper laurel wasnt this talked about before
We'd never do it for Discord emojis
Custom emojis have the issue of it not necessarily being one the bot has access to either
yeah exactly
Also its simply not efficient to regex parse for emojis constantly
its easy enough for users to copy and paste the regex and use it when they need to
Its definitely not a manager, would be closer to MessageMentions in functionality if it did exist, but no
Unlike mentions which are a specific API field, emojis is not
Why do the typings for GuildMember extend PartialTextBasedChannel?
export class GuildMember extends PartialTextBasedChannel(Base) {
so you can call .send on them without it erroring
.send and some other text channel methods that can be executed on members
oh interesting
actually, it is only .send for GuildMembers and Users
the issue with that is the regex for unicode emojis is well, absolutely gigantic, and djs would have to keep updating it, and its not exactly something that should be up to djs
actually, it's as simple as/<% emojiSequence %>|\p{Emoji_Presentation}|\p{Emoji}\uFE0F|\p{Emoji_Modifier_Base}/gu
<% emojiSequence $> is a placeholder generated by a script
Yeah, we are not interested.
There is a package for this out there already anyway. Do it yourself.
Are you sure? I just plug that in as a regex with no libs and it appears to work
anyway, just adding my opinion, not saying you have to
Why do GuildMember#permissionsIn and Role#permissionsIn throw an error when the passed parameter is invalid whereas GuildChannel#permissionsFor would return null?
const [embed] = reaction.message.embeds; Why is embed not nullable according to the typings?
Getting a runtime error because of it
it's an array of MessageEmbeds, it's not guaranteed to contain any elements, but if it does, all elements are a MessageEmbed - in your case, you destructure the first element, which the array doesn't seem to have, so it's undefined
@tough geode "It's not guaranteed to contain any elements", don't you think the actual type should be public embeds: MessageEmbed[] | undefined[]; in that case?
I think that type is more accurate
I was wondering because it's been like this for a great amount of time so maybe there was some reason behind it
Or cleaner public embeds: (MessageEmbed | undefined)[];, I'll make a pr for this
not at all, doing that suggests "the array might include elements which are undefined", which is not true.
T[] also suggests that the array might be empty, so the typings are correct.
How about public embeds: [MessageEmbed | undefined, ...MessageEmbed[]];?
This gives full type safety
That would suggest that every array needs undefined in its typings, as accessing an invalid index always returns undefined
the typings you describe would be applicable if undefined could be a value inside that array, it is not.
the array will always include a MessageEmbed - or be empty
Well the thing is that right now you can simply get a runtime error when you destructure
That's a bit against the point of types
This literally prevents a runtime error
Before you are simply greeted with TypeError: Cannot read property 'footer' of undefined
Typescript can catch this, even if the type might be inaccurate, I think it should still be considered
Like if you want it to be 100% accurate why is it not MessageEmbed[] & { length: any } | MessageEmbed[] & { length: 0 }} ?
the typings are correct, typing it as (MessageEmbed | undefined)[] is incorrect and it can change behaviour for arrays that aren't empty. this is just how arrays work in JS.
An array of zero MessageEmbeds is still MessageEmbed[]. What you're implying is unrelated to this specific array - it suggests that every array ever should be typed that way in TS. That's simply not how it's done
Isn't an array of 0 message embeds an empty array?
An empty MessageEmbed Array, yes
Well that doesn't make sense to me, in runtime you are expecting message embeds or an empty array, in typescript it's unknown, but you can tell ts it can be an array without elements or possibly an array with message embeds
All arrays are possibly arrays without elements
You can't define them as containing undefined, because they don't. The array never contains undefined. It will only ever contain 0 or more MessageEmbeds. Having 0 MessageEmbeds does not make it contain anything else
Typings don't define the size of a container
type NonNullableArray<T> = [T, ...T[]];
public embeds: [] | NonNullableArray<MessageEmbed>;
```?
Destructuring from an empty array is not fixed by typings, nor should it be. It's not undefined because the array contained undefined, it's because you declared a variable and populated it with no data, because there was no 0th element to reference in the array when destructuring.
The same thing would happen if you tried to destructure 5 things from an array that contained 4. The 5th is undefined because its declared without definition.
Well I'll fix this with declaration merging then, for the sake of not randomly running into the runtime error
Thanks tho
Or just do a length check before trying to access 1 element of 0
Thats how this should be checked, not through typings
const [embed] = reaction.message.embeds as [MessageEmbed?]; asserting works too since this is what I expect
or just have it ```js
const [embed] = message.embeds;
if (embed...)
typescript deals with this too
just fyi your whole argument implies half the node typings are incorrect.
its almost like implying string[] is guranteed to yield a string even if you index with 2837293922.
Other modern, strongly typed languages like C# will also yield runtime IndexOutOfBounds errors in such cases 
Thats what I was saying. It's not the purpose of typings to define how many elements are in the array - even when that number is zero.
correct me if im wrong, but VoiceState is supposed to be an extensible structure, no?
using Structures.extend("VoiceState") doesnt seem to affect VoiceState instances received through voiceStateUpdate
https://github.com/discordjs/discord.js/blob/ae716872b9d9f711c0f7240a9dbd951d99a9c0ee/src/client/actions/VoiceStateUpdate.js#L15 it would seem that Structures.get('VoiceState') is not used here and it is instead used from the direct require (Structures, being imported from "src/util/Structures.js")
which would explain why its not effecting the VoiceState
perhaps an oversight when adding the VoiceState as extendable
i've made a
4616
@unique axle any way you could document that / type that?
got a suggestion? because i really am unsure how that'd work
about the typings I have absolutely no idea
maybe you could have some BitFieldError interface exported with bit: any on it
then an info tag telling users about that
what i'd want to do is the original approach, but that's making it major (internal discussion), so monkey-patching it is i fear
and for the docs you could add an info tag to .resolve like "if an invalid bitfield is passed an BitFieldError will be thrown"
then have BitFieldError as a typedef
because currently it is really undocumented
i too prefer it the way you had it before, but i understand the semver circumstances
@unique axle any ideas by now?
What is a typedef by definition?
Guild#memberCount will be inaccurate without the members intent right?
no, it does not depend on it
iirc it gets updated based on member add and remove events?
Guild#memberCount !== Guild#members#cache#size
i know
nope, it's just data given by Discord on any occasion they give you a guild object
not necessarily guild member/add
nope, discord only gives member_count on GUILD_CREATE
in theory message events should also keep it updated
hmm
I'm gonna ask around how this will be handled
there is the approximateMemberCount u optionally can get when fetching a guild
but that isnt sent in gateway events
guild.memberCount++
@warped crater
and https://github.com/discordjs/discord.js/blob/master/src/client/actions/GuildMemberRemove.js
guild.memberCount--
asked a question to some api people
Guild#memberCount will be inaccurate without the members intent right?
@oak quail Short answer, yes
Unless Discord adds an event for it or such
Discord has just added a role#tags property https://github.com/discord/discord-api-docs/issues/1537#issuecomment-656308581
as per usual features will be introduced once they are properly documented, this is not yet the case https://discord.com/developers/docs/topics/permissions#role-object
Can there may be a way to access the raw object passed to any Base constructor?
Pretty sure that you can patch it in right now using Structures.extend, if you really want it: https://discord.js.org/#/docs/main/stable/class/Structures?scrollTo=s-extend
@unique axle Intergration#role makes sense
but with RoleManager#integrationRole, what would it be?
which integration
there could be more than one
oh, i forgot the call (<IntegrationResolvable>) or however those things are identified, apparently they do have an id
- I can see
<RoleManager>.botRole(<UserResolvable>)to make that slightly easier to access (note: this is Guild#roles, not GuildMember#roles)- I personally prefer Integration#role over
<RoleManager>.integrationRole(<Integration|Snowflake>), though the latter might also have its place for consistencies sake.
was what i meant
Yes, it's a good idea
At the end, it's the same as a GuildMember#botRole getter, as a user resolvable is not necessarily a bot?
- https://discord.js.org/#/docs/main/stable/class/Integration?scrollTo=role already exists
- no, it really is a role access from the guild based on a user, so
<Guild>.roles.getBotRole(<User>)is the only thing that makes sense
@unique axle maybe make properties on role.tags nullable so they will be ID or null and not undefined?
if (Reflect.has(data.tags, 'bot_id')) {
this.tags.botID = data.tags.bot_id;
}
``` could be ```js
this.tags.botID = Reflect.has(data.tags, 'bot_id') ? data.tags.bot_id : null;
no, the object should just have the key if the key is present on the data
seems a little inconsistent
how so? that is how the API provides it, that's how it should be applied
we don't provide #clientStatus web if you're not on web either
oh, didn't notice
maybe make a typedef for RoleTagsData instead of typing it as an object with props?
similar to fetchVanityData
i modelled it exactly after #clientStatus, the underlying ts typings have a typedef (only that the respective values are fix at string (snowflake) or boolean (since the api provides null see "considerations" section (4.) of the PR)
https://discord.js.org/#/docs/main/stable/class/Presence?scrollTo=clientStatus
well one last suggestion ig
maybe have premiumSubscriber instead of premiumSubscriberRole for consistency with what the API sends (premium_subscriber)?
the camel-case version would be #premiumSubscriber, which however sounds more like a GuildMember than a Role instance, so the suffix -Role is added
also covered in considerations 1.
oh, i missed that too
why use Reflect.has(data.tags, 'bot_id') and not just 'bot_id' in data.tags?
because i need to learn some more js basics
last thing, i don't see the benefit of adding GuildMember.roles.premiumSubscriberRole when you can do GuildMember.guild.roles.premiumSubscriberRole instead
thought about it more along the lines of GuildMember#isPremiumSubscriber or something, but figured since it's about roles it should probably be moved to the role manager
then i figured instead of the boolean setup of is* i could also just return the role, which will be truthy regardless
that's not quite equivalent, due to that consideration and fact
oh yea, i forgot that it can be used as an additional premium check
good thought though, added it as considerations 6.
re:
comment: @vivid field first part yes (good catch, i am so deep in the API spec with my mind) second bit: no, GuildMember#id is just as good, or am i missing something?
you're on the GuildMemberRoleManager though
oh, this.member.id, for sure
i just used .member.user.id because this is the common way for the rest of the lib
guildmember.id is just a getter for guildmember.user.id
the rest of the lib actually doesn't use that getter?
afaik no
pff.. why should we use our own api, right 
changing all uses would probably be a lot of work tho, so the question would be if someone is willing to change it (if it's actually a thing to consider)
find and replace would make it quite easy
will apply .user.id for consistency for now (also time we switch to TS, would've caught most of my silly mistakes)
@unique axle
- good morning!
2.what about the integration roles, I can't see any comment about it
oh wait i am very stupid
it already exists
The feature part dealing with integrations is only minimal and does not need to introduce new access or getters due to consideration 8.
Implementation: Integration identifiers are more of a nieche part here and do not need new access as Integration#rolealready exists
@unique axle here are the full results: https://gist.github.com/Vaporox/9f865b71b3f2155ceb2e06b414169d55
Basically, for now the methods work as expected, but the tags don't get registered in the first place
that's an issue 
from all i've seen _patch should be called at the end of the constructor of Role, time to investigate when i'm done with uni stuff
it might be a discord issue
because i'm not receiving the raw tags
.raw is added by an extended structure
i've found the problem, or at least a part of it
you need to fetch the role manually to get the tags, changing the code to
guild2.roles.cache.clear();
const premiumRole = await guild2.roles.fetch('585597796967776257');```
logs the tags as expected
well... that is...
which means that if it's a problem on discord's side, we need to introduce fetchTags() similar to fetchFlags() or hope that discord resolves it themselves
you fetched it with the guild role manager, why not have Role#fetch?
Role#fetch isn't a thing
i have deleted the role from cache and then fetched it through the guild role manager
but role.tags is undefined
it's like patch is not actually called for some reason
but the data exists 
wait
so even when patch is called it does not have tags
the initial role data apparently has no tags property
which kind of entirely defeats the purpose of this thing, after all the idea is to easily find a bots/the premium sub role
yeah, but role.raw is the fetched data
and it has .tags on it
which is the raw tags
but even when i call patch with it it doesn't have it
Ignore the above, I suck at coding.
await <Guild>.roles.fetch() does the job though... still, no idea why they don't just send that data... same for User#flags tbh.
well now it works ofc
though that makes the fix (funortunately) adding a note on the methods that (all) roles need to be fetched through .roles.fetch once in order for them to work... which sucks
regardless i feel like role#fetch should exist
tell that discord
GET /guilds/id/roles is the endpoint
i mean, we could just call that on Role#fetch and return the respective single role
but that's weird as hell, update all roles but have an API that suggests you just fetch a single role...
If you look at the source code, that fetches all the roles, then accordingly does its work
there could be something like member.ban on role.fetch like fetch() { return this.guild.roles.fetch(this.id); }
https://discordapp.com/channels/613425648685547541/697489244649816084/730895745011548230 (discord developers server)
for anyone without access here is a transcript: https://paste.nomsy.net/edefeqimoh.md
- night09/07/2020
i guess the best way to put it is that it's partially deployed
and leave it at that
so now that that's resolved, i actually found another strange thing while testing this: Integration#role is only a single role, but an integration can have multiple roles associated with it. By comparing all roles' integrationID values to the twitch integration's id, i get this result:
Using Integration#role: [1] Twitch Subscriber
By filtering all roles: [4] Twitch Subscriber, Twitch Subscriber: Tier 1, ...```
so i thought maybe it would make sense to introduce a `Integration#roles` getter which filters all roles by their integrationID to get all roles that belong to the integration
if there is multiple why does Integration#role even exist/not come with an array? 
https://discord.com/developers/docs/resources/guild#integration-object-integration-structure really just lists a single role snowflake.. wha...
the gui also lists only a single role when going to the integrations tab, but there are three other roles with the same applicationID nonetheless
discord, just....
please add as feature request on the GH/PR to the PR branch (yes, sounds weird, but hey, that's how github works) if you want to introduce it yourself
alright, will do
otherwise i'll get to it later, but i should really get some database theory exercises done now 
Couldn't load the documentation data.
Error: Failed to fetch docs data file from GitHub
I get this error when I open 12.2.0 on the docs website
GitHub pages seems to have issues at the moment, will have to wait it out i suppose
Regardless if anywhere #archive-site-discussion , as this has absolutely nothing to do with discord.js internal code considerations
Okay
why is GuildMemberResolvable a thing when guildmembers are already included in UserResolvable?
Because you can resolve a User from a GuildMember, but cant resolve a GuildMember from a User
you can, if you have the corresponding guild
if that doesn't count it shouldn't be typed like it is right now because they consist of exactly the same types
As of now yes
Maybe not in the future though, and if you need the corresponding guild too then what I said is correct - you cant resolve a GuildMember from a User
you need the guild for everything that's not a GuildMember object though, so that would even make ids not a valid GuildMemberResolvable
Message#createdTimestamp can be an invalid date on partial message objects, (because it doesn't use the snowflake to get the timestamp, see https://github.com/discordjs/discord.js/blob/f9f36610907e12b6a1d515aac4728a0f675162aa/src/structures/Message.js#L118) should this be updated to fallback on the snowflake ID, or be updated to just use the snowflake ID instead?
also, some properties, for example
https://github.com/discordjs/discord.js/blob/f9f36610907e12b6a1d515aac4728a0f675162aa/src/structures/Message.js#L95
https://github.com/discordjs/discord.js/blob/f9f36610907e12b6a1d515aac4728a0f675162aa/src/structures/Message.js#L183
https://github.com/discordjs/discord.js/blob/f9f36610907e12b6a1d515aac4728a0f675162aa/src/structures/User.js#L34
would be set incorrectly if partial data is provided, i haven't got time to make a possible fix at the moment but if someone else wants to go through all of that and correct it feel free
and also User#username isnt explicitly set to null, but the typings for a PartialUser says it should be null (happens for other properties too ofc)
I'll try and tackle the first one, would it be okay if instead of it using the timestamp from data.timestamp, I just use SnowflakeUtil and deconstruct the id and get the timestamp from there?
yeah thats what i think is the best soloution
removed cause i made dumb mistake
what exactly is the point of the REACTION partial? it looks like it just makes the MESSAGE partial work in the reaction context, but shouldnt just the MESSAGE partial be enough for that? (since it needs to be enabled anyway for it to work)
Well maybe you don't want partial reactions in your partial messages
some more opinions on the topic above would be appreciated
on removing GuildMemberResolvable in favour of just UserResolvable?
seeing as they are the exact same type ig it could make sense, but you could also add a new type to it (e.g Guild, resolving to the owner of said guild)
on that note GuildMemberManager doesnt seem to compare the id passed to the guild owner id, just checks if the id is in the member cache (as the guild owner could be uncached)
Wasn't guild removed from GuildMemberResolvable at some point?
not sure, guild was just an example though
as far as the docs and typings are concerned, should properties that could be null on a partial object be documented as such?
i mean, the User class has everything documented as non-nullable for a full object, but the PartialUser interface covers that
but for the jsdoc, should it all be marked as nullable or
ill mark it all as nullable in the PR (that im going to be making) then?
should all the _patch methods use 'x' in data or a typeof data.x !== 'undefined' check, for consistency?
in the Message#_patch 'x' in data is used, but in GuildMember#_patch, there is only a truthy check, and in other a typeof x !== 'undefined'
The discord.com domain change has already been addressed: refer to https://github.com/discordjs/discord.js/pull/4160 which was merged 28 days ago (at time of writing)
The next stable release of discord.js will support the new domain name. Further discussion is not required.
When does the new stable release will be released so ?
No ETA yet, but being a minor or patch release if you've already upgraded to 12.2.0 there should be no issues going straight to the next version
Have you guys seen this ? Do you know when will discord add that and will it be possible with djs ? Discord article : https://blog.discord.com/the-future-of-bots-on-discord-4e6e050ab52e
Example 1 : https://www.figma.com/proto/DDsdQLvBqmmPgZNgeNKmvf/Bot-Proposal?node-id=155%3A1443&viewport=2729%2C692%2C0.735587477684021&scaling=min-zoom
Example 2 : https://www.figma.com/proto/DDsdQLvBqmmPgZNgeNKmvf/Bot-Proposal?node-id=129%3A77&viewport=28579%2C-4007%2C6.748552322387695&scaling=min-zoom
as soon as discord documents it
Once they have announced how they plan on implementing this feature we (discord.js) will discuss how we plan on providing this functionality through the interface of our library. However this is in no way yet clear to anyone (not even discord) so it is way too early to make any assumptions or plans for when it may finally be implemented. Please be patient.
nice ! it really seems awesome
we're just as excited as you, however it's way too early to say anything or discuss it in more detail in this channel
np 🙂 i understand
As Discordjs v12.2.0 doesn't include this fix : https://github.com/discordjs/discord.js/pull/4138
I need to wait for v12.3.0 or v12.2.1?
(if so, is a release which would fix the latest bug planned?)
i believe the next release will be 12.3.0
could just npm i discordjs/discord.js to install from GitHub
Hey there, since discord will soon shut down discordapp.com, will the v11 lib get updated too?
Guys, is the library getting updated for the new domain?
v12 has already been updated accordingly, v11 won't recieve any updates regarding the domain change or intents.
- "Discord changes their domain!" - Yes.
- "Will discord.js implement that?" - Yes, commit
ea19faa. - "In v11?" - No.
- "Why?" - R.I.P. v11
would it make sense to bring an improved version of g#874 up again? seeing how it's used (by users as well as internally) pretty often, i think it'd be a nice addition
Considering its false all the time except once, no not really.
and what would "improved" mean here?
Do we internally check for guild ownership anywhere?
It's as simple as member.id === member.guild.ownerID
what is the reason for StreamDispatcher having a default highWaterMark at 12 bytes? (its not operating in objectMode is it?)
Why is the api version set to 7 by default? Discord's latest version is 6, isn't it?
The gateway version latest is 6, the API latest is 7
v7 has much more useful errors, hence why discord.js (and a lot of other libraries) use v7 despite it not being properly documented.
v6 and v7 are about to be deprecated and replaced with v8 with breaking changes, as night has said in the discord dev server
for now waiting for the documentation and further information about what is broken is all we can do. The respective changes will (hopefully) be applied before v7 dies.
Does that mean v13 would be developed following discord api v8?
due to how night worded that it points towards v13 not being a re-write but the necessary adaptions to support v8, yes
(which then is a hard deadline for v11/v12 of discord.js)
so discord.js-next would be v14?
who cares, some future version
Hello
Hi! I just read that the current version of the RPC API and the Gateway Discord were in v7 and v6 respectively.
I just want to point out that this is false, indeed the API RPC is in v6, as well as the Gateway API:
https://discord.com/developers/docs/reference For the API RPC
https://discord.com/developers/docs/topics/gateway#gateways For the Gateway API
And check the change-logs, that's for skeptics: https://discord.com/developers/docs/change-log.
I think you just made a typo, but this is just in case.
Or i missed something 😁
discord documents v6 as latest
https://github.com/discordjs/discord.js/blob/d827544fbd12e827fb4b6ff99d8894ecd79ede02/src/util/Constants.js#L81 discord.js runs on v7 (undocumented) due to better error handling.
Discord (night) has however said on the developer server that both v6 and v7 will simultaneously be deprecated and faded out once v8 is released (and hopefully properly documented).
v7 was meant as an internal version for development, but libraries use it due to much more useful API feedback, which apparently is a bad thing. anyways. no typo, all correct
Oh okay, sorry and thanks !
so what i was told to do was combine the major parameter, like channel id, and the bucket hash in order to key actual rate limit info. but when i look at djs' thing they seem to ratelimit per route. ex; /channels/channel_id/messages/123 is a completely different queue from /channels/channel_id/messages/124
is this how it actually is? or am i just misunderstanding how the library works? and if it is isn't it improper?
i believe you have mis-understood the code
here, :id will be pushed to the routebucket if the current index of route is an id, and the previous index is not guilds or channels
eg
channels/1234/messages/12345
would be
channels/1234/messages/:id
@vernal atlas so it sort of makes its own sort of identifier, but it doesn't actually use a bucket hash?
yeah
so its not actually future proof is it?
@left moat no
hmm. Is there any reason why a shard ID couldnt be a string as all snowflakes are strings anyway?
even though shard IDs arent snowflakes it still hurts my ocd
Any reason why it would?
it's not actually a snowflake so this isn't really a type inconsistency
shard IDs:
- are not snowflakes, but numbers
- most certainly won't go past 1k or 10k or 100k
Hello !
I have a question 😅
Why do you use _patch and _update methods in structures ?
_ prefixes symbolize private properties and methods
they should not be used by non-internals as they are not part of the semver promises https://semver.org/
meaning private methods and properties are allowed to break at any time without notice or deprecation
i think the question wasn't meant to be how to use them but rather why things aren't just done in the constructor instead of calling another method (i'm actually curious myself)
_patch() updates data (used when new data comes in)
_update() clones the existing data before patching, then returns the cloned data (used in update events)
When something changes in the object, for example a channel name being changed. The object needs to be updated to show the new name
Thanks for the answer 😄
But why _patch is called inside the constructor ?
Instead of modifying values inside
so you dont have duplicated code
that's litteraly the same thing, put the code inside the constructor or inside a method of this class
So there is another thing that makes it useful, and that's why i asked 😅
sorry if i am annoying
what? we need patch anyways to update the structure when updates arrive
so might as well do that with the initial data to not have code duplication
you need the method anyway when data comes in and the object already exists, otherwise you would have 2 copies of the same code, one when the object is created, and again when the existing objects needs updating
oh okay, thank you 😄
I understand it better, now
(btw sorry if i made mistakes)
so, TextChannel#send currently accepts a StringResolvable which is any, but should the typings for this be a bit more strict as to what is accepted, seeing as { toString() { return "hi"; } } would be a valid StringResolvable, but its not converted into one, instead its treated as an empty MessageOptions object
which creates an error as a message would be sent with no content
and/or should any functionality in the send method be altered, eg (perhaps checking for toString as a method using Object.hasOwnProperty this wouldnt be able to be enforced via typings it seems though)
in future, for example, v13, will d.js consider selective d.js cache flags to disable and member cache policy? or there are no discussion or decision on it right now?
No specific discussion that I'm aware of, but I imagine caching policies will be looked at in order to fully support the way different Intents can be subscribed to or might be privileged
Do you know when will djs-next be started ? Because the repo has been inactive for 5mo
will likely take some more time, for now we'll wait for v8 of the API to be released and documented and the breaking changes we need to address in the library, which will make up the next major release, since -next is going to be a full rewrite that'll likely take a lot of time and effort, there are no estimates for when it will be available.
Thanks ! Yes that’s why i asked for the beginning, i sure do understand that it’ll take time, np 🙂
regarding what's being talked about with ratelimits in #4327, what about a client option for a specified time, in which if the ratelimit is longer than that an error is thrown? might be something for v13 or might just be a dumb idea altogether, thought it would be worth mentioning
Hi, is there a reason why there is no "premium" property on the user object ? Because it is documented here : https://discord.com/developers/docs/resources/user#user-object-premium-types ^^ (i just want to know if there is a good reason not, and otherwise make a PR if I can ^^)
you might want to re-read that section
premium_type? integer the type of Nitro subscription on a user's account identify
Especially the last column. Premium type is only accessible through the identify oauth2 scope, if you make a request in the name of the user. It's not part of the bot API
ohh that's what it means! thanks! Just out of curiosity then, why can you access the discriminator property (or any other), which are also "identify"
the non-optional parameters are present on received user data, id, username, discriminator, avatar hash
(flags are optional as well and are received through updates, not in the initial user data)
okay! thanks
#4641 seems to be a problem more for my PR #4636, would it make sense to close that and put the change in 4636, or is it fine how it is
what would be the best way of inlcuding the type change in GuildChannel.edit?, the error the API responds with could be confusing for some as the error message just provides numbers and not the string representives
would it better to have a GuildChannel.setType(type) method? (that makes the patch call by itself and doesnt utilize edit
perhaps the method should only exist on text-based channels as only they can have their type changed at the moment
eg: text channel => news channel
it might also be an issue handling any type change
are there any other channels that can change their type except those two? store/voice/categorychannels aren't text based and dms, well, should be obvious why not
as the class would have to be re-instantiated, eg all Message objects cached would have to have their channel replaced with a new object
i believe its just
text, news, and store
voice channel type cant be changed and i havent tested a category but i imagine they cant either
Hello, I have a small suggestion for Collections,
<Collection>.watch();
<Collection>.watch returns an EventEmitter which would have the following events:
change - { operation: "change", oldDoc: *old doc*, newDoc: *new doc* },
delete - { operation: "delete", doc: *document of the schema*},
Could be helpful for people logging collections
am i mis-understanding the suggestion or is this literally the collect and remove events (or well, in the case of update perhaps an additional update event could be made for message collectors)?
collector <-> collection
let me edit my message to make clearer
that notation is hella confusing and i don't yet really see a use case for this
Personally a <collection>.on('set/delete/get', fn) would make more sense
OH, my bad
i think maybe a better option would be to be able to provide your own cache type in the client options?
So that'd mean we need a mixin for events on Collection.
I don't really think that this should be part of Collections. And I also still can't see a lot of use cases warranting this clutter.
if the cache type provided was restricted to extending the Colleciton class, then it could be passed as normal to the Manager constructors right?
i guess for the permissions _new update, we should make a BigIntBitField or smth and move permissions to that?
what if <Role>.members returned a sort of RoleMembersManager so that a line like db.get(<Guild>.id)?.joinRole?.members.add(<Member>) could work in ecma2020
currently <Role>.members returns the cache
hmm true
and the cacheType property ofc 
That would be a misrepresentation of the actual APIs. Roles are added to GuildMembers, not the other way around
One question, in #4667, shouldn't the object also be documented in JSDocs? The WebSocketProperties interface in question.
if it gets added, yes
As in, added in Discord's API docs?
there is a significant amount of pushback against adding the websocket properties
where exactly is the streamDispatcher start event inherited/emitted from
Ty
also where would i find the voiceConnection#play() function?
look at the docs, click on the <> symbol which leads you to the code implementing the documented feature
https://discord.js.org/#/docs/main/stable/class/VoiceConnection?scrollTo=play -> <>
https://github.com/discordjs/discord.js/blob/stable/src/client/voice/util/PlayInterface.js#L62
this channel is for discussing the library, not general questions.
alright. My bad i just wasnt sure where to ask this kinda questions. Didn't realize there was that kinda feature.
are discordjs shards able to take advantage of hyper threading?
assuming you're referring to multi-threading and not hyper-threading (which very few applications need to do anything special to take advantage of since it's handled by the OS scheduler), the answer is only if you're using multiple processes or worker threads
why in an embed if we set the color to #ffffff(white) it return black?
discord doesnt allow full white
Is possible add edit channel type for inside this object: https://github.com/discordjs/discord.js/blob/fb1dd6b53aee68722b057f9a460eb618c61dd1c6/src/structures/GuildChannel.js#L341
The discord api is supported only text or news: https://discord.com/developers/docs/resources/channel#modify-channel
would it make more sense to add clickable links to the ExtendableStructure (https://github.com/discordjs/discord.js/blob/stable/src/util/Structures.js#L3)? or at least declare the @type reference for the sake of code consistency?
Well... no, not for that typedef, because "string" is correct. Structures.extend(ExtendableStructure, Function) expects a string as the first parameter
hm, right, but a reference to the types would make more sense
Most other typedefs dont do that either though in their descriptions
Discord provides info regarding nitro flags so adding nitro flags support in the library will be really appreciated
That's an oauth thing only, not public flags
https://github.com/discordjs/discord.js/blob/fb1dd6b53aee68722b057f9a460eb618c61dd1c6/src/util/BitField.js#L52 this parameter seems to be leftover from v11, is that so or.? since the has function doesnt take extra params on any of the bitfield classes, however the Permissions class on v11 did
wait- in stupid, it still does take an extra parameter
Looks like Discord added the crosspost endpoint
It should be the publish feature of announcement channels
Will it be added to DJS?
They still need to document it though
the policy here is until it's documented it's not implemented in the library, they haven't yet documented it so it won't be added yet
Yeah, was gonna say.
Looking forward to it then 🙂
Do you know roughly how long it takes from Discord's documentation to reach the DJS?
it's pretty quick usually, lots of people make PRs
Awesome, thanks.
I guess it was added since all servers are getting the announcement channels feature with the community option.
g#4105
- https://github.com/discord/discord-api-docs/issues/1510#issuecomment-627911898
currently stale and conflicting
Would it be useful a PR to add the private property (getter) to the GuildChannel class ?
what would it get
It is when a channel is set to private (with the private icon), when everyone doesn't have the read messages permission.
it's done literally with overwrites
checking this
makes it update overwrite for everyone role to not allow reading, and for selected roles to allow read. nothing more, nothing less
and if you talk about
as opposed to
, then this means literally that, that it is not accessible for everyone role
I know lol, I was talking about a Pr to add a property to know if it is a private channel or not
Since that's a simple permission lookup after applied overwrites: no. The current stance on permission getters is that we'll only add additional ones if they have complex/tiered requirements
<Channel>.permissionsFor(<GuildMember|Role>).has(["VIEW_CHANNEL"]) is simple enough to not warrant another getter
Edit: see sugden below, still don't see a huge, if any, use case for this
Edit2: not quite right either, would need to be "any overwrite that denies view exists"
to check if the lock icon is showing, you need to check the overwrites specifically, not just can the everyone role not see the channel, would be more along the lines of
channel.permissionOverwrites.has(everyoneID) && channel.permissionOverwrites.get(everyoneID).deny.has('VIEW_CHANNEL')```
edit: this is simply to check if the lock icon is on the channel for the client, permissionsFor is your best bet if you just want permissions and don't care about the icon
https://github.com/discordjs/discord.js/blob/master/src/structures/GuildChannel.js#L119-L120 is there a specific reason that verified param is still there? or was it just leftover from v11?
Is it a bug that using Client#fetchInvite does not support discord.com/invite URLs, and only discord.gg?
any context?
this has already been fixed with g#4281
Uh hello, i know this may be a very insignificant detail but i was wondering why the voice state property is optional for Guild while not for GuildMember. Couldn't a VoiceState object be also generated for the client if it doesn't exist?
Because it depends on the user ID, in the latter case your bot's (the client's) id
this.client.user.id (ClientUser#id) is nullable
the only case where that will be null is when the client is not yet ready
(in which case you likely wont have any guilds anyway)
but this means that as long as you access Guild#voice in ANY of the client events it will NOT be null under regular circumstances
cc: @manic thistle (been about 2 hours since you asked)
But wait, if the client is not ready, the guild wouldn't be accessible in the first place, just like you said.
Also what prevents it from just setting the voice state when it is ready instead of it staying null until it first joins a voice channel (which actually prevents you from doing stuff like muting yourself until you join a voice channel, no?).
Maybe this is the right place to ask :
Hello wanted to get some basic information. I am new to discord.js and was going through the source file. It seems it maintains a state cache. How and where is this stored? is it only ram or also backed up somewhere? will i lose data if somehow code were to stop running? In such a case can you recommend me how to back up and "reload" the cache ?
@manic thistle that's... a getter anyway as you can see in the source, you dont "set its value"
a guild may be accessible before the client is ready, its probably inconsistent but if you try to mess around outside of events (code that'll run as your bot starts up) it can probably cause something like that as the guilds are being populated
the property is dependant on the client's id, which the library simply can not gurantee the pressence of by the time class instances are created, therefore, it may simply not be something it can do
by "set its value" i meant to add it to the cache
@dawn ivy No, the library does not store cache anywhere. And with v12 there is no easy way to replace cache with eg. redis cache
oh! so nothing can be done if i need to stop the bot for some reason/host has an issue etc ?
@ornate topaz sorry for ping, hope its okay
i probably then need to maintain own cache sigh
how soon after the new bot features are released is djs planning on supporting them?
We support APIs as soon as the code is ready, tested and stable enough to be merged
Impossible to give an accurate ETA since we have no real idea what the APIs for those features will look like
ah was about to ask if you get some sort of early access so you can support them close to when they are released
Nope
We monitor Discord Developers and the API docs repository and things like that, so we see PRs for APIs to be documented before the actual documentation goes public
But no, we have no beta API access or similar
any idea if its something that will be supported in v12 or will it be planned to be integrated to v13?
Again, will depend on the API. If its all new stuff that can be added, and doesn't break anything currently in v12, it could in theory be a minor release
awesome
Anything we say currently is just guessing though
yeah figured
Sort of. Its programmatically correct, since Snowflake is just a named typedef for string - that Collection is indexed by strings, since the emoji is still a unicode character in a string.
It's definitely misleading and semantically incorrect though because that doesn't fit what's a Snowflake is understood to be
So yeah, it could be changed, feel free to PR
😀😃😁😆🤣 all these are local twitter emojis (twemojis), therefore no id
All the same, also pure unicode
Whatever is not uploaded as an image inside of a guild to discord, has no id
Base#valueOf is ```js
valueOf() {
return this.id;
}
But `Base#id` is not even a thing on just un-extended `Base`
Will bots streaming ever be a thing?
It'd make sense of you could be able to stream a .mp4 file
It'd be very useful as well.
Bots cannot stream in a voice channel at the moment.
That's up to discord, nothing the library controls
Yea, I meant is there news about it...?
no. and we cannot do anything regarding that topic anyway
if there were any rumors, we probably would hear about them
Yo I never thought of this. It would be a dangerous yet cool thing kek. I wonder if discord is already working on it.
further discussion in #archive-offtopic please, we can not say anything about this. the chances are not very high that video will ever be properly documented.
it would be a breaking change to account for a partial member here right? because it would change the property to actually be nullable
would there be a way around that, or will it just have to stick with this behaviour
The user should first check if the member is partial
If displayHexColor was changed, so would every other property on partial objects to continue to be consistent
yeah, all structures that can be partial are documented, and are, to have most properties be null when the structure is partial
however this is a case where the returned value could be incorrect for a partial member
That's why you should check if the member is partial first
Same with checking if a guild is available before reading its properties
ig its something for v13 to make that nullable
I still don't think you should rely on the library to check for partials when you can put your own check in place
its not nessercerily about relying on the library, its about the properties shouldn't default to an incorrect value if the member is partial right?
That's why you are required to put checks into place
Unexpected behavior should be expected when you neglect warnings like that one
@unique axle what about #4617?
what about it?
i can not find any way to feasibly document or type that without completely rewriting error handling or introducing a new error class to throw here which would be considered breaking
i see what you mean but if it is merged there's no actual way for the user to know unless they reqd the source. an info tag could be the solution, and you can have a type BitFieldError = DiscordAPIError & { bit?: any };, then note that in the info tag too
that's my solution
very much not a fan of relying on info tags to document that
at that point i'd rather go with undocumented and seeing it as additional hint if you actually catch your promise rejections and log the full error - as you should be doing anyways
good catch, i doubt it's supposed to have three
x)
I still prefer to wait for Souji, space etc to confirm before doing an umpteenth pr that will be denied 😂
Also, we can't create news channel?
I think we can, because it is not in the exclude
this is probably a bug
Right so I'll make a pr
yes this is a bug
Also I want to add backup support to my discord-backup package. I saw https://github.com/discordjs/discord.js/blob/master/src/managers/GuildChannelManager.js line 65 and I thought we couldn't create news channel x)
Should I add news to the lost?
*list
What list
- @param {string} [options.type='text'] The type of the new channel, either
text,voice, orcategory
that list
maybe create a typedef for ChannelType
Is there anywhere we can talk about upcoming features or thoughts? :3
Whether a new api feature gets added to d.js depends purely if it gets released and documented by discord.
If that's what you're asking about
It was that I was wondering about screen sharing abilities now that they're available on servers. Just a thought 🙂
Unless it is and im blind 🤔
Bots do not have access to streaming
Only voice streaming yeah :/
And again. We don't decide if they can or not. Discord does.
why does the .id property not exist on Base directly?
my guess is it was originally for documentation purposes
@ornate topaz add news here:
- @param {string} [options.type='text'] The type of the new channel, either text, news, voice, or category
Why is message.mentions.members nullable (i assume that's what the ? is albeit im pretty stupid at this sort of thing) when message.mentions.users isn't? they're very similar and I would think that in a message where no one is mentioned both wouldn't exist, correct?
I believe the logic is that users can be mentioned in DMs but members cannot be, as there is no guild thus no GuildMembers
ah, ty
setExplicitContent filter doesn't accept numbers
using ts
should this be fixed or it doesn't matter as we can use string levels
yes the typings should be updated for that, the method does accept numbers
Using TS, not using numbers here is actually preferred, simply from a type-safe standpoint.
But I guess we can loosen the type.
strictly speaking couldnt the typings be altered to support only the numbers that match a verification level?
you could use a numeric enum for convenience with that
ah its because d.js drops it if the member is uncached
and members arent cached without sending messages if presence is disabled
Would the discord.js maintainers be open to a PR that added optional best-effort pre-emptive enforcement of the global rate limit? That is, add an option to the Client (constructor and/or setter as appropriate) to limit to sending 50 (or a configurable other number) of requests per second?
I say best-effort since obviously the global rate limit is based on timing on Discord's end, so without them providing additional headers, we can't be 100% sure we won't hit the limit, but restricting to 50 outbound requests per second should at least reduce the rate you hit it without really adding any latency above what Discord itself enforces.
For context, I have a bot using d.js that does enough things in enough servers that it hits the global limit several times per day, and during our peak usage times, we've gotten hit with the temporary block for 10k invalid requests in 10min. Rather than wrapping every single call to d.js on our end, it seems like it would be a lot easier to add global rate limiting inside d.js. I'd probably also add invalid request tracking at the same time, and have a warning event emitted at some configurable threshold (default 9.5k) so users could have an easy way of noticing the limit coming and avoiding the hour-ish long block it triggers
there is a ratelimit event that you can use
I mean... if you're hitting that limit/s with good reasons, it'd be time to contact support to have your limit raised anyways
Also, reminder that the 10k invalid request ban does NOT apply to just 429's, but also 403/401, something you can handle on your end 👍
The ratelimit event now is raised when the responses come back. If there are 10 responses "in-flight" when you hit the rate limit, that means you get 10 429s.
As for contacting support to have our limit raised, our bot is in several hundred guilds, and the docs say to ask about an increase if you are in 200k+ guilds. IMO we are hitting the limit for good reason when we hit it, but I'm guessing Discord doesn't care about my opinion for a "small" bot.
And yes, I'm well aware of what the 10k invalid request limit includes - I already instrumented my copy of discord.js to log all the invalid requests, their types, and whatever cause info is available 🙂
That's wrong. The ratelimit event we emit means we're currently handling a ratelimit (aka pausing X amount of time before continuing, something we do for any request that 429's). We also handle the global limit when hit by basically blocking all outgoing requests for however long Discord tells us to
right - I want to block when necessary, before discord tells us to. Since the existing headers provided by discord don't provide any info on the global limit until you hit it, they aren't relevant here
and as for the ratelimit event - you emit it when you are handling a rate limit. But if I send 60 requests, all 60 might go out before discord responds to any of them, which means the global rate limit will kick in on discord's end when it receives the first 50, and the last 60 are over the limit. Same thing for a non-global limit - if 10 requests go out to an endpoint with a limit of 5, then you're going to get 5 successes and 5 429s coming back
That is not true
Requests on the same ROUTES are sequentially sent
So only after the current one finishes do we go to the next one
This is the default (and only option in v12) and the "sequential" in v11 (also default, the other being burst, however you shouldn't use it)
ok fair point, I have been staring at the global part so deeply I forgot how the per-route thing is handled
although technically that assumes that the mapping to routes that you have is identical to the buckets that discord uses for the actual rate limit determination on the backend, since
"Per-route" rate limits may be shared across multiple, similar-use routes
We do that, except not with their relatively-but-not-that-recently added bucket hashes. We currently group by the 3 major parameters discord has (guild, channel and webhook ID to be exact)
sure, I've looked at the source code 🙂
Also, the only cases of there POSSIBLY being 429s is with Discord and their reaction buckets IIRC, there's an issue on their api docs repo
but regardless - the global limit is what I really care about here (well, also the fact that there is an undocumented 2/10 minutes channel rename sublimit on the channel edit route, but that's a whole other can of worms)
Back on track tho, I understand what you want, however...I dunno if that should be added (esp since giving a lot of control over rest to users...is one easy way to get api banned)
the fact that there is an undocumented 2/10 minutes channel rename sublimit on the channel edit route
It was announced in the ddevs server but sadly cannot be represented in the headers
Which also causes issues as it stands; you can still edit overwrites even tho you're ratelimited on name changes but as it stands, we don't have that edge case
yep, I discovered that once I was pointed through several other servers to ddevs 🤦
but not before I put a ticket in complaining about it being entirely undocumented
which I hold is fair since ddevs is at best quasi official
HA, you'd be surprised how much can be undocumented if we don't do it 
oh I'm sure 🙂
DDevs IS official, DAPI is the unofficially official or w/e (I think it's the official unofficial one)
since giving a lot of control over rest to users...is one easy way to get api banned
@tacit crypt not really sure what you mean by this. I don't want to give control to my bot end users, I want to give control to users of d.js
if blocking the request for invalid ones before it is sent is some how possible, that'd be very useful (if i undersotood corect)
so I don't know who you are concerend about being banned
You're an end user of our library, like me, and many here. The more control we give you over the rest dials (like we do with the restTimeoutOffset) the higher the chances someone will turn them wrong and well, suffer the consequences. or someone turns them wayy down and then complain that d.js is sO sLoW
so don't make the threshold of 50/second tunable, just let it be off (default, as now) or on (best effort to not global rate limit)
What about those whose global limit is higher/lower
right - that's part of why my instinct was to make that configurable
but if you want to limit turnable knobs...
well, ok you can keep it off
Fair point
Regardless, I don't see why not but 
You should still probably try to contact support for a limit raise (guild limit aside, doesn't hurt to ask) but make sure your use case is actually not considered API abuse and the such
could also set the min global rate limit to 50 - I was under the impression that was the limit for everyone who hadn't gotten it explicitly raised, so if you try to set lower than that, you're probably making a mistake
However I do have to ask..what are you doing that causes you to actually hit 10k 429's in 10 minutes
that's a great question, and I don't have a super clear answer now tbh - the bot I work on is for Pokemon Go, and there is a weekly event that sees a pretty substantial uptick in active players and hence in active bot users. The past three weeks, we've gotten blocked sometime around the end of the east coast activity window for the event.
After last week, I added instrumentation to track all the HTTP responses, but all I know now is what happens during lower usage times. So far today, we've had 164 429s from the global rate limit, 94 429s from the channel rename limit (also working on that separately, but that's easy to do from my end), and a handful of other things. My assumption is that those just scale up dramatically during that weekly event window and cause us to hit the 10k in 10 minutes, but I won't know for sure until wednesay evening (or, ideally, never if I can make the necessary changes to not hit the limits before then)
Suggestion: Make the discord.js client cache only things you want it to cache. Discord.JS bots can take up loads of memory mostly because of the cache.
Update: on what we were doing to hit 10k 429s in 10 minutes for @tacit crypt:
We made some API calls in our unhandledRejection handler and in response to rateLimit events. Turns out this is a terrible terrible terrible idea. If we hit 50/s global rate limit and then attempted to handle an error, we called the API to attempt to resolve what the name of the channel that the error came from was. Obviously this in turn gets a 429, and the descent into madness begins. So no, we didn't get 10k 429s in 10 minutes, we got 12k 429s in about 40 seconds. Big yikes for us
So while I still want to submit a MR for preemptively handling the global rate limit (especially since I did about 95% of it before discovering what was going on), it is somewhat less important/urgent for my bot 😂
Why does the typings are in index.d.ts and not directly into the declarations files ?
what exactly are you asking about
index.d.ts is a declaration file.
also, library is written in javascript, not in typescript
should probably be mentioned in the release notes that v12.3.0 updates the domain
what is the difference for the end user though
older versions may stop working soon
fair
Yes, but why do not writing the library in ts ?
typescript is typed js
which supports being used in typescript projects via the typings file
Ok
A future version of the library may be written in ts
also, you cannot just rename all files from .js to .ts and call it a day. typescript code is never ran, it's transpiled to javascript before it runs.
user.bot was changed so it is now always true or false and can't be null in 12.3.0, right?
yes, null was removed as a possible value in 12.3.1 but the docs didn't get updated accordingly
i would try and change that but im bad at PRs
dont even know which repo docs are on omegalul
they're on the default master branch together with the code (https://github.com/discordjs/discord.js/blob/master/src/structures/User.js#L46)
ah thanks
I believe this issue is also the case with system, correct? https://github.com/discordjs/discord.js/blob/master/src/structures/User.js#L76
.system hasnt been updated (although i mentioned in the issue that it should be)
the code for .system should have been updated but it wasnt
yeah i dont see why it wouldnt?
i have a feeling that opening an entirely new pr just to remove a single question mark is a bit over the top so im assuming youre just going to commit to the existing one
but its already been merged 🤔 anyway ill prob leave this up to you and vaporox you guys are good at these tings
Also in the Guild class documentation, some of the descriptions of fields speak about de the removed PUBLIC flag
I supposed that it has been fixed in the meantime, the one that I had noticed have not the mistake anymore
i mean, nothing has changed since you sent that 
I found the errors like 20 minutes after the release of the 12.3.0 and now it's all fixed 🤔
maybe it loaded the wrong docs version? because it was changed in 12.3.0
Yeah it's possible
Does someone know how do I test the library?
what do you mean by "test"
run the code on test/. all around there's mention to require auth.js, on those files, but there's nothing like this
Just look what it imports from that file and you can reconstruct it.
Its not really much used, those files are just to debug certain things, not to completely test everything
sure, thank you!
I guess there should be easier ways to get information from a User like If he has nitro
without OAuth2
I guess there should be easier ways to get information from a User like If he has nitro
There is not, there shouldn't be. We can only implement what the discord API offers
flags https://discord.com/developers/docs/resources/user#user-object-user-flags do not include that information. premium type https://discord.com/developers/docs/resources/user#user-object-premium-types is only accessible through an authorized user request - oauth2
summary above, discussion around the topic swepped for less clutter 
https://github.com/discordjs/discord.js/blob/stable/src/structures/User.js#L74 when checking if a user is system would it make sense to set this.system to null if the data value isnt a boolean?
or default to false potentially?
To your second point of defaulting to false, if it’s coerced to a Boolean and is null, wouldn’t it already be turned to false (cause null is falsey)?
it doesnt check if it's falsy, it just checks if it exists in the data, correct?
otherwise nothing is set and it remains undefined
I mean, I dont believe that it is
and be more consistent with other properties
But it is consistent with the others
Nearly everything in _patch has an if in data check
discord sends bot and system the same way: either undefined or true
discord.js now makes bot true or false
but system hasnt been updates, so its inconsistent
https://ptb.discordapp.com/channels/222078108977594368/682166281826598932/744773648547577966 so this would be valid? @oak quail
looking at documentation you're right, they come back identical https://gyazo.com/e96678c3ef53c36bb39ec6a31cb4a5d9
we're defaulting bot to false, so we should also default system to false, for consistency
yeah that makes sense - i'll probably pr it when i can
i didnt set system to null in my PR because i assumed it would've been a breaking change
although now that i think about it the docs say it should be null
typings say undefined docs say ?boolean which is boolean | null
this seems to be happening on every pr sent
yeah i noticed that the other day, i suppose someone can make a PR to ignore it or make a getter that is this.client.options.http.api
Suggestion:
When calling the fetch method, you can pass in an argument as false and It won't cache whatevrer you fetch yet it will return it.
that's already a feature on some, if not all, of the fetch methods
?docs client.users.fetch
although on other managers (roles, channels, etc) i don't think it's there, but they're usually assumed to be cached anyway
thanks! I might work on a PR fo it tomorrow.
on what exactly
no caching of other collections for the fetch method
but why? library assumes that it's always there (and it's actually always there until you forcefully remove it)
due to that there is no reason to specifically fetch role or a channel
oh ok. nvm
In the typings, should StringResolvable be string | number | boolean | bigint | symbol | any[] (primitives except undefined and null + any[]) instead of any? If content is an object in TextBasedChannel#send, Message#reply etc., it gets used as the options and won't be sent: https://github.com/discordjs/discord.js/blob/master/src/structures/APIMessage.js#L342-L345
Currently, there are no editor suggestions for MessageOptions in TextBasedChannel#send, Message#reply etc. because anything can be used as content. It also means that typos such as channel.send({embed: {tilte: 'Title'}}) do not get reported because it's still a StringResolvable.
I know this would be a breaking change, which is why I'm discussing it here.
Typings arent breaking changes, assuming thats all you plan to change
i think it would make more sense to change what the first parameter for TextChannel.send is in the typings rather than the actual StringResolvable type
Yeah true because StringResolvable is also used in Util.resolveString
yeah
anything with a typeof of object (aside from an array) is treated as MessageOptions | MessageAdditions
if no options are provided through the second argument*
https://github.com/discordjs/discord.js/blob/stable/src/structures/BaseGuildEmoji.js#L47 discord states that available is an optional property and the lib doesn't consistently set it as a boolean so would the jsdoc for this not be correct?
it appears that available can be undefined from what ive seen
i mean
honestly there are probably some mistakes in discord's docs for whether properties are optional or not
theres no harm in making it constantly boolean value
even if there is no mistake it doesnt effect anyone
but if it is optional it defaults to false
i too would not be surprised if there were mistakes in discord's documentation
the docs (typings too probably) would also need updating for Emoji#animated and Emoji#id
animated isnt documented as possibly being undefined, and id is marked as ?string which implies null, but its infact undefined
should Activity.syncID be documented, its the track ID for a spotify status, except syncID doesnt really give that away so maybe under a different name?
This appears on every PR
This also happens when running npm test: https://hastebin.com/pasageseqi.coffeescript
oh i see
thing is
when i run npm test it doesn't even pop up
but that might be because of errors because of prettier/prettier
which i have no idea why they don't show on GH
there seems to be an issue with Util.mergeDefault (https://github.com/discordjs/discord.js/blob/05c9e301639848121dda27ab1f8a643f465be502/src/util/Util.js#L286) that i can't seem to trace, but it seems to cause a new client with the options { http: { api: { version: 8 } } }; to freak out, and once merged causes client.options.http to be https://paste.nomsy.net/ulediduwot
oh wait did i just
k i facepalmed there, api is meant to be a string
but is there still an issue there? doesnt seem like its meant to iterate over the string
Hey sugden can you read my comment to your PR review when you can, thanks 
sure
regarding that pr review comment ^ are the jsdocs incorrect for properties such as Guild#approximateMemberCount? as its documented as ?type rather than type|undefined, because ?type indicates type|null as per https://jsdoc.app/tags-type.html
if thats the case then a lot of things are wrong in djs
such as <Guild>.widgetChannelID
and Guild#widgetEnabled
you get the picture, this is the case with a lot of properties
?type should indicate that something is nullable. We shouldn't have any documented properties be potentially undefined imo
i agree that if something isn't sent by api it should be nulled but that's breaking
at this point the best solution is probably just to go with ?type even for undefined properties
unless we change literally every single one to type|undefined
?type should indicate that something is nullable. We shouldn't have any documented properties be potentially undefined imo
yeah thats what i think would be the best approach, except it would be a breaking change to fix that accross the board
v13
well for v13 / djs-next obviously yea, but as for v12 at the moment
for now i reckon just making the JSDoc consistently wrong rather than occasionally right and inconsistent is better
because this is the case for pretty much every property which can be undefined
i think the jsdoc is a bit of a mess
the approach that i take in the pr is the best we can do for now afaik
types are correct for the most part i think but its just the little parts like this
yeah exactly
having 2 properties typed correctly and 100 not is just more confusing
i resolved the conversation since its pretty clear we can't make the changes you suggested sugden, at least not for now
yeah for now it cant be done, maybe if this is an issue it can be implemented with another PR
can you explain me the choice which lead to te poorly designed partials feature?
why we can't have simply an event like raw previously dedicated to partial instead of dealing with them for each declared listener ? this is completely insane
while writing this part of the doc, nobody thinked: oh, finally it's maybe a bad design?
WARNING
Partial structures are enabled globally. You can not make them work for only a certain event or cache and you very likely need to adapt other parts of your code that are accessing data from the relevant caches. All caches holding the respective structure type might return partials as well!
nope, my IDE tell me this event don't exists anymore (using typescript)
maybe this event is missing into the typedef
the in fact partial would be incredibly more usefull if we can bind then to a custom event instead of using them globally like that
well it does @paper furnace
mhhh really weird
it's not shown in the typings as you are encouraged not to use it
same as v11, wasn't shown there either
and partials are very helpful, it's as simple as adding if(<x>.partial) await <x>.fetch(); wherever a partial may occur
raw is undocumented, because it emits the raw websocket data
https://discord.js.org/#/docs/main/stable/class/WebSocketManager emits raw dispatches, see the info tag
There is recipient, isn't there?
¯_(ツ)_/¯
no, because guild would no longer mean guild
thats true
so you actually could not do message.guild.roles or anything similiar
that just makes things even more confusing
yeah ok fair enough
honestly, imo its ok (but a bad idea) to not document the raw event, but its really dumb to not put it in typings
in my opinion the typings are there to reflect the public API of the library, "raw" is simply not.
the exact same functionality - properly documented https://discord.js.org/#/docs/main/stable/class/WebSocketManager and typed can be achieved through <Client>.ws.on("evt", cb)
imo the typings should cover the entire library
yes but thats not a public aspect of the library
Why don't you create a separate typings file and point somewhere that this file exists for those who want to use the whole power of the library?
"whole power"? you mean "unrealiable power that can change at any point without any warnings, as its undocumented"?
Thats... also exactly what it has
https://github.com/discordjs/discord.js/blob/master/typings/index.d.ts
I mean, we can type the raw event as "unknown" so it's up to you to either type it or use a typings library for it 
raw is this middle-ground between undocumented and documented, it's a slightly more uh.. raw than what Souji linked, and what you should most likely use (cause raw includes things like the sequence and op and stuff, which for most is really NOT needed, however YMMV)
i have a question about TextChannel#startTyping, from what i understand it was built so the promise resolves once the bot finishes typing, however it seems a little counter-intuitive considering all other api methods resolve as soon as the request returns a response. Doesnt this prevent the user from properly awaiting it for example at the beginning of a command?
for example, you cannot do the following because startTyping will never resolve ```js
await message.channel.startTyping();
await message.channel.send("test");
correct, the promise will resolve once the typing has ended.
correct, awaiting it like this will wait for the typing to end before continuing, consequently never continuing
can we add an option to not wait for stopping to type?
currently the only alternative is not awaiting, which introduces a possible race condition
IIrc you can pass a count too
?docs textchannel.starttyping
i don't really see the use case tbh, and passing a count does not change the behaviour of the returned promise
well, passing 1 WILL make it return
but also end typing
if you pass 1 the exact same happens, it stars the typing indicator and the promise resolves when the adequate count (1) of stopTyping has been called
well, what about the option idea?
the use case is being able to ensure the typing indicator has started before proceeding with the command, otherwise there is a possible race condition where the command's response will be received by the api before the typing indicator, which makes the bot send the response first and start typing afterwards
unless someone PRs a sendTyping (which is just await this.client.api.channels(this.id).typing.post())... Nothing stops you from using the raw API
sure, there is always a workaround
wouldn't be too difficult to perhaps create a function that listens to the typingStart event
for yourself - not in the library
but perhaps a wait boolean parameter for the sendTyping function could work?
which would of course determine if the promise should wait until.the typing has finished
does the count parameter even... work? i don't see it being decremented anywhere in the startTyping function and testing a startTyping(1) doesnt seem to resolve
ok yeah im either stupid or the count parameter doesnt even do what its supposed to
Maybe adding an actual error for when you try to ban a guildmember while not providing an object as options would be nice 🤔, for now it gives an Internal Server Error which gives the user no information
https://ptb.discordapp.com/channels/222078108977594368/222078374472843266/746602660500602910 - people have asked for help on this on three occasions today
might be a change due to the new update, as djs updated to the new preferred discord behavior which is iirc sending a json object instead of query params
Yeah, the change mentioned above resulted in the API returning an error when invalid data is passed instead of... whatever it did before, possibly resolving a ban but not passing the reason
The error would be the same as the TypeError for Message#delete
I agree the response isn't meaningful to what they did wrong, but having said that, if they bother to read the docs and use the ban method correctly it won't be encountered
should Client#generateInvite have options for other query parameters for the invite other than permissions? eg preselcting a guild, redirect URI etc
also bump #archive-library-discussion message 👀
i'm not too sure what you mean there with the count parameter not working?
.startTyping(1) -> .stopTyping()
.startTyping(2) -> .stopTyping() x2
.startTyping(3) -> .stopTyping() x3
and so on. i tested that up to 5 the other day, could not see any misbehaviour in the counts
discord.js heavily diverges from how typing works api wise, we keep the typing indicator alive as long as not all typing "instances" are resolved (the count is decremented through stopTyping to the point where none are left) and sending a message does not resolve the call, but has to be done manually.
and as was pointed out above you can't await the start call as is right now, since it resolves only after the typing is fully resolves (has stopped)
should Client#generateInvite have options for other query parameters for the invite other than permissions? eg preselcting a guild, redirect URI etc
https://discord.com/developers/docs/topics/oauth2#bot-authorization-flow sure, the redirect is really just useful for the non-invite generation, unless i'm missing something?
You'll also notice the absence of response_type and redirect_uri. Bot authorization does not require these parameters because there is no need to retrieve the user's access token.
Since all are optional probably best withPermissionResolvable|objectand deprecating the first.
sweet
so do you have to actually call stopTyping?
i was under the impression the route was called count times, and resolved on the final call
what are the marked ones for?
Those are all legacy and we’ll prolly not use them anymore except for v12 @snow crypt
so is the current repo gonna move to a legacy repo when next goes live?
next being the typescript one
no
next will be merged into the current repo
but the tags/labels won't be the same most likely
so i realized the docs and typings dont have
syncIDfor theActivityclass. I decided I will make a PR because it'll be useful. What exactly should I put forsyncID's jsdoc comment?
Can anyone provide input on this? i did some further digging and found this PR related to it https://github.com/discordjs/discord.js/pull/2314 with the commit messagespotify stuff. So should I put the comment asThe ID of the Spotify track?
should
Activity.syncIDbe documented, its the track ID for a spotify status, exceptsyncIDdoesnt really give that away so maybe under a different name?
@vernal atlas my apologies for pinging you, but i'm in the same boat as you are and hoping to get a conversation out of this as well
so it seems the reason its not documented is because Discord API docs doesn't even document Activity#sync_id because that's their intention? ( https://github.com/discord/discord-api-docs/issues/1239#issuecomment-563425694 ) but I'm also reading this issue comment ( https://github.com/discord/discord-api-docs/issues/545#issuecomment-370604860 ) that sort of backs the previous one, but it's been 2.5 years since that comment has been made and I believe the Spotify integration has matured since then? Someone even questioned the relevancy of the property here ( https://github.com/discord/discord-api-docs/pull/436#issuecomment-349790557 )
So overall, does this go up one level higher to the Discord team to consider adding this? For now, I ended up extending the Activity interface myself and defining that missing property. I'm in limbo on it in general for submitting an issue to discord.js, but potentially the Discord API docs repo instead? Thoughts?
undocumented fields might change name or functionality at any point without further notice. due to that discord.js just implements (and accepts PRs for) upstream (discord-api-docs) documented fields. If you get them to document it it's relatively surely going to be added.
* we can't promise semantic versioning if we introduce a change that might result in breaking functionality, discord mostly doesn't break documented fields
I see. I think I'll go upstream with this. Thanks for the input @unique axle
what will Collector use if there is no time (in collector options)
this is not a support channel, whatever other ending criteria you give it, if none - none
https://github.com/NotSugden/yeetcord.js/blob/patch-16/src/structures/NewsChannel.js#L3-L9 NewsChannel doesn't seem to extend any custom TextChannel class, is it intended to be that way or is it a bug? (the same applies for ClientPresence, https://github.com/NotSugden/yeetcord.js/blob/patch-16/src/structures/ClientPresence.js#L3-L8)
are there any plans of porting discord js to deno in the future many people have made their own attempts but they lose support in a month or 2
no current plans, has not been discussed - might become easier after the planned typescript rewrite or be considered during it
ok
@vernal atlas not sure what you're pointing out here honestly - what are you suggesting it should extend?
you can extend the classes Presence and TextChannel via Structures.extend, however ClientPresnce and NewsChannel extend those classes (respectively), but they don't extend the custom-made extended class
a bit like how ClientUser extends User
Ahh gotcha. So you're suggesting they should extend the extended Structure, if that's even possible
the ClientUser export is a getter so it can properly get the User class from Structures.get
yea
I had a look through the events on the client and there isn't one for when messages are swept, so could that be added?
This would also work when calling client.sweepMessages() along with the automated interval system.
the debug event emits whenever messages are swept. it's quite crude, but you could filter through debug messages (i.e. not the WS ones) then emit your own event based on that
you could also extend the client class and override the sweepMessages function to emit an event 👀
oh yea lol
also, there isn't such thing as a message.quote, might be cool.
ex:
if a message had the content of hi and you called the quote method with hello as the content it would resovle this:
> hi
@user hello
what would be a use case for that
As discord themselves are planning to remove that feature in favor of proper reply (which may or may not get proper bot API support at some point) I don't personally see much value in this
Yeah that new quoting thingy is pretty epic
the API seems to have stopped sending embed_enabled causing Guild#embedEnabled to always be undefined, rather than a boolean as it should be, should this be left as-is or perhaps changed to use the widget_enabled value?
O wait- embed_enabled/widget_enabled doesnt/never come with the initial GUILD_CREATE packet
but it perhaps should be cached with the fetchWidget/fetchEmbed method, ill pr that
has that changed, or was it always like that?
thats what puzzled me at first because i could've sworn it was sent with the initial packet
i'd make an issue on discord-api-docs
did a search in DAPI and found https://github.com/discord/discord-api-docs/issues/1102
Guilds do not store this metadata, so it isn't returned in guild creates
GUILD_UPDATE contains them
logic 200
would it make sense to make fetchEmbed just return this.fetchWidget() to avoid duplicated code?
Ye, and mark as deprecated
ye, already deprecated, the same for setEmbed too?
they both hit a different endpoint, guilds/:id/embed and guilds/:id/widget, but yield the same result, which is why im asking first xd

why is https://github.com/discordjs/discord.js/pull/2910 not merged?
im tryna implement the changes from https://github.com/discord/discord-api-docs/pull/1886/files into a PR - but the short of it is should i make a new class for IntegrationAppliation or just use the ClientApplication class
making a new class would essentially just be the same as ClientApplication, but without botPublic,botRequireCodeGrant, cover, owner, and rpcOrigins
perhaps an Application interface/base class?
i think that would actually be a good idea
@vernal atlas why not have includeApplications just true by default
like, not even an option
just always true
well, i thought it best to add the option & default it to what discord defaults it to
oof just made me realise i forgot the typings
@vernal atlas well they could have done the same thing with webhook ?wait
but i really wonder, why not
it's not like it will be breaking
or cause anything unpredictable
i say just have it always true so you always have the application
perhaps default to true, but still have the option if you need it
why would i explicitly NOT need it?
yeah i might not really have a use for it
but in what case is it gonna be "it must not be sent"?
well, it would be easier for a user to filter out bot & webhook integrations
can you explain?
well, if for whatever reason you didn't want to list bot & webhook integrations (eg in a command), simply passing false would be easier than (await guild.fetchApplications()).filter(int => int.application === null)
ohhh wait my bad
yeah
PR #4762 was merged before the docs pr was merged
Why did you make separate methods for avatars (avatarURL and displayAvatarURL)? Why not merging the second one with the first one by making a parameter "callback", which could be an image (URL, buffer or anything else) or "default", which effectively returns default avatar URL?
avatarURL yields the avatar given by Discord as is, null in case the user has none set
defaultAvatarURL gives back an asset from Discord's API with... a default avatar; calculated as they do it in the client
displayAvatarURL is simply a utility that either gets the user's set avatar, or their corresponding default (theoretically, what you should have on screen)
this design choice makes sense to me, and either way, it can not be changed as this would be breaking
(Yes I know this would break existing code, but why not a change for DJS v13)
I don't see a huge benefit in merging them