#djs-in-dev-version

1 messages · Page 3 of 1

feral island
#

hm.

knotty plover
#

Basically everyone in this channel right now

feral island
#

I have been tryingI have been trying why is this not working?

#

it doesnt i.reply and logs undeifined

knotty plover
#

There may be a collector bug, we're looking into it

knotty plover
#

Using a dev release means you take the risk that things may be broken or require additional changes

feral island
#

ye i get it

knotty plover
#

By no means it is guaranteed to even be working code

feral island
#

Can you please ping me if you find a bug in it?

#

with collectors.

knotty plover
#

It usually will be because we know what we're doing, but small things slip through

feral island
#

Ye i see

knotty plover
#

If we find and fix a bug it'll be in the next nightly dev release

feral island
#

ah okay

uncut kelp
feral island
uncut kelp
#

This sentence confuses me. You've already written it

feral island
uncut kelp
#

Uhh I'm confused proof that it works won't change anything

feral island
#

why is it not working for me?

uncut kelp
#

I wouldn't know

feral island
uncut kelp
#

I guess nuke node_modules and reinstall stuff and see what happens

feral island
#

o dang okay

#

WTH

#

FIXED @uncut kelp

uncut kelp
#

Huzzah

feral island
#

how do i get what role a user selected?

knotty plover
#

interaction.roles

feral island
#

thanks

knotty plover
#

i think

feral island
knotty plover
#

well, is it a RoleSelectMenuInteraction?

forest elm
#

i.roles probably

feral island
#

thats what i did

knotty plover
#

No it isnt

feral island
knotty plover
#

That is not the same thing at all

feral island
#

then..?

knotty plover
#

nevermind monbreyFacepalm

feral island
#

with i.roles

feral island
knotty plover
#

it is a Collection, which extends Map, yes

feral island
#

ah

feral island
#

so it shows the one they pick

plain roverBOT
knotty plover
#

Which one do you want?

#

I cant answer that

feral island
#

i wnat it to say the role id and name

knotty plover
#

i guess the last one, joined into a string then

#

This is really getting into Javascript basics now. These are just Map methods

feral island
#

Array.from(collection);
?

feral island
knotty plover
#

Collections do not have a name or an id

feral island
hoary fox
#

it's a role name?

feral island
#

yes

#

whatever role they pick i want to show the name and id

hoary fox
#

so not collection's but role name

feral island
#

huh?

#

its inside

keen abyss
#

Then map it

#

It’s a collection

feral island
#

k,

hoary fox
#

so interaction.roles.first() will be your role

keen abyss
#

Like monbrey already told you

hoary fox
#

or just use interaction.values to get id with my pr dogeHaHa

hoary fox
#

waitWhat
right before u said it's a collection

feral island
#

its inside.

#

what do i do..

feral island
#

it doesnt work... i get a err

forest elm
#

thats definitely not a Discord API error

feral island
#

idk what to do...

forest elm
#

you made it say so

feral island
#

Its a error handler

forest elm
#

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

feral island
feral island
#

Im comfused as on what to do..

plain roverBOT
#

method Collection#map()
Maps each item to another value into an array. Identical in behavior to Array.map().

feral island
#

Im so comfused

#

I DID IT

stone sequoia
#

Hello, will it be possible in the future to add select-menus menus in a modal ?

dawn phoenix
#

we can only implement features discord has

dawn phoenix
#

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

stone sequoia
#

Hope they add it

scarlet tangle
#

why role menu only has 15 roles? How can I view all the roles in the menu?

knotty plover
#

Thats a question for Discord, not us

scarlet tangle
#

oh, I thought okay

scarlet tangle
#

What does dev have that the regular package doesn't have

knotty plover
#

At the moment, the new select menus

scarlet tangle
#

You mean these? They're ancient

knotty plover
#

No the new ones

#

Role select, User select, Channel select

scarlet tangle
#

Oh understood thanks

wide pivot
#

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

rain bramble
rain bramble
dawn phoenix
#

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.

silent hedge
#

makes it annoying

dawn phoenix
#

okay, so then i can't think of any use case firL

glad spoke
plain roverBOT
jaunty vault
#

nvm the builders link is invalid

#

I sent the discordjs.dev docs here

silent hedge
#

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

hoary fox
#

Should new select be in v13?

formal kernel
#

probably

hoary fox
#

like MesageSelectMenu().setType("ROLE_SELECT")

#

also hmm how to leave SELECT_MENU type the same
but add STRING_SELECT

rain bramble
potent hedge
#
/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
silent hedge
#

read the pin

potent hedge
#
import { Client } from 'discord.js';

const client = new Client({
    intents: 0,

    ws: {
        properties: {
            browser: 'Discord iOS',
        },
    },
});
potent hedge
silent hedge
#

unlucky

potent hedge
#
{
  "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?

knotty plover
#

Yeah, did you then run npm install or whichever package manager to install that version?

restive wadi
#
npm WARN deprecated @discordjs/builders@1.4.0-dev.1667347887-5152abf.0: This version has been automatically deprecated by @favware/npm-deprecate. Please use a newer version.

#

is this fine?

#

like how long does it have til EoL

hoary fox
forest elm
#

all the dev versions are deprecated after a new one is published

scarlet tangle
#

Hello

hoary fox
scarlet tangle
cloud swift
hoary fox
#

ehh look at pins

cloud swift
#

"i checking the pin and try it and method not work..."

jaunty vault
#

wot

#

did you install it with the override

hoary fox
cloud swift
jaunty vault
scarlet tangle
#

oh crap wrong channel, never noticed sorry

hoary fox
cloud swift
#

There are no new versions?

knotty plover
#

Of what

#

See pins to fix issue

knotty plover
#

can you please run npm why @discordjs/builders

#

thats not what I said

cloud swift
knotty plover
#

yeah you dont have builders dev installed, so possibly the resolution hasnt been properly applied?

cloud swift
knotty plover
#

npm i should have done it though

cloud swift
#

Or am I doing it wrong ?

knotty plover
#

What if you delete node_modules and install again clean

cloud swift
knotty plover
#

i have no idea

uncut kelp
#

Probably unrelated @cloud swift but you don't need /rest installed. discord.js ships with it

rigid haven
#

same with fs, that's a default node module

rotund herald
#

my bot is online but whenever i do the cmd in the dc channel nothing happens

rigid haven
rotund herald
#

ok ty

scarlet tangle
long quail
#

installed => Run => Error

#

and yes its the development version

cinder wraith
#

read pins

restive wadi
hoary fox
#

In case that client is muted
should VoiceChannel#speakable be false? bc now it doenst check that

steel haven
karmic trail
#

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.

knotty plover
#

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"

karmic trail
#

ah, and on a per-feature basis?

#

so no clustering of features into a single minor?

knotty plover
#

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

karmic trail
#

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?

knotty plover
#

If we know in advance that Discord is releasing a few things close together we might cluster them

karmic trail
#

ah, thanks

knotty plover
#

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

karmic trail
#

who makes those decisions?

#

is it an individual or a group consensus?

knotty plover
#

Mostly Crawl has final say, but space, kyra and vlad are the other maintainers

#

And generally all the contributors discuss it

rich mason
#

is this help for v15 beta?

cinder wraith
#

while v15 doesn't really exist yet, this is channel for dev releases that will eventually get released as stable versions

lament lava
#

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)

jaunty vault
lament lava
#

ahmmh

#

i mean npm shows it like its on: discord.js@14.7.0-dev.1667822677-ff85481.0

steel haven
#

Can you restart ts-server and check again?

lament lava
#

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)```
keen abyss
#

Read pins

lament lava
#

yea ok

slender schooner
cinder wraith
#

Commando is long dead

slender schooner
jolly pike
#

it hasn't been relevant or maintained for a long time

slender schooner
white nebula
slender schooner
white nebula
#

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

cold lotus
dawn phoenix
#

sapphire is a framework built for discord.js

#

no, it's not part of discord.js

lament lava
#

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] });
rigid haven
lament lava
#
  1. woops
  2. let me try..
#

same error..

rigid haven
#

Hmm then idk

lament lava
#

well someone else?

#

(14.7.0-dev.1667822677-ff85481.0)

dawn phoenix
#

Should be ISO8601

plain roverBOT
#

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

lament lava
#

ohh thanx its working now :))

pallid root
#

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}.`;
}
knotty plover
#

Okay?

knotty socket
#

yo why is the dev team releasing 2 versions of djs?

#

like what's the difference between 13.2 and 14.6.0

knotty plover
#

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

knotty socket
#

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?

cinder wraith
knotty plover
#

Jumping between major versions will require you to update your code

knotty socket
#

ah thanks 👍

main knot
#

is there a proper channel for asking questions about any prs?

uncut kelp
#

You could ask here, I suppose

main knot
#

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

plush heron
scarlet tangle
#

How can I use the new selects?

uncut kelp
tropic raven
# uncut kelp ~~Hey <@97470053615673344>, regarding your comment on <https://github.com/discor...

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

teal solar
#

how do i use encodeURIcomponent()

hoary fox
#

not djs?

teal solar
#

what

dawn phoenix
#

your question is not related to discord.js, which this server is for, exclusively

heavy pasture
#

Is it possible to add a button in the user's message?

dark light
#

no

scarlet tangle
#

how do i solve this?

uncut kelp
#

See pins

scarlet tangle
jaunty vault
#

Latest pin

uncut kelp
#

You need to see the latest pin. Add that to your package.json

scarlet tangle
#

ah alright

scarlet tangle
jaunty vault
#

Did you reinstall the dev version?

scarlet tangle
#

i installed it after putting the override in my package.json

#

was i to delete it and reinstall?

jaunty vault
#

Delete what?

scarlet tangle
#

the dev version

jaunty vault
#

Yeah try it

scarlet tangle
#

ah, how do i delete it? i'm terribly sorry for asking all of these questions

jaunty vault
#

npm uninstall discord.js

scarlet tangle
#

okay

scarlet tangle
jaunty vault
#

what did you put in your package.json?

scarlet tangle
#
"overrides": {
    "@discordjs/builders": "1.4.0-dev.1667347887-5152abf.0"
  }
uncut kelp
#

Try deleting your node_modules folder and trying again

scarlet tangle
#

okay

scarlet tangle
jaunty vault
#

just delete the folder
Right click -> delete

scarlet tangle
#

alright i deleted the folder and ran npm i discord.js@dev and the error still persists

#

@uncut kelp

jaunty vault
#

Did you... save your package.json

scarlet tangle
#

so this has been happening

uncut kelp
#

What's in your package.json?

scarlet tangle
uncut kelp
#

discord-api-types and @discordjs/builders shouldn't be in your dependencies

scarlet tangle
#

oh?

#

you're the first to tell me that

#

where should they go?

uncut kelp
#

Nowhere. Remove them

scarlet tangle
#

gotcha

uncut kelp
#

discord.js exports those two packages already

scarlet tangle
#

ah, i see

rigid haven
#

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.

scarlet tangle
#

i'm gonna try deleting node_modules and reinstalling again

jaunty vault
rigid haven
#

ah yes permissions

#

oh wait i said the wrong endpoint

#

i was thinking of the Add Guild Member Role endpoint 🤦

scarlet tangle
#

@uncut kelp seems to be working! thank you and @jaunty vault so much for your help

steel haven
#

@scarlet tangle 👆

pliant tinsel
#

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

dawn phoenix
#

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

pliant tinsel
#

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.

feral island
knotty plover
#

Have you reinstalled modules after applying the override?

feral island
knotty plover
#

Yes

feral island
#

yes

feral island
fallow iris
#

This worked for me

sly crypt
#

When is djs 14.7 coming?

knotty plover
#

When its ready

sly crypt
# knotty plover 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.

sly crypt
knotty plover
#

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

jovial cypress
steel haven
jovial cypress
#

i can't just download the package from npm so there has to be another way

steel haven
jovial cypress
#

git checkout gives me access to the branch, but it doesn't add it to the node_modules folder of a project

jovial cypress
#

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

steel haven
#

I was just asking because pushing for it to be released without knowing if it even fixes the issue is strange

jovial cypress
#

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

steel haven
#

How can you be sure if you didn’t check if it really fixes your issue?

jovial cypress
#

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

jovial cypress
steel haven
#

So no other PR will be made if everyone assumes it fixes it

jovial cypress
#

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

jovial cypress
#

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

steel haven
jovial cypress
#

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

velvet jasper
jovial cypress
scarlet tangle
#

link to dev guide?

dawn phoenix
#

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

scarlet tangle
#

How should ComponentType.MentionableSelect work?

#

because the selectmenu is crossed out

dawn phoenix
#

the one you want to use isn't, though?

scarlet tangle
#

StringSelect work

#

but

#

I'd like to know how the others work

dawn phoenix
#

you supply the respective type and other options

scarlet tangle
#

@dawn phoenix like this?

uncut kelp
#

Why don't you check the documentation too

hoary fox
swift pelican
#

where are the docs for ChannelSelectMenuBuilders?

hoary fox
#

at main docs

rigid haven
#

they dont exist tho

swift pelican
#

they don't exist

rigid haven
swift pelican
rigid haven
#

ohh
ok

dull mulchBOT
hoary fox
#

^ pr with new selects for guide btw

knotty plover
#

Yeah I'm still working on that

#

Lots to do

swift pelican
#

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

hoary fox
#

read the pins

swift pelican
#

i tried that

hoary fox
#

have u ran npm i

swift pelican
#

im using pnpm but i used pnpm i, yes

hoary fox
#

maybe delete node_modules then install

swift pelican
#

still broken

swift pelican
#

@knotty plover think you can help?

knotty plover
#

no

swift pelican
#

oh

scarlet tangle
#

is there a way to view collectors that are currently being listened to

hoary fox
#

no but probably u can see listeners which it could use

jovial cypress
jovial cypress
#

It has now been online for 24 hours without issues

livid basalt
#

<@&839912195994812420> yuu is offline

hoary fox
#

also docs command is not working

jovial cypress
jovial cypress
#

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

jagged marsh
knotty plover
#

See pins

jagged marsh
#

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?

cinder wraith
#

yes

jagged marsh
#

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)

cinder wraith
#

you do be using a dev build

knotty plover
#

Yeah, end users of the stable releases, which is almost all of the users, don't have to do that

jagged marsh
#

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

steel haven
#

again, you are using a dev build. You can't expect stable end user documentation on that

vestal portal
#

Apologies if this has been asked already, but is there an ETA on the new select menus in the dev version?

silent hedge
#

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

jagged marsh
hoary fox
#

ehh dont spam

#

thanks :)

slow fossil
#

Is there a list of features/changes coming in v15 yet?

visual mirage
slow fossil
#

Well, that's what I'm asking 😄

jaunty vault
#

it's not in dev yet, afaik

#

we do have some semver:major prs though, ig

dawn phoenix
#

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)

visual mirage
#

whats semver

dawn phoenix
#

semantic versioning

visual mirage
#

ok

dawn phoenix
#

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

slow fossil
#

Isn't lib TS already?

jaunty vault
#

no

#

it is made with js, and has typings

steel haven
#

All subpackages are TS, main lib isn’t yet

rustic holly
#

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?

rich cipher
#

What is the most stable dev version for just the Selectmenu types?

cinder wraith
#

god knows

rich cipher
#

damn ok I'll use client.ws.on then but it'll be confusing

sacred fulcrum
#

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

cinder wraith
#

psst, this isn't channel for regular support

sacred fulcrum
#

oops sorry.

undone yew
#

on discordjs v14.6.1 dev, new error

#

my package.json

steel haven
undone yew
#

no changes

steel haven
# undone yew

Also don’t install /builders and /collection seperately like that, they get re-exported by djs

undone yew
steel haven
undone yew
steel haven
undone yew
#

worked

primal crest
#

@undone yew olm harbi dev kullanıyormuş mskdlkksxpoospxşs

#

manyak

hoary fox
#

?

primal crest
jaunty vault
swift pelican
#

TypeError: Class extends value undefined is not a constructor or null

jaunty vault
#

Read the pins

swift pelican
#

yes ive read the pins, i deleted my node modules, used npm i but im still getting the error

jaunty vault
#

what's in your package.json

swift pelican
#

for discord.js?

jaunty vault
#

wait nvm

swift pelican
#

yea im just a bit stuck

#

it works locally

#

but just not on my vps

jaunty vault
#

oh

swift pelican
#

really strange

jaunty vault
#

maybe the vps doesn't support overrides or something

swift pelican
#

nah it does

swift pelican
digital spire
#

Hey can I please get help on this

steel haven
#

Also don’t install /builders and /rest seperately but use the re-exported stuff from discord.js directly

digital spire
digital spire
digital root
#

why in the world custom selects taking so long to release

dark minnow
#

Each times someone asks, Crawl adds 10 days to the release date

jaunty vault
trim thistle
#

My bad.

simple pecan
digital root
#

ah shit

rigid haven
#

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

neat veldt
#

`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!!!

knotty plover
#

This has nothing to do with discord.js though

formal kernel
ancient wraith
#

What is </command:0> and what can you do with it raw: </command:0>

hoary fox
#

its just command mention?

gloomy kayak
#

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

livid brook
#

mans just mentioned a command

compact arch
#

what is the ratelimit for message editing?

hoary fox
#

yup

teal harbor
#

How ?

jaunty vault
#

With the dev version, it's possible
It will be released in stable soon

teal harbor
#

okeww

zenith notch
#

only 6 messages in whole day

#

sus

hoary fox
#

its dev channel so what more u want

feral island
#

are collectors fixed?

forest elm
#

they were broken?

feral island
#

Yes last time I tried In dev version they said they will look into it

feral island
forest elm
#

i dont see any recent issues on github reporting that collectors were broken

feral island
#

Okay nice!

#

Thanks for the info!

jaunty vault
#

Read the pins

feral island
#

ok

feral island
jaunty vault
#

The last pin

steel haven
feral island
feral island
jaunty vault
#

discord.js

feral island
#

okay

jaunty vault
#

and did you reinstall djs

feral island
jaunty vault
#

cause if you don't reinstall... then nothing is changed...

feral island
#

ah* fixed thanks#

feral island
#

What is the Role Select collector?

steel haven
#

It’s still a MessageComponent

feral island
feral island
#

How do I get the role someone selects ( using selectors )

#

got this so far

plain roverBOT
feral island
#

thanks

livid basalt
#

is the override only working on a certain node version+ ?

hoary fox
#

probably the version which on djs works

#

not higher

livid basalt
#

hmm

jovial cypress
#

a new version has been released but the critical bug that makes my bot silently turn off is not in it yet 😔

fallow iris
#

Does v14.7.0 still require the overwrite from the pins?

knotty plover
#

no

fallow iris
#

Okay 👌

jovial cypress
#

Hopefully this will be fixed soon, I really don't want to open a terminal and restart my bot every few hours

woven grove
#

Yeah it will make it into dev soon

#

I just don't want it in a new release while its still potentially unstable

left frost
#

Do I need to boost the server in order to get d.js blue 🙃

plain roverBOT
#

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

scarlet tangle
jaunty vault
#

What's the problem?

hoary fox
scarlet tangle
knotty plover
#

?? means nullish coallesce

hoary fox
jovial cypress
scarlet tangle
#

so my logic is dead

left frost
#

Yooo we can delete ephemeral messages now. Very cool

hoary fox
#

useless

dawn phoenix
#

let's keep this channel to in-dev versions and move the release excitement to #archive-offtopic , please

ocean timber
plain roverBOT
#

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

ocean timber
#

i mean
makes sense
weird name tho

glad spoke
#

has the removal of ephemeral messages been added to the new version of djs?

uncut kelp
hybrid jungle
#

When is the update for v13 that contains the new active dev badge?!

rain bramble
#

When it's ready

hoary fox
#

is there evan pr including that?

rain bramble
#

No iirc

idle galleon
#

It just needs a -types bump

#

Or nvm, you said v13

rigid haven
#

why is @cobalt badgers/ws not a devDep?

#

oop sorry for random guy

rain bramble
woven grove
#

Because we use ws

rigid haven
#

usually @types dependencies go in devDependencies but @types/ws is in dependencies

woven grove
#

Nope

#

They usually get bundled

velvet jasper
woven grove
#

Check TS docs on it

velvet jasper
#

if you use types that aren't exposed publicly they can be dev deps

rigid haven
#

ahhh that makes sense

#

ok thanks
i don't usually maintain packages meant for consumption, i just consume them 😛

cinder wraith
#

yeah, initially it was there, which was forcing everyone to install it on their own the moment they wanted to use discord.js

high jungle
#

will v15 be out by april 2023?

idle galleon
high jungle
#

alright

woven grove
#

Why April

scarlet tangle
#

why not?

woven grove
#

I just dont know where theyd get the date april 2023 from

idle galleon
#

Isn’t that when dapi v6 gets decommissioned?

high jungle
# woven grove Why April

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.

steel haven
uncut kelp
steel haven
livid basalt
#

sigh

rich cipher
#

nice name

livid basalt
#

balls

daring skiff
#

well what is this channel used for
discord.js v15 has not even come out yet

uncut kelp
#

As the channel name implies, this is the for dev version

daring skiff
#

but which dev version

vague coyote
#

there is only one dev version
so THE dev version

#

the dev version is whatever currently is pushed to the main branch

daring skiff
#

djs 14.7.0

steel haven
#

That’s the current stable version… not the main branch

rich cipher
#

14.7.1 actually stable

scarlet tangle
#

When will v15 come out?

#

when it comes out then i will start a new project

white nebula
#

there's no ETA yet

jovial cypress
#

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

scarlet tangle
jovial cypress
#

Maybe something that I can use to detect when the bot isn't connected anymore so I can kill the process?

scarlet tangle
jovial cypress
#

Like something that I could check on a 2 minute interval?

jovial cypress
#

since i updated everything to v14.7 which was a hassle considering all the breaking typing changes

dawn phoenix
#

the typescript rewrite still has no version number, it never had one, and it will likely not get one before it's done

jovial cypress
dawn phoenix
#

that's what websocket heartbeats are for

jovial cypress
#

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

stone sequoia
#

Hello, is there a rate limit for the deletion of channels because my bot can no longer delete channels...

cinder wraith
#

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

scarlet tangle
#
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
uncut kelp
#

I brought this up the other day, think @forest elm tried to do something to help fix it :eyes:

outer bane
#

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

uncut kelp
#

That's what I suspected too :o I think the same thing happened with the new select menus too

outer bane
#

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)

rigid haven
#

Not very familiar with Yarn - would it work to change ^workspace to dev? (The prepublish script would probably need to temporarily change that back)

scarlet tangle
#

i did find a work around with yarn

jovial cypress
#

What are formatters?

snow crow
#

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)

jovial cypress
#

Ah I looked at the code, hnow I understand

#

yeah thanks :)

snow crow
#

Ye, it was the only thing that I can think of that it can be used for

steel haven
jovial cypress
steel haven
jovial cypress
#

or is there some sort of official npm version for a dev release

steel haven
jovial cypress
#

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

jovial cypress
#

Alright, the bot is now running on the hotfix branch. let's see if it goes offline.

jovial cypress
#

@steel haven The bot went offline with this.

uncut kelp
#

Uh-oh

jovial cypress
#

happened again right away after restarting

#

I will switch back to my stable branch for now

uncut kelp
#

@jovial cypress that should be fixed next release cycle (see the channel topic)

jovial cypress
#

does it only get rid of that error message or also of the bot going offline?

uncut kelp
#

To be determined :o

steel haven
#

Blame me if not

jovial cypress
#

haha

snow crow
velvet jasper
#

Yeah

jovial cypress
#

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

jovial cypress
#

the bug is not fixed

#

just went offline 40 minutes ago

steel haven
# jovial cypress the bug is not fixed

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)

jovial cypress
jovial cypress
#

@steel haven is this enough info?

steel haven
jovial cypress
#

If so, can you ping me when it has been merged so I can update my hotfix at the next dev release?

steel haven
jovial cypress
#

Hope this one fixes it at last 🤞

keen abyss
#

Qjuh the god 🙏

daring skiff
#

what is this channel mainly for

#

discord.js v15 has not even come out

steel haven
#

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

dawn phoenix
#

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

velvet jasper
#

Well that and you need a webserver in order to use it. The feature is targeted towards integrating with an external service.

dawn phoenix
#

still haven't looked at how to detect these, but i suspect a member update payload and role tags as indicators?

velvet jasper
#

Don’t you use the users/me/connections endpoint via oauth2?

uncut kelp
velvet jasper
#

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

uncut kelp
#

I expected as much :o

thin berry
#

Linked roles are already in the lib ?

exotic rain
#

@uncut kelp I can't reply in the #992669226403909652 thread but I wasn't looking for support, thought you could post library issues there

uncut kelp
#

It looks highly likely not a library error

#

And if it is, you should be filing a bug report

exotic rain
#

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

uncut kelp
#

Your error is not from the library. Your error is from Discord

exotic rain
#

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

uncut kelp
#

That would be because your error is not from the library. Your error is from Discord :p

exotic rain
#

Would it be a reasonable request to have the lib handle it and throw one instead then?

uncut kelp
#

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

exotic rain
uncut kelp
#

Yes

exotic rain
#

Okay ty

exotic rain
#

I didn't think of searching for RESTJSONErrorCodes btw, maybe DiscordAPIErrorCodes would be more clear and would pop up in intellisense 😅

#

Would fit DiscordAPIError

uncut kelp
#

That's why you have support channels to ask (:

jovial cypress
steel haven
#

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…

jovial cypress
#

Alright!

steel haven
jovial cypress
#

oh cool! then in a few hours i can install the new dev version :D

jovial cypress
#

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.

steel haven
jovial cypress
steel haven
jovial cypress
#

Is there something I can do to help?

steel haven
#

Find out when/why it happensThonk

rain bramble
jovial cypress
# steel haven Find out when/why it happens<:Thonk:264701195573133315>

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

steel haven
#

not really, since the first close happens 2 minutes after connecting

jovial cypress
#

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

steel haven
steel haven
jovial cypress
#

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

jovial cypress
#

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

jovial cypress
#

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)

steel haven
jovial cypress
# steel haven Because that's exactly what the zombie connection detection is for: if we don't ...

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

steel haven
jovial cypress
# jovial cypress my first attempt at starting it up ended it in going offline after about 2 minut...

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

jovial cypress
#

So it should only be called the very first time that the bot starts up and never again, as far as I understand it

steel haven
#

Yup, was just checking so I know where to search for the bug...

jovial cypress
#

Yeah, was just making sure I didn‘t misunderstand something about how djs works and giving you false info ;)

steel haven
#

Found the issue, now to think about how to solve it (without reintroducing old issues)

jovial cypress
#

Can you explain it to me? Very curious about it (also explaining it sometimes helps finding a solution)

steel haven
#

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

jovial cypress
# steel haven it starts the wsCloseTimeout although your Websocket already was closed... so it...

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

steel haven
jovial cypress
#

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

jovial cypress
#

@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

grim gate
#

@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

steel haven
grim gate
desert basin
#

It’s better to reset for zombie cons but it really increase the bucket tokens used to re-login.

grim gate
grim gate
uneven coral
#

maybe because it’s failing to resume, so it ends up identifying again

scarlet tangle
#

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.

solemn sparrow
scarlet tangle
#

since when i run evaluations or even invoke commands

#

it's happening twice

solemn sparrow
#

whats your sharding options?

scarlet tangle
#

totalShards: "auto",
mode: "process"

solemn sparrow
#

when did it start happening

scarlet tangle
#

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
solemn sparrow
scarlet tangle
#
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
solemn sparrow
#

can you also send the code snippet for the start function for the client?

scarlet tangle
#

sure

steel haven
#

And the constructor of your Client class

scarlet tangle
scarlet tangle
steel haven
scarlet tangle
#

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);
}
solemn sparrow
#

looks normal from what i can see

scarlet tangle
#

exactly

solemn sparrow
#

when you said the commands are ran twice, do you mean prefix commands or slash commands?

scarlet tangle
#

everything actually and application commands were not registered due to command names being similar

solemn sparrow
#

do you have slash commands at all? if you do, run one and see what the output is

scarlet tangle
#

k

#

slash is working fine

solemn sparrow
#

whats your console output

scarlet tangle
#

of interaction create

solemn sparrow
#

is there an interaction already replied error or no?

scarlet tangle
#

Weirdest shit i have ever seen

solemn sparrow
#

im assuming theres only 1 instance since the error isnt doubled, and that theres no interaction already replied errors

scarlet tangle
#

ye

solemn sparrow
#

most likely somewhere in your event handler, theres something emitting events

scarlet tangle
#

i am confused rn

steel haven
#

Do you import your client file or anything else that imports the event loader in your ShardingManager file?

jovial cypress
azure grail
scarlet tangle
scarlet tangle
west fjord
#

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?

uncut kelp
#

If it doesn't throw any errors when you compile, it's a problem with your IDE and not discord.js

west fjord
#

ah yeah just restarted vsc, problem solved. sorry!

rigid haven
cinder wraith
#

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

rigid haven
#

ah i see

surreal lake
#

Guys, is dev version stable or not?

rigid haven
#

no

acoustic temple
#

That's right?

#

This class deprecated?

warped marten
#

@acoustic temple replaced with more specific ones

#

like StringSelectMenuBuilder

rain bramble
acoustic temple
#

Oh, thanks. I was looking at docs, but it doesn't show me that 😅

rain bramble
acoustic temple
#

Yep, I'm using main there

rain bramble
acoustic temple
feral island
#

Whats new in DJS dev

cinder wraith
#

you can probably check github to see what's been done since last release

grim gate
#

@steel haven Hey, can we discuss about the pr here?

grim gate
# steel haven 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.

steel haven
#

Because that will indeed not set closeEmitted to true

grim gate
steel haven
grim gate
#

wait ill do a test with destorying a ws on closed state

steel haven
#

Or some code reset the closeEmitted to false again

grim gate
# steel haven 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

steel haven
#

Almost… just that the ss I sent had issues reconnecting after the destroy and thus didn’t reconnect as fast

grim gate
#

the difference now is that

steel haven
#

And maksi is the one having the original issues (I saw you typing)

grim gate
#

closeEmitted op was missing in the first ss

#

while with the current pr due to early return clears the timeout

jovial cypress
#

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

grim gate
grim gate
#

would be accurate test/results

jovial cypress
#

What do you want me to do?

#

Ah

dull mulchBOT
grim gate
#

and restart in production

steel haven
#

Why not just checkout the PR?

jovial cypress
#

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

grim gate
grim gate
steel haven
grim gate
jovial cypress
#

last time i tried using checkout it was kinda janky with the imports. is it ok if i just copy the file?

jovial cypress
#

14.7.0

grim gate
#

okay then just copy paste

#

how many shards?

jovial cypress
#

one

grim gate
#

can you have it in production ?

#

have the changes run on production, I think everything will be fine with a better uptime

jovial cypress
#

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

grim gate
uncut kelp
jovial cypress
#

And then if that test runs, I can test it on my production

grim gate
#

Oh hi Jiralite

uncut kelp
#

Hello, I no nothing of ws, pls continue (':

grim gate
grim gate
#

after that we are safe to merge ig

jovial cypress
#

@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

grim gate
#

its fine, lmk after your done testing

uncut kelp
#

It'll be available in the next development release cycle now

jovial cypress
#

Wait, I might've forgotten to re-install the old discord package

grim gate
#

thats a normal reconnect

jovial cypress
#

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

steel haven
#

Did you add the task taking time to it?

grim gate
jovial cypress
jovial cypress
#

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

grim gate
#

great!

steel haven
#

Websocket was closed | WS state: OPEN

#

But explains why I thought it wouldn’t work as intended. Great to hear I was wrong

grim gate
#

so the logs were logged after 5s

#

not sure how I can place logs elsewhere

steel haven
#

You can’t put logs back in the past of course… maybe just adjust the wording: old was closed | current WS state: …

steel haven
grim gate
#

any close code besides 1000 or 1001

#

np

steel haven
#

Would’ve been better if they simply said use close code X but🤷‍♂️

grim gate
#

pepecrii 4009 Session timed out Your session timed out. Reconnect and start a new one. true

#

bro wut is this

#

docs contradicts

steel haven
# grim gate

Well, 4009 would be indeed wrong if we want to resume…

grim gate
#

zombie connection is a session timeout

steel haven
#

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

grim gate
steel haven
#

Regarding docs contradicting itself:

If an app doesn't receive a Heartbeat ACK, it should close the connection and reconnect.
Thonk

#

Ah wait, reconnect and resume aren’t mutually exclusive, ignore me once again

grim gate
#

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

steel haven
#

Resume in the context of discord here is using the same session, not the same connection

grim gate
steel haven
grim gate
#

and I am still confused if we should use 4009 in first place for the zombie connection

grim gate
#

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.

boreal knot
#

Not ones we should use

#

And iirc we use 4900 for zombie

grim gate
#

4900

grim gate
#

or 4009?

boreal knot
#

Idk read the code

grim gate
boreal knot
#

I'm confused about your question

grim gate
#

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

boreal knot
#

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

grim gate
#

hmm, why is discord suggesting to to resume and why are we doing it in ws

boreal knot
grim gate
boreal knot
#

At least 1

grim gate
#

yr?

boreal knot
#

At least 1 shrug

grim gate
#

v15?

boreal knot
#

If me saying it twice didn't make it clear, we have no approximates

grim gate
#

sure np

grim gate
woven grove
#

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

steel haven
#

I opt in to breaking stuff… what should I break?🤭

formal kernel
grim gate
#

also not sure if package-lock.json should be updated

steel haven
grim gate
#

wdym

uncut kelp
#

I saw the revert - it's fine to leave it

grim gate
#

I used npm i and it auto updated

grim gate
uncut kelp
#

When a version is released the respective version will be updated accordingly <:

steel haven
#

Oh, you meant on a previous PR?

grim gate
steel haven
#

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

grim gate
#

now I fixed on v14 and backporting to v13, I double checked it

steel haven
grim gate