#archive-library-discussion

1 messages Β· Page 5 of 1

vagrant holly
#

but yeah, unless a process exits via an error, a shard wont respawn in 12.4.x at present

vernal atlas
#

creating 2 bugs from the same PR FeelsBadMan

tacit crypt
#

2?

vernal atlas
#

yes

vagrant holly
#

Oh was 12.4.1 a regression from that PR too?

#

f

vernal atlas
#

yes

vagrant holly
#

what the shit is github actions doing

tacit crypt
#

Apparently not working...and it should be working...

vernal atlas
#

i think because it was changed to npm ci its borked

#

idk i saw someone say that was the issue, but im not sure

tacit crypt
#

no..the git cmd is erroring

#

even though it shouldn't..

vagrant holly
#

lemme npm i locally

vernal atlas
#

i think i actually made a branch to test around with it but got distracted

vagrant holly
#

ah yeah the lock file is cucked

tacit crypt
#

can you uncuck it

#

how is it even cucked

vagrant holly
#

yah 2 secs

vernal atlas
#

does my v8 pr just need (extensive) testing now? or is there more i need to add

oak quail
#

i'll see if i can test it sometime

#

looking at the or desc, it's pretty much just drop-in right? no major breaking changes?

vernal atlas
#

Permissions uses bigints and not numbers

#

so that would be a breaking change there

tacit crypt
#

well yeah but no

#

since its the internals, the user facing funcs still work the same

vernal atlas
#

Permissions#bitfield is public though

tacit crypt
#

well yeah THAT would be breaking

oak quail
#

yeah ik bitfield is a breaking change but like, I doubt many people are using it lol

tacit crypt
#

Directly? Most people fail .has kappapride (obv /s)

vagrant holly
#

Hm

#

So the current lock file is v2

vernal atlas
#

it would be the only way to check if a role had no permissions right?

vagrant holly
#

I guess I should retain that right

oak quail
#

ah someone was using node 15 I see

vernal atlas
#

thats what i use it for

oak quail
#

pre node 15 uses v1

tacit crypt
#

Just push updated file

#

dw about version

vagrant holly
#

Yeah, package.json says node 12+

oak quail
#

node 15 with lockfile v2 broke del's gh actions too lol

vagrant holly
#

probs cause actions node is 14 lts by default

vernal atlas
#

options.ws.intents is also removed in favour of options.intents & options.intents is required

#

so yea def a breaking change

oak quail
#

ah, missed that

vernal atlas
#

i should also add an error actually if intents arent passed

oak quail
#

what does it do rn

#

gateway connection error or something?

vernal atlas
#

yeah it just leaves it for the gateway to error

#

also setPresence and the helpers using it no longer return promises

#

because there wasnt a need for them to return one anymore

oak quail
#

isn't that kinda inconsistent tho

copper laurel
#

that confused me, are they not API calls?

oak quail
#

gateway commands

vernal atlas
#

theres not really anything it waits for

#

the only reason it was async is so the application could be fetched if you provided assets for the presence

#

which according to the docs you cant do anymore

#

only through rpc

oak quail
#

that was never possible πŸ€”

vernal atlas
#

well idk why it was even added then

#

but theres not really anything it actually waits for so idk what the point is in it returning a promise

vagrant holly
#

Just as an aside, 12.4.x had some nice memory usage improvements (I was running 12.3.1 w/ my message edit limit patched in). No idea what else changed w.r.t to mem usage, but something seems to have done.

copper laurel
#

12.4 specifically or discords intent changes?

vagrant holly
#

I was using intents prior, so it seems like 12.4 -- the drop in mem usage & the associated annotation is me rolling out 12.4.1 to the bot

tacit crypt
#

that's.. odd

#

but always welcomed

tender field
#

Hey, using djs 12.4.1, i'm not supposed to have a more complete error thanks to the new async queue? This is after a failed guild.fetchBan(id) (i'm not asking for help, this is a genuine question, because i thought the async queue would give more descriptive error when a promise fails)

DiscordAPIError: Unknown Ban
    at RequestHandler.execute (/bot/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at RequestHandler.push (/bot/node_modules/discord.js/src/rest/RequestHandler.js:39:14)```
tacit crypt
#

are you sure you're on v12.4.1? (odd question i know, check the code itself)

vernal atlas
#

looks alright for me

tender field
#

are you sure you're on v12.4.1? (odd question i know, check the code itself)
yep, checked on the node_modules folder...

vernal atlas
#

are you sure your bot is using 12.4.1?

#

perhaps try evaling / logging require('discord.js').version

tender field
#

well it is in the package.json and on the node_module folder

#

ok

#

yep it prints 12.4.1

#

it is transpiled with babel btw, idk if it changes anything

#

but i'm not sure if it comes from .fetchBan(id) or .unban(id), because the try/catch is the same for both and... you know i don't have the line ^^

#

well i can't reproduce this because it being called was a bug anyway, and i fixed it... but it is still weird that it did that
I managed to reproduce it, and yep, still a small stack trace

#

Same result with Node 14.15.0 and 12.18.3

vernal atlas
#

could it be because the request is being retried?

tender field
#

wdym?

#

wait was it for me or for the team? πŸ˜‚

real jetty
tacit crypt
#

That's..the point

#

We have a bunch of those shortcuts (most are just mere permission checks)

real jetty
#

I proposed a getter to know if a channel is set as 'private' with the private icon but it was denied as it is an easy check... Will some getters diseapear in v13 ?

vernal atlas
#

yeah i believe that some of the getters will be removedf

frank turret
frank turret
#

@vivid field for your pr (#4935), why don’t you just return the cache itself instead of creating another collection?

vivid field
#

because the roles aren't on the cache in case cache is set to false

frank turret
#

Good point

vivid field
#

that's also what every other manager does meguFace

vagrant holly
#

Is a release gonna be cut soon given the regression fix was merged?

unique axle
#

as per usual: no ETA on releases

tender field
#

Will djs 13 provide some mocks or a testing api ?

real jetty
#

I would doubt it:
If you are PRing the lib, chances are you are only providing fixes or extending support to a specific endpoint, writing your own tests should be easy enough

tender field
#

no i meant as a djs user, not a djs contributor. To create tests for your bot

unique axle
#

no

storm igloo
#

Unoffical blabla, but it's very useful in recreating behaviour of a 3rd party api (like discord)

tender field
#

thanks

surreal dagger
#

hey, when v13 is coming?

unique axle
#

as per usual: no ETA on releases

real rivet
#

right, that's how it is
decent ways of implementing pagination will probably be a thing of the far future

copper laurel
#

Things which exist as complex concepts / multi-step processes (such as pagination) rather than wrapping singular API calls will likely never be a part of discord.js

real jetty
#

@oak quail yeah your right, its in there but not in the code

empty viper
#

Hi, I have question, when does the v11 will stop working ?

On the guide I says October 2020, but we are in November and my bot stills run on v11 (it's a test bot) πŸ‘€

oak quail
#

probably sometime in 2021

#

but people are already having some issues with it

ornate topaz
#

Did discord reschedule domain change?

cold basin
#

domain change did happen iirc

ornate topaz
#

Not exactly what i asked about

#

For now both domains work - that's what i asked about

ornate topaz
#

So most likely in few days, not in 2021

unique axle
#

These are the statements, requiring the new domain later this year for third party developers on November the 7th 2020.
While there have been talks about re-directing and keeping discordapp.com alive, that is the public facing information.

#

In the end: we'll have to wait and see

#

You definitely should be updating to v12, not only because v11 might break due to the domain change but also because it does not receive new features or bug fixes anymore.
We have moved on from v11, it's an old version, we do not maintain or support it any longer. Please update at your earliest convenience catThumbsUp

empty viper
#

Okay I see now.
(PS : As I say it is just a test bot, it doesn't even have commands x))

drifting knot
#

first off is the diagnostics channels, could this change the debug event in the future? djs next?

#

there's also an event emitter when a child process spawns successfully, maybe relevant to sharding??

copper laurel
#

Not sure I see the benefit of the diagnostic channel over the existing debug event, unless it happens to be more performant. The spawn event definitely looks useful but again, I'd be hesitant to enforce a minimum Node version of 15.1

thorny tree
#

why can't the shard resume the connection, if the internet fails, and the connection closes with a 1000 code?
isn't this the point of resuming connections, if the internet fails?

If I normally connect:

[WS => Shard 0] [IDENTIFY] Shard 0/1
[WS => Shard 0] [READY] Session 49b63190f****************** (censored)
[WS => Shard 0] Shard received all its guilds. Marking as fully ready.

if I turn off the network:

[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] [CLOSE]
    Event Code: 1006
    Clean     : false
    Reason    : No reason received
[WS => Shard 0] Clearing the heartbeat interval.
[WS => Shard 0] Session ID is present, attempting an immediate reconnect...
[WS => Shard 0] A connection object was found. Cleaning up before continuing.
    State: CLOSED
[WS => Shard 0] [DESTROY]
    Close Code    : 1000
    Reset         : false
    Emit DESTROYED: false
[WS => Shard 0] WS State: CLOSED

and activate it again after more than 30secs, it doesn't resume the connection, but makes a new identify call, which is very expensive

[WS => Shard 0] [CONNECT]
    Gateway    : wss://gateway.discord.gg/
    Version    : 6
    Encoding   : json
    Compression: none
[WS => Shard 0] Setting a HELLO timeout for 20s.
[WS => Shard 0] [CONNECTED] wss://gateway.discord.gg/?v=6&encoding=json in 1489ms
[WS => Shard 0] Clearing the HELLO timeout.
[WS => Shard 0] Setting a heartbeat interval for 41250ms.
[WS => Shard 0] [IDENTIFY] Shard 0/1
...

shards would've been destroyed within 30 seconds, afaik.
because of that, the shard gets destroyed with its sessionID and it does a new identify call (rather than resuming the connection)
is this a bug or a feature?

surreal geode
#

It looks like the socket closed with 1006 (without close frame), d.js was going to try to reconnect and resume but the socket was closed, so it reconnected and started a new session.

#

@thorny tree Why do you think starting a new session is expensive?

thorny tree
#

@surreal geode
because there is a 5s rate limit for identify calls and it needs to build the whole djs structure again

surreal geode
#

The 5s identify ratelimit applies to resume identify calls, too

#

The internal d.js structure is already "built" before you log in; the caches are filled but that isn't very expensive

thorny tree
#

The 5s identify ratelimit applies to resume identify calls, too
@surreal geode no I asked on the offical discord developer, and they said, it doesn't have a rate limit, and I can indeed confirm it after some tests

surreal geode
#

Huh. Sorry about that. I guess the 5s limit could be a problem but it seems you are only starting a single shard

thorny tree
#

30 shards reconnect in a few seconds rather than 2,5minutes
(or more extreme: 400 shards reconnect in a few seconds rather than 33minutes)

ornate topaz
#

(at 400 shards you would have higher max concurrency, but that doesn't change much here)

tacit crypt
#

Your session would expire anyways if you don't resume in time

#

There's like a very short window in which you CAN resume

old hill
#

Hi all. I was looking through the code recently, more specifically the rateLimiting things, and found that (iirc) the β€˜rateLimit’ event is called when an event is delayed to avoid ratelimits, rather than when an actual ratelimit is hit - in which case a debug is sent. To me, this seems kind of counterintuitive, and I feel like at least the documentation should clarify this. Is there any particular reason it’s set up this way?

ornate topaz
#

when an event is delayed, you have hit a ratelimit

old hill
#

I can understand that, but I feel like the behaviour should be clarified in some way

thorny tree
#

There's like a very short window in which you CAN resume
@tacit crypt its more than 5 minutes, so it should be possible to resume all shards in a few seconds

tacit crypt
#

No it's not

#

Sessions that are DCd last max around 1 minute

#

Otherwise you'll get an invalid session

thorny tree
#

wait I'll test it

#

oh you are right, but a minute should be enough right? @tacit crypt

tacit crypt
#

Without a proper example/test, I don't see how it's a problem
We tried reconnecting with the session ID, failed, so now we're reidentifying since session is aasumed to be expired

oak quail
#

why does ClientPresence have all of this when bots can only set name, type, and url

drifting knot
#

i have the typescript code written and commented n everything

#
function findShardIDByGuildID(guildID: Snowflake, shardCount: bigint): number
#

where should i pr this method into

#

it could make sense to make it a method on Guild, however 99% of the use cases are for finding a shard for a guild where the only data you have is the id

#

so maybe it should be a static method on Guild or Util or Client???

warped crater
#

fellas we have got to have a discord js method that implements the formula ...

#

no..? we.. don't?

#

you never specified the need for it πŸ€”

#

if you want to find what shard a guild is on you can simply use an if condition inside of broadcastEval

#

this isn't really particularly useful besides avoiding the use of broadcast and just running the code straight on the target shard (if that's even possible atm)

#

and I see no need for it inside the library itself.

drifting knot
#

ok imagine this

#

imagine i'm mee6 and for whatever reason i'm using discord.js to run my 8660 shards

#

now imagine im caching data in redis that uses the guild and shard id

#

now every time i want to fetch that data execute 8660 eval statements to find the 1 shard that matters

#

this is literally a thing mee6 does, only not with discord.js

#

it makes sense for the discord library to implement the formula discord gives us to use the discord api

lofty birch
#

You could just create the function yourself?

drifting knot
#

i did

lofty birch
#

Given how it's so simple

drifting knot
#

and i am offering to PR it

#

it is easy to make mistakes in the implementation

#

you could argue that everyone could make their own discord api wrapper and discord.js doesnt need to exist but that is stupid

#

we are here to make the discord api more accesible to javascript developers

#

why not make this formula part of that

lofty birch
#

The purpose of the library is to interact with the api. Using the formula doesn't do that in any way

drifting knot
#

and yet it is listed on the discord api docs

#

discordjs has methods for escaping markdown, that isnt api related

#

is it even really your place to decide if this should or shouldnt be in the library

#

just tell me where to put the function, i'll pr it, and someone will approve or reject it

unique axle
#

ShardClientUtil or the general purpose Util shibaThinking
i personally feel like the first represents the area of use better
though i'm unsure i understand the use case. if i'm not mistaken (possible, i'm not very involved in sharding internals) you'll need to #broadcastEval it anyways and returning if a guild is on the respective shard or by applying a formula doesn't seem to make much of a difference

drifting knot
#

the use case is to remove the need to evaluate code on all your shards

#

it uses a formula thats the inverse of what discord uses for sharding (not big bot sharding)

unique axle
#

i understand that. the question is: do we even allow to address a single shard at this time

drifting knot
#

ehhhh not easily

#

but having the function in whatever util class would be good

#

its simple enough its like 20 lines to implement, 20 lines to test, and then forget it forever

#

ooh and 1 use real world use case i actually have for this is to see how many guilds each shard is allocated for me, where my bot uses each cpu core to handle a bunch of shard IDs

sage owl
#

So, I was working on my bot today and when going to test the messageReactionAdd and messageReactionRemove event portion of the code, i am not getting anything that would suggest this event firing. This event has been working for over a month and then all of a sudden stopped working.

I am using partials to grab the message that wasn't cached but the important fact is i am not seeing a console output that i specifically placed at the top of the function. Any ideas what could be causing this?

unique axle
#

bughunter Bug:
β€’ MessageReactionAdd does not fire despite proper partials enabled

PR in the works,
Temporary fix is to ensure the addition of GUILD_MEMBER partial in the client definition
new Discord.Client({ partials: ['USER', 'GUILD_MEMBER', 'CHANNEL', 'MESSAGE', 'REACTION'] });

(copy from #769862166131245066)

sage owl
#

How long has this been going on, because this is the first i have seen this?

#

Is this bug due to discord changes or is this specifically a Discord.js bug?

#

Ok, that makes sense! Yeah, probably should too. Thanks for the info. I just found the discord after searching the net for this issue. IS this going be the best place for announcement and changes?

unique axle
#

well yes, this is our (discord.js) discord server

sage owl
#

Yeah, I just looking or the place where I will get the announcements first. Some API devs like their website to be the front page, others like GitLab or GitHub. I work in the industry, so was just curious where the best place to go is. I appreciate the help!

#

btw, I think you all are doing a stand up job with Discord.Js...keep up the hard work!!

unique axle
#

GitHub is where the issues and new features will be discussed, if we spot things happening regularly in support they'll go into #769862166131245066 , feature releases happen in #announcements
both you can follow if you prefer to get notified on your own server catThumbsUp

oak quail
#

btw re the sharding formula, I use it sometimes to see what shard a guild is on when the bot is offline in it

drifting knot
#

that too

vagrant holly
#

There isn't currently a way to broadcast to a single shard, but that seems like it'd be a super useful change

#

Will take a look shortly

wide sand
#

I have come across a very weird issue i think it;s djs issue.
the clientOption for fetchAllMember get timeout even when server member intent is enabled and bot is in 600 servers with 100K members

#

to test it properly i tried manually adding all intent double check server member intent

#

tried on different vps too

#

make sure to on warn and debug event to see it

#

once it timedout the client will go in ready state but no commands will work

vagrant holly
#

πŸ€” The websocket is closing

wide sand
#

yes which should not be happening

tacit crypt
#

So you're using intents and you have server member intents enabled in the dev portal?

tacit crypt
#

and whats your intent bitfield?

wide sand
#

i am using flags: 'GUILDS','GUILD_MEMBERS','GUILD_MESSAGES','GUILD_MESSAGE_REACTIONS'

#
    fetchAllMembers:true,
    ws: { intents: ['GUILDS','GUILD_MEMBERS','GUILD_MESSAGES','GUILD_MESSAGE_REACTIONS'] }    
});```
tacit crypt
#

d.js version?

wide sand
#

12.4.1

tacit crypt
#

ALSO, I'm pretty sure, on recent versions, it was moved outside of ws

vagrant holly
#

Intents doesn't take strings?

#

It takes a bitfield

tacit crypt
#

it does

#

oh

vagrant holly
#

πŸ€”

tacit crypt
#

that too

#

also this is less lib discussion and more djs-help but I'll give you a pass

You forgot the constructor for the Intents class

vagrant holly
#
        ws: {
            intents: (new Intents()).add(
                Intents.FLAGS.GUILDS,
                Intents.FLAGS.GUILD_MEMBERS,
                Intents.FLAGS.GUILD_MESSAGES,
                Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
            ),
        },
tacit crypt
#
new Intents([])```*
lofty birch
#

you can use an array of strings

#

I do

unique axle
#

what...

#

vlad, pls

#
  1. no, 12.4.1 is still under the ws key
tacit crypt
#

I thought we moved it what

#

oh

unique axle
vagrant holly
#

Nice, TIL it can take strings

#

@wide sand Long story short, ws: { intents: new Intents(['GUILDS','GUILD_MEMBERS','GUILD_MESSAGES','GUILD_MESSAGE_REACTIONS']) }

tacit crypt
#

No..thats fine

#

Doesn't NEED new Intents

#

since we resolve them

#

Well.. leaving aside that (@unique axle wasn't it a PR for moving intents up), it should work... Can you log client.options.ws.intents after you create the client instance (aka before logging in)?

wide sand
#

tried that too before

unique axle
#

Can you log client.options.ws.intents
that one - on the other hand currently doesn't work catLUL

vagrant holly
#

Oh wait, does intents itself get resolved too?

wide sand
#

same this:

Error [GUILD_MEMBERS_TIMEOUT]: Members didn't arrive in time.
    at /root/Node Apps/Menhera Chan/node_modules/discord.js/src/managers/GuildMemberManager.js:317:16
    at Timeout._onTimeout (/root/Node Apps/Menhera Chan/node_modules/discord.js/src/client/BaseClient.js:83:7)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7)
tacit crypt
#

yes, Matt

vagrant holly
#

So much resolving

wide sand
#

it works fine for bot that is small in less number of server. but don't for slightly bigger bot. this error i am getting is in 600 server bot

#

with 100K members

#

so it's djs issue?

vagrant holly
#

It seems like the library gives a guild 120s to return some members, or that error is thrown

#

Which feels like it should be given a setting

#

But also from your logs the WS was dying, so the timeout doesn't seem to be the issue

#

I assume if you disable fetchAllMembers the bot starts fine without the WS dying?

wide sand
#

yes

#

if fetchAllMember is false(default) bot starts just fine

#

but when it's set to true the WS closes

#

and get timeout

#

so there is no solution right now?

vagrant holly
#

I defer to someone who knows the internals of intents better than I

#

My only suggestion would be, as the docs note, to avoid using the fetchAllMembers client option

wide sand
#

but then i can't cache all members and members.fetch takes time

#

when the server is huge

lofty birch
#

you should avoid caching all members

real jetty
#

Why does Message#member returns null even if the message is sent in a guild ? Why doesn't it return a partial member if it can't find it ?

keen cosmos
#

it searches the cache for the member, and if it's not found it returns null

This is also technically a question, and belongs in a help channel, not here

real jetty
#

I'm talking about how the library behavior that seems weird imo

#

why doesn't it add automatically the member to the cache if it can't find it (at its creation) ?

#

With new intents if you disable guild members intents Message#member will be null if you don't fetch it, it's a problem imo

vagrant holly
#

Imo it'd make sense for it to return a partial

keen cosmos
#

Then you'd have to have a partial guild member in the cache

#

Message#member is a getter

#

which retrieves from the cache

real jetty
#

It is not a problem

#

I'll make a PR

ornate topaz
#

There already is one regarding that

real jetty
#

oops didn't see it

#

sry

vagrant holly
#

Am I going mad cause I don't see it, unless it was already merged

real jetty
#

But it is only for events

vagrant holly
#

Yeah, that doesn't actually ensure Message#member can be a partial

#

Just does a better job of populating the cache with partials

slate nacelle
vagrant holly
#

Right, but if the member/user had since been purged, Message#member will return null, not a partial, I think?

#

Message itself could store the raw ID, and could then repopulate the partial when Message#member is called

tacit crypt
#

Which feels like it should be given a setting
It is

It seems like the library gives a guild 120s to return some members, or that error is thrown
We refresh the timeout every time we get a GUILD_MEMBERS_CHUNK payload

As for WHY it errors... I don't know...Make triple sure your d.js is at the version you said, try different bot tokens, etc

vagrant holly
tacit crypt
#

doesn't mean we don't provide the option to change it and let's be honest... if payloads don't come in 120 seconds.. We have an issue

vagrant holly
#

Yeah, agreed it shouldn't affect anything, but there isn't a setting for it πŸ˜›

tacit crypt
#

ALSO

#

peculiar notice

#

..are..we..

#

double requesting all members

vagrant holly
#

double requesting all members
@tacit crypt Where?

ornate topaz
#

(that wasn't the pr i was talking about btw)

tacit crypt
#

I mean the error Chota reported comes from the WS manager

#

oh

#

my god

#

I think we are

vagrant holly
tacit crypt
#

No

#

Not that

#

look at the prefix

#

[WS => Manager]

#

I

#

..I have some testing to do but I think we're double fetching members

vagrant holly
#

Oh you're totally right we are

tacit crypt
#

wait no

#

I'm actually a bot

#

client.ws.status === Status.READY

#

n v m

vagrant holly
#

is status not ready during the initial fetching?

tacit crypt
#

nop

#

it's set to NEARLY

vagrant holly
#

Ah yes ic

tacit crypt
#

It..should..work tho

#

I do this in @signal lintel for now, I'm planning on changing that asap

vagrant holly
#

Are there any situations where you physically cannot request all members from a guild

tacit crypt
#

yeah, if you don't have the guild_members intent

#

or.. y'know, verified bot without it

wide sand
#

@tacit crypt i have guildmember intent enabled and my bot is 600 servers

#

i tried the same in small bot it worked in that

#

didn't timeout at all

#

but in big bot it timedout

tacit crypt
#

are you 100% sure you're on 12.4.1? Some caching issues can cause that

wide sand
#

yes

#

i updated today itself

tacit crypt
#

Oddd

wide sand
#

"discord.js": "^12.4.1",

#

i checked pakage.json just now

#

to make sure once again

oak quail
#

@tacit crypt its gonna be moved out of ws in v13

#

would be breaking to move it in 12

tacit crypt
#

well yes but no if you just deprecate the ws one

copper laurel
#

yeah you can add it to top level client options without removing ws

wide sand
#

DJs is using V6 right

copper laurel
#

v7 technically, same API spec as v6 but with better errors

wide sand
#

Aah

#

So it can be added outside ws in current djs version

#

Or wait till v13 comes out

copper laurel
#

that has nothing to do with the API itself

#

We can provide the ability to receive the options wherever we like

#

Just cant remove the existing placements until v13 because thats breaking changes

unique axle
#

unless - horror ensues - we accept both kek

  • that being said, still not sure i'm personally a fan of moving this specific one at all
lofty birch
#

I agree, I think it makes sense to keep it inline with the ws section

#

Given how that's what it affects - the websocket

oak quail
#

normally everything the library parses is up in ClientOptions and http and ws are only for advanced settings that are sent directly to discord without modification, which aren't meant for normal users

unique axle
#

the planned rewrite to typescript (no release version/roadmap/date estimate, own repository at discordjs/discord.js-next) is planned to be much less monolithic, swapping out cache provider/rest/gateway for own extensions/implementations will be much easier - however no reason for great excitement, it's in a pre-planning phase (very very very early)

vivid lodge
#

πŸ‘

#

I hope you plan on making your event methods easier to work with aswell, I had to go through so much shit to get custom events as a keyof interface in typescript

copper laurel
#

Extending ClientEvents is "so much shit"?

tacit crypt
#
declare module 'discord.js' {
  export interface ClientEvents {
    myCoolEvent: [User, WoahAClassOfMineOwO, SoujiIsSuperCute, BlameVlad];
  }
}```
#

that is not so much shit, it's do it once and call it a day

vivid lodge
#

I had so many issues doing that tho

tacit crypt
#

such as?

wispy forum
#

Within typings of the library, as of 12.4.1, options are mandatory for methods like reply, send or edit. How come that is so? Back in 12.2.0 they were able to be undefined. Why exactly was this change made and how much difference would changing them back to be able to be undefined bring?

ornate topaz
#

Mandatory?

wispy forum
#

One sec.

#

Mandatory as unable to be undefined. My bad.

ornate topaz
#

So you say that it screams at you for not passing them to methods?

wispy forum
#

Which used to work in 12.2.0.

#

I'm just confused.

copper laurel
#

The first typing in that list does not have/require options, therefore there is an overload where they arent required

wispy forum
#

Alright. Still don't understand the desperate need to not make those optional for sake of edge cases but okay. I'm sorry for being irrational or annoying.

copper laurel
#

...but they are optional

wispy forum
#

Yes, I see the top one that solely has content as argument, I'm aware of it.

#

But I still think these bottom ones would be nice as optional.

copper laurel
#

You seem to not understand how method overloads work

#

Okay, credit to @ornate topaz for pointing this out to me, you (and I) were mistaking "optional" for undefined

#

The overloads do not explicitly support passing undefined in place of an optional parameter, because undefined isnt one of the accepted typings for that field if optionally provided

#

I messed up testing that with eval because JS doesnt care of course

#

Only TS does

wispy forum
#

Yes I kind of mess the two up sometimes during talking but I see now.

copper laurel
#

As did I, so apologies for being stubborn haha

wispy forum
#

All good, but guess that clears everything up.

solemn oyster
#

@wispy forum you need to somehow port all overloads those methods have, and then you can do options as any

#

While any is disgusting to use, it can be used to tell TypeScript that the data is fine

wispy forum
#

Yeah, there's a lot of times when handling types looks really ugly but has to do the trick ig

solemn oyster
#

So yeah, your issue isn't about it being potentially undefined

#

But rather about you passing all possible overloads to an overloaded method

wispy forum
#

I see that now.

solemn oyster
#

TS can't match all the overloads we have as a single one, so that's where this kind of issues happen

left moat
unique axle
#

the channel is for discussion, if you have nothing additional to add to the issue that requires discussion refrain from bumping, thanks. We really don't need this to become bump central.

vernal atlas
#

should these error codes be added into djs? i think they're all for store-related things that djs doesn't even have

#

as well as, should these error codes be removed since they can't be obtained?

copper laurel
#

Didnt stores die

vernal atlas
#

the store channels did yea

#

idk if the whole thing went with it

#

not sure what to name this one, ACCOUNT_VERIFICATION_REQUIRED maybe ?

#

same for this one, best i came up with is CANNOT_DELETE_COMMUNITY_REQUIRED_CHANNEL but feels a bit too long

oak quail
#

the store channels did yea
@vernal atlas no

#

store channels still exist lol

#

only the centralized store and nitro games died

vernal atlas
#

ah

tacit crypt
#

but feels a bit too long

#

RESTPostOAuth2AccessTokenWithBotAndGuildsAndWebhookIncomingScopeResult

#

CannotDeleteChannelRequiredForCommunityGuilds

vernal atlas
vagrant holly
slate nacelle
#

Oh right, forgot about that

sick merlin
#

<Guild>.members.fetch() doesn't seem to work anymore with the new intent requirements ( without guild members ), but the error doesn't seem straightforward and the error page in the guide doesn't mention the intent is needed

vagrant holly
#

You can't fetch members without the members intent, I feel that's pretty obvious, no?

slate nacelle
#

The error is actually an internal timeout, Discord (probably) just ignores the request.

#

Since there is no way to always know what intents are present (read: you can omit them on gw6, what we use), we couldn't reliably throw an error here.
Not until v13, then we surely can.

vernal atlas
#

couldn't you check <Client>.options.intents ?

#

oh wait- this is for existing v12

vivid field
#

since WebSocketManager is a custom implementation, where is the ws package used?

slate nacelle
#

/src/WebSocket.js, which then is used in /src/client/voice/networking/VoiceWebSocket.js, and src/client/WebSocket/WebSocketShard.js.

vivid field
#

oh right, i forgot that each shard has its own ws connection, thanks

vagrant holly
#

Just as an aside, 12.4.x had some nice memory usage improvements (I was running 12.3.1 w/ my message edit limit patched in). No idea what else changed w.r.t to mem usage, but something seems to have done.
@vagrant holly Just to follow up on this, definitely looks like a leak got fixed. No idea what or where, but since updating d.js my memory usage no longer creeps.

tacit crypt
#

are you sure it wasn't the message edits?

vagrant holly
#

Nah I was on a hotfix branch with my PR merged before

#

Cause that was causing me to oom

vivid field
#

why does collection allow a thisArg? what's the difference between collection.find(fn, myCoolObject) and collection.find(fn.bind(myCoolObject))?

merry python
#

arrow functions can't be bound, the same parameter exists on standard js functions

vivid field
#

but neither works for arrow functions meguFace

keen cosmos
#

consistency with array methods?

solemn oyster
#

^

real jetty
#

why do we have seemingly useless properties such as <Guild>.ownerID even though we have <Guild>.owner? Is this just for ease of use or is there a valid reason? I understand Discord supplies only the owner_id and DJS works out the owner's guildmember object itself but would it not make more sense to have one or the other instead of both?

#

i feel like just having ownerID would be sufficient

copper laurel
#

Guild#owner is a getter for this.members.cache.get(this.ownerID)

real jetty
#

yes i've seen which is why i kind've see it as useless, the user could simply get the owner with the ID instead of needing two properties for this

copper laurel
#

They could, but thats also the purpose of getters

#

I could make the same argument that message.channel shouldnt exist and we should just have message.channelID

real jetty
#

true, but if you make that argument:
we could just have <Guild>.owner instead of <Guild>.ownerID

copper laurel
#

But GuildMembers are not always cached, making ownerID the valid property here

real jetty
#

ah

#

yeah

#

alright thanks for clearing that up

copper laurel
#

Which is why <Guild>.owner can be null (getters return null if they cant resolve the data) and thats when the user needs to fetch via ownerID

#

This issue became significantly more present due to intents

frank turret
#

Has the possibility of moving convenience getters like this to their own package in next been considered? Recall someone mentioning it in the past

real jetty
#

i feel like removing these types of features has been discussed

#

thats why i brought it up

#

and yes intents seem to complicate this sort of thing, guess that adds more reason for the getter

copper laurel
#

@frank turret their own package? why?

frank turret
#

Well that was an example of some method of separating them so the whole conversation of "why do we have X convenience method when a person can just do Y”

real jetty
#

yeah i guess we have to find a middle ground
on one hand some developers don't need these methods at all since they know what they are doing (more or less)
on the other changes like this would break lots of people's code, and new developers may find it difficult to wrap their head around the change

#

although in my opinion if we're going to remove/change conveniences like this we should do it all at once in a major release to get it over with

copper laurel
#

Removal of a property is semver major so yes

real jetty
#

yeah ik, but as in remove all the convenience methods at once, not just remove one or two
that would just confuse people more

tacit crypt
#

I mean.. considering Discord seems to point at serverless and go: this please; I think we should replace a bunch of getters with fetch<X>

#

Er, stateless

#

Close enough

copper laurel
#

Conceptually agreed, but I feel like there are already other solutions for that and discord.js really is the caching model

raven juniper
#

I believe what nico is referring to is removing stuff like GuildChannel#viewable, the basic permission checks that the user can very easily implement

fading slate
#

How are message replies represented in the API/library?

unique axle
#

?replies

rich iglooBOT
#

Discord.js will support inline replies in v13, replacing Message#reply with the new functionality.
If you'd like to try out the feature ahead of time (in a server with it enabled), please install and test this PR: https://github.com/discordjs/discord.js/pull/4874
You can e.g. use NPM to do this: npm i discordjs/discord.js#pull/4874/head (this requires git to be added to PATH)

fading slate
#

Okie

copper laurel
#

Discord reused the same property crossposts do, so we already support that

fading slate
#

Oh, Okie πŸ‘πŸ»

round mortar
#

How are we looking on d.js v13 (specifically the REST package)?

unique axle
#

see above

old kelp
#

isn't Guild#voice an inferior shortcut for Guild#me#voice? I'm not sure if that's any better to obtain the VoiceState from the Guild#voiceStates (GuildMember#voice does the same there but with a better approach)

solemn oyster
oak quail
#

oh, i asked aj something about that and forgot to finish it after he responded, i'll do it now

#

ok there

lofty birch
#

Any news on this? It's started occuring again

#

Because I see the PR was merged yet it still happened

lofty birch
#

On 12.5 too

tawny warren
#

Why can't inline replies be added to v12?

old kelp
snow crypt
#

they can, but they shouldn't

#

that can cause confusion

#

currently message.reply sends a message with a mention, but the name reply suggests that it is the discord reply feature, and calling it discordReply or anything similar is just- no

copper laurel
#

My PR was Message#inlineReply at one point, and Souji had done one to remove Message#reply in v13

#

But we decided just to merge the two and make it a v13 release

unique temple
#

hi, after the discord.js v13 library exits, will i be able to use discord.js v12 without bot verification?

#

sorry, my english is not perfect

slate nacelle
#

Bot verification is pretty much unrelated to libraries, as long as v12 is working, you will be able to use it. (Whether its recommend is another thing though)

slate nacelle
unique temple
#

A friend told me that I will be able to use the discord.js v12 library until June, after June I need a verified bot to be able to use it

#

@real jetty tΕ‚umacz sie

slate nacelle
#

No, I am not aware of such a thing, especially since verification is only available after your bot is in 76 guilds.

real jetty
#

what

unique temple
#

I hope discord.js v12 can still be used after June.

oak quail
#

@unique temple discord.js v12 will stop working sometime next year

#

it has nothing to do with whether your bot is verified or not

#

but updating to v13 will probably not be hard

tacit crypt
#

How will v12 break? Aren't you confusing it with v11?

#

Oh, wait, api v7

#

Nvm me

lofty birch
#

I'll try something out in a few hours that could find a cause, but can't atm

#

V4 said that the original issue was caused by a process aborting, not exiting. And the manager would then not restart that

vagrant holly
#

^ just tested on 12.4.1 & 12.5.0, a shard respawns on 12.5.0 when process.exit() is called where it wouldn't on 12.4.1, so I'm confident in saying its fixrd

lofty birch
#

One of my shards died and was off for 15 hours this morning until I restarted the manager

real jetty
#

Hmm, quick question, why is publicUpdatesChannel read-only but publicUpdatesChannelID not?

vivid field
#

because publicUpdatesChannelID is a property sent from discord, whereas publicUpdatesChannel is just a getter which returns the channel with that id from the channel cache

real jetty
#

Ahh, I see. Thank you

#

So then i guess that answers the question I was about to ask, "why is it publicUpdatesChannel and not modUpdatesChannel or something", because that's the property name sent from Discord?

vivid field
#

correct, most stuff is named according to the discord api

vagrant holly
lofty birch
#

and I fetch those values via bot.shard.broadcastEval('this.uptime ? this.guilds.cache.size : 0')

vagrant holly
#

so the shard is alive then

#

broadcastEval will throw if the shard is dead

lofty birch
#

but apparently not logged in

vagrant holly
#

okay so this is an unrelated bug to before

#

So you never see a death event in your logs?

lofty birch
#

I wasn't aware there was a death event

#

on manager there's only shardCreate

#

and there's obviously not one on client

vagrant holly
#

Yeah so on shardCreate you then bind to shard events

#

shard death will trigger a respawn

lofty birch
#

I do listen to that, no ready events were logged in that time

vagrant holly
#

I'm confused, do you listen for shard death?

lofty birch
#

only shard ready

vagrant holly
#

Ah right

#

I'd suggesting listening for shard death/disconnect in your manager

#

and seeing what you get back

#

this feels more like some sort of disconnect issue rather that outright shard death

lofty birch
#

Oh I didn't notice those extra events on the shard

#

yeah, will do

#

oh I already listen for disconnect actually (which I've not had since my logs began)

#

just not death

#

Added that now. Other than that is there anything you can recommend?

vagrant holly
#

Honestly not, never seen this before in my experience

drifting knot
#

right now the methods for banning and kicking members/users accept options in 2 ways:

// kicking:
member.kick(reason?: string)
// banning:
member.ban(options?: { reason?: string, days?: number });

would it make sense to have the kick methods also accept an object for options, so that it's easier to reuse code to ban/kick someone and pass a reason?

lofty beacon
#

not in my opinion

frank turret
#

Well, that would make sense only if the object would take more than one param. Kick only has one param you can pass in

lofty beacon
#

the way it is is fine imo

lofty beacon
real jetty
#

i addressed this in PR #4718 however that was considered semver major, however changes with partials mean this would now be considered semver patch, correct?

tawny warren
old kelp
#

you could read a few messages below that and as well read the PR description

sullen bane
#

Have there been any discussions on the github about inlining the documentation in the type definitions? I looked but could not find any.

vagrant holly
#

Disconnecting the docs from the source seems like an odd move imo. When I’m working on the lib source, having all the jsdoc right there is rather helpful

oak quail
#

tbh it would be useful to have it in the types

#

having it in the source is nice for lib devs but having it in the types is much more useful for users

sullen bane
#

Agreed, but we could probably rig up a system to mirror it.

#

Like if we include docs links for each method in the typing, we could probably use a small script to populate the comments in the typing

oak quail
#

ig

#

at that point, typings could probably just all be handled automatically?

sullen bane
#

Not quite. The typeings in TS are much more precise than what is in the jsdoc.

vernal atlas
#

yeah generating the types from the jsdoc would either make the typings inaccurate or the jsdoc super wack

copper laurel
#

Im not sure what you're looking to achieve here?

#

Having the docs appear with Intellisense?

oak quail
copper laurel
#

Was decided against because we don't want to maintain two sets of docs

sullen bane
#

Worth looking into if it can be automated.

tacit crypt
#

If it wasn't said before, that issue will be solved with -next owo

clever crypt
#

correct me if i'm wrong but, can breaking changes be performed to the voice aspect of discord.js since it depends on @discordjs/opus which doesn't have a defined public api (basically it doesn't have a v1 yet)

wild flax
#

No

sullen bane
#

Semantic versioning is a human thing, there are no technicalities with it, even if you could do that -- it would be very rude.

empty viper
#

What means typing count in this method ?

vagrant holly
#

Internally there is counter, while the counter is greater than one, typing will be sent to the channel

#

so stopTyping needs to be called counter times to actually stop the typing

#

(e.g. if you use startTyping when a user runs a command, and use stopTyping when the command executes, the counter allows for two commands to be run at the same time in the channel and not break that typing effect)

#

So when you call startTyping, you can increment that counter by a custom count if you want. So you could pass 2, and then you'd need to call stopTyping twice to actually stop that typing (or use the force flag)

empty viper
#

Okay I see I see, thanks for explanation, and it should be more precise in the description in the doc !

vagrant holly
#

Imo its a pretty weird edge case to need to use the count arg, so having more detailed docs might confuse folks into thinking they might actually need to use it more usually

#

But feel free to create an issue if you want, to log the request for the docs to be improved πŸ‘

limber thistle
#

are djs' caching issues gonna be addressed in future versions

#

like the reason djs-light exists

tacit crypt
#

the only thing that lib does is disable caching. It's not an issue that we do what Discord used to tell everyone (aka cache stuff). If the question would be like are there plans on changing how caching works in the future, then the answer can become, say, maybe, or depends or idk

vagrant holly
#

If you have specific caches that are causing you issues, please do say, I'm always looking to add settings to reduce those

#

But you can just manually sweep most things yourself and D.js will keep working for the most part, esp. if you've got partials enabled

tacit crypt
#

^

limber thistle
#

right thanks

#

its just its not very feasible to run djs on large bots, atleast for me with subpar hosting

tacit crypt
#

Sure there is..

vagrant holly
#

What do you consider "big"?

tacit crypt
#

it's called sweeping

limber thistle
#

a server bot i ran in heroku on one server with 220k members couldnt handle it

#

it had intents disabled

#

my other bot reaching 600 servers runs smoothly rn so thats nice

tacit crypt
#

In highlight, I sweep a bunch of things and the bot works just fine shrug, with little memory too! Course, if there's any cache you notice that eats up a LOT of ram compared to the rest, let us know, preferably with heap dumps

limber thistle
#

right

vagrant holly
#

Manually sweeping members + users will probably help you in that situation (plus ensuring you're not fetching all on boot etc.)

limber thistle
#

yeah im not, currently i upscaled the hosts to fix it

tacit crypt
#

using just intents you NEED is also a huge improvement

limber thistle
#

i turned off all privileged intents too

tacit crypt
#

so then your bot did nothing?

vagrant holly
#

I might look at adding some sort of options into D.js for sweeping users/members, I wonder what folks would think of that

limber thistle
#

yeah that would be nice too

tacit crypt
#

Eh, I'd rather at that point we get some configurable caches instead of piece by piece

limber thistle
#

my bot worked when i increased its allocated ram

#

configurable cache is also nice

tacit crypt
#

If your intents array was empty, then your bot did nothing

#

if you didn't specify intents, it means you just get all events

frank turret
#

does d.js-next plan on allowing us to use our own caching structures? Like if i wanted to use redis for the cache

limber thistle
#

sorry i mean privileged intents

tacit crypt
#

GUILD_MEMBERS and GUILD_PRESENCES are.. shrug

#

depending on each guild, TYPING_START is nightmare, VOICE_STATE_UPDATES, etc

limber thistle
#

ok

#

i dont need any voice stuff

#

ill look into that thanks mate

warm crater
#

Discord.js should go back to what it was before datastores and managers, the high level API it exposed made sense, it just needed to be refactored. DataStores broke every basic rule of software design, Managers tried to correct it, but left us with inconsistencies in the API. To me, there doesn't seem to be a good argument for something like channel.messages.fetch over channel.fetchMessage. Just because you replace multiple word methods with multiple single-word object fields doesn't make it better or "more object-oriented".

Slight tangent, but most of the problems caused by bad design could be somewhat mitigated if the library allowed for easy dependency injection through constructors (or some kind of IoC container). This would do away with things like cacheType, cacheOptions, Structures.extend etc which are all ad hoc fixes to the current dependency injection situation.

Just some thoughts I've had for a while...

wild flax
#

Short answer: yes.
Long answer: Not quite, no.

#

You said yourself that Managers adjusted for the shortcomings that DataStores have, but on the same page you say theres no good argument over them? That seems to contradict yourself.

#

Overall you are not wrong when it comes to dependency injection, but this is far from a "simple" change. It takes quite some time to implement that or even do it correctly.
And even if we do it, there would also be no "going back" to the old structure. With correctly applied DI it would look somewhat similar to what we have now still, just not as inconsistent.

warm crater
#

I'm saying there is no good argument for the current API (that uses managers), over the API that v11 exposed (which didn't have managers or datastores). DataStores tried to separate the responsibilities of the old ClientDataManager, but they also changed the API (e.g. channel.messages.fetch) without good reasoning, this side effect resulted in managers to once again separate cache and Discord API calls, v11 already had this separation. Now we are left with things like channel.messages.cache, channel.messages.fetch alongside channel.fetchInvites, which is inconsistent and clunky. Whereas if we stuck with the v11 style we would have channel.messages for the cache, and we would have consistency with API calls like channel.fetchMessage, channel.fetchInvites etc.

Managers adjusted for the some of the shortcomings of DataStores, but not all of them.

wild flax
#

Yeah there is enough good arguments. And all of them are listed in the issue that eventually led to managers. If you just completely overlook those for the sake of your "more words bad" argument then I don't know how I else I can help you understand.
The more "oop-ey" approach was not the motivation at all here.

vagrant holly
#

Imo, $0.02, having methods that affect cache inside a manager instead of the parent model is cleaner. Yes, it leads to some inconsistency with model methods that don't have a cache, but I think it provides a clear separation between methods touching cache and those that don't.

wild flax
#

Managers adjusted for the some of the shortcomings of DataStores, but not all of them.
And that exactly was the whole point. There is not really any "fixing it all" with the current iterations without a complete rewrite of how the system works. Which would be immensely more time consuming on top of all possible bugs this could introduce. So we are not only talking a new major version increase but also one that has a very high risk associated to it.

#

I don't know how you write software, whether that be hobby-wise or professionally, but since this is mostly a non-profit open source project you can or rather don't want to take such risks if you are aware that it could lead to hundreds or more hours you need to put into "fixing" while you already pushed it to users out there to use but its in a complete broken state.

#

There is a huge component that influences all decisions we make that isnt just "writing code" at the end of the day here. Writing code is maybe 30-40% if at all.

warm crater
#

I did read the original issue, it lists DI as one of its benefits, but there are other ways of doing DI that would have worked with the old API, its not unique to managers. It also lists separating cache and API as a benefit, but reverting also has this effect. It also says that one of the main reasons is that the data store API is more fluent than the v11 API (the more words bad argument), which is what I disagree with.

I think the risk of removing Managers would be similar to the risk of adding DataStores, which admittedly took a long time if I recall but it did happen eventually, so I would say its possible without a complete rewrite. DI was more of an afterthought I had, that would definitely need a complete re-write (probably in TypeScript) for it to be solid and not hacky.

wild flax
#

Feel free to open a PR if you think its the same risk and effort.

#

The reason Mangers took that long was simply because no one worked on it for a long time, not because it actually did take a long time.

copper laurel
#

It's also worth pointing out here that DataStores were never released. They were never in v11, and they weren't in 12.0.0

limber thistle
#

Thoughts on having separate partial events that you could specify in clientOptions? ,
partials will only fire in the events specified in that option so that we dont need to do if(class.partial ) return for all the other events if we decide to use partials

vernal atlas
#

eh

real jetty
#

do you mean different events for partial data or selecting which events the client would emit if the data provided is partial

limber thistle
#

same event, if you enable partialEvents, it only fires partialData if that event is enabled

#

if you dont give any partial events it doesnt affect anything

#

say I only want partial data for the reaction event

#

right now i have to go to each event and add if(partial) return

#

and use it only in reactionEvent

#

I can submit a pr if this is a good idea

oak quail
#

could use client.ws.on to get the raw MESSAGE_REACTION_ADD event

limber thistle
#

guess i could

unique axle
oak quail
#

is there any chance of bringing back disabledEvents?

glad sparrow
#

Why was it removed tho

ornate topaz
#

cause intents were created

#

it has pretty much same effect, apart from the fact that intents are groups and are never sent to you, instead of just being dropped by lib upon receiving

oak quail
#

that "apart from" matters tho

#

https://github.com/discordjs/discord.js/pull/3159

This gives a public alternative to the private raw event. (The raw event isn't removed, for the purposes of library testing.) This gives devs the ability to work with d.js in a cacheless way without relying on the private raw event.

#

Like raw, these event's aren't disabled with ClientOptions#disabledEvents (which isn't very aptly named, since it only disables the internal d.js handlers).
however they are disabled by intents

#

also you dont get per-event control with intents

prime prairie
#

When I do member.premiumSinceTimestamp, I sometimes get 0, or I get null depending on the user (That aren't boosting), is there a reason why these are sometimes different?

#

Thats a log of 2 users

vagrant holly
#

When the messageReactionAdd partials fix was done, did that also update/fix messageReactionRemove?

#

From my super limited test, if I start a bot up and remove a reaction, the event isn't fired

slate nacelle
vagrant holly
#

Huh, there is a user id there?

#

I wonder if it fires if I enable user partials

slate nacelle
#

Yeah, then it should.

frank turret
#

Any specific reason @discordjs/docgen has eslint as a main dep? Along with using Tsubaki just for a simple Promisify that could be done with Util.Promisify? The engine field in the package.json intends for docgen to be used with Node >=8.0.0 so Tsubaki is kind of useless here. Is it worth opening a PR over just to remove those? Asking cause I intend to use docgen for a personal project. I'mma go ahead and make a PR anyways OMEGAlul

empty viper
#

Shen does discord.js-next will start to be programmed ?

copper laurel
#

Whenever the maintainers feel like working on it

vernal atlas
#

when can APIMessage#target be a User or a GuildMember?

warped crater
#

if I had to guess, DM channels result in it being a user for a start

vernal atlas
#

but they are DMChannel instances ?

warped crater
#

huh

warped crater
#

ah, it may be because both DMChannel and User implement TextBasedChannel, sug

vernal atlas
#

hm

warped crater
#

that's still weird though

vernal atlas
#

i guess if you create your own APIMessage instance maybe

#

thats like the only place i can see it being a user/guildmember

warped crater
#

looks like a legacy of the past tbh

vernal atlas
#

possibly

real jetty
#

Im curious, when d.js sends a request to the api and it comes back, does d.js translate the received properties into javascript conventions (like camelCase for example)? Or does it come back already camelCase so there isn't much to do?

#

i could actually probably check the source couldnt i

#

interesting, i'm assuming this var instead of let is intentional? smart

real jetty
#

So looking through at least the Message structure, it seems that if Discord were to add a property to the message object returned by the API, it wouldn't be seen by the end user (the one using d.js). Why is that?

vagrant holly
#

The library isn't really just an API wrapper, it provides proper custom interfaces, so it doesn't just expose API data automagically

warm crater
#

You would also have to manually update the typings to support it anyway.

warm crater
#

And as v4 was saying, if you use some JavaScript magic and dynamically rename snake_case properties to camelCase then you lose the ability to choose what kind of abstraction you want to expose to developers. This would make the library very unstable because some people would adopt the new property and now you can't change how its exposed without breaking everything.

copper laurel
#
  • yes we do translate snake_case to camelCase
  • yes the structures are custom and don't expose new properties
  • unmodified Discord event packets can be listened to via client.ws.on("MESSAGE", message => etc
long perch
#

discord.js-commando should have an implemented property that allows the automatic cancel response to be changed or disabled.

empty viper
#

Is there a version of this library for Deno ?

raven juniper
#

no, only node

empty viper
#

Oh...

vernal atlas
#

there seems to be a slight issue with the typings for the send method on PartialTextBasedChannelFields, passing something that can be of multiple types results in an error
eg:

const options: string | MessageOptions = ...;
channel.send(options);```
this is perfectly valid code, however results in an error with TS, because none of the overloads technically accept this

i think *more* overloads need to be added here, but it seems like its getting very bulky there are already alot of overloads
unique axle
vernal atlas
#

@tacit crypt what precisely do i need to update in my v8 PR for the ratelimits? i did a test and on v7 the API sends 5 as the x-ratelimit-reset-after, but on v8 sends 5.000, so i would assume that rather than 4 for 4 seconds being returned now 4.567 would be returned for 4 seconds and 567 milliseconds? the number is already multiplied though so would be 4567 - or am i just being stupid and missing something

tacit crypt
#

retryAfter is in seconds

vernal atlas
#

oh

#

oh i see now i think

#

yeah i was being dum dum

tacit crypt
vernal atlas
#

applied change

ruby terrace
#

I'm currently working to implement interactions (slash commands being the only interaction for now), based on the last pinned message, should I hold off on my PR?

copper laurel
#

Yes, probably. The API docs PR is still marked as a WIP with comments off. Given that even Discord doesn't want it open for discussion yet, probably best to hold off

ruby terrace
#

Ok thanks, I was going to mark mine as a draft /WIP as well and keep along with the updates, but I'll just wait until they have finalized their docs

tired valve
ruby terrace
#

Whoops, thank you!

drifting knot
ruby terrace
#

I don't think we get ETA's on that, but I believe the intent was to have gateway v8 be a part of the v13 release.

ornate topaz
#

the switch to v8 is the reason there has to be a v13 in the first place

tired valve
#

& reply() being inline replies is a major change

drifting knot
#

does djs use GH milestones? would be nice if appropriate PRs were tagged with a v13 milestone

unique axle
#

due to how we use checkboxes for versioning rather than for progress milestones aren't all that useful
(as milestones accumulate progress based on checkboxes)

drifting knot
#

oh L

agile blade
#

Had a question on a comment on a PR I’m working on, can someone clarify for me? It’s on PR #5026

unique axle
#

if you actually ask the question one might be able to answer

agile blade
#

Just wanted to make sure I was in the right channel...
There’s a comment asking about the options object of the method, and if it could extend RoleData. I’m not entirely sure what is being asked as a change, I know it’s a documentation related thing but unsure on specifics

lofty birch
#

I've noticed that when updating a username, guild member update is fired with an identical user object (both of which have the new username). I presume this is unintended behaviour?

unique axle
lofty birch
#

ah that sucks. any workaround?

unique axle
#

i'd recommend reading the issue responses

lofty birch
#

Oh that's interesting, it's apparently caused by presence updates, but I don't use presence intents

#

It must be from user update arriving shortly before member update then, regardless of presence updates

unique axle
#

and if you now read the issue comments again you will realise that userUpdate is a artificial event that's not directly emitted from the API, as USER_UPDATE only emits for the client user and instead created based on the data in GUILD_MEMBER_UPDATE (which also emits on underlying User data) as well as PRESENCE_UPDATE (which also control the initial GuildMember and User caches to be filled) payloads.

empty viper
#

Are managers coming to djs-next ?

empty viper
#

Oh...
This should be made in a way that you don't have to put .cache everywhere, like a subclass of Collection that have the methods to fetch or resolve

oak quail
#

that was DataStores which got replaced with Managers before v12 was officially released

#

and it is good to have .cache because although it is longer, you know that you are accessing the bot's cache and it will likely not be full

unique axle
#

to get it out of the way: "i have to put a word more" is in no phase of the design process a consideration we make. as harsh as it might sound: "deal with it."

the clear separation of cache from API access is a concept we will be moving forward with. we have tried the other approach shortly during the development of v12 with "stores" which we have discarded as it caused more issues than it solved. with the rewrite considering modularity (plugging in own cache implementation) the separation becomes even more worthwhile.

#

in the current version 12.5.1 managers don't seem to be very useful, however there is a PR which will cover this (likely with v13) #4869 and will expose direct API access (so you don't need to unnecssarily fetch things before operating of them if you have the required data), again putting more value in a clear separation.

a general word about discord.js-next : the rewrite is not a sharp picture yet. we notice issues with the current approaches which can not be solved without a major redesign which we consider for the rewrite. we are aware that mangers in their current iteration are not optimal and have expressed that internally as well as externally, howver we do believe that they are better than the v11 approach of having them on the structure they belong to or the (discarded) v12 in-dev approach of mashing cache and api access together (which seems to be what you propose here)

snow crypt
#

would the way to fix this be removing ```yaml
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

ruby terrace
#

This is a very strange and unlikely edge case, but currently if you want to edit a message and change suppress embeds (basically if you are editing in an embed, and suppress was currently enabled) the API gets two calls unless the user knows to add the undocumented flags parameter as an option.
Would it be a good idea to clean this up and add a suppressEmbeds option to MessageEditOptions and completely remove suppresEmbeds since it is just a helper method?

oak quail
#

@ruby terrace I don't think suppressEmbeds should be removed since there are tons of set__ helper methods which do basically wrap edit

copper laurel
#

edit should support the flags though if it doesn't already, I agree with that much

ruby terrace
#

edit does support flags, it just wasn't in the MessageEditOptions typedef, and only suppressEmbeds passed it

ruby terrace
vale moss
wild flax
#

Devils advocate:
If discord ever decides to again, change something in their naming, we don't need people to change it in all their code because discord decided to rename something or whatever (thought further down the line you prolly still want to rename it, so take that with a grain of salt)

#

2nd, people already typo those permissions left and right, ive seen stuff from "SNED_MESSAGE" to "GILD_MEMER"

#

This assures this surely wont happen

vale moss
#

So you dont want users to change anything, but change lib api extremely?

#

However, i think lib should give users choice what to use and how to

merry python
#

2nd, people already typo those permissions left and right, ive seen stuff from "SNED_MESSAGE" to "GILD_MEMER"
this only works in TS where the compiler can actually tell you whether or not you're using a valid value, if you typo Permissions.FLAGS.SNED_MESSAGE in JS it's no better than typoing "SNED_MESSAGE". But it's better than nothing

wild flax
#

JS auto-completion should be good enough to pick this up

#

To at least list you all the possible values

wild flax
vale moss
#

Agree, extremely do

wild flax
#

This isn't just a wrapper after all, its a whole library

#

A wrapper would just expose and let you do all the other stuff, no caching, no nothing at the end of the day

#

We wouldn't then even need the abstraction for events we have, since you could just listen to .on('MESSAGE_CREATE') yourself for example

#

Its a tough choice sometimes

vale moss
#

The Best choice is change nothing

wild flax
#

Thats subjective here

#

Because as much as you say that, I could argue the best choice is to be as restrictive as possible

vale moss
#

Lib must be restrictive from the beginning

wild flax
#

I can also change

#

Thats the purpose of major changes

tender field
#

Hi, why is discord.js not using a transpiler (such as babel)?
It seems the "main" reason to drop support of node 12 is to benefit of the new ES2020 features, but why not just use babel? It will also allow the use of the "import" notation (which I know is only syntactic sugar), and it will not even be, i think, a breaking change, will it ?

frank turret
#

is that really necessary to do that when djs-next is being rewritten in typescript and can be transpiled down to a lower es version?

tender field
#

no ofc, but why wasn't it use from the beginning? (sorry for the english btw)

tender field
#

i mean it's not a problem for me, i'm already on 14.5.1, but i'm just curious πŸ˜…

undone ravine
tender field
#

okay

low minnow
ruby terrace
low minnow
#

Alright, ty

empty viper
#

Does this will come to djs v12 or v-next ?

frank turret
#

I don't see this as being a breaking change, so I don't see why it wouldn't come to v12

empty viper
#

Oh I understand, breaking changes comes into new releases ?

unique axle
frank turret
#

:oops:

#

hadn't realized interactions were v8

unique axle
empty viper
#

Mh I see, I was thinking that you have to change the MAJOR version when there is a big feature that comes

copper laurel
#

Standard reminder that -next is not the next major release either way

wide sand
#

so there is no option for INTERACTION_CREATE

ruby terrace
#

That's actively being developed, please check the pull requests (you can also get the raw event)

wide sand
#

i see

ruby terrace
raven juniper
oak quail
#

@raven juniper client.ws.on works and is public

raven juniper
#

i see nothing about it on the client.ws docs but i'll take your word for it, i don't mess too much with that stuff, i just know it's a pain and people looking for support aren't likely gonna get any because not many people know it

tacit crypt
#

we don't document what events we emit on client.ws for..obv reasons

#

But, any packet that has a t will get emitted

unique axle
snow crypt
#

Is .tern-profect still needed?

kindred haven
#

Should Client#token really be instantiating to process.env.DISCORD_TOKEN if it exists?
The behavior seems really odd

ornate topaz
#

what's wrong with it?

kindred haven
#

Nothing in particular
just wondering why it was added
it seems like it would only be useful for env vars but nothing really else

ornate topaz
#

this way you don't have to "store" token in your code

merry python
#

it's also used by the sharding manager to pass the token to the shards

ornate topaz
#

and considering that there are million other ways to populate process.env than dotenv, you can do it from outside of your bot code or even node

kindred haven
#

ah k

#

makes sense

frank turret
unique axle
#

yes, search GH for PR, if none: make one

frank turret
#

Make one, got it

unique axle
#

haven't done step 1 yet, so that might need to happen before WonkBOYE

frank turret
#

02facepalm there is one nevermind

real jetty
#

is there support for the new /command system?

#

oh thanks

dawn lodge
#

Nico beat me to it πŸ‘€

dawn lodge
frank turret
dawn lodge
#

Oh nice, already a PR

#

I assume this will arrive in v13 as well?

frank turret
#

I don't see why it wouldn't come in v12, it's not a breaking change and the PR doesn't specify whether only the v8 api would have it

quaint bronze
#

I'm not sure but I think it makes more sense to have an event for that maybe GuildMemberAccept it emit when the member accepts the rules so we can do something like sending a welcome message or giving a role

old kelp
#

we cannot really implement something custom if the API does not support natively (which makes it a way unreliable), so that is upto them, then surely.

ruby terrace
wild flax
#

This is correct and it needs API v8 so it’s a v13 only

ornate topaz
#

How does it require v8 though?

oak quail
#

it doesnt

wild flax
#

I have not touched v6 in a long time but gus mentioned the v8 PR in his

#

Do registering commands / the gateway event exist in v6?

ruby terrace
#

oh, we were talking about the guildMember#pending property. As far as v6 for interactions, I've heard they work just fine, but we should be on v8 at that point anyways

wild flax
#

Right. I was looking at the wrong PR then.

#

Either way, very slim chance this will be released in the 12 cycle, as semver:major prs already landed in master

frank turret
unique axle
#

why? should be the question, rather than "why not"

#

it emits guildMemberUpdate, you check #pending on old and new

#

if the end user wants to make that its own event they are free to use the node vent API to emit it, but i don't see any benefit in doing it on the library level

ruby terrace
#

There's also been a lot of push to make that event a native API event, but as long as we get a difference in pending state, then it shouldn't matter, that's an easy check to make.

unique axle
#

and that push is just as nonsensical from discords perspective, it emits an event, that single check should not warrant it being its own event

#
  • nvm, intents have happened, people want to operate without cache
#

ofc, if it becomes its own gateway event it will get its own Client event in discord.js - as it is GUILD_MEMBER_UPDATE currently however at the present time that makes no sense on the library level

ruby terrace
#

I doubt it will become its own event at this point, supposedly we only get the pending parameter (set false) on the GUILD_MEMBER_UPDATE event after someone finishes screening. That should be enough for people without cache too.

old kelp
#

agreeing Souji and ckohen on that, I guess must be fully enough to make a (single) check against the .pending-property (as GUILD_MEMBER_UPATE already emits for that specific change), and except if you're messing with partials.

vivid field
vivid field
#

oops, didn't notice that integration applications have their own part in the docs

#

thanks

hollow salmon
#

Can I ask here if the Collections utility is still maintained or would that be off-topic?

vivid field
#

it is maintained

proper dock
#

I was asking some questions in the Discord Development server, and someone mentioned that if discord.js hits a rate limit, it waits until the limit expires and then tries the call again (#697489244649816084 message). Is that accurate? I feel that when I call a method that might be rate limited, I should be able to pass in options to tell it whether I want it to retry and/or whether I want it to throw an error. At the very least, it would help in debugging. But ideally if the bot can't do something right now, I'd like to be able to act on that. My bot could say something like, channel.send('Sorry! I've been doing that too fast, and I'm not allowed to right now. Please try again later.');

slate nacelle
#

The behavior you are describing is correct.
Something like an option to limit retries that are longer than x or the like have been brought up, but nothing really has been done in that regard so far.

proper dock
#

Oh, interesting. I missed that. So, something like setTopic - I'm limited to 2 every 10 minutes. Does this fire when I've done the second one, or when I attempt the third one?

#

So discord.js will still make that attempt later, right?

#

Is there any way to stop it from re-trying that request?

slate nacelle
#

You would get a debug log there, rate limit only emits when the request is preemptively throttled. (That is indeed a bit weird)

#

No, there is currently no way to cancel a request.

proper dock
#

Are there any ongoing discussions about this topic? I'd be willing to take a stab at something and make a PR, but I'd totally welcome some guidance onto what the best way to handle all of this is.

#

Option 1: A map of known rate limits. We could fire a rateLimitWarning based on a map of known values: If you try that again in the next X seconds, it will be rate limited.
Option 2: Some hook on the current rateLimit event that does the current behavior by default, but the developer can do something with the event to cancel the request if required.
Option 3: Pass options into anything that might get rate limited to tell it what to do.

Out of these 3, it seems Option 2 is best to me. But maybe there are other options I haven't thought of.

slate nacelle
#

I am not aware of any discussions currently (or recently) about that. (I am pretty sure there was something about that, but I can't find anything at the moment.)

1 is a no, since Discord might change limits at any point, and is generally not happy about hard coded limits.
3 is possible, but feels like it could become a hassle since everything is subject to be rate limited.

2 indeed looks like something that could be done, although I'm not too sure how it would work exactly.

Some possible naive solution could be to add a function to the object that, when called, cancels the request (causing the returned promise to reject with some error).

My initial idea was to be able to configure a static limit for rate limits as client options, but that might be a bit too broad, while yours would allow better control about when to (not) wait.

proper dock
#

So - I haven't FULLY read the code yet. Just given it a quick glance. Requests go into a queue, right? If we attached a UID to each request, we could pass back the UID in the rateLimit event. Then we could provide a method to remove an event in the queue by passing in a UID.

slate nacelle
#

They go into a queue, one per route.

proper dock
#

Okay. So if we have a method called something like cancelRequest(route, uid), that might work.

#

Find the queue for the route and in there, find the request with uid...

#

And although a bit confusing given the rateLimitInfo.method there, it might also be interesting to pass back the name of the method that was called. For example, rateLimitInfo.callingMethod: 'channel.setTopic' or something like that.

#

Unless that's information that's in the route already. I'm not familiar with how the routes are named in the API.

#

I guess my only remaining question is - if I tackle something like this, how do I ensure I'm doing it in a way that will be accepted in a PR? I don't want to do the work, and then have someone say, "no, we're not implementing this." That's the only reason for all of this discussion/questions. So what do I need to do/to whom do I need to speak, to make sure that the spec work I'm doing describes work that will be accepted?

slate nacelle
#

Somewhat, I don't think there are too many, if any, not-helper functions sharing the same route.
What public-facing-method caused the request is currently not known to the request handler.

#

That is indeed a good and reasonable question, which I do not really have an answer to jynEHEH

I'd be +1 on this feature, but think it could be troublesome to actually cancel a request that currently waits for a rate limit to expire (as that's just a promisified setTimeout, and polling some cancel flag does not feel too right?).
But I do not really have another idea about how that would work.

proper dock
#

This'll be my last post. Please @ me if you reply so I can check it later. If we put the setTimeouts into an object with that UID I was talking about as the key, then we could do clearTimeout(queue[uid]). Maybe. Anyway, I'm off. Merry Christmas. Thanks for the chat. Is it correct that I'll need to make an Issue describing my spec ideas and wait for a +1 from you and/or someone else to know it will be accepted? any clarification on how I can only do work after knowing it'll be accepted is appreciated πŸ™‚

vernal atlas
#

im refactoring usages of GuildChannel#permissionsFor to handle there being no permissions returned, but in the getters should i just return null here or default to false?

#

null feels like better option but i just want to be sure

loud moat
#

There's a difference between false and "we don't know", right?

vernal atlas
#

yeah

#

i ask also because

#

GuildChannel#viewable just returns false

#

if there are no permissions

#

but all the other getters just error

old kelp
#

why not also take GuildChannel#viewable under consideration to be removed (relative to all other removals for v13)? I think it has been discussed once

#

<#archive-library-discussion message>

I believe what nico is referring to is removing stuff like GuildChannel#viewable, the basic permission checks that the user can very easily implement
agreed there, users must be able to do basic logical checks πŸ€”

real jetty
#

hey uh guys, i heard you guys are removing the like <message>.delete({timeout:500}) functionality in v13, and im a bit confused as to why?

#

i dont see any downsides personally to keeping it, and it really helps keep code clean

#

rather than having a lot of settimeouts which makes code kinda messy

#

if someone has a moment can they please like gimme the reasoning behind this? thanks!

unique axle
#

it should never have existed in the first place.
no other structure has a native delay on delete, why should message have one? this is nothing the API actually supports but just a timeout wrapper, which the dev can do themselves to the same effect through Client#setTimeout

ruby terrace
#

it also forces you to think about how to handle deleting messages after a time (such as checking if it is actually still deletable)

real jetty
#

yeah, personally I understand how like no other wrapper has a native delay for deleting and stuff, but since it's already like there, and it doesn't exactly have any downsides, I'm not getting like why you guys are removing it
(sorry if i seem pushy, im just genuinely kinda confused)

unique axle
vernal atlas
#

if you miss the functionality you can always add it back by extending the structure yourself

real jetty
#

oh, oof, i guess that kinda makes sense, Personally I still feel like the amount of code a lot of devs will have to re-write isnt worth like removing functionality, since theres other options if you dont wanna use it, but I guess that like reasoning kinda makes sense, so thanks!

unique axle
#

we generally are moving forward with removing inconsistent and unnecessary "convenience" methods, since they have and still do cause more pain than they relieve

real jetty
real jetty
unique axle
#

amount of code a lot of devs will have to re-write isnt worth like removing functionality,
this is not a consideration we make for major version updates.
we are moving forward with what's the more consistent, coherent and ultimately hopefully semi-straightforward API

real jetty
#

ohhh kk gotchu, ty!! πŸ‘

carmine socket
#

Hey there. I don't think my question is 100% related to Djs, but I'm wondering how events work. (ex. client.on('event', callback) in d.js). I first thought that the Discord servers were sending a request to the local machine to trigger an event, but it seems very unlikely. How is the message event triggered for example? Is it some kind of infinite loop that keeps asking for updates over HTTP? (please ping to answer)

vivid field
#

updates aren't sent over http, your client opens a websocket connection to the discord gateway where it receives events on client.ws and forwards them to the user

carmine socket
real jetty
#

Could the member who deleted /created a Channel be added to channelDelete and channelCreate? It could be pretty useful to a lot of things.

unique axle
#

we can only provide information discord provides, so that's a "nope"

#

"who" did something is always accessible through audit logs, not the general event that emits when it happens

real jetty
#

Sad that discord does not provide that directly in the event

solemn oyster
real jetty
latent crag
#

Should i pull request directly to the master branch or PR a new one? If creating a new one, how do i name it?

wild flax
#

You should never commit directly to master

#

And whatever seems most logical to you

latent crag
#

Do i name branch using my github nick and PR to djs repo then?

ornate topaz
#

it doesn't really matter. you're going to create a branch on your fork, which would just get merged into one of branches at the upstream (or closed)

grizzled rover
#

Not sure if this is the right channel but what is message.nonce even useful for? I was just reading docs and couldn't really see a use for it other than maybe checking if you already fetched the message?

frank turret
solemn oyster
#

It's something you send that you can use to verify when you get the response back, e.g. if you send a message with nonce foo bar, you'll get a response that will be a message with nonce foo bar.

However, all other clients (and even you when fetching the message) won't get said nonce again. Think of it as an integrity check. @grizzled rover

ruby terrace
#

I guess this got purged on accident:
The current behavior of the USER partial only affects reaction events and typingStart. Since userUpdate is an internally emitted event through GUILD_MEMBER_UPDATE in most instances, it makes me question whether userUpdate should be emitted for an uncached user. Right now it does not, and other Partial types behavior seem to suggest that it would. Does anyone have any insight into whether this was just an oversight or if its intended.
I definitely see how it could be intended since most GUILD_MEMBER_UPDATE events have nothing to do with a user update, and this would always emit userUpdate if the member was uncached, even when only member parameters have changed.

unique axle
#

i'm currently questioning if userUpdate should be tweaked at all, or if it should just be emitted for current user changes, as the API emits it

ruby terrace
#

Yeah, I was highly considering suggesting just to remove the external handles into userUpdate completely

old kelp
#

i'd personally suggest that, i don't think so there is any use to emit it artificially other than convenience, which rather makes it inconsistent and harder to manage on the library level πŸ€”

ruby terrace
#

And to further that point, the event is probably significantly more confusing for users now that at least one of the privileged intents are required to get the event. I think this would go hand in hand with many of the other changes for v13 that aim to emulate the API more directly.

empty viper
#

I have a question, why on GitHub can't we see the versions prior to v5, and where can I find these ?

vernal atlas
#

npm install discord.js@version

#

all versions before v11 are deprecated and probably dont work / are very broken

empty viper
#

I know

#

but just for seeing the code

oak quail
#

why aren't the v11 versions marked as deprecated in npm?

solemn oyster
#

Probably an oversight

#

But yeah, we should eventually mark v11 versions as deprecated, as they'll stop working next year

frank turret
#

Would we prefer having separate prs for removing all the unnecessary getters (like viewable and other dumb permission checks) or is it alright to have one collective pr for the removal of all unnecessary getters
and hearts to @old kelp for the reminder abt this blobReachReverse

undone ravine
#

don't understand why anybody would want to get rid of those

old kelp
unique axle
#

it's not rest, it's not gateway, i thiiiink caching can be interpreted as "methods that don't do any calls outside and don't interact with discord in any way"
could be that my interpretation of that label is wrong tho shibaSmile

#

nvm, it's utility, i'm a doofus

old kelp
#

ah, right, thanks catThumbsUp

frank turret
undone ravine
frank turret
#

Some of them are simple permission checks that the user can do on their own, unneccessary for the lib to provide methods for something they can do on their own imo. It also feels like a bit of pollution

copper laurel
#

This has been a debated topic for a while but people generally lean towards removal, for a cleaner library.

Having said that, I think the checks we're removing should be "ported" over to a guide page - there are other ways to support good practices.

frank turret
#

Agreed. One other thing I'd like to ask, if we have other methods that depend on the getter, should we leave it?

undone ravine
#

I don't think there's any good reason to remove the permission getters, specifically.

#
  1. They add almost no additional overhead to the library in terms of maintenance
  2. The tiny bit of overhead they do add (making sure the permission checks change to match up with Discord's behavioural changes) aids in making the users' lives much easier, ensuring they don't have to go through and make the same updates themselves
  3. They are substantially cleaner for users of the library vs. the alternative
  4. They give a simple, descriptive name for what a bunch of otherwise arbitrary permission checks are accomplishing
  5. They often build upon each other (see GuildMember#manageable -> kickable/bannable)
#

Seems foolish to remove these widely-used getters that aid in producing much cleaner code on the users' end in the pursuit of a "cleaner" library (they're not even messy, inconsistent, or obtrusive in any way that I can think of internally)

#

All you would be accomplishing by removing them is making an extremely common task much less convenient/clean, there's not even a downside to them existing afaik

lofty birch
#

what could perhaps be better is making them more consistent, as the above complains about them not being so

undone ravine
#

Don't think they were called inconsistent. I believe that was directed at the weird message delete timeout functionality that nothing else shared

frank turret
#

In my PR I outline that getters that are used internally (see point 5 of gawds message) wouldn’t be touched

undone ravine
#

Sounds like you'd be introducing more inconsistency by removing the ones that aren't, then

#

Because then you have some convenient permission getters with much smaller coverage vs. them generally being available on everything where relevant

#

In fact, I think these permission-related helpers should be expanded further. Any object -> action relationship should be covered, ideally. Additionally, the comparison should be able to made between any two arbitrary objects, not just with the client user/member (i.e. a GuildMember#canBan(GuildMember) method or GuildMember#canView(GuildChannel))

unique axle
#

just to clarify: you are suggesting we should essentially have a permission getter per flag on the member as well as a getter per overwritable flag per channel type
additionally relationship methods as well as - possibly the reverse GuildMember#canView(GuildChannel) - GuildChannel#canBeViewedBy(GuildMember)

undone ravine
#

the reverse, no, not really

#

and not every flag, just actionable items

undone ravine
copper garden
#

So ur saying we'd add fail-guards for permission errors to methods like TextChannel#send?

undone ravine
#

no

raven juniper
frank turret
#

Thonk should it really be the responsibility of the library to do simple permission checks

undone ravine
#

permission checks are rarely simple

copper garden
#

Why is Role.comparePositions static method still there? I thought the raw position moved to Role#rawPosition?

#

Or at least why is it still using Role#position

ruby terrace
undone ravine
#

Agreed. I think it is absolutely the responsibility of the library to abstract the [often obscure to those not intimately familiar with discord/its API] requirements behind whether you can do something to an object or not

frank turret
#

Hm, then should the PR be reduced to only getters like message#editable?

undone ravine
#

Personally, I don't really see any reason to remove that one. Just because it's much simpler than the others doesn't mean it can't change in the future. Plus, that would only bring inconsistency, IMO

#

That one is kind of unique in that it's not tied directly to a permission currently

ruby terrace
#

I feel like that may be necessary for an edge case that is coming soon (but this particular one puts a lot extra on the library): interaction responses are from the same user id, but aren't guaranteed to be editable. E.g. once the token expires, and those must be edited via webhook, not the same general edit method

frank turret
#

some of them like voicechannel#speakable and the likes are just wrappers for permissionsFor, which would fall under my meaning

ruby terrace
#

I think that wrapper methods like that were the original aim. This becomes a question of whether those actually want to be removed, as that encompasses all of the basic *.edit() wrappers as well. IIRC, that is a desired end goal, but needed further discussion.

oak quail
#

I agree with gawd here, I don't really see a benefit in removing these, it just adds more work for bot devs

#

I do support changing things which would have an actual improvement, like, iirc someone said changing channel/message type to numbers saves a lot of ram? although they were numbers in early v12 dev iirc; that has an improvement and doesn't really have a disadvantage other than having to change code

#

but removing these methods seems to have disadvantages with no advantages other than them just not existing

ruby terrace
#

I support those changes as well, those type from string to numbers changes would also align with the removal of strings for permission flags

solemn oyster
#

Probably before, I want to evaluate the impact the refactor will have to other PRs (merge conflicts mostly)

#

#5022 definitely needs to be merged before I can do that

#

Just pending review from Space

frank turret
#

So then is the decision to keep all the getters including ones like message#editable and voicechannel#speakable?

vernal atlas
#

is the reply-prefix branch gonna be deleted? mmLol its just been sitting there for months lol

snow crypt
#

the native replies are going to replies discord.js's reply, making reply-prefix useless

ebon radish
#

Would it be out of scope for the library to include a few handy regexes, like the elusive invite link regex

snow crypt
#

that specifically you can grab from resolveInviteCode

#

?docs DataResolver.resolveInviteCode()

rich iglooBOT
ebon radish
#

@snow crypt You can apply this to a whole message and get an invite code?

snow crypt
#

yes

#

you can also make that regexp global and match many

#

but that is outside the scope of this channel

dawn lodge
#

Has the library been updated to allow for the "pending" param upon join to support the screening feature?

frank turret
#

There is a pr for it currently, not merged yet

dawn lodge
#

Okay, thanks!

#

I assume there is no ETA on it quite yet?

frank turret
#

no, it's probably gonna be included with the v13 release since there aren't any more planned v12 releases

dawn lodge
#

Will v13 have breaking changes like v12 had?

frank turret
#

Major versions generally do have breaking changes

dawn lodge
#

Well dang..

raven juniper
#

Not nearly as many as v12, though

long mason
#

Why does <Guild>#equals() even exist

#

Along with <User>#equals()

real jetty
#

Another like basically useless method is <MessageEmbed>#addFields() which I doubt anyone uses, which just adds more like clutter to the library

#

nah i think addfields should stay. people do use it and it makes code easier to read (ie you don’t have to have .addField 8 times in a row in your code)

old kelp
real jetty
#

oops i meant normalizefields @real jetty i copypasted the wrong thing

#

i meant to write <MessageEmbed>.normalizeFields(), idk why i wrote the wrong thing haha

#

sry

snow crypt
#

addFields imo is just... meh ```js
// addFields
embed.addFields(
{
name: "Global",
value: ${stats.globalWins} wins; ${stats.globalLosses} losses;,
inline: true,
},
{
name: "Per-country",
value: stats.countries.map((s) => ${s.name}: ${s.wins} wins; ${s.losses} losses;).join("\n"),
inline: true,
}
);
// addField
embed
.addField("Global", ${stats.globalWins} wins; ${stats.globalLosses} losses;, true)
.addField(
"Per-country",
stats.countries.map((s) => ${s.name}: ${s.wins} wins; ${s.losses} losses;).join("\n"),
true
);

wild flax
#

Yeah for composition I prefer the former

copper laurel
real jetty
#

ohhh kk gotchu , ty!!

lofty beacon
#

If they are statically used internally, in es2021 are they going to be private methods?

unique axle
# snow crypt `addFields` imo is just... meh ```js // addFields embed.addFields( { name:...

The initial idea was to only have #addFields since it's much more verbose, doesn't bear the danger of providing arguments in the wrong order (which has often occurred in support) and takes a variable amount of arguments (field objects) which allows workflows like spreading or providing arrays of data objects.
However due to "feedback" from the community (read as: help channels being full of people calling the person applying the change (me) idiot, the library staff dumb and being very verbose about how much they hate the change) the method was re-introduced shortly after removal, after some proficient+ also expressed doubts in that approach. I might re-visit that thought in -next though, since a full on rewrite allows for structural changes like these to be perceived much less emotionally than in an already existing API.

snow crypt
#

Good point about the spreading, didn't think about that

#

Yet I still believe addField is better for stuff like my example

unique axle
#

i don't but that's besides the point and nothing to be discussed here

unique axle
tacit crypt
#

Kinda hard to male them hard privates and then use them externally actually..

lofty beacon
#

What? NormalizeFields is being used inside the MessageEmbed class, right?

#

If it's being used else where, then it can't be private

unique axle
#

do we use that anywhere else potatodetective
no we don't

old kelp
#

do we use TextBasedChannel as a typedef?

tired valve
tacit crypt
#

If it gets set in .ws then it's fine..if it isn't then it's a problem

tired valve
#

it doesn't hence when you run the pr it throws 4013 invalid intents

vernal atlas
#

resolved

junior pumice
#

who are the libary devs