#archive-library-discussion

1 messages · Page 3 of 1

carmine arch
#

I'm working with Commando in a project that uses es6 modules "type": "module" in package.json.
It seems to find and import the modules, if I give my command files .cjs extensions. I made log progress on discord.js-commando/node_modules/require-all/index.js. But it doesn't seem to register the commands to be used.

austere crane
#

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

lofty birch
#

not a library feature, you'd have to implement that yourself

unique axle
#

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.

austere crane
#

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

unique axle
#

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.

austere crane
#

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.

outer night
#

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

austere crane
#

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 ☺

outer night
#

please stop this conversation. those rumors are groundless

unique axle
#

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.

austere crane
#

Ok

#

Ok

marsh patio
#

Will the discord api / discord.js ever support custom statuses for bots?

unique axle
#

That wholly depends on discord, if it becomes a feature discord.js will support it

oak quail
#

@marsh patio discord said its planned but low priority

ornate topaz
#

That was said over half a year ago

vivid field
snow crypt
vivid field
#

oh thanks, i didn't notice that it just extends textchannel

snow crypt
#

yes

vivid field
#

gotcha

oak quail
#

is it intentional that Guild doesnt have a setPublicUpdatesChannel or setRulesChannel method? or was that just an oversight

copper laurel
#

Pretty sure Discord released those after v12.2.0, but I also don't recall seeing a PR for them to master

patent halo
#

does guilds.cache, users,cache etc gets cleared overtime? 🤔

#

cuz it seems its taking up memory somewhat

rigid trail
#

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

patent halo
#

ahh

#

ok

#

i see

oak quail
#

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)

vernal atlas
#

not sure why i didnt add the methods, guess i just overlooked that

oak quail
#

thought so

vernal atlas
#

and iirc i assumed they were only available on guilds with the public feature

oak quail
#

should i make a pr adding the set methods and removing that note?

vernal atlas
#

sure

oak quail
#

looks like preferred_locale isnt supported, i'll add that too

real jetty
#

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.

unique axle
#

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 the identify scope through oauth2

sudden summit
#

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 👀

real jetty
#

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.

rigid trail
#

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

snow crypt
#

@unique axle why not just .pin(reason)?

unique axle
snow crypt
#

sure

vivid field
#

then the same should probably also be applied to all other methods where this is the case (e.g. GuildMember#kick)

unique axle
#

that'd be semver major, so earliest in v13/next which will very likely have a complete rewrite of internals

unique axle
vernal atlas
#

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

unique axle
#

oh damn, right

vernal atlas
#

has this broken split behaviour with allowedMentions FuzzyEyes

unique axle
#

yup

lofty birch
#

couldn't you just use a truthy check & that it has length?

unique axle
vernal atlas
#

@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

unique axle
#

content && content.length notLikeCat that feels weird

vernal atlas
#

ig all it needs is changing to typeof content !== 'undefined'

unique axle
#

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 blobcatthumbsup

vernal atlas
unique axle
#

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)

vernal atlas
#

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)

unique axle
#

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

idle haven
#

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.

ornate topaz
#

only if you will track it yourself. library doens't add anything else except for ways of interacting with the API

idle haven
#

sure. Maybe discord api provide something like I said, I dont think so but just asking to make sure

burnt cradle
#

It doesn't

ornate topaz
#

definitely won't. there is no point

idle haven
#

ok

#

thanks guys

neon apex
#

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

unique axle
#

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

neon apex
#

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?

unique axle
#

audit logs are handled by discord server side

neon apex
#

wtf discord

#

aight

#

ty

unique axle
#

and no, i have not heard of or experienced that happening

vernal atlas
#

should message.reply automatically add the user you're replying to to allowedMentions?

quasi steppe
#

Is there a reason why GuildMemberRoleManager and GuildEmojiRoleManager don't have a valueOf method?

vernal atlas
#

seeing as they dont extend BaseManager, and thats where the valueOf is inherited from on the other managers, likely an oversight

quasi steppe
#

Found out about it since Util#flatten used valueOf to convert a Collection into a key array

rigid trail
#

its not an oversight, both of those managers are "pseudomagers", because their cache is a getter

unique axle
#

could and shouldn't they still return the cache collection for .valueOf ?

vernal atlas
#

yes and imo yes

unique axle
#

an on another note: is there a good reason for #valueOf to not be typed on either BaseManager nor the pseudo managers?

keen cosmos
#

I believe valueOf is always present on classes, even if untyped

#

typings wise

unique axle
#

affirmative, but since we return a collection i believe it should be typed as such public valueOf(): Collection<K, Holds>;

keen cosmos
#

Ahhh, I see what you mean

unique axle
#

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 notLikeCat

copper laurel
#

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

unique axle
#

so we currently have inconsistent behaviour between BaseManager extensions and pseudo managers which we can not tackle until next major
notLikeCat

copper laurel
#

I guess so yeah

unique axle
#

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

atomic crag
unique axle
#

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
copper laurel
#

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

unique axle
#

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)

copper laurel
#

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

unique axle
#

and even that very technically wouldn't be a primitive, would it?

copper laurel
#

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

unique axle
#

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 notLikeCat but consistent with [{1:"value_here"}] for ["value_here"])

#

semver constraints dragonyay

atomic crag
#

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

keen cosmos
#

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

oak quail
#

discord.js's userUpdate event triggers on Discord's USER_UPDATE (updates for the bot user), PRESENCE_UPDATE, and GUILD_MEMBER_UPDATE events, right?

tacit crypt
#

Nop

#

userUpdate is emitted only by USER_UPDATE

#

presenceUpdate (and apparently guildMemberAvailable?) are emitted by PRESENCE_UPDATE

#

and guildMemberUpdate by GUILD_MEMBER_UPDATE

unique axle
#

and that can be causing issues in terms of data availability compared to what the API* offers

oak quail
#

@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

#

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

tacit crypt
#

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..

oak quail
#

wdym?

tacit crypt
#

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

oak quail
#

yeah

vernal atlas
#

should Util.escapeMarkdown escape quote blocks too?

shell junco
#

Why not add a MessageEmojiManager? Thinkeng

rigid trail
#

uhh, why?

#

MessageMentions literally does that ugh its way too late for me

shell junco
rigid trail
#

its not like theres any api stuff that it could do either

shell junco
#
message.emojis.cache.map(x => x.name).join(" xd ")```
rigid trail
#

i disagree with adding something like that, even if there was something like that it would not be a manager

shell junco
#
message.emojis.cache.first()```
#

anyway

#

I think that can be a collection, sure?

rigid trail
#

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

copper laurel
#

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

rigid trail
#

yeah exactly

copper laurel
#

Also its simply not efficient to regex parse for emojis constantly

rigid trail
#

its easy enough for users to copy and paste the regex and use it when they need to

copper laurel
#

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

real jetty
#

Why do the typings for GuildMember extend PartialTextBasedChannel?

export class GuildMember extends PartialTextBasedChannel(Base) {
snow crypt
#

so you can call .send on them without it erroring

#

.send and some other text channel methods that can be executed on members

real jetty
#

oh interesting

snow crypt
#

actually, it is only .send for GuildMembers and Users

lofty birch
#

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

deft holly
#

<% emojiSequence $> is a placeholder generated by a script

wild flax
#

Yeah, we are not interested.

#

There is a package for this out there already anyway. Do it yourself.

lofty birch
#

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

vivid field
#

Why do GuildMember#permissionsIn and Role#permissionsIn throw an error when the passed parameter is invalid whereas GuildChannel#permissionsFor would return null?

tender surge
#

const [embed] = reaction.message.embeds; Why is embed not nullable according to the typings?

#

Getting a runtime error because of it

tough geode
#

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

tender surge
#

@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

tough geode
#

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.

tender surge
#

How about public embeds: [MessageEmbed | undefined, ...MessageEmbed[]];?

#

This gives full type safety

vivid field
#

That would suggest that every array needs undefined in its typings, as accessing an invalid index always returns undefined

unique axle
#

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

tender surge
#

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 }} ?

tough geode
#

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.

copper laurel
#

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

tender surge
#

Isn't an array of 0 message embeds an empty array?

copper laurel
#

An empty MessageEmbed Array, yes

tender surge
#

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

copper laurel
#

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

tender surge
#
type NonNullableArray<T> = [T, ...T[]];

public embeds: [] | NonNullableArray<MessageEmbed>;
```?
copper laurel
#

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.

tender surge
#

Well I'll fix this with declaration merging then, for the sake of not randomly running into the runtime error

#

Thanks tho

copper laurel
#

Or just do a length check before trying to access 1 element of 0

#

Thats how this should be checked, not through typings

tender surge
#

const [embed] = reaction.message.embeds as [MessageEmbed?]; asserting works too since this is what I expect

snow crypt
#

or just have it ```js
const [embed] = message.embeds;
if (embed...)

#

typescript deals with this too

warped crater
#

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 meguFace

copper laurel
#

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.

fallen arrow
#

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

vernal atlas
#

which would explain why its not effecting the VoiceState

#

perhaps an oversight when adding the VoiceState as extendable

vernal atlas
#

i've made a PR 4616

snow crypt
#

@unique axle any way you could document that / type that?

unique axle
#

got a suggestion? because i really am unsure how that'd work

snow crypt
#

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

unique axle
#

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

snow crypt
#

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

snow crypt
#

@unique axle any ideas by now?

midnight night
#

What is a typedef by definition?

raven juniper
oak quail
#

Guild#memberCount will be inaccurate without the members intent right?

warped crater
#

no, it does not depend on it

oak quail
#

iirc it gets updated based on member add and remove events?

warped crater
#

Guild#memberCount !== Guild#members#cache#size

oak quail
#

i know

warped crater
#

nope, it's just data given by Discord on any occasion they give you a guild object

#

not necessarily guild member/add

oak quail
#

nope, discord only gives member_count on GUILD_CREATE

warped crater
#

in theory message events should also keep it updated

#

hmm

#

I'm gonna ask around how this will be handled

oak quail
#

there is the approximateMemberCount u optionally can get when fetching a guild

#

but that isnt sent in gateway events

#

guild.memberCount++

#

@warped crater

warped crater
#

asked a question to some api people

tacit crypt
#

Guild#memberCount will be inaccurate without the members intent right?
@oak quail Short answer, yes
Unless Discord adds an event for it or such

lofty birch
unique axle
snow crypt
#

Can there may be a way to access the raw object passed to any Base constructor?

slate nacelle
snow crypt
#

@unique axle Intergration#role makes sense

#

but with RoleManager#integrationRole, what would it be?

#

which integration

#

there could be more than one

unique axle
#

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
simple veldt
#

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?

unique axle
snow crypt
#

@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;
unique axle
#

no, the object should just have the key if the key is present on the data

snow crypt
#

seems a little inconsistent

unique axle
#

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

snow crypt
#

oh, didn't notice

#

maybe make a typedef for RoleTagsData instead of typing it as an object with props?

#

similar to fetchVanityData

unique axle
snow crypt
#

well one last suggestion ig

#

maybe have premiumSubscriber instead of premiumSubscriberRole for consistency with what the API sends (premium_subscriber)?

vernal atlas
#

the camel-case version would be #premiumSubscriber, which however sounds more like a GuildMember than a Role instance, so the suffix -Role is added

unique axle
#

also covered in considerations 1.

snow crypt
#

oh, i missed that too

vivid field
#

why use Reflect.has(data.tags, 'bot_id') and not just 'bot_id' in data.tags?

unique axle
#

because i need to learn some more js basics

vivid field
#

last thing, i don't see the benefit of adding GuildMember.roles.premiumSubscriberRole when you can do GuildMember.guild.roles.premiumSubscriberRole instead

unique axle
#

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

vivid field
#

oh yea, i forgot that it can be used as an additional premium check

unique axle
#

good thought though, added it as considerations 6.

unique axle
#

re: pr 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?

vivid field
#

you're on the GuildMemberRoleManager though

unique axle
vivid field
#

i just used .member.user.id because this is the common way for the rest of the lib

vernal atlas
unique axle
#

the rest of the lib actually doesn't use that getter?

vivid field
#

afaik no

unique axle
#

pff.. why should we use our own api, right dragonyay

vivid field
#

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)

vernal atlas
#

find and replace would make it quite easy

unique axle
#

will apply .user.id for consistency for now (also time we switch to TS, would've caught most of my silly mistakes)

snow crypt
#

@unique axle

  1. 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

unique axle
#

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

vivid field
unique axle
#

that's an issue notLikeCat
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

snow crypt
#

it might be a discord issue

#

because i'm not receiving the raw tags

#

.raw is added by an extended structure

vivid field
#

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
unique axle
#

well... that is...

vivid field
#

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

snow crypt
#

you fetched it with the guild role manager, why not have Role#fetch?

vivid field
#

Role#fetch isn't a thing

snow crypt
#

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 Thonkang

#

wait

#

so even when patch is called it does not have tags

unique axle
#

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

snow crypt
#

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.

unique axle
#

await <Guild>.roles.fetch() does the job though... still, no idea why they don't just send that data... same for User#flags tbh.

snow crypt
#

well now it works ofc

unique axle
#

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

snow crypt
#

regardless i feel like role#fetch should exist

unique axle
#

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...

snow crypt
#

but rolemanager#fetch does the same

#

actually no it does not

thorny cosmos
#

If you look at the source code, that fetches all the roles, then accordingly does its work

snow crypt
#

there could be something like member.ban on role.fetch like fetch() { return this.guild.roles.fetch(this.id); }

unique axle
vivid field
#

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
unique axle
#

if there is multiple why does Integration#role even exist/not come with an array? notLikeCat

vivid field
#

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

unique axle
#

kyuclap 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

vivid field
#

alright, will do

unique axle
#

otherwise i'll get to it later, but i should really get some database theory exercises done now idle

earnest abyss
#

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

unique axle
#

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

earnest abyss
#

Okay

vivid field
#

why is GuildMemberResolvable a thing when guildmembers are already included in UserResolvable?

copper laurel
#

Because you can resolve a User from a GuildMember, but cant resolve a GuildMember from a User

vivid field
#

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

copper laurel
#

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

vivid field
#

you need the guild for everything that's not a GuildMember object though, so that would even make ids not a valid GuildMemberResolvable

vernal atlas
#
#

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)

frank turret
#

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?

vernal atlas
#

yeah thats what i think is the best soloution

frank turret
#

removed cause i made dumb mistake

oak quail
#

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)

tacit crypt
#

Well maybe you don't want partial reactions in your partial messages

vivid field
#

some more opinions on the topic above would be appreciated

vernal atlas
#

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)

ornate topaz
#

Wasn't guild removed from GuildMemberResolvable at some point?

vernal atlas
#

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

vernal atlas
#

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'

copper laurel
empty viper
#

When does the new stable release will be released so ?

copper laurel
#

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

unique axle
#

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.

tender field
#

nice ! it really seems awesome

unique axle
#

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

tender field
#

np 🙂 i understand

simple veldt
#

(if so, is a release which would fix the latest bug planned?)

vernal atlas
#

i believe the next release will be 12.3.0

oak quail
#

could just npm i discordjs/discord.js to install from GitHub

bleak mantle
#

Hey there, since discord will soon shut down discordapp.com, will the v11 lib get updated too?

mossy raft
#

Guys, is the library getting updated for the new domain?

tough geode
#

v12 has already been updated accordingly, v11 won't recieve any updates regarding the domain change or intents.

rich iglooBOT
#
  • "Discord changes their domain!" - Yes.
  • "Will discord.js implement that?" - Yes, commit ea19faa.
  • "In v11?" - No.
  • "Why?" - R.I.P. v11
vivid field
#

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

rich iglooBOT
wild flax
#

Considering its false all the time except once, no not really.

#

and what would "improved" mean here?

vivid field
#

also updating all internal uses

#

but i can see how it's mostly unnecessary

copper laurel
#

Do we internally check for guild ownership anywhere?

vivid field
#

mostly just permission checks

#

e.g. guildmember.manageable

lofty birch
#

It's as simple as member.id === member.guild.ownerID

fallen arrow
#

what is the reason for StreamDispatcher having a default highWaterMark at 12 bytes? (its not operating in objectMode is it?)

zenith ravine
#

Why is the api version set to 7 by default? Discord's latest version is 6, isn't it?

lofty birch
#

The gateway version latest is 6, the API latest is 7

unique axle
#

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.

snow crypt
#

Does that mean v13 would be developed following discord api v8?

unique axle
#

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)

snow crypt
#

so discord.js-next would be v14?

unique axle
#

who cares, some future version

normal wadi
#

Hello

velvet raptor
#

I think you just made a typo, but this is just in case.

velvet raptor
#

Or i missed something 😁

unique axle
#

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

velvet raptor
#

Oh okay, sorry and thanks !

chilly urchin
#

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?

vernal atlas
#

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

left moat
#

So

#

Are you able to change a managers cachetype?

chilly urchin
#

@vernal atlas so it sort of makes its own sort of identifier, but it doesn't actually use a bucket hash?

vernal atlas
#

yeah

chilly urchin
#

so its not actually future proof is it?

snow crypt
#

@left moat no

real jetty
#

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

warped crater
#

Any reason why it would?

#

it's not actually a snowflake so this isn't really a type inconsistency

tacit crypt
#

shard IDs:

  • are not snowflakes, but numbers
  • most certainly won't go past 1k or 10k or 100k
digital storm
#

Hello !
I have a question 😅
Why do you use _patch and _update methods in structures ?

unique axle
#

_ 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

vivid field
#

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)

fallen arrow
#

_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)

digital storm
#

@fallen arrow okay, but why updating data ?

#

that's the thing i don't understand

lofty birch
#

When something changes in the object, for example a channel name being changed. The object needs to be updated to show the new name

digital storm
#

Thanks for the answer 😄
But why _patch is called inside the constructor ?

#

Instead of modifying values inside

fallen arrow
#

so you dont have duplicated code

digital storm
#

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

unique axle
#

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

fallen arrow
#

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

digital storm
#

oh okay, thank you 😄
I understand it better, now
(btw sorry if i made mistakes)

vernal atlas
#

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)

loud blade
#

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?

copper laurel
#

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

tender field
#

Do you know when will djs-next be started ? Because the repo has been inactive for 5mo

unique axle
#

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.

tender field
#

Thanks ! Yes that’s why i asked for the beginning, i sure do understand that it’ll take time, np 🙂

vernal atlas
#

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

tender field
unique axle
#

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

tender field
#

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"

unique axle
#

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)

tender field
#

okay! thanks

vernal atlas
#

#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

vernal atlas
#

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

vernal atlas
#

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

vivid field
#

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

vernal atlas
#

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

lofty beacon
#

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

vernal atlas
#

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)?

unique axle
#

collector <-> collection

lofty beacon
#

let me edit my message to make clearer

unique axle
#

that notation is hella confusing and i don't yet really see a use case for this

lofty birch
#

Personally a <collection>.on('set/delete/get', fn) would make more sense

vernal atlas
#

OH, my bad

#

i think maybe a better option would be to be able to provide your own cache type in the client options?

unique axle
#

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.

vernal atlas
#

if the cache type provided was restricted to extending the Colleciton class, then it could be passed as normal to the Manager constructors right?

oak quail
#

i guess for the permissions _new update, we should make a BigIntBitField or smth and move permissions to that?

copper laurel
#

🤢

#

But yes, seems that will be needed

viscid crescent
#

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 lol

copper laurel
#

That would be a misrepresentation of the actual APIs. Roles are added to GuildMembers, not the other way around

viscid crescent
#

RoleMembersManager#addTo()

#

but broger is right it is unnecessary

solemn oyster
#

One question, in #4667, shouldn't the object also be documented in JSDocs? The WebSocketProperties interface in question.

opal mauve
#

if it gets added, yes

solemn oyster
#

As in, added in Discord's API docs?

opal mauve
#

there is a significant amount of pushback against adding the websocket properties

zenith monolith
#

where exactly is the streamDispatcher start event inherited/emitted from

zenith monolith
#

Ty

zenith monolith
#

also where would i find the voiceConnection#play() function?

unique axle
zenith monolith
#

alright. My bad i just wasnt sure where to ask this kinda questions. Didn't realize there was that kinda feature.

real jetty
#

are discordjs shards able to take advantage of hyper threading?

undone ravine
#

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

silver forge
#

why in an embed if we set the color to #ffffff(white) it return black?

wild flax
#

discord doesnt allow full white

near halo
old kelp
copper laurel
#

Well... no, not for that typedef, because "string" is correct. Structures.extend(ExtendableStructure, Function) expects a string as the first parameter

old kelp
#

hm, right, but a reference to the types would make more sense

copper laurel
#

Most other typedefs dont do that either though in their descriptions

paper kernel
#

Discord provides info regarding nitro flags so adding nitro flags support in the library will be really appreciated

lofty birch
#

That's an oauth thing only, not public flags

vernal atlas
charred mural
#

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

lofty birch
#

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

charred mural
#

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?

lofty birch
#

it's pretty quick usually, lots of people make PRs

charred mural
#

Awesome, thanks.

#

I guess it was added since all servers are getting the announcement channels feature with the community option.

unique axle
#

g#4105

rich iglooBOT
unique axle
real jetty
#

Would it be useful a PR to add the private property (getter) to the GuildChannel class ?

ornate topaz
#

what would it get

real jetty
#

It is when a channel is set to private (with the private icon), when everyone doesn't have the read messages permission.

ornate topaz
#

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 channelLocked as opposed to Channel, then this means literally that, that it is not accessible for everyone role

real jetty
#

I know lol, I was talking about a Pr to add a property to know if it is a private channel or not

unique axle
#

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"

vernal atlas
#

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
vernal atlas
lofty birch
ornate topaz
#

any context?

vivid field
#

this has already been fixed with g#4281

rich iglooBOT
manic thistle
#

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?

warped crater
#

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)

manic thistle
#

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?).

dawn ivy
#

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 ?

warped crater
#

@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

manic thistle
#

by "set its value" i meant to add it to the cache

ornate topaz
#

@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

dawn ivy
#

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

regal oracle
#

how soon after the new bot features are released is djs planning on supporting them?

copper laurel
#

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

regal oracle
#

ah was about to ask if you get some sort of early access so you can support them close to when they are released

copper laurel
#

Nope

regal oracle
#

rip

#

looks cool though 😄

#

thanks

copper laurel
#

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

regal oracle
#

any idea if its something that will be supported in v12 or will it be planned to be integrated to v13?

copper laurel
#

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

regal oracle
#

awesome

copper laurel
#

Anything we say currently is just guessing though

regal oracle
#

yeah figured

copper laurel
#

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

wild flax
#

😀😃😁😆🤣 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

snow crypt
#

Base#valueOf is ```js
valueOf() {
return this.id;
}

But `Base#id` is not even a thing on just un-extended `Base`
waxen minnow
#

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.

frank turret
#

Bots cannot stream in a voice channel at the moment.

raven juniper
#

That's up to discord, nothing the library controls

waxen minnow
#

Yea, I meant is there news about it...?

ornate topaz
#

no. and we cannot do anything regarding that topic anyway

#

if there were any rumors, we probably would hear about them

peak mauve
#

Yo I never thought of this. It would be a dangerous yet cool thing kek. I wonder if discord is already working on it.

unique axle
#

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.

vernal atlas
#

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

surreal geode
#

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

vernal atlas
#

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

surreal geode
#

That's why you should check if the member is partial first

#

Same with checking if a guild is available before reading its properties

vernal atlas
#

ig its something for v13 to make that nullable

surreal geode
#

I still don't think you should rely on the library to check for partials when you can put your own check in place

vernal atlas
#

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?

surreal geode
#

That's why you are required to put checks into place

#

Unexpected behavior should be expected when you neglect warnings like that one

snow crypt
#

@unique axle what about #4617?

unique axle
#

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

snow crypt
#

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

unique axle
#

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

simple veldt
#

Hello
Here line 2088 is it an errror or it should be with 3 r?

vivid field
#

good catch, i doubt it's supposed to have three

simple veldt
#

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

opal mauve
#

this is probably a bug

simple veldt
#

Right so I'll make a pr

wild flax
#

yes this is a bug

simple veldt
#

*list

ornate topaz
#

What list

vernal atlas
#
  • @param {string} [options.type='text'] The type of the new channel, either text, voice, or category
#

that list

#

maybe create a typedef for ChannelType

waxen swan
#

Is there anywhere we can talk about upcoming features or thoughts? :3

ornate topaz
#

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

waxen swan
#

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 🤔

ornate topaz
#

Bots do not have access to streaming

waxen swan
#

Only voice streaming yeah :/

ornate topaz
#

And again. We don't decide if they can or not. Discord does.

waxen swan
#

Yep

#

Anyway thanks for your time I will go as I'm not wanted here

vivid field
#

why does the .id property not exist on Base directly?

vernal atlas
#

my guess is it was originally for documentation purposes

simple veldt
#

@ornate topaz add news here:

  • @param {string} [options.type='text'] The type of the new channel, either text, news, voice, or category
real jetty
#

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?

raven juniper
#

I believe the logic is that users can be mentioned in DMs but members cannot be, as there is no guild thus no GuildMembers

real jetty
#

ah, ty

simple veldt
#

setExplicitContent filter doesn't accept numbers

#

using ts

#

should this be fixed or it doesn't matter as we can use string levels

vernal atlas
#

yes the typings should be updated for that, the method does accept numbers

wild flax
#

Using TS, not using numbers here is actually preferred, simply from a type-safe standpoint.

#

But I guess we can loosen the type.

vernal atlas
#

strictly speaking couldnt the typings be altered to support only the numbers that match a verification level?

snow crypt
#

you could use a numeric enum for convenience with that

oak quail
#

ah its because d.js drops it if the member is uncached

#

and members arent cached without sending messages if presence is disabled

timber plover
#

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

lofty birch
#

there is a ratelimit event that you can use

tacit crypt
#

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 👍

timber plover
#

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 🙂

tacit crypt
#

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

timber plover
#

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

tacit crypt
#

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)

timber plover
#

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

tacit crypt
#

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)

timber plover
#

sure, I've looked at the source code 🙂

tacit crypt
#

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

timber plover
#

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)

tacit crypt
#

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

timber plover
#

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

tacit crypt
#

HA, you'd be surprised how much can be undocumented if we don't do it ASmeguFace

timber plover
#

oh I'm sure 🙂

tacit crypt
#

DDevs IS official, DAPI is the unofficially official or w/e (I think it's the official unofficial one)

timber plover
#

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

lofty beacon
#

if blocking the request for invalid ones before it is sent is some how possible, that'd be very useful (if i undersotood corect)

timber plover
#

so I don't know who you are concerend about being banned

tacit crypt
#

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

timber plover
#

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)

tacit crypt
#

What about those whose global limit is higher/lower

timber plover
#

right - that's part of why my instinct was to make that configurable

#

but if you want to limit turnable knobs...

tacit crypt
#

well, ok you can keep it off

#

Fair point

#

Regardless, I don't see why not but shrug
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

timber plover
#

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

tacit crypt
#

However I do have to ask..what are you doing that causes you to actually hit 10k 429's in 10 minutes

timber plover
#

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)

lofty beacon
#

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.

timber plover
#

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 😂

autumn talon
#

Why does the typings are in index.d.ts and not directly into the declarations files ?

ornate topaz
#

what exactly are you asking about

#

index.d.ts is a declaration file.
also, library is written in javascript, not in typescript

oak quail
#

should probably be mentioned in the release notes that v12.3.0 updates the domain

ornate topaz
#

what is the difference for the end user though

oak quail
#

older versions may stop working soon

ornate topaz
#

fair

autumn talon
#

Yes, but why do not writing the library in ts ?

ornate topaz
#

for the same reason it is not in java or c#

#

because it is javascript library

autumn talon
#

typescript is typed js

ornate topaz
#

which supports being used in typescript projects via the typings file

autumn talon
#

Ok

raven juniper
#

A future version of the library may be written in ts

ornate topaz
#

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.

real jetty
#

user.bot was changed so it is now always true or false and can't be null in 12.3.0, right?

vivid field
#

yes, null was removed as a possible value in 12.3.1 but the docs didn't get updated accordingly

real jetty
#

i would try and change that but im bad at PRs

#

dont even know which repo docs are on omegalul

vivid field
real jetty
#

ah thanks

oak quail
#

.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

real jetty
#

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

empty viper
#

Also in the Guild class documentation, some of the descriptions of fields speak about de the removed PUBLIC flag

oak quail
#

@empty viper where? i dont see any

#

im pretty sure i updated all of them

empty viper
#

I supposed that it has been fixed in the meantime, the one that I had noticed have not the mistake anymore

oak quail
#

i mean, nothing has changed since you sent that bloblul

empty viper
#

I found the errors like 20 minutes after the release of the 12.3.0 and now it's all fixed 🤔

oak quail
#

maybe it loaded the wrong docs version? because it was changed in 12.3.0

empty viper
#

Yeah it's possible

haughty venture
#

Does someone know how do I test the library?

ornate topaz
#

what do you mean by "test"

haughty venture
#

run the code on test/. all around there's mention to require auth.js, on those files, but there's nothing like this

wild flax
#

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

haughty venture
#

sure, thank you!

indigo oar
#

I guess there should be easier ways to get information from a User like If he has nitro

#

without OAuth2

unique axle
#

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 sweep

real jetty
#

or default to false potentially?

frank turret
#

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)?

real jetty
#

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

copper laurel
#

Yeah

#

Is that an issue?

real jetty
#

i don't know, you tell me?

#

I just think null would make more sense

copper laurel
#

I mean, I dont believe that it is

real jetty
#

and be more consistent with other properties

copper laurel
#

But it is consistent with the others

#

Nearly everything in _patch has an if in data check

real jetty
#

huh - i always thought by default it turned to null

#

my bad if thats not the case

oak quail
#

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

real jetty
oak quail
#

we're defaulting bot to false, so we should also default system to false, for consistency

real jetty
#

yeah that makes sense - i'll probably pr it when i can

vernal atlas
#

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

snow crypt
#

this seems to be happening on every pr sent

vernal atlas
#

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

lofty beacon
#

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.

raven juniper
#

that's already a feature on some, if not all, of the fetch methods

#

?docs client.users.fetch

rich iglooBOT
raven juniper
#

although on other managers (roles, channels, etc) i don't think it's there, but they're usually assumed to be cached anyway

lofty beacon
#

thanks! I might work on a PR fo it tomorrow.

ornate topaz
#

on what exactly

lofty beacon
#

no caching of other collections for the fetch method

ornate topaz
#

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

lofty beacon
#

oh ok. nvm

plucky jay
#

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.

copper laurel
#

Typings arent breaking changes, assuming thats all you plan to change

vernal atlas
#

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

plucky jay
#

Yeah true because StringResolvable is also used in Util.resolveString

vernal atlas
#

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*

real jetty
#

it appears that available can be undefined from what ive seen

oak quail
#

i mean

#

honestly there are probably some mistakes in discord's docs for whether properties are optional or not

real jetty
#

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

vernal atlas
#

those properties seem to be sent even if they are false

vernal atlas
#

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?

snow crypt
#

This appears on every PR

vernal atlas
snow crypt
#

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

vernal atlas
#

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

real jetty
#

Hey sugden can you read my comment to your PR review when you can, thanks PES_Heart

vernal atlas
#

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

real jetty
#

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

copper laurel
#

?type should indicate that something is nullable. We shouldn't have any documented properties be potentially undefined imo

real jetty
#

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

vernal atlas
#

?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

copper laurel
#

v13

vernal atlas
#

well for v13 / djs-next obviously yea, but as for v12 at the moment

real jetty
#

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

vernal atlas
#

i think the jsdoc is a bit of a mess

real jetty
#

the approach that i take in the pr is the best we can do for now afaik

vernal atlas
#

types are correct for the most part i think but its just the little parts like this

copper laurel
#

Yeah but I think that like

#

?type will do, it indicates that it might not be there

real jetty
#

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

vernal atlas
#

yeah for now it cant be done, maybe if this is an issue it can be implemented with another PR

paper furnace
#

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!
radiant glacier
#

you can still use the raw event

#

in v12

paper furnace
#

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

radiant glacier
#

well it does @paper furnace

paper furnace
#

mhhh really weird

lofty birch
#

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

vernal atlas
#

raw is undocumented, because it emits the raw websocket data

slate nacelle
cold basin
#

would it be handy to add a guild property to DMchannels

#

which is actually the user

slate nacelle
#

There is recipient, isn't there?

cold basin
#

and dont keep asking

real jetty
#

its easier to tell them guild is null in dms

#

because it actually makes sense

cold basin
#

¯_(ツ)_/¯

ornate topaz
#

no, because guild would no longer mean guild

cold basin
#

thats true

ornate topaz
#

so you actually could not do message.guild.roles or anything similiar

real jetty
#

that just makes things even more confusing

cold basin
#

yeah ok fair enough

oak quail
#

honestly, imo its ok (but a bad idea) to not document the raw event, but its really dumb to not put it in typings

unique axle
oak quail
#

imo the typings should cover the entire library

real jetty
#

yes but thats not a public aspect of the library

haughty tide
#

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?

ornate topaz
#

"whole power"? you mean "unrealiable power that can change at any point without any warnings, as its undocumented"?

copper laurel
tacit crypt
#

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 shrug

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)

fallen arrow
#

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");

unique axle
#

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

snow crypt
#

can we add an option to not wait for stopping to type?

fallen arrow
#

currently the only alternative is not awaiting, which introduces a possible race condition

tacit crypt
#

IIrc you can pass a count too

snow crypt
#

?docs textchannel.starttyping

rich iglooBOT
unique axle
#

i don't really see the use case tbh, and passing a count does not change the behaviour of the returned promise

tacit crypt
#

well, passing 1 WILL make it return

snow crypt
#

but also end typing

unique axle
#

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

snow crypt
#

well, what about the option idea?

fallen arrow
#

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

tacit crypt
#

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

fallen arrow
#

sure, there is always a workaround

vernal atlas
#

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

real jetty
#

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

oak quail
#

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

copper laurel
#

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

vernal atlas
#

should Client#generateInvite have options for other query parameters for the invite other than permissions? eg preselcting a guild, redirect URI etc

unique axle
#

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)

unique axle
#

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 with PermissionResolvable|object and deprecating the first.

vernal atlas
#

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

snow crypt
#

what are the marked ones for?

wild flax
#

Those are all legacy and we’ll prolly not use them anymore except for v12 @snow crypt

snow crypt
#

so is the current repo gonna move to a legacy repo when next goes live?

#

next being the typescript one

wild flax
#

no

#

next will be merged into the current repo

#

but the tags/labels won't be the same most likely

velvet tide
#

so i realized the docs and typings dont have syncID for the Activity class. I decided I will make a PR because it'll be useful. What exactly should I put for syncID'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 message spotify stuff. So should I put the comment as The ID of the Spotify track?

#

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?
@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

velvet tide
#

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?

unique axle
#

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

velvet tide
#

I see. I think I'll go upstream with this. Thanks for the input @unique axle

glad sparrow
#

what will Collector use if there is no time (in collector options)

unique axle
#

this is not a support channel, whatever other ending criteria you give it, if none - none

vernal atlas
dapper leaf
#

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

unique axle
#

no current plans, has not been discussed - might become easier after the planned typescript rewrite or be considered during it

dapper leaf
#

ok

copper laurel
#

@vernal atlas not sure what you're pointing out here honestly - what are you suggesting it should extend?

vernal atlas
#

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

copper laurel
#

Ahh gotcha. So you're suggesting they should extend the extended Structure, if that's even possible

vernal atlas
#

the ClientUser export is a getter so it can properly get the User class from Structures.get

#

yea

vernal atlas
#

well

#

all channel classes extend Channel

lofty beacon
#

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.

real jetty
#

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

vernal atlas
#

you could also extend the client class and override the sweepMessages function to emit an event 👀

lofty beacon
#

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
ornate topaz
#

what would be a use case for that

unique axle
#

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

lapis talon
#

Yeah that new quoting thingy is pretty epic

vernal atlas
#

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?

wild flax
#

Considering we can’t just up v13 for this, yes

#

The latter

vernal atlas
#

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

oak quail
#

has that changed, or was it always like that?

vernal atlas
#

thats what puzzled me at first because i could've sworn it was sent with the initial packet

oak quail
#

i'd make an issue on discord-api-docs

vernal atlas
tacit crypt
#

Guilds do not store this metadata, so it isn't returned in guild creates

GUILD_UPDATE contains them

#

logic 200

vernal atlas
#

would it make sense to make fetchEmbed just return this.fetchWidget() to avoid duplicated code?

tacit crypt
#

Ye, and mark as deprecated

vernal atlas
#

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

oak quail
#

/embed is removed in api v8

#

which is why the djs embed stuff was deprecated

vernal atlas
snow crypt
vernal atlas
#

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

snow crypt
#

@vernal atlas why not have includeApplications just true by default

#

like, not even an option

#

just always true

vernal atlas
#

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

snow crypt
#

@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

vernal atlas
#

perhaps default to true, but still have the option if you need it

snow crypt
#

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"?

vernal atlas
#

well, it would be easier for a user to filter out bot & webhook integrations

snow crypt
#

can you explain?

vernal atlas
#

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)

snow crypt
#

ohhh wait my bad

vernal atlas
#

did you think include_applications did something else?

snow crypt
#

yeah

oak quail
#

oldeyes PR #4762 was merged before the docs pr was merged

thorny copper
#

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?

warped crater
#

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

thorny copper
#

(Yes I know this would break existing code, but why not a change for DJS v13)

wild flax
#

I don't see a huge benefit in merging them