#djs-in-dev-version

35223 messages · Page 33 of 36

scarlet tangle

but this was not what I did, I want to replicate it in my bot

rain bramble

As you have said you're using v14.9 which doesn't support the new username system. It's currently onin the dev version. Property names in JavaScript are in camalCase, so it's <User>.globalName. Global name is nullable so there's <User>.displayName which returns the username if the user doesn't has global one.

scarlet tangle

But is there any way I can pull this property without the dev version?

I can assign the user part as a user if I create a ne variable?

variable for example:

const usuário - interaction.options.getUser('user')

steel haven
scarlet tangle

ty @rain bramble @steel haven

scarlet tangle
steel haven
scarlet tangle

ok

south dove

is there anything for usernames

plain roverBOT

Documentation suggestion for @south dove:
property User#globalName
The global name of this user

south dove

How can i install the latest discord.js dev?

vague coyote

channel topic

south dove

Ah got it

So Display Name is .globalName and .username is now the username (ipexa) ?

vague coyote

yes

south dove

Thanks, so then i just replace .tag everywhere with .username where i want the username (because it works similar then .tag) ?

If you understand what i mean

vague coyote

i guess

south dove

okay thanks so much

vague coyote

you could also just use user.discriminator === '0' ? user.username : user.tag

south dove

but i mean soon there is only going to be usernames

oh, but bots keep them

south dove
vague coyote

what_did_you_say

south dove

isnt that good? 😂

vague coyote
south dove

ok chef

south dove
vague coyote

well yeah

south dove
steel haven
south dove
steel haven
south dove

I try to reproduce it, I changed back to stable

oak tusk

When will the full version be released? (v14.11.1)

vague coyote

when its done, we dont do ETAs

light eagle

guys do you find the wording confusing? for the description of filterOld param

uncut kelp

Whether to only consider messages within 2 weeks
This would probably be a better description.

light eagle

Messages that are more than two weeks old will be automatically filtered out and removed.
i thought of this initially

knotty plover

All of those are still confusing imo

uncut kelp

I also thought of "Filters messages out of the collection that are older than 2 weeks"

knotty plover

There's no usage of bulkDelete that allows you to action messages older than two weeks. The Boolean to "filter" and "remove" only makes sense if you're passing a Collection of messages. It's misleading if you just give it a number

That one is definitely better, though not perfect

It's hard to find a way that doesn't imply you could not have the filter, and expect them to be deleted

What it's actually doing is "Ignore/filter messages which cannot be bulk deleted due to age" which happens to be two weeks

I'm not sure that wording is ideal either

light eagle

A

~~ Filters messages out of the collection that are older than 2 weeks~~
B
~~ Filters out messages of the collection that are older than 2 weeks ~~
~~which looks better/correct? ~~
i think we should provide that 2 weeks duration, just saying "can't be deleted due to age" might not be correct
nvm both don't feel right

solemn sparrow

"When given a collection, will filter out entries that are older than two weeks."

actually, seems like passing a number just fetches messages and calls the method again internally

was that option added because it would error if it was passed an older message?

steel haven

It does yes.

solemn sparrow

mmLol, interesting its false as default

cinder wraith

Yes, because if you tell it to delete 30 messages, it is supposed to try and delete 30 messages until you explicitly allow less

light eagle

Filter messages out from the collection that are older than two weeks. Keep in mind that disabling the option won't enable deleting messages older than two weeks

solemn sparrow

i dont think making it longer will make it easier to read

"Removes messages from being deleted that are more than two weeks old."

uncut kelp
cinder wraith

Considered?

solemn sparrow

I think a warning should be added for this method, saying that this method will error if there are messages that are older than two weeks being passed, unless you pass true to the filterOld param

cinder wraith

thonk

solemn sparrow

the wording on the methods docs doesn't hint to the method flat out erroring and not deleting anything if there is a message that is older than two weeks

cinder wraith

Well, it's a direct APIError, not our own

That should probably say why it isn't documented

solemn sparrow

should djs emit an error if theres a message in the collection that is older than two weeks?

uncut kelp

I would prefer we didn't

cinder wraith

Didn't we go away from guarding against such api errors?

Also, what's the difference anyway

uncut kelp

Saving a potential API call

cinder wraith

You have to do it anyway

Cause you did not delete anything

uncut kelp

It's just that we might as well do that across the entire library then we'd have like error checks in every single method and cba

solemn sparrow

it'd be a nice potential idea in a new major or rewrite

cinder wraith

:/

How would you even communicate why djs prevented the call

uncut kelp

And then there's the slight chance of the error no longer being applicable because Discord's API has modified something, and we have already fallen victim to that

cinder wraith

You have to parse the error somehow in case there is a number given (which isn't given by discord), and try with some other number again

uncut kelp

We threw an error if a server did not have the vanity guild feature if you're fetching the vanity URL, but along came server web pages and our error threw incorrectly 🙃

jaunty vault

Isn't this why we have the filterOld parameter...?

cinder wraith

Yes

solemn sparrow

love how this went from a phrasing issue to a topic on invalid api calls mmLol

cinder wraith

You started it 🤷‍♀️

solemn sparrow

fair

light eagle

Should we rename the param
bc filterOld can mean anything, filter in this scenario can mean we are reserving message s or ignoring the messages, it should be something which implies we ignore old messages.. something like ignoreOld i don't think ignoreOld is good though, but something similar is needed

solemn sparrow

could, but that'd have to go in a major version (or not, since its not changing the placement of the param)

rigid haven

is there a reason ThreadMemberManager#remove() doesn't take UserResolvable?

uncut kelp

No

topaz crane

I noticed that now <Member>.displayName shows server nickname or user display name or username respectively is that correct?
so no need to check for <User>.globalName if there's no member nickname

uncut kelp

so no need to check for <User>.globalName if there's no member nickname
You don't see the issue with this statement if you re-read it? A username, a global name, and a nickname are three different things

topaz crane

when I say or I meant that if the property doesn't find a nickname then it will check for a user display name, and so on.

uncut kelp

I wasn't responding to your question

But the answer would be yes

oak tusk
cerulean stag

Is it possible to make a feature with emojis for example, which indicates in real time the number of views of the last message sent?
For example on an announcements channel, a script in the bot, which when a new message is sent in the announcements channel, the bot adds a "👁️" emoji and a database adds in real time the number of times the message has been seen and the emoji counter increases according to the number of views?

rain bramble
umbral slate

Why was User#tag deprecated but User#discriminator wasn't?

I don't think tag should be deprecated while there are still accounts with tags

umbral slate

made a PR to remove it for the time being, I think it can be added back in a later version once the discriminator is no longer in use

dull mulchBOT
rain bramble

User#tag is a getter of discord.js and it can be deprecated at any time, while User#discriminator is a property of Discord API and it can be deprecated only with the deprecation in the API. Most users will be migrated very soon and User#tag will just return the username. For bots Discord announced their own system and User#tag won't be used for them. And anyway that's just one little warning.

rigid haven

wait what's bots' own system?

last i heard they weren't changing anything fn

vague coyote

they aren't changing anything fn

rigid haven

ok

lunar jacinth

Iirc aren’t they just making it their username + tag?

vague coyote

they aren't changing anything fn
so it stays username and discriminator

cinder wraith

that would also imply moving them onto same system as users

velvet parrot

guys how i use the Masked Links??

i can't

cursive venture

text in embed descriptions or webhooks but why are you asking that here

keen abyss

Are you using the dev version?

Then I'm guessing you're not. Please use the channels appropiate for your version

west fjord

when it comes to pull 9660, would it be more useful to still mark as deprecated on User but have it still as available to ClientUser? or instead of deprecating, maybe have a check to see if the discriminator exists and return something like @username or username#0001 accordingly? might be terrible ideas

knotty plover

Not really no

Other bots exist, with User objects, which rules out the first one

Discord also havent indicated what their long term plan is anyway

We might do something like the second, but still deprecated

torn swan

is there a way to fully disable the djs's cache? so that I can use redis

steel haven

Use /core

Because if you disable all caching you also disable many helper methods working correctly. And what remains is what /core is

torn swan

Okay thanks I will look into it

mystic lily

can we get soundboard events?

rain bramble

Not yet

dull mulchBOT
mystic lily
torn swan

is there a guide for sharding with djs/core? Thonk

hoary fox

just put your sharding options in websocket manager

also its not a topic for djs dev

sick magnet

you saved me thanks heartDope1

true zephyr

is there has any way for get the Orginally Known as ... value??
for show the old <User>.tag

zenith notch
dawn phoenix

this is not part of presences, but profiles which are not distributed to bots
you can get them from the identify oauth2 scope and requesting /users/@me

gritty siren

I see that discord.js.org seems to already point to the docs for the new dev version. I find it a bit odd that the tagline directly highlights an "object oriented approach" but the new "pong" example given in the introduction uses static-like reply methods (and I'm assuming that means interaction objects no longer have instance methods?). Are these design decisions documented somewhere for me to read up on? I'm curious why this change was made

I looked around on GitHub and in the new documentation a bit but I haven't seen much discussion on what motivated the new API design. Any pointers would be appreciated :)

vague coyote

nothing... changed?

it was always like this

and what exactly do you mean with static-like reply methods?

rain bramble

Do you mean @discordjs/core? That's not the dev version

solemn sparrow

@discordjs/core is barebones, you create your own structures/caching when using the core library

gritty siren

Ah. Sorry for the confusion. I assumed since the first entrypoint for the docs is the /core package now that that was the intended way to start development from here on

vague coyote

discord.js just isn't part of the new docs yet since it requires a typescript rewrite to be compatible

solemn sparrow

on that note, wouldnt it be a better idea to have the Docs button on the landing page point to the packages selector instead of to the core package?

rain bramble

It used to

gritty siren

Oh so the reason the discord.js package redirects to the old docs is because it's not updated yet, not because it's been deprecated? That makes more sense

Thanks for clearing that up for me 😅 sorry

cinder wraith
umbral plover

what is going on with the core package? is this ready for production? this seems a bit more "in active unfinished development" than 14 or 13

oh nevermind in stupid

just caught me off guard that the docs go to indev

solemn sparrow
umbral plover
solemn sparrow

the core package is basically barebones djs, no structures and no caching (its basically so you write your own structures and caching)

umbral plover

i skimmed the core docs but it didn't make much sense to me

ah yeah that would do it

core isnt replacing the entire discordjs v14 style is it?

knotty plover

no

solemn sparrow

nah, its not replacing the main lib at all, its for more experienced devs that are interested in writing their own caching and structures

knotty plover

Its an alternative, and might be used as an internal dependency for the main package in future

umbral plover
solemn sparrow
knotty plover

Because v14 isnt compatible with the new docgen yet

Which is why theres a banner at the top linking to the old docs

umbral plover
knotty plover

Yeah its not ideal naming lol

umbral plover

good to know im not shooting myself in the foot for the coming months

the same cant be said about the code I wrote though

south iris

which node version should i have for djs 14

steel haven
slim cairn

why does user's displayName return undefined?
version 14.11.1-dev.1687738298-75d91b5.0

slim cairn
const client = global.client;
const db = client.db;
const { EmbedBuilder, Events } = require("discord.js");
const beş_config = require("../../beş_config");
const ms = require('ms');
module.exports = async (oldUser,newUser) => {
   return console.log(newUser.user.displayName) //undef


    let familyRoles = await db.get("five-family-roles") || [];
    let tagData = await db.get("five-tags") || [];
    let chatChannel = await db.get("five-channel-chat");
    if (!tagData.length > 0 || !familyRoles.length > 0 || !chatChannel) return console.log("Değerler Boş");
    if (oldUser.bot || newUser.bot) return;

    let log = client.kanalbul(oldUser,"family-log")
    let chat = client.channels.cache.get(chatChannel)

    let Guild = client.guilds.cache.get(beş_config.guildID)
    let Member = Guild.members.cache.get(oldUser.id)
    if (tagData && tagData.some(tag => oldUser.displayName.includes(tag)) && !tagData.some(tag => newUser.displayName.includes(tag))) {
        if(log)log.send({ embeds: [new EmbedBuilder().setDescription(`> **${newUser} İsminden \`Tagımızı\` Çıkarttı Ailemizden Ayrıldı!**\n\n> **Önceki Kullanıcı Adı: \`${oldUser.displayName}\`**\n> **Sonraki Kullanıcı Adı: \`${newUser.displayName}\`**`).setColor(`#ff0000`)] })
        let role = Guild.roles.cache.get(familyRoles[0]);
        let roles = Member.roles.cache.clone().filter(e => e.managed || e.position < role.position);
        await Member.roles.set(roles).catch();
    }
    if (tagData && !tagData.some(tag => oldUser.displayName.includes(tag)) && tagData.some(tag => newUser.displayName.includes(tag))) {
        Member.roles.add(familyRoles[0])
        if(log)log.send({ embeds: [new EmbedBuilder().setDescription(`> **${newUser} İsmine \`Tagımızı\` Alarak Ailemize Katıldı!**\n\n> **Önceki Kullanıcı Adı: \`${oldUser.displayName}\`**\n> **Sonraki Kullanıcı Adı: \`${newUser.displayName}\`**`).setColor(`#00ff00`)] })
        if(chat)chat.send(`> **🎉 Tebrikler, ${newUser} Tag Alarak Ailemize Katıldı! Hoşgeldin.**`)
    }
    

}
module.exports.conf = { name: Events.GuildMemberUpdate }

slim cairn

GuildMemberUpdate Event

module.exports.conf = { name: Events.GuildMemberUpdate }

so member.user.displayName

but return undef

scarlet tangle

They told you in v14 there is no display name for users

Idk

vague coyote

There is in the dev version

slim cairn

ım using dev version

lastest

plain roverBOT

property User#displayName
The global name of this user, or their username if they don't have one

vague coyote
slim cairn

"discord.js": "^14.11.1-dev.1687738298-75d91b5.0",

vague coyote
slim cairn
vague coyote

No

npm ls discord.js

slim cairn

oh

vague coyote

Put that in the console and show a screenshot of the output

I can almost guarantee its a package like discord-giveaways that installs a previous version of djs

green plume

Why do I get this error while I try to get avatar URL of users without any avatar (default avatar)? I get this error only when the user is in new username system.

uncut kelp

You are not running /rest in dev

green plume

Ya I saw it in when you closed pr, can you please elaborate?

uncut kelp

In a nutshell you need to add an override for @discordjs/rest (or resolution for Yarn) to point it to "dev"

Like this

green plume

Oh okay

Sorry to disturb again, I hope this package.json file satisfies what you told. But I am still getting the same error.

{
  "name": "rolex-bot",
  "version": "1.0.0",
  "description": "Rolex is a multipurpose bot covering many features like security, moderation, logging, and welcomer.",
  "main": "index.js",
  "scripts": {
    "start": "node index.js"
  },
  "keywords": [
    "bot",
    "discord"
  ],
  "author": "Faiyaz Ahmed",
  "license": "UNLICENSED",
  "private": true,
  "engines": {
    "node": "18.x"
  },
  "dependencies": {
    "discord.js": "14.11.1-dev.1687781098-75d91b5.0",
    "@discordjs/rest": "dev",
    "mongoose": "^7.3.1"
  }
}
keen abyss

(btw, i ended up adding this)

"overrides": {
    "@discordjs/builders": "dev",
    "@discordjs/collection": "dev",
    "@discordjs/formatters": "dev",
    "@discordjs/rest": "dev",
    "@discordjs/util": "dev",
    "@discordjs/ws": "dev"
}
green plume

Hm so I need to do something like this?

  "dependencies": {
    "discord.js": "14.11.1-dev.1687781098-75d91b5.0",
    "mongoose": "^7.3.1"
  },
"overrides": {
    "@discordjs/rest": "dev"
}
keen abyss

That’s what that says

green plume

Okay lemme try

onyx sage

I am getting that same error Faze does

even with the overrides

steel haven

Show the output of npm ls discord-api-types then (and/or your package.json)

subtle isle

I have problem with my bot code

steel haven
slim cairn

While all api ping I do is 15 ms, why is the message delay time 5000ms?

rain bramble

You're probably rate limited and the question isn't related to the dev version

onyx sage
steel haven Show the output of `npm ls discord-api-types` then (and/or your package.json)

Sorry forgot about this but here:

Bot@0.0.1 C:\Users\Duel\Documents\GitHub\Bot - BETA
└─┬ discord.js@14.11.1-dev.1687953892-75d91b5.0
  ├─┬ @discordjs/builders@1.6.3 overridden
  │ └── discord-api-types@0.37.46 deduped
  ├─┬ @discordjs/formatters@0.3.1 overridden
  │ └── discord-api-types@0.37.46 deduped
  ├─┬ @discordjs/rest@1.7.1 overridden
  │ └── discord-api-types@0.37.46 deduped
  ├─┬ @discordjs/ws@0.8.3 overridden
  │ ├─┬ @discordjs/rest@1.7.1 overridden
  │ │ └── discord-api-types@0.37.46 deduped
  │ └── discord-api-types@0.37.46 deduped
  └── discord-api-types@0.37.46

package.json

{
    "name": "bot",
    "version": "0.0.1",
    "description": "bot",
    "main": "src/index.js",
    "scripts": {
        "start": "node .",
        "pretty": "prettier --write \"./**/*.{js,jsx,ts,tsx,json}\""
    },
    "nodemonConfig": {
        "ignore": [
            "package.json",
            "package-lock.json",
            "node_modules",
            ".prettierrc",
            ".gitignore",
            ".gitAttributes",
            "checklist.txt",
            "test/"
        ]
    },
    "author": ".duel",
    "license": "MIT",
    "dependencies": {
        "axios": "^1.4.0",
        "canvas": "^2.11.2",
        "date-season": "^0.0.2",
        "discord.js": "^14.11.1-dev.1687953892-75d91b5.0",
        "dotenv": "^16.3.1",
        "express": "^4.18.2",
        "mongodb": "^5.6.0",
        "mongoose": "^7.3.1",
        "node-cron": "^3.0.2"
    },
    "devDependencies": {
        "prettier": "^2.8.8"
    },
    "overrides": {
        "@discordjs/builders": "dev",
        "@discordjs/collection": "dev",
        "@discordjs/formatters": "dev",
        "@discordjs/rest": "dev",
        "@discordjs/util": "dev",
        "@discordjs/ws": "dev"
    }
}
TypeError: calculateUserDefaultAvatarIndex is not a function
    at get defaultAvatarURL [as defaultAvatarURL] (C:\Users\Duel\Documents\GitHub\Bot - BETA\node_modules\discord.js\src\structures\User.js:172:48)
    at User.displayAvatarURL (C:\Users\Duel\Documents\GitHub\Bot - BETA\node_modules\discord.js\src\structures\User.js:183:44)
    at Object.execute (C:\Users\Duel\Documents\GitHub\Bot - BETA\src\events\discord\welcome.js:41:53) uncaughtException

line:

const avatar = await Canvas.loadImage(member.user.displayAvatarURL({ extension: 'png' }));

under guildMemberAdd event

steel haven
warm quail

Hi. Can someone tell me what User#displayName returns if the user didn't switch to pomelo yet?

vague coyote

the username

displayName shows the displayName or the username if the user doesnt have one

onyx sage

I even removed the modules folder and install

steel haven

Can you npm ls @discordjs/rest explicitly?

warm quail
vague coyote

then... it still returns the username

warm quail

okay thanks

onyx sage
steel haven Can you `npm ls @discordjs/rest` explicitly?
bot@0.0.1 C:\Users\Duel\Documents\GitHub\Bot - BETA
└─┬ discord.js@14.11.1-dev.1687953892-75d91b5.0
  ├── @discordjs/rest@1.7.1 overridden
  └─┬ @discordjs/ws@0.8.3 overridden
    └── @discordjs/rest@1.7.1 overridden
steel haven

Meh, why doesn’t it show what version it‘s overridden with…Thonk

Do you use another package Manager than npm?

onyx sage

I got yarn but that’s for other projects

onyx sage

Any idea?

Bit stuck on this as to why it is not working

uncut kelp

Don't really know why that's happening. Just seems like your installation is not looking at your package.json

onyx sage

hm

uncut kelp

I would say wipe node_modules and ensured you've saved your file, but it seems like you've already done that. Dunno

onyx sage

Ok

I found the fix (Hopefully not a me thing)

I had to clear my npm cache and it started working

novel karma

sorry for disturb
but
can someone tell me how to fix list option in this

error of database

knotty plover

Doesn't seem at all related to the dev version of discord.js

bold night

here

haughty sorrel
sudden stirrup

Does the version that is being developed already return the pronouns?

uncut kelp

Discord doesn't in the first place

green plume

/builders or /ws automatically gets installed if I keep /rest in overrides?

steel haven

/builders and /ws get installed by discord.js as dependency, independent of if you have overrides for them. Just the version of them you get installed differs by that

fierce lantern

are we getting a 14.12 release anytime soon? what's blocking it? i find it pretty important because right now my bot can't really moderate globalNames before a new version gets released, and i'm not gonna really use the dev version in production

cursive venture

there is no eta

fierce lantern

yeah i know, but in other times maintainers have said in certain occasions what they want to have merged in main before releasing a (now former) new version

fallow iris
solemn sparrow
wooden sky
green plume

How do I get this in my required format?

uncut kelp
green plume

if I want to get different extensions like jpg, png, webp then? forceStatic will give a specific extension ig

uncut kelp

The extension is derived from extension which may be affected by forceStatic

green plume

Thanks, got it

steel haven
wooden sky
green plume

Is there any difference between user.displayAvatarURL(); and user.avatarURL();?

steel haven

The former will fallback to the URL of the appropriate default avatar if the later would be null. Same as in stable version

green plume

Okay 👍

fallow iris

Since I switched to dev I get these errors. What do I have to change?

steel haven

👆

fallow iris

👌

fallow iris

Somehow I get this warning even when I don’t use user.tag?

steel haven

trace-deprecation to show where the warning was created

Any third-party-library maybe?

green plume

🤔 When I put role id of normal role I get perfect output, but when I put the role id of @everyone I get 0.

rigid haven

that is how discord words

harsh path
green plume
harsh path

Hm, I'm not sure if this is relevant but does your bot have the guild members intent?

green plume

ya I have all intent

harsh path

Can you test if it happens on stable

green plume

Ya sure

works fine on stable

Do I have to do anything on my side or is it a bug which will be fixed?

snow crow
knotty plover

Can I just point out one little thing

Getting the everyone role this way is pointless

By definition, the everyone role is everyone

guild.memberCount

green plume

ya ik, but I have a roleinfo command. If someone does -roleinfo @everyone then in the member count it shows 0.

snow crow

you could fix that component with that fix

green plume

hm but writing a extra line of code doesn't mean anything if it's just a bug which will be fixed in the stable version

snow crow
green plume

hm

snow crow
knotty plover

displayName is a helper, it will return the username is globalName is not set

knotty plover

Depends if it's on a GuildMember or User. Different things

User: globalName > username
GuildMember: nickname > globalName > username

valid sparrow
knotty plover Depends if it's on a GuildMember or User. Different things

So if I'm using:
client.on(Events.VoiceStateUpdate, function (oldState, newState) {
What should I use to get the guild nickname, or in absence of one, their global display name?
right now, I'm using newState.member.displayName which returns either the nickname on the guild, or the username (not display name)

knotty plover

If youre on the latest dev it should be member.nickname > user.globalName > user.username

valid sparrow

I don't quite get the >. Does that mean that what I used to achieve before with member.displayName, I now have to do with member.nickname?

knotty plover

I just meant thats the order it prioritises things

valid sparrow

Adding to my question before:
just use member.nickname instead of member.displayName
or:

if(member.nickname) name = member.nickname
else if (member.globalName) name = member.globalName
else name = member.username

oh, okay, it's done internally

knotty plover

yeah, thats what member.displayName does itself

valid sparrow

perfect, thanks. So technically no changes are needed (at least in may case) from stable v14 to dev.

wild depot

i'm using @discordjs/core, how do i get my application id programatically? need it for registering slash commands

apologies if this isn't the correct channel as well

rain bramble
wild depot

oh, is it the same as the user id these days?

rain bramble

Yes

wild depot

cool, i'll just get the current user and grab id from that instead

👍

wild depot

one quick thing as well - i'm building a sort of "mini-library" on top of @discordjs/core, but should i be? would i be better just abstracting over the latest v14 version on the discord.js package?

...i want to assume this is the correct channel for asking this since the core package isn't used yet, right(???)

therefore "dev"- i don't know.

vague coyote

Its a subpackage anyone can use

wild depot

👍

versed temple
calculateUserDefaultAvatarIndex is not a function
at User.get defaultAvatarURL [as defaultAvatarURL] (/home/node/node_modules/discord.js/src/structures/User.js:169:48)
versed temple
uncut kelp

What have you attempted?

versed temple
uncut kelp What have you attempted?

I put this in package.json:

"overrides": {
    "@discordjs/builders": "dev",
    "@discordjs/collection": "dev",
    "@discordjs/formatters": "dev",
    "@discordjs/rest": "dev",
    "@discordjs/util": "dev",
    "@discordjs/ws": "dev"
}```
then I tried to give the command "npm i"
solemn sparrow
uncut kelp

Try updating your npm version

hollow crest

I am looking for discord server address where can I get discordjs task. If anyone know it, Please help me

steel haven
hollow crest
vague coyote

Your question makes no sense in its current state, so please try to rephrase it.

green plume

Em, what is this?

uncut kelp

An error

green plume

I can see that, is it a package side error or client side?

vague coyote

as long as you give it back 🙄

dark light
green plume

Hm okay 👍

rain cipher

hey can someone explain me the difference between displayName and globalName?

steel haven
rain cipher
steel haven

displayName is a getter that’ll return the globalName if the user has set one but will fallback to their username if they didn’t

globalName might be null, displayName never is

rain cipher

ok thank you

so globalName return only the display name and displayName return the display name or the username

steel haven

Umm, no. globalName returns the globalName. There is no displayName in the API. What the discord UI shows as displayname is actually the globalName

rain cipher

ok, thank you!

valid geyser

Will v15 support HTTP interactions?

rain bramble

No, never. discord.js based on the Gateway

uncut kelp

There may be a package for that in the future though (not the main library discord.js as said above though)

scarlet tangle

Well does anyone know a maintained package with that purpose?

uncut kelp
scarlet tangle

I'm aware of that, was looking for something that includes client methods like discord.js does

Ideally this would be disploy but sadly it's not maintained 😦

knotty plover

But....

Its HTTP interactions

The whole point is not having a client

The client is the gateway connection

scarlet tangle

Maybe it would be easier when @discordjs/structures is released

knotty plover

Again, there is no client

The structures, yes, I understand fully

You want the classes with their helper methods

scarlet tangle

Sure...

steel haven
silent hedge

yeah just use core

uncut kelp

These are the latest dev versions where they don't crash. Pin 'em, btw
"discord.js": "14.12.0-dev.1689552792-351a18b.0",
"@discordjs/rest": "1.8.0-dev.1689552764-351a18b.0" (override)

fierce lantern

why is djs polluting the global namespace with dom types? this will just confuse people into thinking some dom-only globals can be used

i believe a much better solution can be possible

velvet jasper
fierce lantern

what's the problem even? does undici force you to enable dom types? last time i used it (before fetch was enabled as a global) it didn't

if it's to use new globals like fetch or Request i think rest already handles this without importing the dom types

silent hedge

so thats probably why whoever updated those types opted for dom

fierce lantern

they still dont have them mmLol

silent hedge

lol

unlucky

fierce lantern

the pr that introduced it didn't explain much

but like if rest managed to do it i dont see why it should stay like this in djs

fierce lantern

i think im gonna try reverting that types change as long as it doesn't break anything

silent hedge

i'd rather we wait for @types/node to do their thing

since that's the proper fix

but like

so I think you'd have more fun opening a PR over there

fierce lantern

that issue has been opened for a long time yeah

but who knows, maybe it can be safely changed without breaking builds

steel haven

Rest doesn’t need them because rest is ts itself and the type files get generated from that. Mainlib is js though and needs the type file manually written

green plume
hoary fox

override your @discordjs/util to dev

green plume

Thanks

finite pond

does anyone know what happened here?

whole root

help

ashen tartan
whole root

you need to be patient as it can take time. contact your host if this is an ongoing issue. this is not discord.js related. #useful-servers

and please stop crossposting

finite pond

thx

cursive venture

dont crosspost

worn moss

I have a question - Is discord.js@dev worth it?

snow crow

...it is just the dev version (code before stable release)... but you shouldn't usually use if for production

iron latch

how to include the current dev version into a peerDeps checker?

uncut kelp

As soon as discord.js is loaded

rigid haven

huh, it's working fine for me on 14.12.0-dev.1690113844-6307f81.0

uncut kelp

No version of @discordjs/rest will work with 6307f81/anything past the aforementioned version. Using a override will immediately crash yet is needed due to reliance on methods imported from @discordjs/util. I don't recommend using anything past the recommended versions for now

deft prism

how do you get a guild member's permissions bit field in the dev version?

rain bramble

The same way as in #djs-help-v14
<GuildMember>.permissions.bitfield

deft prism

wait is this not support for the next version?

i thought next and dev were the same thing because i don't see a next channel

rain bramble

The next version isn't complete yet

deft prism

i already wrote most of my bot in the djs next version

rain bramble

You can't wrote in next because currently it exports only the version.
Probably you wrote in @discordjs/core that will be the core for the next version.

deft prism

yeah that's what i meant

so what do i do now

rain bramble

discord.js written in JavaScript and uses JSDoc, but the new website supports only TypeScript and TSDoc which other subpackages are written in. Btw there's a warning at the top of the page.

deft prism

the 'current stable' version is labelled as 'old' you can probably see why i thought using next was a good idea

cinder wraith

yeah, we know, but person who put it there doesn't want to change it 🤷‍♀️

haughty sorrel

blameCrawl

deft prism

so is there just no way to check a guild member's permissions? i've tried Client.requestGuildMembers and GuildsAPI.getMember but neither of them return permissions

cinder wraith

it's just GuildMember.permissions

which isn't particularly related to the dev version

steel haven

For questions relating to /core make a post in #986520997006032896 and tag it with @discordjs package

deft prism

ah ok

umbral slate

how is the dev version now 14.12.0 if the repo still has 14.11.0 lol

cinder wraith

what repo?

umbral slate

there's no mention of 14.12.0 there lol

uncut kelp

What happens is cliff-jumper sees 14.11.0 and compares commits from the latest release to see if there's any patches/minors/majors. The patches since the last version make it 14.11.1-dev, the minors make it 14.12.0-dev, and the majors make it 15.0.0-dev

south dove

Can you somehow get the User Pronouns?

haughty sorrel

No

unreal smelt

v15 in dev ?

knotty plover

no

unreal smelt
uncut kelp

Next version won't be version 15, if that's what you're asking

If not, what are you asking?

unreal smelt
knotty plover

the semver gets generated automatically I think

It just means it detected something which would be a breaking change

Not that we're releasing or even actively planning a v15

keen abyss

There’s nothing too breaking right?

knotty plover

I have no idea ¯_(ツ)_/¯

uncut kelp

There are no breaking changes in discord.js currently

keen abyss

Yh and a new entire version means breaking changes right?

uncut kelp

If it's a major version yes

knotty plover

generally thats why a major is released

unreal smelt
iron latch

We should fix that

vague coyote
iron latch

oh ok

npm i @discordjs/rest@dev

iron latch

the overrides thing doesn't work

iron latch

I'll just move to v14

cinder wraith

so it works with /rest being overriden to dev, but doesn't when overriden to 1.8.0-dev.1689552764-351a18b.0?

iron latch

it kees installing rest version 1.7

steel haven
iron latch
steel haven
iron latch

ok

scarlet tangle

anything to do w soundboards yet?

fierce lantern
uncut kelp
scarlet tangle
uncut kelp

Read the linked pull requests for more information, specifically the Discord API documentation one

scarlet tangle

alright thankyou 🙂

mystic lily
uncut kelp

|: No need to answer a question again

mystic lily

sorry you are true

onyx sage
winter topaz

And even if you insist on using the fetch global, don't just include all dom types

I guess i'm going to make a github issue for this since I place value on having accurate typings and having dom types vomited all over my node project is pretty disrupting

fierce lantern

i was gonna open one but i have many things to do, nice to see more people thinking the same

cinder wraith

Check pins

limpid flame
    "discord.js": "^14.12.0-dev.1689552792-351a18b.0",
uncut kelp

Read the message above yours

limpid flame
TypeError: calculateUserDefaultAvatarIndex is not a function

if i debugging ctx.resolveUser("thisID") normally returns me

User {
  id: '964086735422230538',
  bot: false,
  system: false,
  flags: UserFlagsBitField { bitfield: 64 },
  username: 'blookusny',
  globalName: 'Blookusny',
  discriminator: '0',
  avatar: 'e83da4969fc3348506d3487f4cf41e93',
  banner: undefined,
  accentColor: undefined,
  avatarDecoration: null
}
uncut kelp

Did you just repeat yourself

scarlet tangle

I'm having an issue with my whitelist system, whenever I invite the bot it just leaves how can I make it join once to be able to use the whitelist command in the future

uncut kelp

What is your discord.js version?

scarlet tangle
sinful helm
cinder wraith

it is very unlikely that they are actually using a dev version, which means that this isn't really the channel for this

hasty gorge

is anybody else having this issue?

uncut kelp

Nothing is in dev

hasty gorge
uncut kelp

Impossible

There is no difference between the stable and development versions

No commits since

hasty gorge

well, what could cause it then

one sec, i'll install stable and see if it still happens

ok still happens, imma go back to help ig

idle galleon
hasty gorge
pine compass

so are there any big changes in v15 planned? backreading here people say its almost the same as v14 latest

rigid haven

it's not planned (yet)

rain bramble
sinful helm
uncut kelp

Ask them

The description is poor

sinful helm
idle galleon

Others gonna look at the PR and have the same question

sinful helm
covert cipher

don't worry about it

sinful helm

But you didn't explain what it does

covert cipher

it will be updated when it is ready for you to look at it

idle galleon

I don’t see state in ddocs, so I’m assuming it’s an upcoming addition to dapi

silent hedge

honestly, rather than cause this discourse you should just not open the PR until then

mystic lily

is there is a way to get a guild's soundboard sounds from like /guilds/<id>/soundboard
something like that thats just example

uncut kelp

No

covert cipher
frank atlas

finally custom status for the bot

mystic lily

advaith blobreach

south dove

Doesnt work for me

@covert cipher Is it already in the dev?

Or is it an rollout?

rain bramble

That's an open PR in discord-api-docs. discord.js won't implement it until it's merged

south dove
solid sail

not yet

rain bramble
south dove

Is there any way enabling it currently?

rain bramble

Use a patched version of discord.js eg the branch of #9743

south dove
sinful helm

You need to pass state param in while setting the activity

harsh path

It's not recommended to directly change code in node_modules

snow crow

Your best option is cloning the repo (with edits), and link it like recommended for contributing

south dove

Are there any news about it in a officiall dev version?

hoary fox

discord api docs pr was merged
so close to merging djs pr

south dove

How do I know, that it is pushed into djs?

vague coyote

by... looking at the pr?

dull mulchBOT
uncut kelp

It's great that people are always excited about upcoming features but ultimately that doesn't actually speed anything up

All you can do is wait for the next release, which will be announced in #announcements

scarlet tangle

Lol

cursive venture

are you ok?

vague coyote

Keep the shitposting to a different server, thanks

cursive venture

into the demon realm you go

tawdry needle
uncut kelp

It will be now

tawdry needle

lmao aight fair enough

i just woke up so idk if this really makes sense to ask, but why wasn't it already pinned?

steel haven

Because both have downsides. New things being added in the API without the type for it available can break too, while installing the new dapi-types can fix that issue. So it’s mostly a judgment on what’s the lesser evil

tawdry needle
uncut kelp

@hoary fox can you stop commenting one-by-one

You're giving me a bunch of individual notifications

In any case, I don't think they shold be documented as nullable, because it's not the actual full class structure that has the null properties, but the interface... but not sure entirely

hoary fox

well like user
whose username is nullable
so i guess it should be

and sorry

junior cove

Is there an estimated release date for version 15 of Discord.js?

keen abyss

We do not do eta's

junior cove

oh yes, thanks for letting me know

short turret

Hello everyone i just have a quick question, i started a project using @discordjs/core and @discordjs/builders but i don't find everything that i want on the doc. Can someone explain me difference between discord.js and the version that i am using (i know that mine is the next but what are the differences ?). Is everything implemented in @discordjs ? Thanks by advance for your responses, have a nice day !

rigid haven
short turret

Oh ok thanks, but why on the doc there is the .old on discord.js doc and a message telling that @discordjs is the next version ?

rigid haven

that's the old vs new docs, the new docs only support typescript packages so that's why discord.js isn't moved over yet

short turret

Ok thanks a lot, so it is normal that i don't find everything i want on the new docs, right ?

rigid haven

yes

dawn phoenix

"everything you want" is a rather broad statement and depends entirely on what you want
if you expect things a package does not have, you won't find them documented

short turret

I want to do button interactions, sorry to not have precised it.

steel haven

They happen on interactionCreate event. Which core does emit

short turret

ok thanks a lot

high flame

hey

wanted to contribute to the lib

how to get started , it might be my first opensource contribution

hoary fox

You can wait for some simple issue to make
or add some feature which can be found on discord api docs
also remember to follow contribution guide

rigid haven

Looks like the dev release workflow broke

hoary fox

looks like caused by crawls pnpm pr

@woven grove could you fix it?

silent hedge
rigid haven

👍

silent hedge
snow crow

also is this why the || true is probably a bad idea

silent hedge

yes

but its needed for regular function POGGERS

silent hedge

i think we got it

should have a set of releases for most packages out now

we're tryna figure out if there's a better fix

but that'll have to wait till tomorrow

sometime this week they should start working on schedule again though either way

snow crow

very nice, also what efficiency has occured for the reduction of size...

idle galleon

You make that difference sound significant

velvet jasper

I mean 25% reduction isn’t insignificant either

silent hedge

actually it is no one cares abt size

snow crow

i mean, the size i don't care about, but i kinda am wondering what has been done to improve it that much (as it doesn't seem to that much code changes that would be so significant)

does pnpm bundle code better ... (better compression?)

silent hedge

nah i dont think it has anything to do with the package manager

im honestly not sure what it is, i dont think we've done anything explicit to improve it

feel like it could just be a matter of some dep(s) we bumped being smaller now

steel haven

Better question would be why 14.13 was so big. Because all versions before it and the recent after were about 1.5-1.7MB

silent hedge

lol

uncut kelp

It's because the changelog is not published in development releases

Or at least, in this development release

It's the only difference I could find

silent hedge

that's only half a mb tho

steel haven

Which is exactly the difference between 1.5MB and 2.0MB

silent hedge

oh

yeah

02lul

snow crow

ahh that makes sense... has there been that many versions...

subtle gazelle

Please add the ability to call the bot to the user in Discord.js version 15

jaunty vault

d.js can only add features that the Discord Bot API supports, and DM calls are not supported.

subtle gazelle

🙄

How is the streaming?

vague coyote

d.js can only add features that the Discord Bot API supports, and streaming is not supported.

subtle gazelle

Ok, but what does Discord want to add in V15 that will surprise us?

vague coyote

Nobody knows that

v15 has no reason to exist yet

subtle gazelle

🐈‍⬛

fierce lantern
winter topaz

nice!

fierce lantern

i'm unsure on how to fix it though

winter topaz

hmm let me see

SleepingNade

right, install fails after 6 minutes due to node-gyp...

anyway, i think this should be resolved by just replacing Websocket; with WebSocket.WebSocket;

WebSocket here is the * as WebSocket import from the "ws" library

fierce lantern

i'm thinking of replacing the import with import { Data, WebSocket } from 'ws' (data is used as WebSocket.Data right now

winter topaz

the import of dom types overwrites WebSocket to mean the dom WebSocket

winter topaz

but then you have to change a lot more to account for all current WebSocket.Something ussages

fierce lantern

maybe import data as WebSocketData

fierce lantern
winter topaz

ah right

hmh, either should be fine then.

probably still prefer not importing it as WebSocketData to avoid confusion since a lot of WebSocket* names are by discord.js

WebSocketOptions WebSocketManager etc

fierce lantern

yeah but Data can mean virtually anything

winter topaz

yeah just Data is worse

i guess stay with the import * as WebSocket and use WebSocket.WebSocket or go with WebSocketData and see if anyone complains ¯_(ツ)_/¯

but yeah that makes it clear that whoever added the reference to dom types had no idea what they were doing lol

fierce lantern

just commited the latter

\🎉

winter topaz

nice. pr link for anyone else reading

real flume

Is there a way for me to assign myself to an issue on GH?

uncut kelp

No

real flume

Whenever I save index.d.ts, the file gets linted. I know this is intended behavior in VSCode.
However, simply saving the file (without any modifications) already results in 65 lines getting linted.

I'm not quite sure if I'm doing something wrong here. Any pointers?

steel haven
sinful helm
real flume

That is exactly what I’m doing

And I think it’s kinda weird for a random person who has barely contributed to just style: lint out of nowhere.
Or more specifically, I find it weird that this file seemingly wasn’t linted in a long time. Why does ESLint want to do something now, all of the sudden?

uncut kelp

When you run the format script, do they go away?

uncut kelp
real flume

Nope, I deleted the discord.js repo from my disk and then followed the guidelines from the contribution guidelines, including a completely fresh git clone

  • pnpm run test keeps failing with 27/28 tests (discordjs#test being the one that fails)
  • pnpm run format and pnpm run lint finish without errors, but do not affect packages/discord.js/typings/index.d.ts

Seems like the file doesn't get linted by any of the scripts. It's like I'm the first person attempting to lint this file since forever. Maybe nobody else was using VSCode for editing until now, but automatic linting got added more than 20 months ago with commit #7244.

silent hedge

well its likely our configs are just different given its a new-ish feature

ive been using mine for like 3-4 years

uncut kelp

pnpm run format and pnpm run lint finish without errors, but do not affect packages/discord.js/typings/index.d.ts
They do "lint": "prettier --check . && tslint typings/index.d.ts...

Going to take a wild guess and assume when you're saving, it's your own configuration overriding the workspace

real flume

Oh wow, that thought never crossed my min. And it was actually the culprit.
Resetting my user profile did the trick.

Specifically, this setting:

{
  "[typescript]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
  },
}
real flume

Alright, one more thing left standing between me and comitting to the repo:
Tests still keep failing. Is this a known issue perchance?

velvet jasper
real flume

Sure, I’ll give it a shot. Felt like I should have done that from the get-go.

Especially since I ran into tremendous issues (two bugs in MSBuild) with setting up node-gyp.

real flume

Alright, tests are passing now (actually, they've been passing since yesterday)

real flume

Decided to do a sanity check after always getting "cache hit, suppresing logs" on all tests.
Lo and behold, I don't think this should be passing. Am I doing something wrong?

Alright, apparently editing files in packages/discord.js/ doesn't affect the tests run from the repo root.
I also need to run tests in the respective package.

rigid haven
knotty plover

makes sense

cinder wraith

given how this file gets changed like everyday recently, it probably was at some point
not like it's relevant much, it's just couple lines lower at the time of writing this message, and the typing in question is still there

dull mulchBOT
hearty crystal

How to delete an embed send by bot with message id

vague coyote
hearty crystal

Sry channel changed

haughty nebula
meager crag

On discord-api-types.dev, Vercel is currently pointing the "view source" icon links in the API browser towards the non-existent "master" branch on Github. Although Github redirects the browser to the equivalent URL on main, it still flashes an error message first. Is there any way to alter this?

velvet jasper

cc @boreal knot

boreal knot

oh god

meager crag
boreal knot

the website will eventually be replaced with the current style of discordjs.dev one, so... I'm not sure how to fix it right now as the website is wired up with literal throughts and prayers

forest elm

i believe i found it

boreal knot

oh?

boreal knot
daring latch

is there any way I can get the "real" permission bitfield, as in, not the one djs calculated?
The PRs are not merged in upstream discord-api-docs so I get why they aren't added to djs, but can I somehow calculate them myself without doing additional api requests? E.g. using a raw value from Discord?

scarlet tangle

Hi, I want to create an economics bot but I don't know how. Can anyone help me? Remembering that I'm Brazilian and I'm using the translator for this sentence haha

cinder wraith

this is not a channel for stuff like that. and then in proper support channels you won't get much more than link to the guide, unless you have some more specific issues than "i don't know how to make a bot"

white gazelle

Does the in-dev version have any of the new monetization features yet?

cinder wraith

there is a PR for that, not sure if it has been merged yet though, kinda doubt

white gazelle

Yh saw that and therefore was just wondering. Guess I'll go with raw API until it comes to stable. Thank you for a quick reply.

forest elm

the api for it is not stable, so it probably wont be merged for a while

frank basalt

Can anyone help ?

About discord.js v14 StringSelectMenuBilder

haughty sorrel
frank basalt

const row = new ActionRowBuilder().addComponents(selectMenu);
await interaction.reply({ components: [row] });

const filter = (i: StringSelectMenuBuilder) => i.customId === 'ai.settings' && i.user.id === interaction.user.id;
const collector = interaction.channel.createMessageComponentCollector({ filter, time: 60000 });

collector.on('collect', async (interaction: SelectMenuInteraction) => {
  await aiHistory.findOneAndUpdate({ userId: member.id }, { $set: { model: interaction.values[0] } })
  await interaction.update({ content: `Selected model: ${interaction.values[0]}`, components: [row] });
});

frank basalt
frank basalt
haughty sorrel

This doesn't look anything related to the dev version, but i should be typed as StringSelectMenuInteraction, use #djs-help-v14 or #986520997006032896 in the future please

frank basalt

Okay

cerulean charm
uncut kelp

You can view the pull request

cerulean charm

where can i find that

uncut kelp

On GitHub

cerulean charm

i am looking can't find one called entitlements

uncut kelp

It's the first and only result when you search it /:

Entitlements are only a small part of what's being implemented

Premium application subscriptions are here

cerulean charm

thanks i just couldn't find it

yeah it's a pretty decent sized update change

uncut kelp

Yup

cerulean charm

it would be cool to use it! You guys always do a nice job updating and making it more easy for people that code with it to understand

I'm not too sure how to understand what all these things mean but i guess it's being worked on

uncut kelp

Those are just status checks of the pull request, but yeah, it's currently being blocked because the API is still changing (Discord are still documenting it)

dull mulchBOT
uncut kelp

This, for example

cerulean charm

Oh so discord is still changing things understandable, cause what would be the point to code it and then to just update/change it again later

Well thanks for showing me and explaining some details to me, i'll come check it out again at some point later on. Good luck

cerulean charm
uncut kelp This, for example

i did wanna ask you one more thing if you remember those events would those be gateway events like the rest of them?

Like:

ENTITLEMENT_CREATE
ENTITLEMENT_UPDATE
ENTITLEMENT_DELETE

rigid haven

they will be

uncut kelp

Those will be added yeah

cerulean charm

alright

vocal grotto

Good morning !
I would like to know if the functionality allowing you to manage premium bots implemented by Discord will soon be supported or not? And if so in approximately how long, thank you in advance!

cursive venture

there is no ETA, and it will be released once its stable enough

vocal grotto

Ok thank you

velvet jasper

There’s a pr for djs I believe

cinder wraith
hexed horizon

is the use of pictures in modals going to be available anytime soon?

uncut kelp

We can only add what Discord implements

uncut kelp

Have you checked the comment?

Here works

How did you reach that conclusion?

Are you checking a log output?

forest elm

properties are not enumerable by default when set via Object.defineProperty(), so client will not show up if you just console.log(interaction.webhook)

steel haven

Your original issue you had was caused by you confusing InteractionWebhook and Interaction. The former has no followUp method, it has .send

Which could have easily been explained if you didn’t completely delete all your messages about it

random cobalt

Hi sorry for revisiting this issue but this has brought attention to me that @types/node, which is a dependency of @types/ws, will cause type conflicts with bun-types...

Steps to reproduce:

  1. Create a new Bun project
  2. Write something in index.ts that uses bun types, for example RequestInit
  3. Include something from discord.js from another file or index.ts, basically anywhere in the project
  4. Shows error in index.ts because the type definition has a conflict
silent hedge

we follow correct TS practice

random cobalt

Ok, I'll just delete the directory manually then

steel haven

Or report to bun, they tend to fix issues like these if they know about them

snow crow

fyi they already asked in the Bun server, but they said it was a TS issue

steel haven

Well. Bun was made to run ts directly. It doesn’t seem to do that, so it is a bun issue🤷‍♂️

snow crow

as in typescript (in vscode) was emitting the error

meager crag

@dawn phoenix as a slight offshoot to #9999, is there a reason why ThreadMemberManager#remove doesn't accept a UserResolvable like other similar manager functions?

dawn phoenix

i don't know

cc: @tawdry mantle looks like the initial implementation was from you, was there a specific reason?
if not that could be retrofitted in patch, as it's a subset of userresolvable - or threadmemberresolvable (whatever the difference here is)

vague coyote

threadmemberresolvable also allows you to pass a threadmember object

dawn phoenix

which would be the appropriate choice here, then

meager crag

the two types have been exactly identical ever since the threads implementation was merged, I guess the semantics are that one's intended to be passed to ThreadMemberManager#resolve and the other to UserManager#resolve

cerulean charm

or was that only one part of a change to the discord api

cursive venture

No, not yet

cerulean charm

alright

prime ridge

Discord.js Will it be part of the multi-ban?

cinder wraith

if the api will be available to bots and documented. nothing we have any say on though.

meager crag
uncut kelp

Use the main version for now

meager crag

👍

meager crag
cinder wraith

see, i'm not the only one

arctic lodge

The guide tells:

All caches holding the respective structure type might return partials as well!
But the typings for cache collections do not take partials into account
Should they?

uncut kelp

Personally, I feel it's best left as it is. If you use partials, I guess you should know to check the partial property of relevant structures just in case. Not sure what others think about this

I say it's best left as it is because typing something as Collection<Snowflake, Message | PartialMessage> will assume every message in the cache to be partial even if you're not using them. Not sure if there's a smart way around that without it being hacky

rigid haven

just noticed we have underscore and escapeUnderline - that should be made consistent at some point

rigid haven

👍

hoary fox
meager crag

For example, searching for the Client#ready event yields the URL /docs/packages/discord.js/Client:Class/main/ready:Event, whereas it should resolve to /docs/packages/discord.js/main/Client:Class#ready

dull mulchBOT
steel haven

Yes, we know. And we are working on getting that fixed for quite some time already. Bare with us on that

primal perch

Hey guys for discord RPC js how do I make it so when discord is closed the RPC program stops

steel haven
cursive venture
meager crag

@velvet jasper: there's a problem with your draft implementation of await using. TS >=5.2 will only generate the polyfill code if the build target is ES2022 or earlier. If it's set to ESNext (as discord.js currently is), it'll assume that you're running on a JS engine with the TC39 draft specification implemented as standard, and will leave the await using statement in place without transforming/polyfilling it

this isn't technically a library issue for the discord.js package, since it's not transpiled (although does limit end-users on how they configure their TS project); however, for transpiled packages like ws, it simply won't compile into executable code unless the project's tsconfig is changed to target es2022 or earlier

steel haven
velvet jasper
meager crag

by the way, I suspect the discord.js typings would need something like a global-scope declare interface AsyncDisposable {} to avoid compilation errors for users who don't have esnext.disposable in their library includes

velvet jasper

I tested that as well and it only errors if the users use the using syntax in their code. It goes away if it's not there

and they should have the correct tsconfig anyways if they're using using

Yes but despite that, only users who are actually using the new syntax will get an error. TS seems to ignore the interface otherwise. Here I'm using the same tsconfig without esnext.disposable:

the only issue you'd run into is if you have skipLibCheck set to false. But by default it's true and I don't see a reason as to why it would need to be false.

steel haven

Did you check with mainlib Client too?

velvet jasper

yeah same behavior as ws

I also just realized that ts will also typecheck using statements. Here I used using instead of the proper await using. Neat

meager crag
stable bane

Can anyone show me how to make the bot online 24/7 on replit?

cursive venture

use a proper host

and use the proper channel, none of this is djs related, esp not related to the dev version

pure pike

hey ! I got an issue can someone help me pls ? :) :

              new DiscordAPIError(res.request.path, res.body, res.request.method) : err);
              ^

DiscordAPIError: Cannot send messages to this user
    at C:\Users\Vincent\Downloads\AddDmBot\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:85:15
    at C:\Users\Vincent\Downloads\AddDmBot\node_modules\snekfetch\src\index.js:215:21
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  path: '/api/v7/users/922921353823285339/channels',
  code: 50007,
  method: 'POST'
}```
uncut kelp

What discord.js version are you using?

pure pike

i npm install discordjs 12

but i guess this bot is too old (i dev it on v12)

steel haven

Yes. It’s way too old. This channel is for the dev release. Update to v13 (or while you’re at it to v14) and use #archive-djs-help-v13 / #djs-help-v14 for your questions then

pure pike

thank you! have a great day

and i have a last question, have u any idea how to host my bot on a raspberry pi ?

solemn sparrow

Wondering why the REST client event emitter has typings but the client event emitter doesn't have typings? I get typing errors specifically for the REST client emitter but not any other emitter in the library.

solid sail
solemn sparrow

its typed as a string

solemn sparrow
solid sail

i guess it's an oversight as the djs client inherits from the node.js EventEmitter which doesn't have strict typing by default unlike the rest class that inherits from a custom AsyncEventEmitter that does support strict typing

meager crag

the typings enforce the correct callback/parameter types for an event keyed in ClientEvents

the reason it has to also allow event names in Exclude<Event, keyof ClientEvents> is because otherwise you can't extend the class and override it with your own events

scarlet tangle

are there many bugs in dev version?

im planning on using it because of the app subscriptions…

knotty plover

Shouldn't be, no

midnight plume
scarlet tangle
midnight plume
scarlet tangle

does

client.application.entitlements.fetch();

only show ACTIVE subscriptions?

uncut kelp

Active and expired

That's why excludeEnded exists if you only want active ones

scarlet tangle

how would I use that?

    const entitlements = await client.application.entitlements.fetch();
    const isPremium = entitlements.some(entitlement => entitlement.guildId == message.guild.id);
    if (!isPremium) {
        message.sendPremiumRequired();
        return true;
    }

that's my current code

scarlet tangle

aah
like this?

client.application.entitlements.fetch({
excludeEnded: true // or false, depending on requirement??
});

uncut kelp

Yeah

scarlet tangle

ty 🙂

const entitlements = await client.application.entitlements.fetch({
        excludeEnded: true,
        guild: message.guild.id
    });
    if (!entitlements) {
        message.sendPremiumRequired();
        return true;
    }

so I can also use the guild object parameter and make the process a bit faster correct?

uncut kelp

Sure

forest elm

That if statement won't work as the fetch() method always returns a collection. You have to check the size of it instead

scarlet tangle
meager crag

thoughts on a postcard. there are plenty of async functions in the library that return Promises forwarded from other async functions, such as this.fetchReply() wherever a message is sent with the fetchReply option. obviously not an issue, other than for that if the downstream async function throws, the function the user actually called (message.send or whatever) doesn't appear in the call stack for the rejection, making debugging slightly harder

the alternative would be to return await downstreamAsyncFunction() rather than downstreamAsyncFunction() where this occurs, containing the awaited return within the called function's own Promise rather than returning the downstream function's Promise

don't know whether you'd consider that a worthwhile change

cerulean charm

did entitlements come out? I see many people in here talking about it so figured i'd ask i believe i updated correctly and i can't find it under client.application

uncut kelp

This is the dev channel, you need to be on the dev version

cerulean charm

Oh shoot that's why so it didn't come out officially yet then. My bad then

I was wondering why it wasn't announced

steel haven
meager crag

given that return await <Promise> resolves sooner than return <Promise> since ES2019, it seems like a viable paradigm, but the differences are obviously small

steel haven

But only if the function itself is async. It‘s also done in a few functions that aren’t async themselves but just return promises from other functions they call

haughty sorrel

I think EmojiId and EmojiName would be better as pretty sure it can't be Id and Name because of an ESLint rule but let's see what the contributors think, and it'd be nice if you wrote tests for this change, yes

uncut kelp

I think EmojiId and EmojiName would be better
Same

steel haven

Just one, the one which takes an object as single parameter

uncut kelp

Look at the tests you added. There are no overloads that narrow between animated emojis for objects, so it's always a union. None of them are assignable to what you expect them to be

You'll need two more overloads: animated with true and false. Basically, recreate line 316 and 325 but for objects

scarlet tangle
knotty plover

Not yet but appreciate you calling it out. Haven't had time to think about it

I did suspect it was too easy to be perfect lol

So it's specifically the components on a previously updated ephemeral message that will break?

scarlet tangle
knotty plover So it's specifically the components on a previously updated ephemeral message th...

Yes, from my understanding, when we want to collect interaction on component (placed on ephemeral messages) there is two cases depending on the source of the message :

  • .update return an InteractionResponse object where the button we want to listen is on the same message of the original interaction ||that's why the condition was added||
  • .reply will return an InteractionResponse object but the button we want to listen is on another message (not the one indicated in response.interaction.message.id. The problem is that we don't have the ID the another message (without fetching it)

On my project, for a quick fix since it broke a big module, I now fetch the reply to have the full message to attach the listener instead of an InteractionResponse

knotty plover

fetchReply is the workaround we've been advising but trying to avoid that being necessary, since then its not an InteractionResponse at all

scarlet tangle
scarlet tangle
scarlet tangle

Hm I may have an idea but I don't really know if it's clean but in theory it seems to partially work.

Here are some implementation details:

  • InteractionResponse
    • New property messageId. In the case of an update or a deferUpdate it will be equal to the id of the message linked to the interaction ||interaction.message.id||, otherwise it will be set to null
  • InteractionCollector
    • New property messageReferenceId. It will be equal to null EXCEPT if interactionResponse is passed in the options and interactionResponse.messageId is null, in which case we set the value to interactionResponse.interaction.message.id.
    • Update computation of messageId. this.messageId = options.message?.id ?? options.interactionResponse?.messageId ?? null;
    • New check in collect(interaction). if (interaction.message.type === MessageType.Reply && this.messageReferenceId && interaction.message?.reference?.messageId !== this.messageReferenceId) return null;

UPDATE: There is still a problem if there is 2 reply after 2 interaction on a button on the same message

haughty sorrel

And there's also another one, are you testing changes locally?

You should be testing changes locally, please read this

This isn't hard coding though, and that's how it is for all the other formatters

vague echo

What are the key differences between v14 and dev version?

cursive venture

dev version has new features that have yet to be released but can break

vague echo
cursive venture

on github probably

but i think for now its just entitlements

vague echo
twin pivot

Can someone please go over the documentation repo PRs?

steel haven

What is your actual intention/question?

You‘re not seriously pinging me about a PR to the guide you made 27 minutes ago just because of a small detail in OAuth2 which you think should get a warning box, do you? That’s not even djs related, it‘s an additional topic…

twin pivot
steel haven
twin pivot

jesus im sorry

my fault bro

rustic plinth

can anyone tell me why isn't there a constant called Limits in discord.js which would contain all the limits for example custom id character limit or webhooks per channel limit, is there a reason or no one just ever cared about it

white nebula

because limits can change at any time, and waiting for djs' Limits to be updated and published could quickly become out of sync with the API's changes
same reason limits aren't included in djs' documentation either

rigid haven
solemn sparrow

Just to add on to what squid said, adding hard-coded limits (whether used internally or not) would eventually force the developer to update the package, which could possibly have unintended consequences for current code

meager crag
cursive venture

yeah, something went wrong there

knotty plover

Structures is in development

Unsure what you mean by cache package - most of our modules are designed to be separate, for you to build your own caching system around should you want one, like Redis

You can just use a Map/Collection then

There is no caching package in development

There's nothing special about caching. @discordjs/collection already exists, which is the data structure we use for caches on the managers

Any other form of automatic-caching is inherently tied into the library events, which is what the main discord.js package handles for you

You could argue that the main lib is the "caching-enabled" one

I dont understand

Its already the main lib

There's nothing new to implement

no, it wont be any more separated than it is now

That's already what the main lib is now, combining the separate packages

Im not sure where the idea that v15 will be drastically different is coming from

All good, sorry haha

pastel flare

If I'm not mistaken, major version changes are intended for when you flip the table big time.

So one would hope we stay on v14 until Discord change things massivly...which I hope never happens.

Is the above an accurate hypothesis?

steel haven

Major version changes happen when breaking changes in the library happen. Those can have several reasons. For example the long discussed typescript rewrite. Or discord releasing a new API version. Or …

solid sail
pastel flare If I'm not mistaken, major version changes are intended for when you flip the ta...

Im pretty sure discord.js uses semantic versioning which you can read about here: https://semver.org

Unfortunately with the ever-evolving discord api, some decisions that discord.js believed were good to have, must be changed over time to be able to easily conform to the new discord api when it updates next time, so i also personally don't believe that having 14+ major versions is a big surprise when working with the discord api

pastel flare

Both great replies.
Lets hope we get to enjoy v14 for a while...least until TS rewrite happens

weak ridge

Hi! Does someone know why does it returns -1?
Here's the code:

const ping = client.ws.ping;
console.log(ping);
cursive venture

and thats because the first heartbeat hasnt been sent yet, you have to wait a little

weak ridge
cursive venture
weak ridge

A deferReply?

cursive venture

no

you have to wait

idle galleon

Ur running it in an event?

weak ridge
idle galleon

Can you log client.isReady()?

weak ridge

true

cursive venture

just wait, it can take a max of 41s for the first heartbeat to be sent

cursive venture

yes

weak ridge

It works, but now it only returns 101ms, is that normal?

cursive venture

yes

weak ridge
keen bobcat

What's the question here

weak ridge
rigid haven

if you want to get the time it takes for your bot to respond to a command, which is what most people think of as a ping, then send a message like Pinging... then edit it with message.createdAt - interaction.createdAt

steel haven
rigid haven

oh

srry

steel haven

No, breaking changes only happen on major versions

But doesn’t 14.14.1 already have premium app subscriptions released?

brisk elbow

Do you know if there are any plans to add dropdown options (roles, channels etc etc) to modals?

vague coyote

Unfortunately you gonna have to ask discord that, not us.
#useful-servers I suggest you ask on the Discord Developers server

regal mason

Hi, does this version supports premium commands or premium app features yet ?

rigid haven

the dev version does yes

uncut kelp

Please tell me you have read the solution

So what's the issue

If you mean it should be located in your dependencies, then no. It should be located in your overrides

rigid haven

FYI - this is a good long-term solution that I use

tame axle
uncut kelp

There are 3 dependent pull requests. There's nothing to continue

tame axle

Question goes the same for the other 3 🙃

They seem pretty stale 😦

uncut kelp

You should ask Discord then

tame axle

Dependant on api docs while they are already known?

Yet other libraries have implemented it 🙃

uncut kelp

There are no merged mentioned pull requests on the two open pull requests by Discord. I'm not sure you're reading this properly

Suppose the most we can do is split the one that is merged

tame axle

I am not sure you are 🙃

2 dependencies are of the discord-api-docs, which are nothing more but documentation descriptors

1 is on discord-api-types, which is just as stale as this one, which is the only hard dependency

uncut kelp

I don't know what to tell you other than you are wrong

tame axle

Then enlighten me

knotty plover

We do not implement undocumented features

If the discord-api-docs are not merged, then it remains undocumented

And we will not implement

tame axle
knotty plover

Thats why theres an open PR

Its ready to be added, when the documentation is confirmed

Syjalo isnt a maintainer though, not their call

tame axle

Which btw, is just stupid in itself, it's a feature that's been added, it's something that's already exposed to the public. Yet we bot maintainers can not use it because djs decides such a way of working. Other libs have already implemented

knotty plover

k

tame axle

I am not aware of that, and otherwise he should've been correct 🙃

I'll patch it in myself then, thanks

knotty plover

k

That response was to an off-topic question anyway

You've misread it

silent hedge
tame axle
silent hedge

no, it can't. documented features don't just change other than in extraordinary circumstances

look man, stick to writing applications

you clearly have like, no idea what goes into maintaining a library

errant idol

if the change is that major

silent hedge

nkoSigh we're talking about documentation that is not yet merged

errant idol

oh

spark hearth

I think I know the answer to this question, but new releases are completed on a "it's done when it's done" basis, right?

plush rune