#djs-in-dev-version
1 messages · Page 3 of 1
Basically everyone in this channel right now
I have been tryingI have been trying why is this not working?
it doesnt i.reply and logs undeifined
There may be a collector bug, we're looking into it
okay
Using a dev release means you take the risk that things may be broken or require additional changes
ye i get it
By no means it is guaranteed to even be working code
It usually will be because we know what we're doing, but small things slip through
Ye i see
If we find and fix a bug it'll be in the next nightly dev release
ah okay
Your exact code works for me
wow what can u send it in dms
This sentence confuses me. You've already written it
Can you send that works for you? since i might of made a very small bug
Uhh I'm confused proof that it works won't change anything
why is it not working for me?
I wouldn't know
hmm how does it work for you??!
I guess nuke node_modules and reinstall stuff and see what happens
Huzzah
how do i get what role a user selected?
interaction.roles
thanks
i think
well, is it a RoleSelectMenuInteraction?
i.roles probably
thats what i did
No it isnt
okay
That is not the same thing at all
then..?
nevermind 
i.roles does a array with object map.
it is a Collection, which extends Map, yes
ah
so how do i do it
so it shows the one they pick
what one
i wnat it to say the role id and name
i guess the last one, joined into a string then
This is really getting into Javascript basics now. These are just Map methods
Array.from(collection);
?
I made it log but if i do ${i.roles.name} | ${i.roles.id} it says undefined for both
Collections do not have a name or an id
hmm how do i get these then
it's a role name?
so not collection's but role name
k,
so interaction.roles.first() will be your role
Like monbrey already told you
ah
or just use interaction.values to get id with my pr 
hm

right before u said it's a collection
thats definitely not a Discord API error
you made it say so
Its a error handler
i.roles is a Collection, which is extends Map, why are creating an array (unused; twice), then you're creating a map out of the collection (??)
..
I got told to map it??
Im comfused as on what to do..
Collection#map()
Maps each item to another value into an array. Identical in behavior to Array.map().
Hello, will it be possible in the future to add select-menus menus in a modal ?
we can only implement features discord has
ask discord
there was a brief period in which it was accessible on desktop clients, but has been removed because feature parity with mobile clients was not in sight - i reckon eventually we will see them as 1-per-row components
Hope they add it
Ok thx you !
why role menu only has 15 roles? How can I view all the roles in the menu?
Thats a question for Discord, not us
oh, I thought okay
What does dev have that the regular package doesn't have
At the moment, the new select menus
You mean these? They're ancient
Oh understood thanks
Oof.. I suppose I'll add an auto complete work around for roles/channels until they get added.. Just went through the work upgrading to v14 only to find out they don't have it yet..
I would imagine it's only a few days out seeing as it was released nearly a month ago?!.
Do you mean new select menus? Or use role and channel options.
New select menus.
They are already in the dev version. Check out the pins.
depending on your use case, that might even be the better option - there is currently no way to limit these selects to a subset of channels/users/roles which quite honestly makes it absolutely useless for anything i can think of apart from config setups - and then you can also just use a command for it.
even for config stuff you cant specify default values :<
makes it annoying
okay, so then i can't think of any use case 
is there any documentation on the new select menus? or take it from the source code
RoleSelectMenuBuilder
Class used to build select menu components to be sent through the API
we don't seem to be building docs for the main library for dev builds anymore
so you're probs gonna have to work w/ typings mostly
and source code
Should new select be in v13?
probably
ehh can i just leave old classes
just with new properties lol
like MesageSelectMenu().setType("ROLE_SELECT")
also hmm how to leave SELECT_MENU type the same
but add STRING_SELECT
This is a support channel.
#992669226403909652
/home/rias/Documents/Base (copy)/node_modules/discord.js/src/structures/ChannelSelectMenuBuilder.js:10
class ChannelSelectMenuBuilder extends BuildersChannelSelectMenu {
^
TypeError: Class extends value undefined is not a constructor or null
at Object.<anonymous> (/home/rias/Documents/Base (copy)/node_modules/discord.js/src/structures/ChannelSelectMenuBuilder.js:10:40)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Module.require (node:internal/modules/cjs/loader:1061:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (/home/rias/Documents/Base (copy)/node_modules/discord.js/src/util/Components.js:140:34)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
Node.js v18.12.0
read the pin
import { Client } from 'discord.js';
const client = new Client({
intents: 0,
ws: {
properties: {
browser: 'Discord iOS',
},
},
});
it doesnt work
unlucky
{
"devDependencies": {
"@types/node": "^18.11.9",
"typescript": "^4.8.4"
},
"dependencies": {
"discord.js": "^14.6.1-dev.1667563454-68c9cb3.0"
},
"overrides": {
"@discordjs/builders": "1.4.0-dev.1667347887-5152abf.0"
}
}
is this right?
Yeah, did you then run npm install or whichever package manager to install that version?
npm [2;30m[2;41mWARN[0m[2;30m[0m [2;35mdeprecated[0m [2;37m@discordjs/builders@1.4.0-dev.1667347887-5152abf.0: This version has been automatically deprecated by @favware/npm-deprecate. Please use a newer version.[0m
is this fine?
like how long does it have til EoL
yup
all the dev versions are deprecated after a new one is published
gotcha
Hello
sorry
Hello !
I have this error "TypeError: Class extends value undefined is not a constructor or null", i checking the pin and try it and method not work...
ehh look at pins
"i checking the pin and try it and method not work..."
have u used npm i after it?
Yes
then #djs-help-v14
oh crap wrong channel, never noticed sorry
so it should work
.
yeah you dont have builders dev installed, so possibly the resolution hasnt been properly applied?
Ok, how can I install the right version ?
npm i should have done it though
I feel like it doesn't change anything... https://media.techdev-os.fr/1n96qm.png
Or am I doing it wrong ?
What if you delete node_modules and install again clean
i have no idea
Probably unrelated @cloud swift but you don't need /rest installed. discord.js ships with it
same with fs, that's a default node module
ok ty
How do you copy the ansi from terminal or vscode?
read pins
I just recreated the ansi.
In case that client is muted
should VoiceChannel#speakable be false? bc now it doenst check that
No, because that’s a property of the VoiceState, not the channel
not sure the best place to ask this, but how is the release schedule determined? I would assume that for a major version it has a roadmap and expectations should just be "when it it's ready." and patch versions are on an as-needed basis. but how are minor versions determined "release ready?" are there roadmaps for minor versions or schedules for release of any sort?
curious how the team here is currently managing such a large project release schedule and what lessons can be learned.
No specific schedules for anything, we follow semantic versioning as you indicated
Something like the new types of select menus will likely be a minor, as they're a new feature (dont belong in a patch) but were implemented in a non-breaking way (doesn't require a major)
So minors are very much also "when its ready"
It can vary, although we do make our own improvements and changes and stuff, the release of features is really based on what Discord does, since we're just an API wrapper
Although we follow good software development principles we still have a dependency on the releases of other software to define what our features are
We're just following along
right, that makes sense. although with Discord releasing multiple things at once, do you take the approach of needing to be in lock step with what all goes in the next update, or you can break it up into multiple releases?
If we know in advance that Discord is releasing a few things close together we might cluster them
ah, thanks
The opposite is also true though, we might have something almost ready to go and then Discord drops something else new
So we might split, or we might decide to wait and cluster
It really does vary
Mostly Crawl has final say, but space, kyra and vlad are the other maintainers
And generally all the contributors discuss it
is this help for v15 beta?
while v15 doesn't really exist yet, this is channel for dev releases that will eventually get released as stable versions
dos any one know why i get this error on vs?:
"resource": "hehe.ts",
"owner": "typescript",
"code": "2769",
"severity": 8,
"message": "No overload matches this call.\n Overload 1 of 6, '(content: APIMessageContentResolvable | (MessageOptions & { split?: false | undefined; }) | MessageAdditions): Promise<...>', gave the following error.\n Argument of type '{ embeds: object[]; }' is not assignable to parameter of type 'APIMessageContentResolvable | (MessageOptions & { split?: false | undefined; }) | MessageAdditions'.\n Object literal may only specify known properties, and 'embeds' does not exist in type 'MessageEmbed | readonly any[] | (MessageOptions & { split?: false | undefined; }) | MessageAttachment | (MessageEmbed | MessageAttachment)[]'.\n Overload 2 of 6, '(options: MessageOptions & { split: true | SplitOptions; }): Promise<Message[]>', gave the following error.\n Argument of type '{ embeds: object[]; }' is not assignable to parameter of type 'MessageOptions & { split: true | SplitOptions; }'.\n Object literal may only specify known properties, but 'embeds' does not exist in type 'MessageOptions & { split: true | SplitOptions; }'. Did you mean to write 'embed'?\n Overload 3 of 6, '(options: MessageOptions | APIMessage): Promise<Message | Message[]>', gave the following error.\n Argument of type '{ embeds: object[]; }' is not assignable to parameter of type 'MessageOptions | APIMessage'.\n Object literal may only specify known properties, and 'embeds' does not exist in type 'MessageOptions | APIMessage'.",
"source": "ts",
"startLineNumber": 22,
"startColumn": 47,
"endLineNumber": 22,
"endColumn": 71
}]```
the line is: ```ts
const msg = (await message.channel.send({ embeds: [embed] }));```
version: 14.7.0-dev.1667822677-ff85481.0
(also its in typescript)
This looks like v12 error 🤔
Can you restart ts-server and check again?
do i just close and open vs code?
yep that fix that thx
yea another error 💀
^
TypeError: Class extends value undefined is not a constructor or null
at Object.<anonymous> (path\node_modules\discord.js\src\structures\ChannelSelectMenuBuilder.js:10:40)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (path\node_modules\discord.js\src\util\Components.js:140:34)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)```
Read pins
yea ok
Commando is long dead
Mind elaborating im very tired
it hasn't been relevant or maintained for a long time
It hasn't And I kinda need it now.. /;
Sapphire is a newer and currently-maintained framework: https://www.sapphirejs.dev/
Sheesh ima have to re code the whole shit aint i.
No matter what you choose, you're probably not using discord.js@dev, so you're in the wrong channel for guidance on that front
What is this framework? Is this parts of discord.js module?
hhi
does any one know why im getting:
[antiCrash] :: Multiple Resolves
resolve Promise {
{
code: 50035,
errors: { embeds: [Object] },
message: 'Invalid Form Body'
}
} undefined
[antiCrash] :: Unhandled Rejection/Catch
DiscordAPIError[50035]: Invalid Form Body
embeds[0].timestamp[DATE_TIME_TYPE_PARSE]: Could not parse 1667922859626. Should be ISO8601.
``` error?
im useing this:
const time = Date.now();
embed = {
"title": `Minecraft server status`,
"color": 0x00ff11,
"timestamp": time
}; // shorted version of the json
message.edit({ embeds: [embed] });
- #djs-help-v14
- Change
Date.now()tonew Date()
Hmm then idk
Date.prototype.toISOString()
The toISOString() method returns a string in simplified extended ISO format (ISO 8601), which is always 24 or 27 characters long (YYYY-MM-DDTHH:mm:ss.sssZ or ±YYYYYY-MM-DDTHH:mm:ss.sssZ, respectively). The timezone is always zero UTC offset, as denoted by the suffix Z.
ohh thanx its working now :))
I don't hate DiscordJS it's just pesky to write.
const { Command } = require("@src/structures");
const { Message, CommandInteraction } = reuire("discord.js")
const { banTarget } = require("@utils/modUtils")
const { resolveMember } = require("@utils/guiltUtils")
module.exports = class BanCommand extends Command {
constructor(client) {
super(client, {
name: "ban",
description: "ban a specified member",
category: "MODERATION",
botPermissions: ["BAN_MEMBERS"],
userPermissions: ["BAN_MEMBERS"],
command: {
enabled: true;
usage: "<ID|@member> [reason]",
minArgsCount: 1,
},
slashCommand: {
enabled: true,
options: [
{
name: "user",
description: "the target member",
type: "USER",
required: true,
},
{
name: "reason",
description: "reason for action",
type: "STRING",
required: false,
},
],
},
});
}
/**
* @param {Message} message
* @param {string[]} args
*/
async messageRun(message, args) {
const target = await resolveMember(message, args[0], true);
if (!target) return message.reply(`No user found matching ${args[0]}`);
const reason = message.content.split(args[0][1]).trim();
const response = await ban(message.member, target, reason);
await message.reply(response);
}
/**
* @param {CommandInteraction} interaction
*/
async interactionRun(interaction) {
const user = interaction.options.getUser("user");
const reason = interaction.options.getString("reason");
const target = interaction.guild.members.fetch(user.id);
const response = await ban(interaction.member, target, reason);
await interaction.followUp(response);
}
};
async function ban(issuer, target, reason) {
const reason = await banTarget(issuer, target, reason);
if (typeof response === "boolen") return `${target.user.tag} is banned!`;
if (response === "BOT_PERM") return `I do not have the propper permission to execute that action!`;
else if (response === "MEMBER_PERM") return `You do not have permission to execute that action!`;
else return `Failed to ban ${target.user.tag}.`;
}
Okay?
yo why is the dev team releasing 2 versions of djs?
like what's the difference between 13.2 and 14.6.0
Do you mean why are we still maintaining v13?
Not everyone has upgraded yet, so where features can be backported we continue to do so
If you're starting new always go for latest
I dunno I updated to djs 13.2 on my server lol and I see there is 14.6
like, can I go to 14.6? what's it gonna change?
check topic of #djs-help-v14
Jumping between major versions will require you to update your code
ah thanks 👍
is there a proper channel for asking questions about any prs?
You could ask here, I suppose
Maybe first I'll ask if there is a pr guide of some sort or how to contribute md for discord js
found it nvm lol
? its formatted correctly I personally prefer it then any other packages
How can I use the new selects?
Hey @tropic raven, regarding your comment on https://github.com/discordjs/discord.js/pull/7938#discussion_r1020831026... are you sure it's safe to pass a regular expression here? Are regular expressions in Rust not different to that in JavaScript? Would syntax highlighting not work since it's, you know, not Rust?
I'll respond to the review
Sorry, I have everything in this server muted except #archive-offtopic because I don't usually contribute to discord.js. I responded via GitHub.
I ran some tests myself and there are some similarities between Rust's regular expressions and JavaScript's, but they are not identical. A warning in the JS documentation that it will not be run by a JavaScript regex engine might be helpful. (Alternatively, the user should use another library that converts JS Regex expressions to Rust-flavored expressions anyways).
how do i use encodeURIcomponent()
not djs?
what
your question is not related to discord.js, which this server is for, exclusively
Is it possible to add a button in the user's message?
no
how do i solve this?
See pins
can you be more specific? what exactly am i looking at?
Latest pin
You need to see the latest pin. Add that to your package.json
ah alright
i added it, but i'm still getting the error
Did you reinstall the dev version?
i installed it after putting the override in my package.json
was i to delete it and reinstall?
Delete what?
the dev version
Yeah try it
ah, how do i delete it? i'm terribly sorry for asking all of these questions
npm uninstall discord.js
okay
yeah, i uninstalled and reinstalled it, and it didn't work
what did you put in your package.json?
"overrides": {
"@discordjs/builders": "1.4.0-dev.1667347887-5152abf.0"
}
Try deleting your node_modules folder and trying again
okay
npm uninstall node_modules?
just delete the folder
Right click -> delete
alright i deleted the folder and ran npm i discord.js@dev and the error still persists
@uncut kelp
Did you... save your package.json
so this has been happening
What's in your package.json?
discord-api-types and @discordjs/builders shouldn't be in your dependencies
Nowhere. Remove them
gotcha
discord.js exports those two packages already
ah, i see
Should Role#editable be false for the built-in @everyone role? You can't edit it since the Modify Guild Role endpoint always throws with "Unknown Role" if you try.
alright, i removed them, but the problem is still there
i'm gonna try deleting node_modules and reinstalling again
Well... it is possible to edit the permissions 🤔
I can't reproduce that
Yup
ah yes permissions
oh wait i said the wrong endpoint
i was thinking of the Add Guild Member Role endpoint 🤦
@uncut kelp seems to be working! thank you and @jaunty vault so much for your help
@scarlet tangle 👆
does anyone know if Its normal for me to refresh & reload my bot slash commands using node deploy-commands.js everytime when my bot is invited to new servers? i invited it to a new server and it didn't show my slash commands until I did node deploy-commands.js
if you deploy them to a specific server that is expected
if you deploy them globally (which you should, once you are done testing) that should not be the case and might instead be resolved by reloading the viewing discord client
I did deploy the slash commands globally or at least Im pretty sure I did, ill try kicking the bot and re inviting it and seeing if the slash commands shpw up if not ill reload my discord client if it still doesnt show up then I must of not pushed them globally correct but Im pretty sure I did
okay yeah it ended up being my discord client. Cause I made a new discord server and invited the bot and the slash command came up right away, I also kicked it from a current server and re invited and the command shows up.
Have you reinstalled modules after applying the override?
node modules?
Yes
yes
I have but same err
Delete the NODE_MODULES Folder first
This worked for me
When is djs 14.7 coming?
When its ready
Of course. Would be nice to know rough or estimated timeline like if it would be released by November end or mid December or before/after Christmas holidays etc. We have our community bot working with 13.11, we would start upgrading the code to support 14.x . Thanks.
No ETA
Oh okay. Well, thanks anyway, hope it comes soon.
I mean you can do that upgrade regardless. 14.7 will only deliver new, non-breaking things. Any switch from 13 will require the same effort
I hope that https://github.com/discordjs/discord.js/pull/8759 will be resolved soon. It's really frustrating that I have to restart my bot every few hours because it silently turns off
Did you check if using the PRs code does in fact fix your problem?
how would i go about testing that?
i can't just download the package from npm so there has to be another way
git Checkout that PR
git checkout gives me access to the branch, but it doesn't add it to the node_modules folder of a project
Build the package locally and then link to that in your package.json
hmm, i'd have to do that on my server though, not my personal computer
a lot of work for testing, but i'll see if i get around to it
I was just asking because pushing for it to be released without knowing if it even fixes the issue is strange
well it's part of the milestone, all i'm saying is that (edit: i hope) a PR that fixes the issue will come with 14.7
How can you be sure if you didn’t check if it really fixes your issue?
i can't be sure, i'm saying i hope that a PR will fix the issue with the next update
because i want the issue to be fixed. if this one doesn't fix it i hope another one gets made that fixes it
i missed a "i hope" here. sorry for the confusion
Well, the thing is: if you don‘t test if it fixes it nobody will know it doesn’t fix it before 14.7 gets released…
So no other PR will be made if everyone assumes it fixes it
true
i will try to get everything working to test it. im sick atm so everything seems like a lot of work haha
first time i got sick in 3 years but as a consequence ive been bed ridden for 2 weeks already
@steel haven so how exactly do I link to that locally built package now? do i need to run that yarn build-package command? even so, how do i link to it in my package.json?
is npm link what i need to do?
Yes
the problem is that now, importing from discord.js doesn't work anymore, and using the name of the package which is @discordjs/discord.js just shows the same error
i figured it out, its @discordjs/discord.js/packages/discord.js
I’m actually instructions for this in a PR: https://github.com/discordjs/discord.js/pull/8802

link to dev guide?
no such thing
if you want to use dev you should know what you are doing
the main guide (v14) is still applicable, but there might be (currently non-breaking) additions that have no guide
How should ComponentType.MentionableSelect work?
because the selectmenu is crossed out
the one you want to use isn't, though?
you supply the respective type and other options
@dawn phoenix like this?
Why don't you check the documentation too
no it doesn't support options
where are the docs for ChannelSelectMenuBuilders?
at main docs
they dont exist tho
they don't exist
^
that's for the guide
ohh
ok
tyy
#1336 in discordjs/guide by monbrey created <t:1667438127:R> (review required)
feat: Components rewrite
^ pr with new selects for guide btw
im getting TypeError: Class extends value undefined is not a constructor or null when running pnpm dev with discord.js@14.7.0-dev.1668686657-ff85481.0
read the pins
i tried that
have u ran npm i
im using pnpm but i used pnpm i, yes
maybe delete node_modules then install
still broken
@knotty plover think you can help?
no
oh
is there a way to view collectors that are currently being listened to
no but probably u can see listeners which it could use
So far an uptime of 16 hours. My main bot did go offline again in this time.
I‘m going to let it run for the rest of the day and maybe tomorrow. If it doesn‘t go offline, I will conclude that the problem is fixed
It has now been online for 24 hours without issues
<@&839912195994812420> yuu is offline
I'm very very certain the bug is fixed with that PR, the bot has been online for 44 hours now, and my main bot has been going offline several times in that timeframe
I am going to shut this down now after 54 hours of continuous uptime and conclude that the bug will be fixed with that PR
has nobody else experienced this issue???
https://github.com/discordjs/discord.js/issues/8850
(and yes I've reinstalled)
See pins
which part? the reinstalling part? the part stating it may have issues?
oh the overrides part? alright got it
is there a reason the dev build doesn't account for that?
yes
hmm alright that is a bit annoying to say the least, wish there was an easy way around that... (not that overrides isn't easy but something so the end user doesn't have to do that)
you do be using a dev build
Yeah, end users of the stable releases, which is almost all of the users, don't have to do that
I think there should at least be some documentation on it
or at least a better pinned message, it doesn't explain anything in the top one
again, you are using a dev build. You can't expect stable end user documentation on that
Apologies if this has been asked already, but is there an ETA on the new select menus in the dev version?
do you mean when they'll hit the dev version? they're already there.
if you mean when they'll get a stable release, dunno. we don't give ETAs for those
it will be whenever we release a minor - 
no I know just so you don't keep getting asked about similar issues :)
Is there a list of features/changes coming in v15 yet?
who knows
Well, that's what I'm asking 😄
you can have a look at the semver:major labels and blocked on github for requests that can't be merged yet, no guarantee that those are actually coming (any much less any time soon)
whats semver
semantic versioning
ok
Cheers!
there is a general desire to rewrite to typescript and use subpackages to achieve that, rather than the heavily monolithic structure the current iteration of the library has - but that is not tagged to a version milestone and more relevant to developers and contributors than most users, that will still just use the combined NPM release in js
Isn't lib TS already?
All subpackages are TS, main lib isn’t yet
on djs14.6.1 getting this error:
class ChannelSelectMenuBuilder extends BuildersChannelSelectMenu {
^
TypeError: Class extends value undefined is not a constructor or null
at Object.<anonymous> (C:\Users\---\OneDrive - Cheshire College South & West\Desktop\HypeMonitor\node_modules\discord.js\src\structures\ChannelSelectMenuBuilder.js:10:40)
at Module._compile (node:internal/modules/cjs/loader:1205:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1259:10)
at Module.load (node:internal/modules/cjs/loader:1068:32)
at Module._load (node:internal/modules/cjs/loader:909:12)
at Module.require (node:internal/modules/cjs/loader:1092:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (C:\Users\---\OneDrive - Cheshire College South & West\Desktop\HypeMonitor\node_modules\discord.js\src\util\Components.js:140:34)
at Module._compile (node:internal/modules/cjs/loader:1205:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1259:10)
Node.js v19.1.0
However, no where in my code am I using select menus, so why is it being encountered?
Read the channel pins
What is the most stable dev version for just the Selectmenu types?
god knows
damn ok I'll use client.ws.on then but it'll be confusing
hi guys, need help with giving roles to users on message reactions...
i have created a bot using discordjs
and i am listening to. events called messageReactions
but this event gives only 2 paramaters - reaction , user
i am able to listen to users reacting on the bots message
i want to know how we can give roles, i have read the docs, we need interaction as a parameter in the event
but interaction is not present in this event
psst, this isn't channel for regular support
oops sorry.
Read the channels pins
no changes
Also don’t install /builders and /collection seperately like that, they get re-exported by djs
I'm using collection for CacheManager
Okay? Doesn’t change the fact that you can import it from discord.js directly
:|
Did you npm i after adding the override?
worked
?
english..?
Sorry, I'll be careful.
This is not a support channel
This is not even discord.js related, so you should ask in #869652447881207858 or #useful-servers
Ah, thanks!
TypeError: Class extends value undefined is not a constructor or null
Read the pins
yes ive read the pins, i deleted my node modules, used npm i but im still getting the error
what's in your package.json
for discord.js?
wait nvm
oh
really strange
maybe the vps doesn't support overrides or something
nah it does
ok uhhh turns out it was my node version
Hey can I please get help on this
Read the pins
Also don’t install /builders and /rest seperately but use the re-exported stuff from discord.js directly
that resolved it thanks buddy
thanks for the suggestion will fix it
why in the world custom selects taking so long to release
Each times someone asks, Crawl adds 10 days to the release date
This is not a support channel
#djs-help-v14 #archive-djs-help-v13 #986520997006032896 #869652447881207858
My bad.
wondering the same thing ooop i guess thats an extra 10 days
ah shit
Installing discord.js without any other changes causes type errors because of discord-api-types not being pinned and not supporting new select menu interaction types
adding
"overrides": {
"discord-api-types": "0.37.14"
}
before installing d.js works
but a release either pinning dapi-types or including new selects should be released ASAP
`PS C:\Users\gamin\AndroidStudioProjects\dashboard> import os
import : The term 'import' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
At line:1 char:1
- import os`
need help!!!
show your code
This has nothing to do with discord.js though
not djs? try another server
What is </command:0> and what can you do with it raw: </command:0>
its just command mention?
Yeah, you can mention a command so that when it is clicked it gets automatically filled into the chat bar. If the id is a correct command id or there aren't others command with the same name, you automatically get options for that command
mans just mentioned a command
what is the ratelimit for message editing?
yup
With the dev version, it's possible
It will be released in stable soon
okeww
its dev channel so what more u want
are collectors fixed?
they were broken?
Yes last time I tried In dev version they said they will look into it
So, Is it fixed now?
i dont see any recent issues on github reporting that collectors were broken
Alr
Read the pins
ok
says nothing about my issue
The last pin
You‘ve been at this exact point before. Just do what you did last time you were in this channel
Wait what did you say I cant have? @discordjs/rest or discord-api-types
Both…
what do i require instead then..
discord.js
and did you reinstall djs
Ahh tahts the step i forgot, Why do you need to reinstall tho?
cause if you don't reinstall... then nothing is changed...
aj
ah* fixed thanks#
What is the Role Select collector?
It’s still a MessageComponent
Sorry, I need to be more specific. I meant componentType but found it now.
Documentation suggestion for @feral island:
RoleSelectMenuInteraction#roles
Collection of the selected roles
thanks
is the override only working on a certain node version+ ?
hmm
a new version has been released but the critical bug that makes my bot silently turn off is not in it yet 😔
Does v14.7.0 still require the overwrite from the pins?
no
Okay 👌
Hopefully this will be fixed soon, I really don't want to open a terminal and restart my bot every few hours
Yeah it will make it into dev soon
I just don't want it in a new release while its still potentially unstable
Do I need to boost the server in order to get d.js blue 🙃
Like what we do and want to put some money behind it? Donate to discord.js and rep your support with a role on our support server:
• OpenCollective: Use </claim-sponsor:1046604458991300619> and provide your OC slug (Settings > Info > URL slug)
• GitHub Sponsors:
1) Create a private gist
2) Include your Discord tag (d.js docs#1083) or user ID (348607796335607817)
3) Include your Transaction id or screenshot of the donation
4) Send the link to the gist to @woven grove (Crawl#0002) via direct message
hmm
What's the problem?
|| means or
ik
?? means nullish coallesce
&& means and so its good
fair enough, just so you know i did test it and it worked fine for me :)
so my logic is dead
lol ok ty
Yooo we can delete ephemeral messages now. Very cool
useless
let's keep this channel to in-dev versions and move the release excitement to #archive-offtopic , please
Got it. Sorry D:
nulliwho
Nullish coalescing operator (??)
The nullish coalescing (??) operator is a logical operator that returns its right-hand side operand when its left-hand side operand is null or undefined, and otherwise returns its left-hand side operand.
i mean
makes sense
weird name tho
has the removal of ephemeral messages been added to the new version of djs?
Yes, also #djs-help-v14
When is the update for v13 that contains the new active dev badge?!
When it's ready
is there evan pr including that?
No iirc
Not a dependency of v14? That would be a breaking change I think. v15 must be will use it.
I thought you were about @discordjs/ws
Because we use ws
usually @types dependencies go in devDependencies but @types/ws is in dependencies
Because its types are a part of the public API, it needs to be a regular dep
Check TS docs on it
if you use types that aren't exposed publicly they can be dev deps
ahhh that makes sense
ok thanks
i don't usually maintain packages meant for consumption, i just consume them 😛
yeah, initially it was there, which was forcing everyone to install it on their own the moment they wanted to use discord.js
will v15 be out by april 2023?
We can’t say for sure at this time
alright
Why April
why not?
I just dont know where theyd get the date april 2023 from
Isn’t that when dapi v6 gets decommissioned?
well i have a bot that is currently in v13 so i thought i would upgrade it to v14 after my exams but then i thought ima just ask if v15 will be ready by april cuz my exams end in april.
did they push the date that far back? I thought start of 2023 was the deadline...
Early 2023 with blackout periods increasing in frequency over a period of 3 months which results in the API version being totally unavailable
https://github.com/discord/discord-api-docs/discussions/4657
Ugh, and I thought the blackout phase already started…😞
sigh
nice name
balls
well what is this channel used for
discord.js v15 has not even come out yet
As the channel name implies, this is the for dev version
but which dev version
there is only one dev version
so THE dev version
the dev version is whatever currently is pushed to the main branch
djs 14.7.0
That’s the current stable version… not the main branch
14.7.1 actually stable
there's no ETA yet
I'm really sick and tired of the really critical bug of the client silently disconnecting not being fixed yet. My bot is being removed from servers and people are deleting their accounts, and my hands are tied.
I already tested the PR and it worked fine, but it still wasn't added to v14.7
Is there any hotfix I can apply or anything I can do to stop my bot from going offline, me having to manually restart several times a day, calm down annoyed bot users and do damage control for over a month now??
ain't v15 TypeSript rewrite?
Maybe something that I can use to detect when the bot isn't connected anymore so I can kill the process?
you can run your with the pr branch
Like something that I could check on a 2 minute interval?
the branch is out of date now that v14.7 came out so i'd have to roll back code
since i updated everything to v14.7 which was a hassle considering all the breaking typing changes
the typescript rewrite still has no version number, it never had one, and it will likely not get one before it's done
that’s okay, im just wondering about a hotfix for this really big bug. is there some way to check on an interval whether i am still connected?
that's what websocket heartbeats are for
so how do i check that
i guess if the last heartbeat is older than 2 minutes it'd be down
but idk how to check the last heartbeat
actually, i have an idea as to how to hack it
Hello, is there a rate limit for the deletion of channels because my bot can no longer delete channels...
there probably is, like for everything.
this isn't really related to the dev build of discord.js, or even discord.js as a whole though
npm ERR! code ETARGET
npm ERR! notarget No matching version found for @discordjs/formatters@^0.1.0.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
``` This seems to be coming up when installing the main branch
and the versions in the @discordjs/formatters are these https://www.npmjs.com/package/@discordjs/formatters/v/0.1.1-dev.1670026137-a0d6bc4.0?activeTab=versions
I brought this up the other day, think @forest elm tried to do something to help fix it :eyes:
there's no formatters release yet on npm (aside from dev), you can override the dep to use the dev version or wait till it gets published
That's what I suspected too :o I think the same thing happened with the new select menus too
almost the same, the monorepo uses ^workspace for versions so the published versions have whatever the current version in the packet's package.json is (so no dev version and/or unpublished versions)
Not very familiar with Yarn - would it work to change ^workspace to dev? (The prepublish script would probably need to temporarily change that back)
try again, should work now
yep does
i did find a work around with yarn
What are formatters?
From my understanding, it is some of the things in builders moved into a seperate package that has a more appropriate name: eg userMention and time (formating date info a Discord date mention)
Ye, it was the only thing that I can think of that it can be used for
Did your ws issues get solved by the recently merged PR in dev version?
not sure, as i am not using the dev version for my stable bot, so i am still waiting for a new stable release where this bug is fixed :)
Well, it’s hard to determine if the bug gets fixed by it if nobody who had the bug tries it, that‘s why I asked (to know if it needs other stuff to work before it makes it into stable and you need to wait for yet another release for your bug to actually get fixed)
good point. i actually just got done with a PR, so i would have time to implement this.
is the process for using the current dev version the same as the process that i went through last time?
or is there some sort of official npm version for a dev release
There is, check this channel‘s topic
ah yeah i was thinking that there was something like this :)
okay, let me make a branch for this real quick so i can deal with all the typings changes that probably happened lol
Alright, the bot is now running on the hotfix branch. let's see if it goes offline.
@steel haven The bot went offline with this.
Uh-oh
happened again right away after restarting
I will switch back to my stable branch for now
@jovial cypress that should be fixed next release cycle (see the channel topic)
cool! thats in…. 10 hours if im not mistaken
does it only get rid of that error message or also of the bot going offline?
To be determined :o
Blame me if not
haha
Should the guide be changed to reflect the separation: https://discordjs.guide/popular-topics/builders.html (by saying that there is @discordjs/builders and @discordjs/formatters)
Yeah
Now trying out the dev branch again
It seems to just not receive any responses to heartbeats, so it always closes
ok now it works. still weird that immediately at restart, it just didn't wanna receive any heartbeats
no further problems for now, i'll see if the bot stays online or not
could you show a bit more context above? seems like shards were connecting while at the same time the websocket was waiting to be closed, which sounds weird (and probably the reason for the issue)
i will once im home. happened again rn btw
@steel haven is this enough info?
Probably. I'm gonna investigate and try to track this down
Is the PR you opened 30 minutes ago your new attempt at fixing it? :)
If so, can you ping me when it has been merged so I can update my hotfix at the next dev release?
Of course it is😉 and will do
Hope this one fixes it at last 🤞
Qjuh the god 🙏
The discussion of the dev version (nightly builds). It will be discussion for v15 too once that’s on the roadmap, but not once v15 comes out (because then it won‘t be the dev version anymore but actually released😉)
what do you expect as a feature for linked roles in discord.js?
it's based on registering connections, pushing data when it changes all controlled through the oauth2 flow
making requests in the name of a user through oa2 is not really part of the bot library that discord.js covers
Well that and you need a webserver in order to use it. The feature is targeted towards integrating with an external service.
still haven't looked at how to detect these, but i suspect a member update payload and role tags as indicators?
Don’t you use the users/me/connections endpoint via oauth2?
Yeah that PR allows reading/updating existing application metadata for its linked roles but it doesn’t have anything thing to setup and provide role connections
I expected as much :o
Linked roles are already in the lib ?
@uncut kelp I can't reply in the #992669226403909652 thread but I wasn't looking for support, thought you could post library issues there
It looks highly likely not a library error
And if it is, you should be filing a bug report
What is that forum for then? I posted library issues before as well there
And if it's not a lib issue, I guess it's my bad for not understanding I have to hardcode error codes while others do exist
Your error is not from the library. Your error is from Discord
The enum I was referring to is matching against discord errors. It's called DiscordjsErrorCodes
It's just missing the one I was looking for
That would be because your error is not from the library. Your error is from Discord :p
Would it be a reasonable request to have the lib handle it and throw one instead then?
Just for one API call with one specific error? No
You should import RESTJSONErrorCodes which are the REST JSON error codes (per name) and match against your error
Just in case you didn't get it, DiscordjsErrorCodes are for discord.js error codes
So the other DiscordJsErrorCodes are not from API calls but all internal things?
Yes
Okay ty
I didn't think of searching for RESTJSONErrorCodes btw, maybe DiscordAPIErrorCodes would be more clear and would pop up in intellisense 😅
Would fit DiscordAPIError
That's why you have support channels to ask (:
Do you know if there are any updates? :)
I know as much as you can see in my PR… it has been approved by 2 maintainers, once the third approval rolls in it‘ll get merged. Or there will be more changes requested, then I‘ll apply needed changes…
Alright!
… and it’s merged
oh cool! then in a few hours i can install the new dev version :D
i have now added the new dev version to my hotfix, let us see whether my bot will die at any point
my first attempt at starting it up ended it in going offline after about 2 minutes, with this being the logs
Second attempt has the same issue. It says "Sending a heartbeat" but the heartbeat never gets acknowledged, despite it being acknowledged higher up in the logs without much delay
As you can see it replayed one event where I tried to send a command, which is more than it was able to do last time. but otherwise ended in a disconnect again
Trying one last time before switching back
It failed again. Notice also how it is sending a heartbeat at 22 minutes and 30 seconds, which was acknowledged, so the next heartbeat should be sent at 23 minutes and 11 seconds, but it is only sent at 23 minutes and 55 seconds before the heartbeat interval is cleared just a few seconds later. That looks weird to me, but yeah idk. Hope these screenshots help the diagnosis process, though.
…now the old stable version is having the same issue… what do i do now?
ah okay this time it fixed itself. nvm
For a good comparison (this is 14.6.0), you can see how it goes through the same process of not receiving the heartbeat (which is sent way too late) then closing, reconnecting, then going through that zombie connection problem. But this time, the heartbeat gets acknowledged after that.
Do you have any kind of shard settings?
nope
Could reproduce once but not while debugging yet
Is there something I can do to help?
Find out when/why it happens
Can't that issue be related to this?
#discord-dev-news message
Well when is everytime the same way, as to be seen in the screenshots. Why it happens is something I'm unsure how I could help, I don't really know which files are responsible for what in the first place so I don't know how to kind of recreate the logic that the code is going through in my head and then know what it would have to do instead
not really, since the first close happens 2 minutes after connecting
let me actually try this hotfix on my locale copy that i use for testing instead, let's see if i can recreate the issue
WebSocketShard.js is the one doing all the work in this case... I'm unsure why emitClose gets called there... unless your websocket actually gets closed immediately
faster than normal, but not 2 mins...
This is interesting. So since my last stable release (which the hotfix is branching off of) I have made some changes to my code, because during testing I'm not actually compiling my typescript but instead calling ts-node. Since it still has to compile, just without saving it anywhere, I've noticed that there was a serious delay after the ready event was called, where the heartbeat wouldnt be acknowledged for 20 seconds. This is because only after the ready event was called, I was calling all my handlers including the command handler which would load all the command files for the first time. I figured that this is taking a lot of the processing power so I did two things, first of all move this before the client login, and second of all making it asynchronous to save some extra time.
I figured that because the stable version is compiled, it wouldn't take so long to load all the files, but it seems to be doing exactly that. This would explain the delay in the heartbeat being sent, and it also explains why now in my local version, it is happily acknowledging all heartbeats without ever closing or assuming a zombie connection
So what I will do now is try to bring over this part of the code to the hotfix just to see whether that will make a difference
Well, the file loading doesn't actually take that long, but instead what takes super long is a loop over every database entry (which is happening for a good reason). So now I have to see whether I can stop that from holding up other code
So at least one thing is sure, something must have changed between 14.6.0 and the current dev branch, where the old version can save itself from completely dying when a big process is clogging up the heartbeat code from running, where the new code is not able to do that
But I think other than that the new code is working fine. The issue seems to be that if it hangs for a bit or can't acknowledge the heartbeat for some time for some reason, it will just give up (even if it doesnt intent to do that)
Because that's exactly what the zombie connection detection is for: if we don't receive an event for a long time we assume the connection is dead and reconnect... is your database loop one big async function or does each iteration itself run async? if the former then that would explain the hold-up...
each iteration isn‘t async, but it does have to do enough computing to take 2-3ms per iteration, which obviously adds up for thousands of entries. i have found a "fix" where i have an interval set at 20ms and with each call it goes through one database entry, which allows the code to run the heartbeat intervals inbetween when needed. the question is just, why was the old code able to restart the shard successfully after this heavy computing was completed, while the new code just kinda gives up? while this won‘t be an issue for me anymore now since i found a fix for this specific issue, it would still be an issue if my connection died for just too long. it would be better if it was still able to restart after that which it seems to not be able to do
do you do the DB loop on every ready event?
@steel haven so looking at this screenshot, I am seeing that at 14:57 my loops are done looping, but because it took so long, it closes the websockets and connects again.
at 15:00, the connection is finished, and at 15:01, a heartbeat is acknowledged.
This would indicate that everything is working right now, but despite that, it is assuming a zombie connection. This is the first part of this that I don‘t understand. The second part is that a heartbeat is sent but not acknowledged, which is precisely what differentiates it from earlier versions.
It is called only once since I am calling client.once('ready') (and calling that loop from within that event)
So it should only be called the very first time that the bot starts up and never again, as far as I understand it
Yup, was just checking so I know where to search for the bug...
Yeah, was just making sure I didn‘t misunderstand something about how djs works and giving you false info ;)
Found the issue, now to think about how to solve it (without reintroducing old issues)
Can you explain it to me? Very curious about it (also explaining it sometimes helps finding a solution)
it starts the wsCloseTimeout although your Websocket already was closed... so it waits for something to happen that can't happen anymore, but immediately reconnects. That way it still waits for the close code after reconnecting and closes the connection thinking it's still the one that didn't close properly. What's weird is that the websocket was closed (as your debug logs show the [CLOSED] 1000) and it starts to clean up but doesn't clean up the close timeout
So if I'm understanding this correctly, the onClose event gets called because my process is taking too long to send a heartbeart. This removes the heartbeatTimer, the helloTimeout and the wsCloseTimeout etc. It's also calling "WebSocketShardEvents.Close", and the connect function is called again, which acknowledges that there is a connection and attempts to clean it up (which tries to remove the wsCloseTimeout again), before setting a hello timeout etc. So if at this point the wsCloseTimeout was removed like it was tried, everything would work fine, but instead, it still exists, which destroys the shard again and then the heartbeat can't be acknowledged etc etc.
So the problem is just, why is the wsCloseTimeout not closing when cleaning up
see my newest PR for answers 😉
ohh yeah i see. Very tricky but I think this helped me understand how the ws connection is made at least.
So the original issue which led to websockets quietly failing is already fixed, which is already great news. This issue which relates to not being able to connect (ie because you have a loop which runs for a minute) will be fixed with this PR, but also it shouldn't affect me anymore since I replaced the loop with a 20ms interval which gives the heartbeat interval time to send and acknowledge heartbeats in between.
all in all means with the release of 14.8.0, the time of having to restart my bot due to mysterious issues will finally be over. Thank you a lot for all the support, I'm happy that all these issues could be resolved now :)
@steel haven My bot actually did go offline again while using the hotfix branch. Does this look like it's the same issue as the one that you made your newest PR about?
Because to me it kind of doesn't
The plot thickens
@steel haven what do you think about resetting the connection on 4009?
on the new ws package we have reset as false for a zombie connection
and even the discord docs say we can do a safe resume when the connection goes into zombie
Sounds reasonable but I‘d rather wait for some other discussions to settle before making any more changes to mainlibs ws
ahan, I and @desert basin tested it out on bots with (350+ and 70+ shards bots) and found out resetting is the best.
Not sure why discord wants us to resume when resuming causes more issues and wspackage follows discord docs
It’s better to reset for zombie cons but it really increase the bucket tokens used to re-login.
wait resetting true means attempt a new login which will eat up all the login quota for the day
false means try resuming and that wont attempt a new login
Yep
then why are you running out of logins when the reset is false?
maybe because it’s failing to resume, so it ends up identifying again
Hello, So i was using the ShardingManager for my bot and it seems that i am having double processes in a single shard i am not sure how so i checked everything if i have a sub process or something but no i couldn't find anything, Everything is happening twice for example:- Emitting events twice and everything else.
Is there a chance this is a problem with your logging solution?
no i checked it not a problem with that
since when i run evaluations or even invoke commands
it's happening twice
whats your sharding options?
totalShards: "auto",
mode: "process"
when did it start happening
well today actually the bot didn't need sharding before it's on 2.5k guilds so i thought to shard it
i am not sure if i can find a lead but you may be so i'll share my code, since i have exports and imports that might be a case too lemme check
const {
ShardingManager,
ShardingManagerOptions,
ShardClientUtil,
} = require("discord.js");
const Logger = require("@structures/Logger");
class Manager extends ShardingManager {
/**
*
* @param {ShardingManagerOptions} options
*/
constructor(options = { token, totalShards: "auto", mode: "process" }) {
super(`./src/bot.js`, options);
// Logger
this.logger = new Logger({
displayBadge: true,
displayDate: true,
displayFilename: true,
displayTimestamp: true,
});
// Events
this.on("shardCreate", async (shard) => this.logger.success(`Launched shard ${shard.id}`));
}
async start() {
await this.spawn();
}
}
module.exports = Manager;
``` My manager class and i import this in the file index.js inside my src directory and in the same directory as the index.js has the bot.js which has the client class imported from structures aswell which then calls the start method for the client class which basically establishes a gateway connection
send the index.js and bot.js files as well
sure
require("module-alias/register");
const Quacky = require("@structures/Client");
const bot = new Quacky();
bot.on("debug", console.debug);
bot
.start()
.then(() => null)
.catch(console.error);
``` bot.js
```js
require("module-alias/register");
const Manager = require("@structures/Manager");
const sharder = new Manager();
sharder.start();
``` index.js
can you also send the code snippet for the start function for the client?
sure
And the constructor of your Client class
Also is this the @dev version or some regular #djs-help-v14 ?
dev version i mistakenly posted in #djs-help-v14
async start() {
await this.login(this.config.token);
await this.database.connect();
await this.calculatePing();
await this.database.calculatePing();
await this.register._loadCommands();
await this.register._loadEvents();
await this.register._loadModels();
}
👆
ok
constructor(
options = {
intents: [
IntentsBitField.Flags.Guilds,
IntentsBitField.Flags.GuildMessages,
IntentsBitField.Flags.MessageContent,
IntentsBitField.Flags.GuildMembers,
IntentsBitField.Flags.GuildMessageReactions,
IntentsBitField.Flags.GuildVoiceStates,
],
partials: [Partials.Channel, Partials.Reaction, Partials.Message],
allowedMentions: { parse: ["users", "roles"], repliedUser: false },
restRequestTimeout: 30000,
}
) {
options.makeCache = (manager) => {
switch (manager.name) {
case "GuildEmojiManager":
case "GuildBanManager":
case "GuildInviteManager":
case "GuildStickerManager":
case "StageInstanceManager":
case "PresenceManager":
case "ThreadManager":
return new LimitedCollection({ maxSize: 0 });
case "MessageManager":
return new LimitedCollection({ maxSize: 1 });
default:
return new Collection();
}
};
super(options);
}
looks normal from what i can see
exactly
when you said the commands are ran twice, do you mean prefix commands or slash commands?
everything actually and application commands were not registered due to command names being similar
do you have slash commands at all? if you do, run one and see what the output is
whats your console output
is there an interaction already replied error or no?
no
Weirdest shit i have ever seen
im assuming theres only 1 instance since the error isnt doubled, and that theres no interaction already replied errors
ye
most likely somewhere in your event handler, theres something emitting events
i am confused rn
Do you import your client file or anything else that imports the event loader in your ShardingManager file?
@steel haven just making sure you saw this - do you believe it might be another undiscovered bug?
what is this
well no
wdym?
so i tested it locally on my pc and it works fine, as you can see no duplicates
P.S: I am fucking stupid i called those loaders methods twice once in the client and in that class itselves
, Sorry for bothering ya'll
all good
hi, has anyone else experienced this issue? i've never noticed it before and it doesnt throw any errors when i compile, but for some reason the typings for this method seem to be undefined? I was previously importing ActivityType from discord.js but i moved to discord-api-types, both work but the method seems to not be typed?
If it doesn't throw any errors when you compile, it's a problem with your IDE and not discord.js
ah yeah just restarted vsc, problem solved. sorry!
it's discouraged to import from d-api-types
...if you already use discord.js.
there's nothing wrong at all in using dapi-types in case where you don't use discord.js
ah i see
no
Yes. Will be replaced with StringSelecMenuBuilder in v15. You can use it right now.
Oh, thanks. I was looking at docs, but it doesn't show me that 😅
Make sure you're looking in v14 (main), not v13 (stable)
Subpackeges docs are not updated there. Use https://discordjs.dev.
And use discord.js docs too see what you are importing.
That's helpful, thanks ❤️
Whats new in DJS dev
you can probably check github to see what's been done since last release
@steel haven Hey, can we discuss about the pr here?
Sure
In this case the onClose couldn't happen due to an (a)sync task was taking so long that it blocked the ws execution for too long
thus closeEmitted was false so it reconnected
But if the close ever happens its going to get caputred by onClose which will make closeEmitted true and that will cause the WsCloseTimeout to return early
The point of starting the WsCloseTimeout is we have seen zombie connection happening with diff readyState and to cover it all we thought of not having it under readyState check and rather depend on the closeEmitted variable.
Well, this log shows a normal reconnect (ws was still open when destroying). It should indeed not be about readyState but to wait for a close emitting on a WebSocket that already is CLOSED won‘t ever work either…
Because that will indeed not set closeEmitted to true
wait if the the state can go into CLOSED that means the closeEmitted is going to be already true
Not in this case, the emitting of the close event seems to not have happened while the listeners were attached (if it even ever happened)
wait ill do a test with destorying a ws on closed state
Or some code reset the closeEmitted to false again
Preparing to connect to the gateway...
[WS => Manager] Fetched Gateway Information
URL: wss://gateway.discord.gg
Recommended Shards: 1
[WS => Manager] Session Limit Information
Total: 1000
Remaining: 993
[WS => Manager] Spawning shards: 0
[WS => Shard 0] [CONNECT]
Gateway : wss://gateway.discord.gg/
Version : 10
Encoding : json
Compression: zlib-stream
[WS => Shard 0] Setting a HELLO timeout for 20s.
[WS => Shard 0] [CONNECTED] Took 363ms
[WS => Shard 0] Clearing the HELLO timeout.
[WS => Shard 0] Setting a heartbeat interval for 41250ms.
[WS => Shard 0] [IDENTIFY] Shard 0/1 with intents: 513
[WS => Shard 0] [READY] Session 6d8feb8f70abb22375fd2e8d9f13d13d | Resume url wss://gateway-us-east1-c.discord.gg.
[WS => Shard 0] [ReadyHeartbeat] Sending a heartbeat.
[WS => Shard 0] Shard received all its guilds. Marking as fully ready.
[WS => Shard 0] Heartbeat acknowledged, latency of 317ms.
kek dying
[WS => Shard 0] [HeartbeatTimer] Didn't receive a heartbeat ack last time, assuming zombie connection. Destroying and reconnecting.
Status : 0
Sequence : 2
Connection State: OPEN
[WS => Shard 0] [DESTROY]
Close Code : 4009
Reset : false
Emit DESTROYED: true
[WS => Shard 0] Clearing the heartbeat interval.
[WS => Shard 0] [WebSocket] Destroy: Attempting to close the WebSocket. | WS State: OPEN
[WS => Shard 0] [WebSocket] Close: Tried closing. | WS State: CLOSING
[WS => Shard 0] [WebSocket] Adding a WebSocket close timeout to ensure a correct WS reconnect.
Timeout: 5000ms
[WS => Shard 0] [DESTROY]
Close Code : 4009
Reset : true
Emit DESTROYED: true
[WS => Shard 0] [CONNECTED] Took 385ms
[WS => Shard 0] Clearing the HELLO timeout.
[WS => Shard 0] Setting a heartbeat interval for 41250ms.
[WS => Shard 0] [IDENTIFY] Shard 0/1 with intents: 513
[WS => Shard 0] Tried to send packet '{"op":2,"d":{"large_threshold":50,"compress":false,"properties":{"os":"win32","browser":"discord.js","device":"discord.js"},"version":10,"presence":{"activities":[],"afk":false,"since":null,"status":"online"},"intents":513,"token":"NzQ2NzkwMTc3MDQwNjI5ODE5.Gz-KIA.**************************************","shard":[0,1]}}' but no WebSocket is available!
[WS => Shard 0] [DESTROY]
Close Code : 4000
Reset : false
Emit DESTROYED: true
[WS => Shard 0] Clearing the heartbeat interval.
[WS => Shard 0] [WebSocket] Destroy: Attempting to close the WebSocket. | WS State: CLOSED
[WS => Shard 0] Shard was destroyed but no WebSocket connection was present! Reconnecting...
[WS => Shard 0] [WebSocket] Adding a WebSocket close timeout to ensure a correct WS reconnect.
Timeout: 5000ms[WS => Shard 0] [WebSocket] Clearing the close timeout.[WS => Shard 0] Failed to connect to the gateway, requeueing...
[WS => Manager] Shard Queue Size: 1; continuing in 5 seconds...
[WS => Shard 0] [WebSocket] Clearing the close timeout.
[WS => Shard 0] [WebSocket] Close Emitted: false
[WS => Shard 0] [WebSocket] did not close properly, assuming a zombie connection.
Emitting close and reconnecting again.
[WS => Shard 0] [CLOSE]
Event Code: 4009
Clean : false
Reason : Session time out.
[WS => Shard 0] [CONNECT]
Gateway : wss://gateway.discord.gg/
Version : 10
Encoding : json
Compression: zlib-stream
[WS => Shard 0] Setting a HELLO timeout for 20s.
[WS => Shard 0] [CONNECTED] Took 370ms
[WS => Shard 0] Clearing the HELLO timeout.
[WS => Shard 0] Setting a heartbeat interval for 41250ms.
[WS => Shard 0] [IDENTIFY] Shard 0/1 with intents: 513
[WS => Shard 0] [READY] Session 6a4af0685e7d98b80b6834c47db0dc57 | Resume url wss://gateway-us-east1-b.discord.gg.
[WS => Shard 0] [ReadyHeartbeat] Sending a heartbeat.
[WS => Shard 0] Shard received all its guilds. Marking as fully ready.
[WS => Shard 0] Heartbeat acknowledged, latency of 322ms.```
this is same to the ss you sent on that pr
Almost… just that the ss I sent had issues reconnecting after the destroy and thus didn’t reconnect as fast
the difference now is that
And maksi is the one having the original issues (I saw you typing)
closeEmitted op was missing in the first ss
while with the current pr due to early return clears the timeout
Yes, the way this happened to me was because heavy calculations immediately intiated after login were blocking the thread entirely for a minute. Maybe try simulating this scenario to see if it gets you the same result
maksi
It would be better if they can put the pr to test in production
We have this pr on 370+ shards and 60+ shard bots and no issues so far, infact we now have a better and stable uptime
It would be better if you can do it.
would be accurate test/results
#8989 in discordjs/discord.js by legendhimself opened <t:1672266862:R> (review required)
fix(WebSocketShard): Zombie connection fix
https://github.com/discordjs/discord.js/blob/a7fd2d8194677d6e90cda96194b29ace9f8238af/packages/discord.js/src/client/websocket/WebSocketShard.js
Copy the entire file and paste it in WebSocketShard
and restart in production
Why not just checkout the PR?
I‘m not home right now. I‘m in a train with no seat, if I‘m able to sit down for a longer amount of time I will attempt this
I mean it shouldn't be a guess, we need a repro. I tried a repro and it reconnected
the missing logs caused the issue for maksi
I meant as in git checkout… not read
mybad
last time i tried using checkout it was kinda janky with the imports. is it ok if i just copy the file?
what djs v are you on?
14.7.0
one
can you have it in production ?
have the changes run on production, I think everything will be fine with a better uptime

I‘d prefer to just test it locally though, since I was able to reproduce the issue that you can see in the screenshot locally too
thats great, all that matter to me is to check if it works
(Update to 14.7.1, there's a crash in 14.7.0 with select menus)
And then if that test runs, I can test it on my production
Oh hi Jiralite
Hello, I no nothing of ws, pls continue (':
just saying hi
sounds good, lmk if it works
after that we are safe to merge ig
@grim gate The problem is that I installed a hotfix for the particular problem that was discussed earlier which is specific to startup. So it doesn‘t really make sense for me to revert production just for this. So my idea rn is to create a local branch just to test that startup problem, then checkout the PR in production afterwards only to check for the silent disconnects that occur many hours after startup
The pr also has the silent restart fix
its fine, lmk after your done testing
It'll be available in the next development release cycle now
So I reverted to the version that this screenshot is from. For some reason, I cannot reproduce this anymore, I just get this instead:
Wait, I might've forgotten to re-install the old discord package
@steel haven what do you think?
i think its the expected result
thats a normal reconnect
I now tried again with 14.7.2-dev.1672056271-3160ab0.0 which is what I used back then and while I'm getting a different error, I'm still not able to reproduce the issue, aka it reconnects. So I'm still not sure what happened between then and now that makes me unable to reproduce the issue
I'm gonna try on prod just to make sure
Did you add the task taking time to it?
anyways the pr got merged, if you come across any issue with pr let us know. Iterative development
Yes, I just reverted to the commit of that time.
I tried again on my production branch. I was able to recreate this issue. I think I used the wrong commit on my local branch actually
Tried inserting Vox's PR. This is what happens. So it seems to resolve itself
I now switched back to the newest of my commits but using Vox's PR. I'm gonna leave it at that and report if there are any problems
great!
The third line from the bottom reads wrong though 
Websocket was closed | WS state: OPEN
But explains why I thought it wouldn’t work as intended. Great to hear I was wrong
need to fix those logs, the problem is it waited 5s but by that time it was reconnected and then it logged
so the logs were logged after 5s
not sure how I can place logs elsewhere
You can’t put logs back in the past of course… maybe just adjust the wording: old was closed | current WS state: …
thats what I did
Why is it 4009 when discord States to do 1000 or 1001? ignore me, can’t read
Would’ve been better if they simply said use close code X but🤷♂️
4009 Session timed out Your session timed out. Reconnect and start a new one. true
bro wut is this
docs contradicts
zombie connection is a session timeout
But we want to resume the session, so we shouldn’t call it a timed out session (because those should be abandoned and a new one made, right?)
wait I wanna to confirm if 4009 is zombie connection according to discord
Regarding docs contradicting itself:
If an app doesn't receive a Heartbeat ACK, it should close the connection and reconnect.
Ah wait, reconnect and resume aren’t mutually exclusive, ignore me once again
In the context of WebSockets, "reconnect" refers to the process of establishing a new connection to discord after the existing connection has been lost or closed.
resume is just using the same connection
Resume in the context of discord here is using the same session, not the same connection
oh sorry for my bad english but that's what I meant
All good, I was way too confused myself
and I am still confused if we should use 4009 in first place for the zombie connection
@boreal knot what do you think?
on op codes page
Reconnect and start a new one.
while on gateway page it said
If a client does not receive a heartbeat ACK between its attempts at sending heartbeats, this may be due to a failed or "zombied" connection. The client should immediately terminate the connection with any close code besides 1000 or 1001, then reconnect and attempt to Resume.
The codes in that table are sent by discord
Not ones we should use
And iirc we use 4900 for zombie
4900
Idk read the code
but we are setting those for zombie connection? while there is no code to extract that code for zombie
I'm confused about your question
if we get a zombie connection we are currently resetting and making a new session/connection while the discord docs asks for a resume instead of a new session
and in the new ws package we are resuming instead of starting a new session
We are highly unlikely to have a valid session then
I'd honestly suggest not trying to improve current ws further as we'd be better off providing support for using our new ws system
hmm, why is discord suggesting to to resume and why are we doing it in ws

any approx date when we will have new ws as the ws for djs
At least 1
yr?
At least 1 
v15?
If me saying it twice didn't make it clear, we have no approximates
I am more confused now thanks lol
it needs v15 since its breaking
but it can be done in a v14 version if users enable it themselves with a client option or something
and thus opting into the breaking stuff themselves
I opt in to breaking stuff… what should I break?🤭
everything, make it suffer 
https://github.com/discordjs/discord.js/pull/9003
can you please review, I previously messed up the backport which caused the issues
also not sure if package-lock.json should be updated
Why should it? Don’t, even less so on a backport
wdym
I saw the revert - it's fine to leave it
I used npm i and it auto updated
🫡
When a version is released the respective version will be updated accordingly <:
Oh, you meant on a previous PR?
the issue that you and I were trying to fix was caused by me messing up the backport
I initially fixed it on v13 then backported fixes to v14 where I forgot one line
Could you request me for review on that PR directly? I‘m gonna go to bed now and will forget to review it tomorrow otherwise
now I fixed on v14 and backporting to v13, I double checked it
Wouldn’t that be a forwardport then
you gotta comment on the pr so I can request a review ig
Additional Information: Collections

