#archive-library-discussion

25217 messages · Page 7 of 26

vagrant holly
#

Hm

ebon radish
#

but only in 1 of the four times his name is there

#

it's interesting because it goes \___ and __\_ twice, then that becomes \_\_\_ 3 times and \\_\__ once. well I am sure my commentary isn't helpful at this point, suffice it to say I don't know how it decides what to escape

vernal atlas
#

a single _ also is italics, so say you have

\_\_message\_\_ (which escapeUnderline is ran on) then run escapeItalic and you get \_\\_message\\_\_

#

i think thats whats happening right ?

#

perhaps the soloution is to escape everything else then .replace(/_/g, "\\_");

#

might also get similar behaviour with asterisks too but idk

ebon radish
#

I don't think it will mess up on such a common case

#

but clone and edit on runkit isn't working for some reason

#

It works fine with __message__

#

It works in an interesting way with ___message___, then italic really does take care of one and underline the other

#

Anyway. I kinda expected it to just escape everything that could possibly be markdown with zero analysis tbh

outer raven
#

deletable, editable, manageable, joinable, speakable, viewable

#

some like joinable make sense but manageable, deletable and editable seem the same to me

fringe temple
#

super.deletable and this.manageable also perform different checks

unique axle
#

they also all have utility for the bot itself to be able and do things

#

"is a channel accessible for everyone" is completely irrelevant for a bot to do stuff

outer raven
outer raven
#

ah gotcha

#

thanks

loud blade
#

seems like the url of null is happening again more frequent this time

tacit crypt
#

I should really just remove that...

ruby terrace
#

bringing this up again since https://github.com/discord/discord-api-docs/issues/2702 was fixed: #archive-library-discussion message
I seem to have misread the docs for X-RateLimit-Reset-After.
On v8 it is in floating point seconds, to ms precision. The value in this is not how long the reset is, but how long until the current reset, meaning it is possible to handle ratelimits better.

Basically, I would like to add handling of the x-ratelimit-reset-after header so that, if present, RequestHandler#reset gets set to Date.now() + reset-after, without relying on calculating server offset and manually adding 250 ms for reactions. Falling back to the current handling if that header is not present (in case the referenced issue ever pops up again for example).
Can anyone see a reason not to do this?

faint cipher
#

recently people are getting errors connecting to discord.com, I am not sure if it's released yet but if not shouldn't it connect to discordapp.com

ornate topaz
#

no? domain change happened several months ago

faint cipher
#

Thonk I feel so outdated

oak quail
#

how should i add msg type 22

#

should i add 21 to the createEnum too? or just put null for it

#

since 21 is in the interactions pr

faint cipher
#

why isn't 'size' documentated as a property of collection

copper laurel
#

Its a property of Map, which Collection extends

frank turret
#

so whys that stop it from being in the documentation

strange moat
#

Because you can view the documentation for it on the MDN docs website

#

No point on having duplicate docs

frank turret
#

then how come we do that for the get, set, clear, delete, and has methods

ruby terrace
#

I believe because they are implemented differently (as in there is code that makes them different from Map's equivalent)

frank turret
#

not for get, has, and clear. We literally just return the super method

#

set & delete are extended but provide the caching functionality that collections has

ruby terrace
#

which is being removed IIRC

#

I am interested in all these functions that just call super

loud jayBOT
#

pr_merge #12 by Tenpi merged at 2020/02/24 17:13 UTC
chore(docs): document basic Map methods

oak quail
#

couldnt joinVoiceChannel in djs/voice just take a channel object?

#

so instead of js const connection = joinVoiceChannel({ channelId: channel.id, guildId: channel.guild.id, adapterCreator: channel.createVoiceAdapter() }); just js const connection = joinVoiceChannel(channel);

tacit crypt
#

@discordjs/voice is meant to be lib agnostic iirc

#

could be wrong

raven juniper
#

pretty sure that's the stated goal, yes

oak quail
#

couldnt it work for either

tacit crypt
#

then it wouldn't be agnostic, advaith

#

It's meant to be a standalone thing

oak quail
#

ig blobshrug

tacit crypt
#

aka you can use with a library or with pure raw data sprinkled from json files

remote wasp
loud jayBOT
#

pr_open #4154 by izexi opened at 2020/05/03 13:44 UTC (approved)
feat(GuildMemberManager): add 'search' method
📥 npm i izexi/discord.js#GuildMemberManager-search

remote wasp
#

aight, thanks 👍

oak quail
#

what do u guys think on interaction.webhook vs interaction.followup(s) ?

#

i feel like .webhook might be confusing since it isnt really a normal webhook

#

the library internally uses it for .editReply and .deleteReply but users wont need to use it for anything about the original reply

stone niche
copper laurel
#

I dont think callback is correct, no

#

Thats definitely not what it is

ruby terrace
#

I agree webhook could be a bit connfusing, however, I can't think of a better name, and it is mostly a webhook

oblique prairie
#

Hey! For v13, do you think it would be possible to keep track of extended classes throughout the library? By that I mean keeping the jsdoc/types. Quick example:

Structures.extend("TextChannel", (Channel) => {
    return class CustomChannel extends Channel {
        constructor(...) {
            super(...);
        }
    };
});
Structures.extend("Message", (Message) => {
    return class CustomMessage extends Message {
        constructor(...) {
            super(...);
        }
        someMethod: () => {
            // Now
            this.channel // jsdoc/hint shows that this.channel is a TextChannel

            // Better I think
            this.channel // jsdoc/hint shows that this.channel is a CustomChannel
        }
    };
});

Maybe what im asking for already exists, in that case please make me aware of how to achieve it :D Thanks!

#

Btw, i'm asking that because i'm trying to work in typescript so if I want to use a method from an extended class, I have to "force" types (ex: (this.channel as CustomChannel).customChannelMethod() // would not work if type is TextChannel

copper laurel
oblique prairie
#

Yeah, I don't think this is an important thing rn

copper laurel
#

JSdocs definitely dont do it, but you can write your own extended typings

#
declare module "discord.js" {
  interface Message {
    client: MyExtendedClient;
  }
}``` etc
oblique prairie
#

Okay, thx for answering!

oak quail
#

Util.cleanContent can be modified to take a channel instead of a message right?

copper laurel
#

...for what purpose?

#

Or do you just mean in general because all it accesses is message.client and message.guild

oak quail
#

well i want to do it so it can be used for interactions

#

was just making sure i wasnt missing anything

copper laurel
#

Just make sure you fix the message.channel.guild line lol

oak quail
#

are the types intentionally not imported?

#

looks like eslint complains that its not being used, although it helps with intellisense ablobthinking

copper garden
#

The docsgen recognizes the typings as is since it's compiled into one file anyways

oak quail
#

ik, but the intellisense helps for developing

copper garden
#

I don't think the docsgen supportimport("...")

oak quail
#

well require works

#

other than eslint

copper garden
#

Wouldn't that create issues with cyclic dependency?

copper garden
warped crater
#

I think this approach that isn't event loop bound at all and doesn't cause the tests to take an extra 100ms to exit is much more desirable:

test('Util#delayFor', async () => {
  jest.useFakeTimers();

  const cb = jest.fn();

  const promise = halt(100).then(cb);
  jest.runAllTimers();

  await promise;
  expect(cb).toHaveBeenCalled();
});```
#

or.. something along the lines of that nevertheless.

#

but it's kind of redundant to "test" the ms parameter at all when it's just thrown into setTimeout

#

there's fairly little to test with this method overall so I can't really think of an approach that doesn't look lame

clever crypt
lavish mural
#

seems like I would need to dig deep into DJS to find out which cache the lib doesn't deeply depend on

ornate topaz
#

i think the biggest hint would be managers that don't have everything cached from the start

clever crypt
#

how will main branch deployments on -next be handled?

wild flax
#

come again?

tacit crypt
#

how will we do them for -next

#

build branch? npm publish?

wild flax
#

not anytime soon

tacit crypt
#

if so, who can publish or will it be automated for canary?

#

see: rest module once someone reviews it and it gets merged

wild flax
#

will be figured out when its in an actual alpha state

clever crypt
#

i've been told the reason why rest hasn't been merged is because it hasn't been texted in prod but the only way you can at the moment is by vendoring

wild flax
#

clone, build, npm link

olive nacelle
#

what is left to be implemented for v13?

#

the main features (replies and interactions) seem to be implemented already

raven juniper
#

Interactions are not implemented

ruby terrace
#

interactions haven't been merged (although they are not a major change so it can release without and be a .1.0 thing). There are several semver major things that are still left (check pins in #djs-help-v14 ) Some things that aren't noted there: #5490 - Welcome screens, #5298 + #5296 - Reply options, and some other internal things that generally clean up the library

olive nacelle
#

ah i see, still workin on it

#

best of luck contributors, thank you for all your hard work

oak quail
#

wonder what's the API status on screening

#

I pinged yuugu a while ago and he didn't respond

#

also it would be nice to get monbrey's manager method prs in

loud jayBOT
ruby terrace
#

Yeah it'd be nice to get those in before 13, but they are, suprisingly, semver minor

oak quail
#

oh there are a lot of semver major prs lol

ruby terrace
#

yeah

#

a lot are simply internal things, and waiting on conflicts resolved / reviews

#

speaking of which, for https://github.com/discordjs/discord.js/pull/5161 I never got a response on if I should change it to just not emit presence / GMU if the only thing changed is the user object (still emitting userUpdate, basically the oposite of the current PR). I am aware that the PR will not get merged as is, trying to find a good solution.

oak quail
#

wait why would it not emit presence/gmu

ruby terrace
#

because oldMember and newMember are identical in those cases

#

as they used a referenced user object

oak quail
#

ah

#

yikes

ruby terrace
#

and there's no way to just freeze the user object because you'll get multiple GMU / PU per user change depending on how many servers they share, so it is only successfully freezed on the first update recieved, the rest already reference an updated user object

opaque copper
#

The tag property on User is returning null for a partial user? I understand it can be partial but discord docs never mark the username/discriminator property as nullable?

copper laurel
#

yes

#

Because if we had the full Discord structure it wouldnt be partial

patent halo
#

not sure if this is possible or its just "hard" to do, is it possible to manage the shards through PM2 .
Like if the library could implement it to auto shard and tell the PM2 to spawn N of processes

ornate topaz
#

what benefits would what have?

#

apart from having to write completely new way of having shards communicate between each other, which is supplied by the fact that main process spawns child_processes (or worker threads) which in turn allows communication directly in the processes, without any external abstraction

real jetty
#

In version 13, would you be able to give us more control over the caching? Some of the more popular bots that use discord.js use a crazy amount of memory, and most of the cache is useless because the bot doesn't use it. Even if it was just an object that said okay I want channels, roles, guilds etc etc

#

Then you could also ignore events where the bot doesn't want the cache for it

ruby terrace
#

I believe you can achieve that already (and will be more selective naturally in v13) via intents. If you don't need a message cache, don't add the messages intent. Speaking of which, that is something that needs to be heavily considered for v13. While many people will use the built-in INTENTS.NON_PRIVILEGED (IIRC that's what it is), granted not what should be done and most likely unneeded, it is totally possible, and recommend, to only specify the intents that you think your bot needs, only to find out djs breaks because it expected cache to be present and updated

copper laurel
#

Intents are one method of controlling caching as ckohen pointed out - if you never receive the events, your bot doesn't cache them. v13 is unlikely to change the caching structures and methods themselves though - this is something we're likely to explore more in the TypeScript rewrite

real jetty
#

Hmm okay thanks, I will look into intents and see if I can sort that out. Don't wanna have to buy a bigger server because my bot is using 200gb KEKW

#

(it's not actually)

copper laurel
#

You can also manually clear caches as needed

#

discord.js is built to expect things like guild/channels/roles to be in cache though

tacit crypt
#

The main things you can clear are users, members, maybe emojis, and presences. Those you can clear with little worry (except having to fetch members when needed)

real jetty
#

Ah alright thanks

quiet viper
#

Ghost Ping RIP

quiet viper
real jetty
quiet viper
unique axle
#

discord.js does currently not support swappable cache implementations or optional caches
this is a design goal to apply when we get around to rewrite the library.
that being said, you can always clear caches you do not need on an interval, as has been said above. not receiving data in the first place can also reduce cache size.

if you want to further discuss this on a level that's got nothing to do with discord.js development please use #archive-offtopic

wild flax
quiet viper
wild flax
#

Yeah now that makes sense lol

old hill
#

a native implementation of AbortController has been released in node.js 16
should this kind of thing be delayed until a future version of djs, since node 16 is so new?

#

and I guess also because swapping it out doesn't achieve anything of much significance aside from removing a dependency

warped crater
#

could polyfill it I guess

#

i.e check if it exists globally otherwise use the package

patent halo
old hill
#

so it was

#

I missed the

Some of the recently released features in Node.js 15, which will also be available in Node.js 16, include

#

question is still relevant though

raven juniper
#

Since master targets node 14 and I don't think there are any plans to make it target 15, this would be waiting until whatever comes next

ruby terrace
#

Seems like API v9 has been released to the clients (canary only for now). Since v13 isn't finalized yet, any thoughts on jumping directly to api v9 (obviously once documentation is present)?

sick merlin
#

the issue is at this rate, by the time all changes have been done to use v9, discord will release v10 and discord.js v13 will never come out
and theres no eta ( afaik ) for v9

vivid field
#

v9 has almost no breaking changes afaik, so switching over shouldn't take too long

copper laurel
#

v9 isn't likely to have THAT many changes

unique axle
#

let's start worrying about API versions when they're actually documented, thanks catThumbsUp

covert flint
#

Right, that's what I mean by "officially"

oak quail
#

on I didn't know there was another commit

#

there was one a few weeks ago

unique axle
#

We can start discussing implementations of threads once the features API is solidified and a PR on the original source repository discord/discord-api-docs, not some fork (which is already deleted)
A merge will of course require the implementation to be tested and the docs PR to be merged

empty viper
#

Node.js v16 is out also 👀

unique axle
#

that's also not relevant, because by far not LTS

empty viper
#

v16 will be LTS

unique axle
#

yes, at some point that might factor into library development. at the moment LTS is still 14.16.1

copper garden
#

Node v16 is scheduled to become LTS near the end of October 2021. D.js v13 should hopefully be released way before that happens

solemn knoll
#

i wondered how exactly a discord library like this on fetches "incoming" messages (like in this case with client.on("message", msg=>{...}))

copper garden
#

Why would you need to fetch a message?

solemn knoll
#

does it, like, fetch every latest message of each channel of a guild and compare it with the previous fetch

copper garden
#

No, it’s an event received via the ws

solemn knoll
#

ah makes more sense

ruby terrace
#

woah, sorry to spark such a controversy, thanks for the opinions (Souji, of course, was looking on a grand scale, although so far it seems like going to v9 might not involve a major change for the library somehow, all speculation for now though so I'll shut up)

oak quail
#

@ruby terrace interaction routes dont use the bot token anyway

#

WebhookClient is the easiest way to implement it afaik

#

otherwise youd have to copy all the methods

ruby terrace
#

That's an error in the latest PR's that add editMessage and deleteMessage, they should be passing auth: false to the request anyways

faint cipher
#

what's the point of resolve and resolveID if they depend on cache

ruby terrace
#

resolveID does not depend on cache, whereas resolve does as it is attempting to give you the cached instance

strange python
#

Hey. I was wondering if there is an official port of discord.js for deno. I found discordeno but I'm not sure if that is the official one

remote wasp
#

no, there isn't any

strange python
#

I see

#

Thanks :)

junior pumice
#

will v13 support slash cmds / interactions in general

unique axle
verbal solar
faint cipher
#

so resolve is useless

copper laurel
#

no it isnt

#

get must be passed an ID, resolve generically supports being passed any resolvable and returning the right thing

#

eg GuildMemberManager#resolve works with GuildMembers, Users, IDs

faint cipher
#

oh

empty viper
#

Hi, I'm talking about djs-next, what is tsyringe ?

raven juniper
#

?npm tsyringe

rich iglooBOT
vivid field
clever crypt
#

@vivid field resolved

void geode
#

Hey, do you know when stage channels will be supported by discord.js ?

unique axle
#

with the next major release (v13)
if you want to test it you can install the master (development) branch:
instructions and caveats: <#djs-help-v14 message>

worn bobcat
#

Why aren't the Discord embed types not sub stringed? Like this would make much more sense to substing the embed types not just trow an error saying that there are too many characters.

covert flint
#

Why should the library be responsible for something at the fault of the user?

wild flax
#

Its your responsibility to make sure the input is correct.

void geode
#

And, do you know if the parameter dynamic of ImageURLOptions will turned to true by default in V13?

remote wasp
#

no

raven juniper
#

There was a pr, or at least a discussion, about having it be true by default but it couldn't be done in stable because it's a breaking change

void geode
#

Yeah I understand, thank you

rough glacier
#

what was the reason behind this change?

vagrant holly
#

Encourage the user to handle errors properly, actually checking the message still exists before they delete it etc.

empty viper
#

You can change it to client.setTimeout(message.delete, 10000) no ?

slate nacelle
#

No

empty viper
#

why couldn't you 🤔

tacit crypt
#

Many reasons that are outside the scope of this channel

mighty sequoia
#

If i wanted to do this issue, what git commit message would I give it like feat or chore?

slate nacelle
#

feat

oak quail
#

so

#

threads

#

docs are available and looks like lib devs will have access to test them before full release (which will be in at least 2 months)

ruby terrace
#

Already working on adding them, might make a draft PR if someone doesn't beat me to it. I'm thinking to add threads into the channel cache since they are truly channels at heart, then have a #threads on text/news channels that is a ThreadManager. That way they can be accessed globally and in the guilds cache but still have references in their actual parent channels

ruby terrace
#

Also, definitely need to wait until after that disclaimer about potential breaking changes is removed

copper laurel
#

Yeah we get updates from Discord Developers too. They're API v9 though which although is supposed to have basically no breaking changes, isn't what v13 has been written to so far

#

Could be an easy switch, but I don't know if we'd want to wait another 2 months on deploying the other features

ruby terrace
#

So far (of course subject to change but hopefully not), I think switching to api v9 would be a non-breaking, non-major change for the library, its already using the PATCH method for suppress-embeds which is the only actually breaking change for v9.

#

But yeah I agree the release of v13 should not be delayed for it no matter what

mighty sequoia
#

Does a pr take 3 approvals to merge?

ornate topaz
#

there isn't any specific number for that

mighty sequoia
outer raven
#

When will package.lock be updated to lockfile version 2?

ornate topaz
#

probably not soon

#

since it's not really backwards compatible, and v16 isn't LTS yet

oblique prairie
#

Hey! When a client creates a shard, it emits messages to the debug event listener. One of them is IDENTIFY followed by the id of the shard over the total number of shards. However, this display method is confusing.
For example, let's say a shardManager creates 3 shards. The last IDENTIFY message sent is [WS => Shard 2] [IDENTIFY] Shard 2/3 which could mean that the 3rd shard wasn't created yet.
I think it should be changed to [WS => Shard {ID}] [IDENTIFY] Shard #{ID} ({ID+1}/{total}) where ID is the id of the created shard and total the total amount of shards to be created.

tacit crypt
#

That's not happening, as shard IDs are 0-based

#

Think of shards like an array, the ID being the index, the count being the length

oblique prairie
#

But 0/3 being the first and 2/3 being the last is really confusing and doesn't make any sense even if it's 0-based.

tacit crypt
#

Could we? Yea! Should we? ehh..
The docs also show it as 0-based, and it'd stay consistent with that and how the identify payload works. We could add a (normalized ${shardID + 1}/${shardCount})

tacit crypt
oblique prairie
#

The id is a 0-based cardinal number, you're right ;
in (position/total), position is an ordinal number tho, which means by definition that it has to be between the minimum value of total and total (included).The minimum value of total cannot be 0 so position must be included in [1 ; total]. Showing (value1/value2) implies that the two values are comparable and thus have the same meaning. An ordinal and a cardinal do not have the same meaning at all... Anyway, this debug line is just a detail.

flint zephyr
#

Hey guys I am making my own client and am here for some guidance (don't worry it's totally unrelated and not a discord.js competitor)
So the thing is, I am confused what to do.
My initial plan was to connect to the gateway and cache the session id. Whenever the bot connects after that, use Gateway Resume instead of making a new session.
But would this be a good idea? What does discord.js do?

unique axle
#

this channel is for the development of discord.js, not to help develop other libraries for the discord bot API

flint zephyr
#

Well then is there any other channel to ask such a question? Or is it banned D:

wild flax
#

Making your own client is already not really ToS conform, so it will be kinda hard finding a good place to ask such a question

flint zephyr
#

Why is it not TOS compliant? I'm contributing to open source and helping people.

wild flax
#

If you mean your own library instead, the discord API server is always a place to ask in #resources

flint zephyr
#

Oh yeah I mean library, sorry for the confusion

#

Thanks I'll take a look

worn bobcat
#

Why aren't the Discord embed types not sub stringed? Like this would make much more sense to substing the embed types not just trow an error saying that there are too many characters.

raven juniper
#

It's not the library's responsibility to check your input. It also makes it harder to maintain, if discord ever changes their limits

#

It's better in that way to let the API throw the error like it does

unique axle
#

to add to that there are a ton of different limits that need to be enforced. for example the "all characters in embed values can not exceed 6k"
in which of the up to 25 field bodies to you substring? why? do you just delete fields if you don't have characters left?
how do you handle the description? does it have priority over fields?
the title seems important, so maybe always use that... but what if field titles are already taking up too much space with the description, do you just show field titles? or field titles and values until that's depleted?
do you prioritise the footer over fields? or not?
etc.

drifting thunder
#

if its possible, function for that would be useful

empty viper
#

No it isn't

real jetty
#

Add event : on_bot_add

#

Or something linke this

stable escarp
#

what is that supposed to be

real jetty
#

That if someone adds a bot is happening an event

#

Sory translator mistranslated xD

stable escarp
#

you can listen to guildMemberAdd and filter bots? I don't think a whole new event is entirely necessary

undone ravine
#

That would already be very achievable by listening to the guildMemberAdd event and checking to see whether the user is a bot

stable escarp
#

plus I'm sure there's a way to make your own event. Come to think of it, I should do that

real jetty
#

But I mean that as someone will invite __ bot with this event __ something happens

#

And not that as the bot is already on serwer

stable escarp
#

so you want to know who added the bot? I'm not sure the API handles that, correct me if I'm wrong

raven juniper
#

You need to fetch audit logs

stable escarp
#

yeah

drifting thunder
#

this is 2 years ago, something may have changed

covert flint
#

If that were the case then I'm pretty sure they would've said something by now

outer raven
ornate topaz
#

I know

#

And that's why i said what i said

outer raven
#

but v14 is LTS

ornate topaz
#

Also no, node 14 does not come with npm 7

#

15 does

outer raven
#

but it prompts you to update when you run npm commands

#

and v7 is not in beta, it's the latest release

#

it's what gets installed when you run npm i npm -g

ornate topaz
#

Prompts you because node 14 comes with not the latest npm 6

#

And yes, correct, it's latest release, but it's different major, and as expected, has breaking changes

#

Which in this case rule out backwards compatibility

outer raven
#

does package-lock change backwards compatibility all that much?

#

This change only adds things it doesn't remove anything

#

and I believe if you use an older npm version it converts to version 1

ornate topaz
#

It doesn't convert

#

It warns about unknown version

outer raven
#

it did when I was using it

#

it automatically changed the file and warned about the wrong version

ornate topaz
#

Yeah ok. Still doesn't change the fact that lock file in such case would be constantly swinging around.
Npm 7 does not come with latest LTS, and we don't require node 16

outer raven
#

is node 16 even a thing?

ornate topaz
outer raven
#

OH I thought the "Current" version was v15, was not aware of the update flush

ornate topaz
#

Both 16 and 15 are current rn, look at linked time table

empty viper
#

V16 doesn't really add features anyway

strange moat
#

It does add features, though their usefulness is questionable

wild flax
#

It’s a new LTS regardless. It’s not about features but the long-term support it has for us in case there is bugs or whatever

#

Since they will be fixed in an LTS compared to v15 for example

weak parrot
#

Region changer for VCs?
like
message.member.voice.setRegion("EU") ?

brisk pawn
weak parrot
#

oh

outer raven
#

there are multiple instances across the library where optional parameters are marked like this which does not work properly in the docs website (the name of the variable should be wrapped in []). Should I make a PR to fix all of these or is this somehow intentional?

remote wasp
#

You're confusing it with optional param, the ? here shows that it can be null

slate nacelle
#

No, it's using node-fetch.

outer raven
delicate agate
#
New slash commands for bots! Performing actions with bots is easier than ever. Bot developers—when they’re ready, please don’t scare them—can have a list of commands available for their bots accessible by the forwardslash key (/). You won’t have to remember bot commands anymore and get laughed at when you get the command wrong :( !help…..!help….please

Any idea when and if this going to be in Discordjs?

loud jayBOT
tender field
#

it is this PR iirc ^

#

yep it is it (cf the pinned messages)

brisk pawn
#

When will djs update to v9 for threads?

#

Like how long after it comes out?

#

Hopefully it won't be like slash commands, it's been like 6 months since it released and the pr still isn't merged

warped crater
#

as always, when it's done

copper laurel
#

The initial announcement of the developer beta wasn't even 6 months ago, let alone actual release (which has still had more changes since). It also went through a complete rewrite via a second new PR

topaz coyote
worn bobcat
#

Why can't @everyone mentions be disabled by default? It would make much more sense to make a option to enable it

ornate topaz
#

this isn't channel for suggestions for discord

wild flax
strange igloo
#

Bringing the discussion here so it can get answered quicker than on GitHub.
As of now, <BitField>.has(undefined) returns true which may be problematic if you've made a typo in your code (e.g.: <Permissions>.has(<Permissions>.FLAGS.MANAGE_SERVER)).
<BitField>.constructor.resolve returns defaultBit if typeof bit === undefined.

Now, how should the library behave if undefined or [..., undefined, ...] are given to BitField#has. My first idea was to throw an error, like we did for earlier versions with string flags, but this message from Monbrey > #djs-help-v14 message kinda confused me.

  • Should <BitField>.constructor.resolve throw an error when typeof bit === undefined ?
  • Should we silently ignore undefined bit(s) and do not count them ? (<BitField>.has(undefined) === false)
worn bobcat
vagrant holly
strange igloo
lofty birch
#

Hi. I've noticed more than once that my server IP become temporarily banned from discord due to exceeding ratelimits, specifically due to multiple webhook clients (which are dynamically generated by user configured webhooks). I would assume this is because of a global limit of 50/sec? Does the library not handle this?

ornate topaz
#

don't think that lib tracks that

lofty birch
#

it probably should given that I'm using it's WebhookClient class

warped crater
#

Unfort. its hard to track but global rate limits are handled

ruby terrace
#

Each WebhookClient uses its own #api internally, which has separate ratelimit handling

#

but global limits should be taken into account IIRC

warped crater
#

which means you'll hit between 1 and N 429s for global

#

but N tends to be fairly small...

#

you def shouldnt be running into this frankly

#

cc @tacit crypt

tacit crypt
#

You got... 429d... on your bot token, by using a webhook client...?

warped crater
#

they got the 10k ip ban

tacit crypt
#

Thats on a bot token tho?

warped crater
#

no, its ip

lofty birch
#

it's an IP ban, yes

tacit crypt
#

Is it? damn

#

Are you sharded?

lofty birch
#

only 6 shards

tacit crypt
#

And you use the same webhook on all 6 shards?

ruby terrace
#

well 4711 was only merged to master, so djs 12 won't have that fix yet

warped crater
#

oh, right

lofty birch
#

ah so it's not in stable, that explains it

#

might have to merge that specific branch into a fork of V12 because it's very inconvenient

lofty birch
oak quail
#

theres a new clientoption to handle the 50/s global rl

#

oh i think thats what ckohen mentioned

#

but yeah that probably wont help u

#

are you getting the "you have been temporarily banned from our api for consistently exceeding our ratelimits" error?

lofty birch
#

yes

#

that PR would at least back off

#

the solution might just have to be making some queue system that runs on a cheap VPS that handles these across all shards, as those obviously make this a lot harder to handle

oak quail
#

is there a reason u arent just sending via the bot

#

would it really hit 50/s?

lofty birch
#

I mean it has

#

when night helped me debug it the first time it happened, almost every one of the ratelimit requests occurred on webhook routes

oak quail
#

hmm

#

do webhooks have ratelimit headers now

lofty birch
oak quail
#

u can still send cross server via the bot tho? 🤔

lofty birch
#

the bot isn't guaranteed to be there

oak quail
#

ah

#

so the server provides the webhook url?

lofty birch
#

yes

ornate topaz
#

cough didn't that go slightly offtopic?

lofty birch
#

you're right, was just asking here to find out if it was a lib thing and it turns out there was a PR for master, just obviously not on V12 yet lol. thanks for the input

spiral oak
#

can MessageType be updated to include all the new ones?

wild flax
#

You need to be a bit more specific than that

spiral oak
#

These are the current djs ones

#

But the discord doc has a load more now, including ones like reply which would be very useful

slate nacelle
#

Those will come with v13, for example reply and application command are already there.
The thread types will come with threads, which will still take some time and no idea what the last one is.

spiral oak
#

👍

tacit crypt
#

INVITE_REMINDER is related to a system channel flag

remote wasp
#

The InteractionReplyOptions links to WebhookMessageOptions in docs, which isn't completely correct as the latter one has some extra fields. Vaporox and I had a talk about it (#djs-help-v14 message) and the problem was that making a new typdef would result in code duplication for the third time.
One potential solution that we arrived at was creating a new base typedef that will have all the common fields which MessageOptions, WebhookMessageOptions, InteractionReplyOptions, and ReplyMessageOptions (yet to be merged) can extend. This will result in no code duplication and a correct documentation.
I wanted to discuss about it first before working on it just to make sure that this is what we want.

outer raven
#

Don't really know where to put this but is it possible to improve the embed sent with discord.js.org links so that it shows more information about that link?

wild flax
#

Not really no. We can't really do SSR and pre-generating all the pages depending on stable/master/version/branch doesn't seem necessarily worth it.

#

It would also make the embed unnecessarily big, any reason why this would be particularly useful?

outer raven
wild flax
#

Yeah but there isn't necessarily a big benefit in this

outer raven
#

It would just look nice and would help people quickly understand what they're gonna find once they click the link

wild flax
#

The benefit doesn't really outweigh the work required for it here sadly

outer raven
#

Fair enough, I'm not sure how these docs are even generated so it might be harder than it seems, thanks for the feedback!

outer night
#

it's been 12 hours, give it at least another day before bumping

pale seal
remote wasp
pale seal
#

I'm having the issue too. Seems to be an issue that comes back all the time xD

outer raven
#

Quick question: what's happening in the options.types type in the ApplicationCommandOptionData interface? It has 2 values and 1 of them seems to link to the other and, when writing in TS, we don't get autocomplete like we do with permissions, intents, etc

vivid field
#

ApplicationCommandOptionType are the strings that you can pass, ApplicationCommandOptionTypes their corresponding numbers

outer raven
#

ah gotcha, why aren't they autocompleting then?

vivid field
#

they should be

outer raven
#

Could you try to reproduce this? Maybe I'm doing something wrong

vivid field
#

oh, could actually replicate

#

but i guess that's a problem with typescript then, not with discord.js

outer raven
#

Well I can't get to the value of ApplicationCommandOptionTypes since it's an import and for some reason my IDE doesn't let me open discord-api-types/v8 but maybe there's something wrong with that?

#

You could try declaring the types directly in index.d.ts instead of importing, not sure if that would fix it tho

vivid field
#

you can open it, just ctrl+click the import

outer raven
#

yeah I know but it doesn't work

#

just doesn't do anything

vivid field
#

but it shouldnt really matter where the enum is declared

outer raven
#

I can't find a folder called discord-api-types in my node-modules either

vivid field
#

even tho it will have to be declared locally anyway with discord-api-types v0.19

#

then you didn't install it probably

outer raven
#

I think I did tho

#

lemme try again

#

yeah just reinstalled and the import still has any value 🤔

#

I can ctrl click all imports except for discord-api-types/v8 and ws

#

I think the package isn't declared as a dependency

ruby terrace
#

I was having some weird issues with ts imports too, both in master and -next (it is a dependency and is in the modules folder though)

outer raven
#

Is it a dependency? I can't find it in my package-lock.json

ruby terrace
#

dev

vivid field
#

it's a dev dependency

outer raven
#

well those don't show up, that might be why

#

They're not getting imported when installing the package

vivid field
#

yes, you have to install discord-api-types and @types/ws separately if you don't want them to fall back to any

outer raven
#

ooooohhhh

#

it works now

#

it was that simple huh

lone vector
#

I'm curious on the decision for how Role#edit() is made to work, since from what I can tell reading the code for it, it always sends the permissions field to the API although the API considers it optional, so just trying to edit a role's colour or name can cause a Missing Permissions error if the bot doesn't have at least the exact same role permissions as the role it's attempting to edit, or maybe I'm just missing something/doing something wrong to cause this?

solemn oyster
#

Continuing from #archive-offtopic message

@old kelp proposed merging create and edit into upsert, as it's the term for "create or edit".

However, since the edit part isn't a patch, but rather a full rewrite (override, if you will), it matches set's description, which also creates.

This also wouldn't break consistency with existing methods in the library, e.g. member.roles.set. While I don't recall upsert being used anywhere else.

What are your thoughts? @tacit crypt

tacit crypt
old kelp
#

so are we going with upsert?
cc @solemn oyster @tacit crypt

tacit crypt
#

thing is, with permission overwrites, create and edit do the same

unique axle
#

no BOYEbomb

tacit crypt
unique axle
#

no

tacit crypt
#

Souji dear

unique axle
#

vlad dear, i broke that discussion loose 2 times, and every time i in the end saw that space was right and i was wrong, they are not the same

tacit crypt
#

Look at the source code for the overwrite methods, they do 1:1 the same code??

tacit crypt
#

Casein point

old kelp
#

bump again kyra, vlad, so are we going with upsert now or..

tacit crypt
#

iirc i said upsert too at some point, I can't speak for kyra or crawl tho

old kelp
#

@unique axle could you elaborate on your point?
is it not same just for making it more verbose to users, because they internally work the same, otherwise i'm missing something?

unique axle
#

nvm, that was GuildChannel#createOverwrite and GuildChannel#updateOverwrite (they don't do the same, hence why they still both exist)
which:

thing is, with permission overwrites, create and edit do the same
sounded like potatodetective

tacit crypt
#

Souji dear..

unique axle
#

no.

tacit crypt
#

WDYM NO??

#

Look at the code

unique axle
#

i literally argued about that for hours with space and i lost

#

they don't do the same

#

update retains other bits but the ones specified, create replaces them

tacit crypt
#

Wat

#

OH, I see

#

Still, code deduplication would be ideal

unique axle
tacit crypt
#

Yeah the difference is that update appends it, as space said, while create just..creates

#

But the end API calls and checks are the same in a way

#

So, those parts should be deduplicated in a private function

ashen garden
#

add an event "raw gateway response" or something

#

basically a way to listen for everything the api sends back to us

#

ah, is it undocumented?

#

ye exactly

#

thanks

old kelp
tacit crypt
#

No, edit and create do different things, but their end code is the same except for one line

old kelp
#

so should edit call create then?

tacit crypt
#

you should have upsert as the base func, create call it, and edit call it with the existing overwrite

#

Let me get you example code

#

Think ```js
class Example {
upsert(userOrRole, permissions, reason, old = null) {
userOrRole = this.guild.roles.resolve(userOrRole) || this.client.users.resolve(userOrRole);
if (!userOrRole) return Promise.reject(new TypeError('INVALID_TYPE', 'parameter', 'User nor a Role'));

    const type = userOrRole instanceof Role ? 'role' : 'member';
    const { allow, deny } = PermissionOverwrites.resolveOverwriteOptions(options, old);

    return this.client.api
        .channels(this.id)
        .permissions[userOrRole.id].put({
            data: { id: userOrRole.id, type, allow: allow.bitfield, deny: deny.bitfield },
            reason,
        })
        .then(() => this);
}

}

class PermissionOverwrites {
update(options, reason) {
return Example.upsert(this.id, options, reason, this);
}
}``` but you'll need to make it prettier (theres a PR that makes it to where we can specify the type, so.. that might be good too)

#

I think this would be accurate-ish

#

could be cleaner, shoving everything in an object too

#

CC @wild flax @solemn oyster

old kelp
#

shouldn't the base method be in PermissionOverwriteManager and make that call in PermissionOverwrites though?

#

oh, that's what you technically did.. i'll come up with a cleaner implementation and re-ask for review, thanks 👍

tacit crypt
#

Yeah, think Example as the manager

outer raven
#

was the code link in the docs removed?

#

I can't seem to find it for some reason

oak quail
#

also in the "Links" section of the welcome page

outer raven
oak quail
#

this?

#

never knew it existed tbh, thats useful

outer raven
#

ye I can't see that

#

lmao really

#

but I don't see that button for some reason

oak quail
#

try hard reloading?

outer raven
#

yep did exactly that and it worked

#

thats odd

#

ty

unique axle
#

resize your window, something weird happens there sometimes that pushes it farther out

outer raven
#

it was maximized ¯_(ツ)_/¯

grave tree
#

What discord gateway link is using discord.js?

wild flax
#

gateway link??

grave tree
# wild flax gateway link??

when you are connecting to the gateway and receiving payload with the websocket, you use a link like wss://gateway.discord.gg/?v=8&encoding=json

wild flax
#

Yes, well that very much depends

#

Encoding depends on if you have zlibsync installed, but overall we are on gateway version 8

grave tree
#

oh thank you

wild flax
#

lol, the 2nd is not so relevant

#

You'd be better off just looking in the Constants or WebSocketShard

warped crater
#

yeptune fair

wild flax
#

Convoluted mess

warped crater
#

one day

grave tree
#

is discord.js master branch updated to gateway v9?

keen cosmos
#

there's a PR for it

loud jayBOT
solemn oyster
#

There are some backwards incompatible changes with gw v9 that will be released over time, and stable doesn't even use v8 yet

keen cosmos
#

oh, gateway, not api, my b

silk wren
#

How does D.js get the GuildMember#joinedAt ?
Of course it has to be exposed by the API itself, but I'd like to hear where x)

unique axle
#

joined_at ISO8601 timestamp when the user joined the guild

next inlet
#

@solemn oyster mind jumping in a VC with me for a sec?

#

uh,,

solemn oyster
#

Is this going to be related with the library?

next inlet
#

yes

#

give me a sec, gonna restart discord

solemn oyster
#

Ok

solemn oyster
#

We concluded a structure called ApplicationCommandOption (as opposed to a plain object with a typedef) would be a sensible way to approach this

#

And it'd also refactor away ApplicationCommand.transformOption (they'd be transformed inside ApplicationCommandOption's constructor) as well as allow us to add isEqual in them for fast deep comparison

#

The idea behind checking for equals recursively is so we can dynamically build a framework which updates the registered application commands on Discord automatically, without us needing to write migrations or pushing all commands in every log in, which can be rather inefficient

copper laurel
#

So it would load files like a regular framework, then fetch API and compare?

next inlet
#

yes that is pretty much the thought

vivid field
#

Sounds reasonable for received options, but how would that approach handle options passed by the user?

solemn oyster
#

Isn't that pretty much framework independent? It's not like regular users can update one bot's slash commands

vivid field
#

I mean the users of the library

#

You shouldnt need a framework to create/update application commands

copper laurel
#

Need, no, but you never needed one for regular commads either

#

It just makes it easier

vivid field
#

That's why I'm asking, because from what I understood, for commands.edit()/.create()/.set() you would still need a transformOption method or similar

sly forge
#

The ApplicationCommandOption structure sounds great, but handling received interactions should be left out for the user to implement.

ruby terrace
#

I assume you would then need to pass it an instantiated ApplicationCommandOption which would have a toJSON method for readying it for discord. (not sure if I'm a fan of this)

vivid field
#

I guess that would work, but constructing a new class instance only to convert it back to an object right after also sounds a bit expensive

ruby terrace
#

yeah, that's why I'm not exactly a fan

solemn oyster
solemn oyster
tawdry pasture
#

Will the BLURPLE string in
ColorResolvable be updated to match the new blurple?

wild flax
#

Yes

#

Mind you, this will most likely happen in a non-backwards-compatible fashion since we are increasing the major version

tawdry pasture
#

So Ill have to switch my v12 bots to using the new color manually then?

wild flax
#

No. It means we’ll switch the color and when you update you automatically have it

#

Usually you aren’t allowed to do that as a library, since users might still want the old color without us forcing it on them

unique axle
#

will have to do some figuring out regarding the new default icons, they're not numbers anymore nkoBruh

#

eh, v13 is a major anyways, might as well flip colour codes and avatars

tawdry pasture
#

Ah got it. thanks!

oak quail
#

the client has always used /assets instead of the cdn ones

outer raven
#

I noticed the default avatar URL no longer works. Is this a bug with the library or discord?

#

By "no longer works" I mean it links to the old one(s)

ornate topaz
#

you could read messages just above yours, and judge on your own why it links to old ones

outer raven
#

oopsie, didn't notice, sorry

ornate topaz
#

yes, that is /assets

outer raven
#

Adding the bigint type for RoleManagers made things slightly more annoying for typescript devs, is it possible to remove this type for this and other managers that have this?

vernal atlas
#

what

ornate topaz
#

what are you talking about

outer raven
#

Whenever I try to access a guild member's roles, the manager has those 2 types which makes it so TS always throws an error when trying to remove/add roles for example

#

Talking about the master branch btw

wild flax
#

Please post the associated code with it

outer raven
#

ok sorry I missed some context. I'm getting this when accessing a guildmember through an interaction, for which the roles object is a Snowflake type sometimes, which comes with that `${bigint}` type

#

the line is just this

wild flax
#

Yes.

outer raven
#

Is this intentional?

ornate topaz
#

fairly sure it is, and it's array of snowflakes when there is no bot

outer raven
#

How would there be no bot?

ornate topaz
#

interactions don't need a bot

wild flax
#

Interactions don't require a bot connected to the gateway or in the guild

outer raven
#

even if it's a commandinteraction?

wild flax
#

of course

ornate topaz
#

what difference does that even make here

outer raven
#

that we have to specify the type for the rolemanager every time we want to add or remove roles which is slightly annoying

wild flax
#

well, it is accurate thats for sure

#

your code will break if you don't check first

outer raven
#

well in my case my bot is only in 1 guild and I'm sure it will always be there and have access to interactions so I don't think any checks would be needed

wild flax
#

Sure, whatever, but that doesn't mean we can change the typings just because you have no use for it

outer raven
#

Yeah of course but it seems like such an edge case that will cause so much trouble for other users and isn't even documented properly on your docs website

ornate topaz
outer raven
#

Yeah exactly, doesn't specify any properties for that "Object" so it's hard to know

wild flax
#

How is it an edge case? If someone invites your commands via the oauth scope without inviting your bot, you need to check.

outer raven
#

You can do that?

wild flax
#

Yes.

outer raven
ornate topaz
#

but it's an Object. it does not have any methods GuildMember would

outer raven
#

it could be the APIInteractionGuildMember object which is what is given in TS

untold python
#

I dont know if this fits here, but is there a version of discord.js that doesnt use the fs module? I need to run it in the browser, which doesnt offer the fs module

frank turret
#

webpacked versions of d.js aren't supported anymore and don't work

untold python
#

aw

#

ill write my own wrapper then, thx anyways

remote wasp
#

@untold python I don't think you can make any request to the discord api in browser now

remote wasp
#

yeah

cloud nest
#

Would it be thinkable to add an APIEvent enum containing all currently available events? That would simplify event handling implementations. Possible benefits of such an implementation (and the issue I am currently facing) are described at https://github.com/microsoft/TypeScript/issues/10570#issuecomment-769442192

I do see that solely supporting such an enum in the library itself would be a breaking change. However, one could merely provide support for using the enum for listener registrations as an alternative way to the current one.

Admittedly, this is a bit of a minor inconvenience, but it bothers me enough to propose such a feature.
I am quite new to d.js and apologize if such discussions have already taken place.

Also, I'd be happy to create a GitHub issue if need be. Thanks!

slate nacelle
empty viper
#

:/

cloud nest
# slate nacelle Would `keyof ClientEvents` not be sufficient here?

I initially thought so too, but

abstract class Parent {
  abstract event: keyof ClientEvents;
}

class Child extends Parent {
  event = "message";
}

throws an error. TS cannot infer that event in the Child class is indeed a keyof ClientEvents, but interprets it as a string instead.

Instead, you need to assert the type manually each time:

class BetterChild extends Parent {
  event: keyof ClientEvents = "message";
}

It works, but it is an inconvenience that could be avoided by using an enum that would allow for TS to automatically infer the correct type

slate nacelle
#

Using event = "message" as const; seems to work.
This seems more like some "TS is not smart enough to infer that properly" than something we can do.

cloud nest
#

That's totally true, see the issue I referred to above. The enum is only a workaround to TS being incapable of figuring out the obvious on its own

outer raven
#

Would it be possible to create a latest pre-release with the latest commit from master and publish that to NPM so that we can more easily use that version? The website I'm currently hosting my bot on doesn't seem to support installing repositories as dependencies

remote wasp
#

That's not possible but you can fork the repo and publish your own fork of djs on npm under private scope

outer raven
#

How is it not possible? I've seen multiple packages do this

remote wasp
#

I don't know about that but publishing unstable changes doesn't sound like a good idea and it will also mess the versioning

outer raven
#

You can have a latest release that always gets updated with every commit to master and label it as a pre-release. This wouldn't affect the stable version and thus the version that would be installed through regular npm i discord.js

ornate topaz
#

which packages do that?
do they have breaking changes between commits that are published under that pre-release?

outer raven
#

Unfortunately I can't find one anymore but I remember seeing a pretty common package with a latest release on github and npm

outer raven
wild flax
#

Thought about it before already, decided against it

outer raven
#

Any reason why?

wild flax
#

Yeah, if we ever have some sort of hotfixes because our master isnt stable, we need to think about re-releasing it constantly

#

It's not worth it, you are much safer just pinning a commit that works

outer raven
wild flax
#

Yeah thats not really desirable for us

#

We don't want a new release on every commit

outer raven
#

Fair enough :/

real pilot
copper laurel
#

It's by design. Slash Commands are designed to be usable with a bot - headless functions running on CloudFlare workers for example

ornate topaz
#

*without

copper laurel
#

yeah ty, without a bot

real pilot
#

That makes sense, I just put a message in the interactions channel too, but is there a way to handle when someone adds your commands to a server even if they don't authorize the bot scope? Like a webhook, etc.? If so, can the library handle it and emit an event?

copper laurel
#

No, not in discord.js

ornate topaz
#

don't think there is a way to get an event for when someone adds an interaction without a bot

copper laurel
#

...unless it emits the ws event anyway?

ornate topaz
#

what ws event

copper laurel
#

well any of them

ornate topaz
#

i mean, there is intehration create, not sure if it's relevant

copper laurel
#

INTERACTION_CREATE, APPLICATION_COMMAND_CREATE etc

ornate topaz
#

but then again, if there is no bot, there is no ws

copper laurel
#

Yeah that I wasnt sure on, makes sense

ornate topaz
#

In many cases, you may still need a bot user. If you need to receive gateway events, or need to interact with other parts of our API (like fetching a guild, or a channel, or updating permissions on a user), those actions are all still tied to having a bot token. However, if you don't need any of those things, you never have to add a bot user to your application at all.
https://discord.com/developers/docs/interactions/slash-commands

wild flax
#

Thats not true

#

the WS event emits either way

ornate topaz
#

well, but if you don't have the bot app, you don't get the event (unless you connect to ws on your own, obviously)

#

and do you get the ws event from guilds you aren't on?

real pilot
#

Got it, makes sense. My app does still have a bot user since it needs it for some functions, but it also has commands that work perfectly fine without the bot user. What I'll just do is check each interaction, and if it needs a bot user it'll reply saying it needs additional authorization and send the oauth link for a server admin to fix it. Thanks guys!

lofty birch
copper laurel
#

@oak quail moving discussion
TextBasedChannel handles it like this

apiMessage = APIMessage.create(this, content, options).resolveData();
if (Array.isArray(apiMessage.data.content)) {
  return Promise.all(apiMessage.split().map(this.send.bind(this)));
}

So I guess reply with split would have to be

if (Array.isArray(apiMessage.data.content)) {
  const split = apiMessage.split();
  return Promise.all([this.reply(split[0]), ...split.slice(1).map(this.followUp.bind(this))]);
}```
#

Unless you can just send everything as a followup?

ruby terrace
#

You have to send a reply first (or edit the deferred reply)

copper laurel
#

I think followUp edits a deferred one, but if it can't send an initial it'd be this

#

If it's an editReply with split data they can all be followUps

#

...no nvm

ruby terrace
#

edits shouldn't take split options IIRC

#

followUp did edit a deferred one in the past, but I think that was for backwards compatibility, I think it has changed

copper laurel
#

So use case - deferring, then sending a split message

#

Can that be handled and if so how?

ruby terrace
#

It could be handled, but you'd run up on weird situations where there are messages in between

#

followUp should honestly be calling .webhook.send with the created apiMessage after data and files have been resolved, and Webhook#send line 172-174 should move outside the else statement

kindred lagoon
#

I really have a very huge bot and it is known as well and there is play sound when it starts the result is a very large pressure on the server so if you have a solution I will not reprogram it in c ++ language I am sure that you have a problem playing sounds so always the huge bots do not use your library

strange igloo
# kindred lagoon I really have a very huge bot and it is known as well and there is play sound wh...

discord.js voice is not designed to be the most powerful broadcast solution
If your needs are above the expected target, feel free to design your own solution or use an existing one (Lavalink for the most popular one)
There are no flaws in how discord.js handles voice features
Also, sending encrypted audio data will always require some resources (in CPU for the most) no matter if it's being made by discord.js or any other library/solution, so the issue of the pressure will stay as long as you don't split your bot logic and your audio between two machines, or if you don't upgrade your current machine resources.

kindred lagoon
real jetty
#

Would it be possible to make an auditLogEntry event for Client?

warped crater
#

No.

#

the client only has events for websocket dispatch packets that come in from Discord

#

there is nothing to signal audit log creation

real jetty
#

alright, i'll try to manually make it then

copper laurel
ruby terrace
#

you can, if you resolve the data and files in followUp, it will use that resolved data and files in Webhook send, it doesn't re-resolve

copper laurel
#

Hmmm fair enough, I'll take another look.

real jetty
#

Not sure if this has been brought up before, but something that would be really useful are hooks. Here is a use case:

When discord.js gets the users, you would have a $beforeUserLoad(UserManager) hook where you can inject your own data into users. Then if you have sharding, it would shard all the users with your injected data
It would be the same for guild, so $beforeGuildLoad(GuildManager)

ruby terrace
#

Extendable structures are discord.js's way of doing exactly that

real jetty
#

You can extend the structures but you cant add the data before it gets sharded afaik

copper garden
#

Wdym when it "gets sharded". When you shard, all events and results of api calls are sent directly to the corresponding shard process

real jetty
#

Essentially when all the discord users are cached, i would want to have a hook where i can make a request to my own api and map that data to users

copper garden
#

The only issue I see with that is that it’s async. Constructing/caching a user wasn’t made to perform async calls

#

Can’t you just fetch the data on demand?

real jetty
#

yeah i could shrug

quiet viper
#

I have a suggestion, regarding too the broadcastEval in the Sharding Manager, you should add a optional option, where the promise should be resolved/rejected after a certain time, bc when this does not happen --> we have to many event listeners and this could cause a memory leak

ornate topaz
#

imo such timeout should be there by default

quiet viper
# ornate topaz imo such timeout should be there by default

no there isnt, I can reproduce the error, go on worker mode, use a code which causes a dom expect error, broadcastEval(this.guilds.cache) --> error, no response.
Do this 10 times and voila, most of the machines will give a event listener error or crash

ornate topaz
#

what that has to do with my answer

#

i said "should" not "is"

#

in response to you suggesting there being one only if you pass the timeout time as the parameter

#

locking you out for no real reason if you forget to pass it

maiden loom
#

Hi, how can I download the v13 version ?

ornate topaz
#

there is no v13 version yet. you can however install the version from master branch, more info in #djs-help-v14

maiden loom
ornate topaz
maiden loom
ornate topaz
maiden loom
quiet viper
ornate topaz
#

i didn't say anything as to if it will be there or not. it was a suggestion

quiet viper
#

okay, sorry for the misunderstanding

clever spoke
#

it already does tho.... but just on master so i dunno if that counts

manic thistle
#

the typings for PermissionOverwriteOptions seem to not match the actual js implementation

#

wait whoops i forgot to put the typings, sorry

#

there's also this function which uses a completely different type in the options parameter?

remote wasp
#

that PermissionOverwriteOptions interface is defined in typings but isn't used anywhere. Whereas the typedef PermissionOverwriteOptions (plural) is defined as PermissionOverwriteOption(singular) in typings. weird 🤔

manic thistle
#

OH

#

actually nevermind, i didn't realize the definition was created in the same commit so it couldn't have been the parameters changing or something
it seems to have been a mistake that was added when the function was created and nobody really noticed lol

remote wasp
#

I looked through all of it and I think the current interface for PermissionOverwriteOptions (plural) should be removed from the typings (I searched it up, this interface isn't being used anywhere in the codebase) and the interface PermissionOverwriteOption (singular) should be renamed to PermissionOverwriteOptions so that it matches its jsdoc typedef. Just want to make sure that I'm not missing anything here. 🧐

manic thistle
remote wasp
#

that's fine but it doesn't solve the issue above

manic thistle
#

my bad
yeah, it seems like the interface PermissionOverwriteOptions was only used as a parameter for GuildChannel#overwritePermissions anyway, which was replaced by OverwriteResolvable (More specifically it was replaced by the interface OverwriteData, as it has the exact same properties, minus the new type property and the fact that allow and deny are now optional) so there should be no problem with it being removed, with PermissionOverwriteOption taking its place to match the documentation

ruby terrace
slate nacelle
#

Sounds good to me

oak quail
#

since members might not have joined_at now, should this be changed?

#

i suppose they still arent "full members" but it is a member object

manic thistle
#

I was inspecting the typings when I noticed the function Permissions#serialize returned the type Record<PermissionString,boolean> and that there was an interface PermissionObject (which wasn't used anywhere in the code) with the exact same type .
After inspecting the history of the function and interface, I found out that it was in fact previously used as the return type, but was removed (along with the function) when the Permissions class extended BitField<PermissionString> and later added back with this type.
Since these are the only two instances of Record<PermissionString,boolean>, should PermissionObject be removed?

strange igloo
manic thistle
real jetty
#

What is the point of removing timeout?

raven juniper
#

Keeps it in line with other methods, also to prevent some problems that arose (eg if it was deleted before the timeout)

strange igloo
wild flax
#

No

#

The output isn't stable

#

And may change in the future depending on our needs

strange igloo
#

Oh okay

wild flax
#

If you want to parse an emoji, we do expose the regex itself on the class

#

to at least get the id

outer raven
#

@copper laurel do you know what the new buttons will look like? Asking bc of your draft pr

copper laurel
#

Yes

#

They look like other Discord branded buttons. Can be blurple, green, red or grey

remote wasp
#

Found this while working on the nsfw_level PR. Same issue there. When I move the property assignment inside #_patch it logs DEFAULT correctly otherwise it's just undefined

slate nacelle
#

It should be in _patch. Must have slipped through jynEHEH
Discord only sends unavailable guilds in ready, which we then patch with their relevant guild creates.
So only newly joined guilds would have that property set if it's in the constructor.

remote wasp
#

I see, I'll update the PR. Thanks 👍

real pilot
copper laurel
#

Not that I'm supposed to share

#

Sorry! Should be available soon

real pilot
#

Ah okay, I didn't know it was private info still haha

outer raven
#

They’ll probably be “released” on Tuesday

#

Why does CommandInteraction#channel have a Channel type instead of a text based channel type (TextChannel, NewsChannel or DMChannel, maybe ThreadChannel idk)?

copper laurel
#

Because it's a getter for this.client.channels.cache.get(this.channelID) which is a Collection<Snowflake, Channel>

#

And its inherited from Interaction

fringe star
#

Where can I post bugs?

solemn oyster
#

What bugs?

fringe star
#

.permissions doesn't work correctly

#

For some members

#

It returns bitfield 0

#

Even if they have certain permissions

#

I really need a statement on this, please

fringe star
#

Ohk

fringe star
#

Can I send a reproducible example here

slate nacelle
#

sure

fringe star
#

I have almost all permissions still the bitfield is 0

#

This thing worries me when I check for permissions in certain commands

#

All checks return false

#

bruh moment

remote wasp
#

can you do npm list discord.js and send the hash here

fringe star
#

Ok

#

discord.js@12.5.3

#

This has been happening with me since months

remote wasp
#

Can't reproduce the bug on stable. You should open an issue like space said and it would be great if you can also drop a link to your bot's repo if there is one in the issue.

sleek apex
#

what's the point of this? can't we just have in ./DJSError.js's module.exports Messages = require('./Messages');?

#

oh

wild flax
#

Circular references

sleek apex
#

wait

sleek apex
#

also is my vscode broken or is the entirety of /src/errors/ used for nothing? oh nevermind i see now

#

im confused

sleek apex
#

wish me luck

vagrant holly
#

👋 Not sure if this got discussed anywhere, but it seems the lockfile in master is now v2, which is Node 15+ by default?

#

Node 14 still ships with npm 6 by default, and the project claims to be Node 14+, but if you actually want to develop on the project this is not the case and you need Node 15, or to manually update npm in your Node 14 install

sleek apex
#

most package managers ship the latest version (v16) and brew upgrades all packages whenever you run a command

wild flax
#

npm 6 can work with v2 of the lockfile, and the library still works with 14

vagrant holly
#

Off the top of my head, won't npm 6 overwrite the lockfile back to v1 if deps are modified?

wild flax
#

maybe

vagrant holly
#

Would it not make sense to at least define npm >= 7 in engines.npm in package.json?

wild flax
#

maybe

elder reef
#

Not sure where else to put this... the invite in the org's description is outdated

outer night
#

it still works

hallow ocean
#

Yes, it just doesn't use the vanity url so it's fine if it isn't changed

wild flax
#

Maybe refresh your browser

fringe star
remote wasp
#

yeah

gusty tide
#

Hey, apologies if this is the incorrect channel to ask such a question, but can someone here give me an idea as to when v13 is released, as it apparently has support for the new slash commands? Thanks!

copper laurel
patent needle
strange igloo
patent needle
#

Ah alright

raven juniper
strange igloo
#

I meant that it hasn't been released in stable yet

grave tree
#

What gateway V is using djs v12

wild flax
#

7

grave tree
#

Oh ok

outer raven
#

I'd like to propose a change to the docs to make it so that the "Default" column in the parameters table displays the default value set by the discord API, even if the code itself doesn't have any default values. This way it would be easier to understand what would happen when leaving certain optional parameters out. Would this be a good idea?

unique axle
#

no, re-documenting things is almost always a terrible idea, because upstream docs changes could very easily make the information displayed wrong

outer raven
#

It wouldn't be re-documenting as the current docs don't link to the respective page on the Discord API docs

wild flax
#

our docs represent our wrapper, not the discord api

outer raven
#

what I'm saying is that currently it's quite hard to find the default value for stuff because most are left empty

wild flax
#

so the default values are the ones in our code, not from the discord api

outer raven
#

ye that's how it works atm, but why not change it?

wild flax
#

if we start mix-matching it it would become quite confusing

#

also we would need to keep it up2date with discords docs

#

thats also why we don't document what perms you need for certain actions

outer raven
#

wouldn't be too hard, I doubt they'd change values all the time and if they did it would be rarely

wild flax
#

what about the first point

outer raven
#

I don't see how it would be confusing

wild flax
#

how are you going to discern what default value is ours or theirs

outer raven
#

you're not because it doesn't really matter in the end

#

if you have a default value on the code, you use that on the docs, otherwise you use the one from the API

wild flax
#

yeah it does, we have functions and methods that have default parameters that have nothing to do with discord

outer raven
#

yeah I know that's what I'm saying

#

we'd prioritise the default values used in the code

wild flax
#

so how do you document 2 default values then

outer raven
#

you don't, you just document the one used by the library

#

because that one will always have priority in the code over the one the API uses

wild flax
#

and what happens to the one the api uses (just in case they are different)

#

now you decide arbitrarily what to use when

outer raven
#

it's ignored because from the moment you have a default value in the library, the default value given by the api is ignored

wild flax
#

"oh no this isnt a default from discord, this is ours"

#

"oh no this is a default from us, not discord"

outer raven
#

it doesn't matter to the user, they just need to know what value is gonna be put there if they don't specify that parameter

#

and we'd put the one with the highest priority

wild flax
#

yeah, the user can just open the discord api docs too for that

outer raven
#

which is library > api

#

yeah but the discord api docs are way harder to navigate than the djs ones and its easier to have it all in one place

#

because saying there is no default value is essentially misleading because the result you will see on discord will have a default value

wild flax
#

its not misleading

#

we don't claim that the discord api doesnt have defaults

#

its just that we don't have any in the library

outer raven
#

yeah but if the library is an API wrapper, it should also document what the API does in certain situations

unique axle
#

hmm.. no

wild flax
#

no, not really

#

thats what the API documentation is for

outer raven
#

but it's easier to have everything in one place

wild flax
#

yeah, thats fair

#

doesn't mean we are doing it

outer raven
#

why not make the docs more accessible instead of telling users to go search in a million places?

outer raven
wild flax
#

the docs are plenty accessible

#

downgrading their value simply because we don't do this one thing doesn't make them any less good

#

we still have, to this date, the best auto generated library documentation

outer raven
#

that is true but there's always room for improvement

wild flax
#

improvement is great, more things to maintain is not

outer raven
#

If any default value changes, people will most likely hear about it quickly from the discord staff themselves and make a PR to change it

wild flax
#

just like how interactions were released and we needed 2 PRs for it and a 6 month delay right?

outer raven
#

I see PRs changing little things that the API changed all the time

wild flax
#

I can't imagine that for something thats even more hidden and less important

outer raven
#

and I don't think that delay was because people didn't know about them

wild flax
#

I say that specifically because interactions could have been done in a 2 week window

#

No, it was because no one was simply doing it. We don't get a lot of contributions for things the API changes

outer raven
#

but their release was also quite weird and a lot of things changed

wild flax
#

That was also not the reason, this discussion is pointless overall

#

As it stands right now we arent doing it

outer raven
#

fair enough I guess, I'd be willing to do it if you change your mind in the future

outer raven
#

you can technically put any type on an embed description but objects and maps will look weird and I doubt people would want to put that intentionally so would it be possible to change the embed description type to string | number | string[] | number[]? It's currently set to any

ornate topaz
#

the fact that they look weird doesn't mean that they can't be passed

outer raven
#

Yeah I'm saying they can but no one would want to put [object Object] in an embed description and it would help them identify errors if they do this accidentally (in TS of course)

ornate topaz
slate nacelle
outer raven
#

that's different because message.member.toString() exists

ornate topaz
#

well, so why not add all other variants like GuildMember | User | Channel to that huge type as well

outer raven
#

you don't need to because it runs toString() automatically

ornate topaz
#

but your type would mean that it cannot be passed there at all

#

i didn't pass a member.toString(), i passed member

outer raven
#

but since the toString() function exists, I think ts doesn't detect that as an error

ornate topaz
#

which type are you talking about

#

the param to setDescription?

outer raven
#

yep

ornate topaz
#

why the hell would it care about completely random properties on passed object if the object itself doesn't fit

outer raven
#

the only reason why it throws an error is because of the number type, but it is assignable to a string type

unique axle
outer raven
#

wdym?

#

is that gonna change?

unique axle
#

space literally linked it

outer raven
#

I didn't see that it would require you to run the function

unique axle
#

we aren't doing any string conversion for you anymore, you have to actually provide a proper string (once that lands)

outer raven
#

why tho :/

ornate topaz
#

you can't really do const x: string | GuildMember and use x only as a string. if x would be GuildMember, it would require you to call the toString() manually every time, it won't call it for you.

#

it doesn't matter that it has a function to resolve into string

#

it literally isn't a string

outer raven
#

it does though

#

I just tested it

ornate topaz
outer raven
#

yeah it doesn't do that

#

it only conflicts with number, not string

ornate topaz
#

what doesn't do that

outer raven
#

if you have a string type and pass a GuildMember, it works

ornate topaz
#

what works

outer raven
#

passing a GuildMember object

slate nacelle
#

Yes, because we forcefully resolve everything you (don't) pass into a string.

outer raven
#

yeah and TS doesn't detect that as an error

#

so its all good

#

but it still won't work due to the number type, which is stupid

#

and for some reason passing a number to a string errors

ornate topaz
#

am i missing something

outer raven
#

hmm I didn't test it like that, I modified the StringResolvable type to string | string[] and it worked

ornate topaz
#

the c literally isn't a string, otherwise the type would be useless

#

so anyway, the method works (atm) because it resolves

#

but you narrowing the type from any to your string | number | string[] | number would mean that you cannot pass anything that you currently can

outer raven
#

yeah I know I believe that would be benefitial

ornate topaz
#

if the change that requires strings lands, yes

#

right now? not really, as the method handles passing some objects (some as in literally anything that has a toString(), so pretty much everything)

#

technically needing to list them all in the type

unique axle
#

since the type is literally going into the bin, i'm not sure what to improve about it and why

outer raven
#

well yeah i wasnt aware

#

thanks for the explanation

remote wasp
vivid field
#

Looks like another remnant of the webpack build support

remote wasp
#

hmm, that's what I was suspecting too, just wanted to be sure. Thanks 👍

haughty anchor
#

Any word on when library will be brought in line with button update?

unique axle
haughty anchor
#

Thanks sorry

wild flax
#

It’s maybe been 24h since release. At least a little bit of patience would be appreciated

haughty anchor
#

Im not trying to hurry anyone I was just wondering what the general timeframes are normally like, this is the first API change that will actually affect what I work on for the time being

#

The activity on that PR is nuts

#

Is better news than I was hoping for

copper laurel
#

I've just marked it as ready for review and testing now

haughty anchor
#

Yeah i saw you are a madman

copper laurel
#

There was a lot of base structure and classes to be built - but it should make future components a lot easier

haughty anchor
#

Thankyou for your service

loud jayBOT
copper laurel
#

Buttons are now ready for review and testing, but may not be stable

fair yarrow
#

nice

copper laurel
#

Just pushed breaking changes to it, FYI anyone already using it

sage owl
#

To someone who actually works in the industry, “When it’s ready” is such a cop out response. It allows Scope Creep to become a real problem which v13 is starting to show signs of. So I think many of us, who are relying on new features being implemented, would like a little more effort in that part of the department. We understand things come up and things get pushed back but no reason to set goals for your releases. Setting Target dates is important in any software lifecycle, especially when people actively use your codebase and count on these new features. Anyway, this is just some words of advice from someone who works in the industry as a Software Engineer. Take it or leave, ignore if you like.

real jetty
#

A key thing to keep in mind is that you can still use it if you really want it. Installing from master does work and you can choose from which commit.

manic zinc
#

@sage owl have you considered using your professional experience to help move the project forward so it gets done faster? I'm sure the team would appreciate the addition of a Software Engineer helping out on the project!

outer raven
outer raven
#

Also for the server avatar feature, should the guildmember object have a displayAvatarURL() function or just the avatarURL() and avatar properties?

copper laurel
#

What would the defaulting be

#

Server avatar > Global avatar > default Discord avatar?

fair yarrow
#

monbrey

#

attaching Imge file in embed in interaction response won't work

ornate topaz
#

Fairly sure it's on API on this one, someone brought that up before

#

@outer raven typescript also doesn't follow semver, but that's different topic

fair yarrow
#

Ohk

#

but can i attach files on interaction reponse

copper laurel
#

Only in the edits

#

Dunno why

copper laurel
# sage owl To someone who actually works in the industry, “When it’s ready” is such a cop o...

We know we have a huge community that are excited for new features to be released, but Evie is right. A lot of the staff, myself included, and particularly the maintainers are professionals, we do work in the industry - that's exactly why we don't have the time to manage this like some sort of enterprise scale product.

We don't have a dedicated testing team, we don't do sprints, and the majority of the people who use the library are, to put it bluntly, amateurs. They don't understand how to handle semver major breaking releases.

That ties into a lot of decision making around what goes into a major release, how we can be prepared to support it (eg v13 changes guide) and ultimately, when we are ready to release it.

I get that "when it's ready" might seem flippant and dismissive, but setting a date that we don't meet is pointless. Alternatively pushing out a buggy mess that hasn't been properly tested just because a date was set is even worse.

fair yarrow
#

oh k so no way to attach a file nor show in embed

solemn oyster
#

Also keep in mind Discord also likes to introduce breaking changes from time to time, which screws our release cycle at times

#

@fair yarrow you might want to use the support channels for this, this one is reserved for discussions regarding the library

echo fog
#

when will message components be implemented?

solemn oyster
#

There's a PR for it

echo fog
#

ah

#

nice

clever spoke
#

?buttons

rich iglooBOT
clever spoke
#

worked on there

echo fog
#

epic

outer raven
#

I made the PR meanwhile and added the display avatar url method which sends the server avatar or the user’s display avatar

ornate topaz
strange igloo
#

Major . Minor . Patch*

#

Major for breaking changes
Minor for features
Patch for bug fixes basically

strange igloo
wild flax
#

Very unlikely

outer raven
#

I don't see why they wouldn't be able to

wild flax
#

What lol

strange igloo
#

Since it's going to be restricted to their $10 Nitro apparently, I don't think they'll allow that

wild flax
#

Can’t wait for some mods to set my image to something I don’t want

ruby terrace
#

I'd find it unlikely they unlock that feature to bots

wild flax
#

You really can’t see how this isn’t abuseable?

ruby terrace
#

while those "self host" bots would love it, that type of data storage for large bots seems like a bad idea

wild flax
#

Oh, the idea of the bot having one

#

Puh.

outer raven
wild flax
#

Not even sure that’s smart

outer raven
wild flax
#

I can totally see someone setting a different avatar on their 300k guilds

outer raven
#

well yeah

ruby terrace
#

yeah....that

wild flax
outer raven
#

yeah true

#

well ignore that comment then lol

strange igloo
#

About Nitro perks for bots, I don't think they'll grant perks from the $10 one
Not even sure if they might allow any more perk from any of both Nitros (well yes animated avatar is an example)

copper laurel
#

bots have global emojis