#djs-in-dev-version
35223 messages · Page 33 of 36
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.
understand
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')
No. Either dev version or wait for the next release (14.12)
ok
ty @rain bramble @steel haven
when is the next update?
We don’t do ETAs
ok
is there anything for usernames
Documentation suggestion for @south dove:
User#globalName
The global name of this user
How can i install the latest discord.js dev?
channel topic
Ah got it
So Display Name is .globalName and .username is now the username (ipexa) ?
yes
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
i guess
okay thanks so much
you could also just use user.discriminator === '0' ? user.username : user.tag
but i mean soon there is only going to be usernames
oh, but bots keep them
let user;
if (auditCache.executor.username && auditCache.executor.discriminator) {
user = `${auditCache.executor.username}#${auditCache.executor.discriminator}`;
} else if (auditCache.executor.username) {
user = `@${auditCache.executor.username}`;
} else {
user = `???`;
}```

isnt that good? 😂
literally copy paste and replace user with whatever the user variable is
ok chef
I see the deprecated spam in the console with .tag
well yeah
but with that i wouldnt have the deprecated spam
When you say spam do you mean once per run? Or actually logging more than once? Because it should only emit that warning once
I think it was there multiple times
Can you reproduce and if so open an issue on GitHub? Because it definitely shouldn’t
I try to reproduce it, I changed back to stable
When will the full version be released? (v14.11.1)
when its done, we dont do ETAs
guys do you find the wording confusing? for the description of filterOld param
Whether to only consider messages within 2 weeks
This would probably be a better description.
Messages that are more than two weeks old will be automatically filtered out and removed.
i thought of this initially
All of those are still confusing imo
I also thought of "Filters messages out of the collection that are older than 2 weeks"
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
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
"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?
It does yes.
, interesting its false as default
Yes, because if you tell it to delete 30 messages, it is supposed to try and delete 30 messages until you explicitly allow less
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
i dont think making it longer will make it easier to read
"Removes messages from being deleted that are more than two weeks old."
Had to go but
Ensures messages older than 2 weeks are not considered
Consider only messages younger than 2 weeks
Consider only messages within 2 weeks
Considered?
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

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
Well, it's a direct APIError, not our own
That should probably say why it isn't documented
should djs emit an error if theres a message in the collection that is older than two weeks?
I would prefer we didn't
Didn't we go away from guarding against such api errors?
Also, what's the difference anyway
Saving a potential API call
You have to do it anyway
Cause you did not delete anything
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
a 4xx code at that
it'd be a nice potential idea in a new major or rewrite
:/
How would you even communicate why djs prevented the call
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
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
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 🙃
Isn't this why we have the filterOld parameter...?
Yes
love how this went from a phrasing issue to a topic on invalid api calls 
You started it 🤷♀️
fair
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
could, but that'd have to go in a major version (or not, since its not changing the placement of the param)
is there a reason ThreadMemberManager#remove() doesn't take UserResolvable?
No
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
so no need to check for
<User>.globalNameif 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
you didn't understand my question
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.
I wasn't responding to your question
But the answer would be yes
okey thx
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?
- Not related to the dev version
- Not related to discord.js
- You can't just increase a reaction count
- Discord doesn't give view stats.
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
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
#9660 in discordjs/discord.js by ImRodry opened <t:1687274927:R> (review required)
refactor(User): remove deprecation warning from tag
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.
wait what's bots' own system?
last i heard they weren't changing anything fn
they aren't changing anything fn
ok
Iirc aren’t they just making it their username + tag?
they aren't changing anything fn
so it stays username and discriminator
that would also imply moving them onto same system as users
guys how i use the Masked Links??
i can't
text in embed descriptions or webhooks but why are you asking that here
Are you using the dev version?
If not then please use the appropiate channels. #djs-help-v14 or #archive-djs-help-v13
Then I'm guessing you're not. Please use the channels appropiate for your version
No, that will be v14. #djs-help-v14
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
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
is there a way to fully disable the djs's cache? so that I can use redis
Use /core
Because if you disable all caching you also disable many helper methods working correctly. And what remains is what /core is
Okay thanks I will look into it
can we get soundboard events?
Not yet
#9288 in discordjs/discord.js by Jiralite created <t:1679996675:R> (review required)
feat: Voice Channel Send Effects

is there a guide for sharding with djs/core? 
just put your sharding options in websocket manager
also its not a topic for djs dev
you saved me thanks 
is there has any way for get the Orginally Known as ... value??
for show the old <User>.tag
<User>.tag will just give you 0 if the person has already shifted to pomelo system, theres no such way to get Orginally Known as ...
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
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 :)
nothing... changed?
it was always like this
and what exactly do you mean with static-like reply methods?
Do you mean @discordjs/core? That's not the dev version
@discordjs/core is barebones, you create your own structures/caching when using the core library
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
discord.js just isn't part of the new docs yet since it requires a typescript rewrite to be compatible
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?
It used to
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
It used to, but that was disabled cause then you are presented with a list of packages that tell you nothing. When discord.js actually lands on the new docs (
) it will probably be the default one.
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
core is still in v0, so its not completely finished and breaking changes are expected, but it is functional
is this like a total rewrite or is this a list of features to be in v15
the core package is basically barebones djs, no structures and no caching (its basically so you write your own structures and caching)
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?
no
nah, its not replacing the main lib at all, its for more experienced devs that are interested in writing their own caching and structures
Its an alternative, and might be used as an internal dependency for the main package in future
ah, im just unsure why it would be put that on the front page of discordjs website when its intended for more technically inclinded developers
new docs are a bit confusing in that regard, #djs-in-dev-version message
Because v14 isnt compatible with the new docgen yet
Which is why theres a banner at the top linking to the old docs
ah i was wondering if i was using a version that was about to be deprecated because old.xxx.xxx gives me that vibe
Yeah its not ideal naming lol
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
which node version should i have for djs 14
why does user's displayName return undefined?
version 14.11.1-dev.1687738298-75d91b5.0
Show your code
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 }
What's newUser?
GuildMemberUpdate Event
module.exports.conf = { name: Events.GuildMemberUpdate }
so member.user.displayName
but return undef
They told you in v14 there is no display name for users
Idk
There is in the dev version
ım using dev version
lastest
User#displayName
The global name of this user, or their username if they don't have one
Show the output of npm ls discord.js
"discord.js": "^14.11.1-dev.1687738298-75d91b5.0",
Show a screenshot of that
No
npm ls discord.js
oh
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
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.
You are not running /rest in dev
Did you make https://github.com/discordjs/discord.js/pull/9672? I said it there too
Ya I saw it in when you closed pr, can you please elaborate?
Yep
In a nutshell you need to add an override for @discordjs/rest (or resolution for Yarn) to point it to "dev"
Like this
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"
}
}
(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"
}
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"
}
That’s what that says
Okay lemme try
I am getting that same error Faze does
even with the overrides
Show the output of npm ls discord-api-types then (and/or your package.json)
I have problem with my bot code
What version are you running exactly?
While all api ping I do is 15 ms, why is the message delay time 5000ms?
You're probably rate limited and the question isn't related to the dev version
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
You didn’t npm i after adding the overrides, did you?
Hi. Can someone tell me what User#displayName returns if the user didn't switch to pomelo yet?
the username
displayName shows the displayName or the username if the user doesnt have one
I even removed the modules folder and install
Can you npm ls @discordjs/rest explicitly?
yes I am aware that it returns the username if the user doesn't have a global name, but what if the user still has a discriminator?
They also have a username
then... it still returns the username
okay thanks
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
Meh, why doesn’t it show what version it‘s overridden with…
Do you use another package Manager than npm?
nope
I got yarn but that’s for other projects
Any idea?
Bit stuck on this as to why it is not working
Don't really know why that's happening. Just seems like your installation is not looking at your package.json
hm
I would say wipe node_modules and ensured you've saved your file, but it seems like you've already done that. Dunno
Yeah tbh idk
Hm
Ok
I found the fix (Hopefully not a me thing)
I had to clear my npm cache and it started working
sorry for disturb
but
can someone tell me how to fix list option in this
error of database
Doesn't seem at all related to the dev version of discord.js
someone can help me how i tag the user https://cdn.discordapp.com/attachments/1117066909804937288/1124253936581365810/image.png
here
Does the version that is being developed already return the pronouns?
Discord doesn't in the first place
/builders or /ws automatically gets installed if I keep /rest in overrides?
/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
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
there is no eta
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
I switched to dev today until 14.12
It’s working fine so far on a 40k bot
If you're interested in seeing what PRs that are still in progress for v14.12, you can look at this milestone
https://github.com/discordjs/discord.js/milestone/90
I just made the stable version get display names
I modified user structure in the module
How do I get this in my required format?
For a while now, if you don't want animated avatars, you need to use forceStatic
https://discord.js.org/docs/packages/rest/1.7.1/ImageURLOptions:Interface
if I want to get different extensions like jpg, png, webp then? forceStatic will give a specific extension ig
The extension is derived from extension which may be affected by forceStatic
Thanks, got it
You do realize that altering internals in a stable version makes it a development version and not the stable version anymore, right? So installing the dev version would have had the same effect
Dev verison would have other development stuff
But this modified one will only have Displayñames
Rest will be stable
Is there any difference between user.displayAvatarURL(); and user.avatarURL();?
The former will fallback to the URL of the appropriate default avatar if the later would be null. Same as in stable version
Okay 👍
Since I switched to dev I get these errors. What do I have to change?
👆
👌
Somehow I get this warning even when I don’t use user.tag?
trace-deprecation to show where the warning was created
Any third-party-library maybe?
🤔 When I put role id of normal role I get perfect output, but when I put the role id of @everyone I get 0.
that is how discord words
Mine works, @everyone role is the same as the server ID, did you modify any caching and can you double check if the id is correct
No didn't modify any caching. and yes the id if perfect.
Hm, I'm not sure if this is relevant but does your bot have the guild members intent?
ya I have all intent
Can you test if it happens on stable
Ya sure
works fine on stable
Do I have to do anything on my side or is it a bug which will be fixed?
i would open an issue: https://github.com/discordjs/discord.js/issues/new/choose
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
ya ik, but I have a roleinfo command. If someone does -roleinfo @everyone then in the member count it shows 0.
you could fix that component with that fix
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
i think the change of using _roles may not include everyone https://github.com/discordjs/discord.js/pull/9529
hm
as it is manually added in the user prop: https://github.com/discordjs/discord.js/blob/main/packages/discord.js/src/managers/GuildMemberRoleManager.js#L37 and discord doesn't provide the everyone role to all members https://discord.com/developers/docs/resources/guild#guild-member-object-example-guild-member
displayName is a helper, it will return the username is globalName is not set
Depends if it's on a GuildMember or User. Different things
User: globalName > username
GuildMember: nickname > globalName > username
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)
If youre on the latest dev it should be member.nickname > user.globalName > user.username
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?
I just meant thats the order it prioritises things
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
yeah, thats what member.displayName does itself
perfect, thanks. So technically no changes are needed (at least in may case) from stable v14 to dev.
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
Decode the first Base64 part of your token
oh, is it the same as the user id these days?
Yes
cool, i'll just get the current user and grab id from that instead
👍
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.
👍
calculateUserDefaultAvatarIndex is not a function
at User.get defaultAvatarURL [as defaultAvatarURL] (/home/node/node_modules/discord.js/src/structures/User.js:169:48)
npm ERR! Invalid comparator: dev
how to install using npm?
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"
what is your node and npm version?
npm -v
node -v
Try updating your npm version
I am looking for discord server address where can I get discordjs task. If anyone know it, Please help me
Can you rephrase your question?
What do you mean?
Your question makes no sense in its current state, so please try to rephrase it.
Em, what is this?
An error
I can see that, is it a package side error or client side?
may i borrow this?
as long as you give it back 🙄
it's package side
Hm okay 👍
hey can someone explain me the difference between displayName and globalName?
i know that but i don't understand 
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
ok thank you
so globalName return only the display name and displayName return the display name or the username
Umm, no. globalName returns the globalName. There is no displayName in the API. What the discord UI shows as displayname is actually the globalName
ok, thank you!
Will v15 support HTTP interactions?
No, never. discord.js based on the Gateway
There may be a package for that in the future though (not the main library discord.js as said above though)
Well does anyone know a maintained package with that purpose?
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 😦
But....
Its HTTP interactions
The whole point is not having a client
The client is the gateway connection
I meant client methods as in the methods that are attached to the discord.js client and structures
Maybe it would be easier when @discordjs/structures is released
Again, there is no client
The structures, yes, I understand fully
You want the classes with their helper methods
Sure...
That would be @discordjs/core/http-only
yeah just use core
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)
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
Which solution do you think would be more optimal here?
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
as far as i recall @types/node didnt have those at some point despite them being available for quite a bit
so thats probably why whoever updated those types opted for dom
they still dont have them 
lol
unlucky
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
https://github.com/discordjs/discord.js/pull/8861 its only purpose was to fix building
i think im gonna try reverting that types change as long as it doesn't break anything
i'd rather we wait for @types/node to do their thing
since that's the proper fix
but like
it seems like no one feels it? https://github.com/DefinitelyTyped/DefinitelyTyped/issues/60924
so I think you'd have more fun opening a PR over there
that issue has been opened for a long time yeah
but who knows, maybe it can be safely changed without breaking builds
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
Won't this error will be fixed?
override your @discordjs/util to dev
Thanks
@hoary fox for visibility
does anyone know what happened here?
help
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
thx
dont crosspost
I have a question - Is discord.js@dev worth it?
...it is just the dev version (code before stable release)... but you shouldn't usually use if for production
how to include the current dev version into a peerDeps checker?
wait when do they crash
As soon as discord.js is loaded
huh, it's working fine for me on 14.12.0-dev.1690113844-6307f81.0
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
how do you get a guild member's permissions bit field in the dev version?
The same way as in #djs-help-v14
<GuildMember>.permissions.bitfield
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
The next version isn't complete yet
why is it the default version on discord.js.org then
i already wrote most of my bot in the djs next version
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.
yeah that's what i meant
so what do i do now
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.
the 'current stable' version is labelled as 'old' you can probably see why i thought using next was a good idea
yeah, we know, but person who put it there doesn't want to change it 🤷♀️

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
it's just GuildMember.permissions
which isn't particularly related to the dev version
For questions relating to /core make a post in #986520997006032896 and tag it with @discordjs package
ah ok
how is the dev version now 14.12.0 if the repo still has 14.11.0 lol
what repo?
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
Can you somehow get the User Pronouns?
No
v15 in dev ?
no
Next version won't be version 15, if that's what you're asking
If not, what are you asking?
why when there are js discord mods it appears on the v15-dev screnn ?
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
There’s nothing too breaking right?
I have no idea ¯_(ツ)_/¯
There are no breaking changes in discord.js currently
Yh and a new entire version means breaking changes right?
If it's a major version yes
generally thats why a major is released
Okay thank you very much for your answer and clarification.
We should fix that
its not a bug, its the dev version being incompatible with your installed rest version
#djs-in-dev-version message
oh ok
npm i @discordjs/rest@dev
the overrides thing doesn't work
👆
so it works with /rest being overriden to dev, but doesn't when overriden to 1.8.0-dev.1689552764-351a18b.0?
the overides generally don't work
it kees installing rest version 1.7
Do you use npm or a different package manager? Also the <15 there is weird
npm, i wanted to do <15 so i enfore that discord.js is in all sub packages on the same dev version
That… isn’t what that does
ok
anything to do w soundboards yet?
rest has breaking changes and djs uses its latest version, maybe thats why
Discord has not documented it
https://github.com/discordjs/discord.js/pull/9288 what about this tho?
Read the linked pull requests for more information, specifically the Discord API documentation one
alright thankyou 🙂
not yet 
|: No need to answer a question again
sorry you are true
I had the same problem, what I did was reset the npm cache npm cache clean --force and it worked for me for the overrides
(coming from #1134145116844605531 message )
Yeah i agree. including dom types pollutes the users namespace which is genuinely terrible. I don't even see the point, since you have undici installed anyway so you could simply import it explicitly (as some files do) instead of using the unstable fetch api
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
i was gonna open one but i have many things to do, nice to see more people thinking the same
Check pins
"discord.js": "^14.12.0-dev.1689552792-351a18b.0",
Read the message above yours
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
}
Did you just repeat yourself
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
What is your discord.js version?
I'm pretty new to this so I really don't know if you can tell me how to check I'd be glad to do so
Do npm ls discord.js in terminal
it is very unlikely that they are actually using a dev version, which means that this isn't really the channel for this
is anybody else having this issue?
im using dev version and i never saw anybody complain about anything like it on stable so im guessing its an issue with dev version?
Impossible
There is no difference between the stable and development versions
No commits since
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
Update ts to 5.1 or higher
yeah, i fixed it. thanks
so are there any big changes in v15 planned? backreading here people say its almost the same as v14 latest
it's not planned (yet)
It's just a bug that v15-dev is used. It's still v14-dev.
https://github.com/discordjs/discord.js/pull/9743
What is this PR for? Will be able to set custom status with this?
Ask them
The description is poor
https://github.com/discordjs/discord.js/pull/9743#issuecomment-1661238598
Well, this comment made me think so. Just curious if setting a custom status will be possible in the future for bots.
That’s why you should ask them tbh
Others gonna look at the PR and have the same question
@covert cipher please explain what this PR does actually and edit the description to be more clear
don't worry about it
it will be updated when it is ready for you to look at it
I don’t see state in ddocs, so I’m assuming it’s an upcoming addition to dapi
honestly, rather than cause this discourse you should just not open the PR until then
is there is a way to get a guild's soundboard sounds from like /guilds/<id>/soundboard
something like that thats just example
No
the update has been deployed so the pr is now ready
finally custom status for the bot
advaith 
Doesnt work for me
@covert cipher Is it already in the dev?
Or is it an rollout?
That's an open PR in discord-api-docs. discord.js won't implement it until it's merged
Means u can use it on discord but not with djs?
not yet
Means we can't release everything that works, but isn't documented yet. If things changed we'll have to bump the major version.
Is there any way enabling it currently?
Use a patched version of discord.js eg the branch of #9743
how do you install this branch and is it possible to switch to the normal branche back when it is supported?
Yes you can switch back to the normal branch, for now I have edited the code in node-modules and did the changes that the PR did and it seams to work.
You need to pass state param in while setting the activity
It's not recommended to directly change code in node_modules
Your best option is cloning the repo (with edits), and link it like recommended for contributing
Are there any news about it in a officiall dev version?
discord api docs pr was merged
so close to merging djs pr
How do I know, that it is pushed into djs?
by... looking at the pr?
#9743 in discordjs/discord.js by advaith1 merged <t:1691839890:R>
feat(ClientPresence): allow setting activity state
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
Lol
Keep the shitposting to a different server, thanks
into the demon realm you go
https://discord.com/channels/222078108977594368/1141808977819213987
this isn't the first time this has happened, where the 0Ver of discord-api-types introduces breaking changes (understandably) that djs can't handle
why isn't discord-api-types pinned to a specific version?
It will be now
lmao aight fair enough
i just woke up so idk if this really makes sense to ask, but why wasn't it already pinned?
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
so i guess this change in... idk philosophy, reflects a decision towards the other side?
@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
well like user
whose username is nullable
so i guess it should be
and sorry
Is there an estimated release date for version 15 of Discord.js?
We do not do eta's
oh yes, thanks for letting me know
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 !
@discordjs/core is for advanced users, it doesn't define structures or caching like normal discord.js does
@discordjs/core is not the next version, it's just another package
v15 is not in development yet
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 ?
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
Ok thanks a lot, so it is normal that i don't find everything i want on the new docs, right ?
yes
"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
I want to do button interactions, sorry to not have precised it.
They happen on interactionCreate event. Which core does emit
ok thanks a lot
hey
wanted to contribute to the lib
how to get started , it might be my first opensource contribution
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
Looks like the dev release workflow broke
looks like caused by crawls pnpm pr
@woven grove could you fix it?
made a PR addressing this
👍
update on this, workflow just ran and seems to have released successfully
Nope
npm ERR! 404 Not Found - PUT https://registry.npmjs.org/discord.js - Not found
it doesn't exist????
also is this why the || true is probably a bad idea
yes
but its needed for regular function 
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
very nice, also what efficiency has occured for the reduction of size...
You make that difference sound significant
I mean 25% reduction isn’t insignificant either
actually it is no one cares abt size
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?)
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
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
lol
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
that's only half a mb tho
Which is exactly the difference between 1.5MB and 2.0MB
oh
yeah

ahh that makes sense... has there been that many versions...
Please add the ability to call the bot to the user in Discord.js version 15
d.js can only add features that the Discord Bot API supports, and DM calls are not supported.
🙄
How is the streaming?
d.js can only add features that the Discord Bot API supports, and streaming is not supported.
Ok, but what does Discord want to add in V15 that will surprise us?
Nobody knows that
v15 has no reason to exist yet
🐈⬛
just opened a pr, it seems like the actual missing types weren't from fetch, but rather from WebSocket
nice!
i'm unsure on how to fix it though
hmm let me see

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
i'm thinking of replacing the import with import { Data, WebSocket } from 'ws' (data is used as WebSocket.Data right now
the import of dom types overwrites WebSocket to mean the dom WebSocket
that's the same thing in a different format, yeah
but then you have to change a lot more to account for all current WebSocket.Something ussages
maybe import data as WebSocketData
there is only a single mention here
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
yeah but Data can mean virtually anything
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
just commited the latter
\🎉
nice. pr link for anyone else reading
Is there a way for me to assign myself to an issue on GH?
No
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?
Not related to this channel
It sure is, if it‘s about the index.d.ts of djs and they are working on a PR
Oh didn't think about that, my bad
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?
When you run the format script, do they go away?
It could be you built the monorepo a long time ago and haven't pulled since (outdated versions so outdated styles)
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 testkeeps failing with 27/28 tests (discordjs#testbeing the one that fails)pnpm run formatandpnpm run lintfinish without errors, but do not affectpackages/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.
well its likely our configs are just different given its a new-ish feature
ive been using mine for like 3-4 years
pnpm run formatandpnpm run lintfinish without errors, but do not affectpackages/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
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"
},
}
Alright, one more thing left standing between me and comitting to the repo:
Tests still keep failing. Is this a known issue perchance?
Try WSL if you're on windows
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.
Alright, tests are passing now (actually, they've been passing since yesterday)
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.
https://github.com/discordjs/discord.js/blob/main/packages/discord.js/typings/index.d.ts#L3159
types are incorrect here
even if the command is run in a server, .targetMember could be null if the user has left
const interaction: UserContextMenuCommandInteraction;
interaction.targetMember // GuildMember | APIInteractionGuildMember | null
if (interaction.inGuild()) {
interaction.targetMember // GuildMember | APIInteractionGuildMember // <--- Incorrect!
}
makes sense
Is your link correct?
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
#9844 in discordjs/discord.js by Jiralite opened <t:1695246268:R> (review required)
types(UserContextMenuCommandInteraction): Nullify targetMember
How to delete an embed send by bot with message id
#djs-help-v14 / #archive-djs-help-v13, this channel is for dev version related stuff
Sry channel changed
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?
cc @boreal knot
oh god
The usual reaction to me entering the room...
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
i believe i found it
oh?
As in some old ass alpha version of docusaurus and the typedoc plugin bc I tried updating it TWICE and it broke down hardcore 
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?
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
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"
Does the in-dev version have any of the new monetization features yet?
there is a PR for that, not sure if it has been merged yet though, kinda doubt
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.
the api for it is not stable, so it probably wont be merged for a while
Can anyone help ?
About discord.js v14 StringSelectMenuBilder
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] });
});
I know, i just copying the code
It gives some typescript declaration errors in row, filter,, i.customId
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
Okay
i have a question how is the progress of these going on adding into discord.js? https://discord.com/developers/docs/monetization/entitlements
You can view the pull request
where can i find that
On GitHub
i am looking can't find one called entitlements
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
thanks i just couldn't find it
yeah it's a pretty decent sized update change
Yup
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
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)
#6502 in discord/discord-api-docs by colinloretz created <t:1698423267:R> (review required)
WIP - Premium Apps: Updated Guidance on Entitlements and SKU endpoints
This, for example
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
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
they will be
Those will be added yeah
alright
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!
there is no ETA, and it will be released once its stable enough
Ok thank you
There’s a pr for djs I believe
this was said last time that PR was mentioned
is the use of pictures in modals going to be available anytime soon?
We can only add what Discord implements
Have you checked the comment?
Here works
How did you reach that conclusion?
Are you checking a log output?
properties are not enumerable by default when set via Object.defineProperty(), so client will not show up if you just console.log(interaction.webhook)
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
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:
- Create a new Bun project
- Write something in
index.tsthat uses bun types, for exampleRequestInit - Include something from discord.js from another file or
index.ts, basically anywhere in the project - Shows error in
index.tsbecause the type definition has a conflict
nothing we can do
we follow correct TS practice
Ok, I'll just delete the directory manually then
Or report to bun, they tend to fix issues like these if they know about them
fyi they already asked in the Bun server, but they said it was a TS issue
Well. Bun was made to run ts directly. It doesn’t seem to do that, so it is a bun issue🤷♂️
as in typescript (in vscode) was emitting the error
and they found similar error for workerd: https://github.com/cloudflare/workerd/issues/1298
@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?
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)
threadmemberresolvable also allows you to pass a threadmember object
which would be the appropriate choice here, then
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
I have a question i see in here that everything passed was skus added into discord.js and the rest yet? https://github.com/discord/discord-api-docs/pull/6548
or was that only one part of a change to the discord api
No, not yet
alright
Discord.js Will it be part of the multi-ban?
if the api will be available to bots and documented. nothing we have any say on though.

It looks like the docs system has trouble resolving classes in the main discord.js package that inherit from mixins. For example, BaseGuildTextChannel should inherit props/methods like send() from TextBasedChannelFields via TextBasedChannelMixin, but none of these appear in the docs: https://discord.js.org/docs/packages/discord.js/14.14.1/BaseGuildTextChannel:Class
Use the main version for now
👍
@uncut kelp good first issue, congrats https://github.com/discordjs/discord.js/issues/10020
see, i'm not the only one
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?
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
just noticed we have underscore and escapeUnderline - that should be made consistent at some point
👍
shouldnt you also show a deprecation for that?
Looks like if you search the API docs and click on an event, the resulting URL is invalid (#archive-offtopic message)
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
#10055 in discordjs/discord.js by jaw0r3k opened <t:1702915234:R>
Search generates invalid event urls
Yes, we know. And we are working on getting that fixed for quite some time already. Bare with us on that
Hey guys for discord RPC js how do I make it so when discord is closed the RPC program stops
#986520997006032896 but the rpc package is not actively maintained atm, so don’t expect a fast answer there
oh alr tysm!
and what exactly is your question?
@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
But the draft only adds the method to make it possible and polyfills the Symbol if it doesn’t exist. It doesn’t add any using to the codebase.
I tried running the ws code locally with my target set to esnext and it compiles. You're correct in that it doesn't output the polyfills needed to actually run the code, however this is what ESNext represents. It's simply the next es version that supports using natively
oh, I've managed to conflate two different issues in my head
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
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.
Did you check with mainlib Client too?
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
and await using will fall back to the @@dispose method if @@asyncDispose isn't implemented, similar to how await foo is just equal to foo if it's not a Promise
Can anyone show me how to make the bot online 24/7 on replit?
use a proper host
and use the proper channel, none of this is djs related, esp not related to the dev version
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'
}```
What discord.js version are you using?
i npm install discordjs 12
but i guess this bot is too old (i dev it on v12)
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
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 ?
see #how-to-get-help for advice on where to ask
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.
what is the type of event.name
seems like there are types provided for using valid client events with listeners but no checking for other unknown values, so a regular string is accepted by the djs client
on the other hand the rest class has stricter typing which only accepts valid events
its typed as a string
i get that, but why not type the djs client as well? the same argument could be had to add strict typings to the djs client event emitter
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
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
are there many bugs in dev version?
im planning on using it because of the app subscriptions…
Shouldn't be, no
It work great I use it
wonderful 😃😃
does
client.application.entitlements.fetch();
only show ACTIVE subscriptions?
Active and expired
That's why excludeEnded exists if you only want active ones
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
It's an object parameter: https://old.discordjs.dev/#/docs/discord.js/main/class/EntitlementManager?scrollTo=fetch
The options being https://old.discordjs.dev/#/docs/discord.js/main/typedef/FetchEntitlementsOptions
aah
like this?
client.application.entitlements.fetch({
excludeEnded: true // or false, depending on requirement??
});
Yeah
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?
Sure
That if statement won't work as the fetch() method always returns a collection. You have to check the size of it instead
yea, i changed it to this entitlements.size == 0 after it didn't work
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
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
This is the dev channel, you need to be on the dev version
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
If the user does correctly await their promises it would make it perfectly clear where in their code they called it since their file would show up in the stacktrace. And if they don’t it‘s not really the library‘s job is it?
true (hence the "slightly"!) although jumping from a call point to a function that the user didn't directly call does add an element of obfuscation.
given that return await <Promise> resolves sooner than return <Promise> since ES2019, it seems like a viable paradigm, but the differences are obviously small
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
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
I think EmojiId and EmojiName would be better
Same
Just one, the one which takes an object as single parameter
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
@knotty plover Do you have any idea for the fix of the bug related to this PR: https://github.com/discordjs/discord.js/pull/10068
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?
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 :
.updatereturn 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||.replywill return an InteractionResponse object but the button we want to listen is on another message (not the one indicated inresponse.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
Well if its on another message, why would we expect this to work? It's a different interaction response isnt it?
fetchReply is the workaround we've been advising but trying to avoid that being necessary, since then its not an InteractionResponse at all
Well if its on another message, why would we expect this to work?
I don't think it ever quite worked out as expected honestly (before and after the change) 😂 However, as before all interactions were collected, the problem was less visible thanks to thefilteroption.
It's a different interaction response isnt it?
I'm not sure what you meant by that sorry 😅
Unfortunately, I don't think there's any other solution to this as we have no other way of retrieving information related to the message sent via .reply
Without information, we can't effectively collect interactions linked to the message
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 anupdateor adeferUpdateit will be equal to the id of the message linked to the interaction ||interaction.message.id||, otherwise it will be set to null
- New property
- InteractionCollector
- New property
messageReferenceId. It will be equal to null EXCEPT ifinteractionResponseis passed in the options andinteractionResponse.messageIdis null, in which case we set the value tointeractionResponse.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;
- New property
UPDATE: There is still a problem if there is 2 reply after 2 interaction on a button on the same message
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
What are the key differences between v14 and dev version?
dev version has new features that have yet to be released but can break
Where can I see a list of them?
on github probably
but i think for now its just entitlements
Yeah, as long as there aren't any changes in the API...
Can someone please go over the documentation repo PRs?
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…
I mean there's a bunch of other ones also
You mean the three other PRs from last year that have lots of discussion on them stating why they aren’t merged and the one from 5 days ago that also only changes small detail?
jesus im sorry
my fault bro
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
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
Afaik those limits have not changed in a good while, and those limits are also listed under the embeds section, which is very useful to know since embeds are very commonly used
To also add on to that, they are also documented on the API docs
https://discord.com/developers/docs/resources/channel#embed-object-embed-limits
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
#discord-dev-news message – is this not the same feature that's existed for the last two years?!
yeah, something went wrong there
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
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?
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 …
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
Both great replies.
Lets hope we get to enjoy v14 for a while...least until TS rewrite happens
Hi! Does someone know why does it returns -1?
Here's the code:
const ping = client.ws.ping;
console.log(ping);
are you using the dev version?
and thats because the first heartbeat hasnt been sent yet, you have to wait a little
Yes, I am
What should I do?
wait
A deferReply?
no
you have to wait
Ur running it in an event?
In a command
Can you log client.isReady()?
true
just wait, it can take a max of 41s for the first heartbeat to be sent
After the bot launch?
yes
It works, but now it only returns 101ms, is that normal?
yes
What's the question here
My problem has been resolved
client.ws.ping is not your bot's ping btw, that's how often the bot sends a heartbeat, aka a message telling discord you're still online
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
No, don't spread misinformation. It's not how often it sends a heartbeat. it's the latency of said heartbeat. aka the websocket ping.
oh
srry
No, breaking changes only happen on major versions
But doesn’t 14.14.1 already have premium app subscriptions released?
nuh uh
Do you know if there are any plans to add dropdown options (roles, channels etc etc) to modals?
Unfortunately you gonna have to ask discord that, not us.
#useful-servers I suggest you ask on the Discord Developers server
Hi, does this version supports premium commands or premium app features yet ?
the dev version does yes
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
FYI - this is a good long-term solution that I use
Any plans to continue this PR? @hoary fox
https://github.com/discordjs/discord.js/pull/9336
There are 3 dependent pull requests. There's nothing to continue
Question goes the same for the other 3 🙃
They seem pretty stale 😦
You should ask Discord then
Dependant on api docs while they are already known?
Yet other libraries have implemented it 🙃
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
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
I don't know what to tell you other than you are wrong
Then enlighten me
We do not implement undocumented features
If the discord-api-docs are not merged, then it remains undocumented
And we will not implement
Thats why theres an open PR
Its ready to be added, when the documentation is confirmed
Syjalo isnt a maintainer though, not their call
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
k
I am not aware of that, and otherwise he should've been correct 🙃
I'll patch it in myself then, thanks
k
That response was to an off-topic question anyway
You've misread it
yeah until discord decides to change something and other libraries get bitten in the ass
Oh you mean something that can also happen to current implemented functionality?
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
doesn't that call for a new api version
if the change is that major
we're talking about documentation that is not yet merged
oh
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?
Yes
When I click for example this url to go to a part of the docs:
https://discord.js.org/#/docs/discord.js/main/class/Message?scrollTo=delete
this is where i land:
