#djs-in-dev-version
35223 messages · Page 25 of 36
Make sure you treat the cache as a Collection<string, Role>
For instance, the full Collection does not have a .permissions property; only the Role entries within it
Ok well thats more complex then as I need to list all the roles and show their bitfield. I will play around and try to figure it out.
Like I need that output, but also need it to show the bitfield.
Collection#map()
Maps each item to another value into an array. Identical in behavior to Array.map().
you can map the Collection into each Role's permission bitfield
Thanks, that shows the bitfield now... But removes the rest of the output. I will go play around and see if I cant find a way to make it show all the data including the bitfield.
why does <client>.decrementMaxListeners() remove 1 listener, doesnt that break some event?
isnt that private? that's meant to be used internally in the lib
yes im aware, this question is lib internal
Those methods are used internally by collectors
increase listeners, bind collector
i am also aware of that
when it ends, decrease again
So whats your question?
so decrementing has to do with binding?
I mean
The max controls how many you can bind without it throwing warnings/errors
So to make sure collectors dont throw errors, it increments, binds, then when the collector is over, unbinds, decrements
aha, i see.. i think
The default Node sets it to is 10 listeners per event
cuz it kinda seemed weird how there are 6 .on() added, on end 6 removeListener() called and then one additional listener removed via decrement
Where is that?
If its 6 different .on then its fine, its the max per event
Yeah thats fine
yeah im not saying its not, just trying to understand why its there
Its only adding 1 of each type of listener so the max only needs to increase by 1
oh i didnt see the incrementMaxListeners 
Yeah
Its just reversing that when it ends
yeah no nvm, thanks monbrey 
uhh ??
did sending a message with components changed ?
The typings might have, show your code?
Show how the row is defined
it just edits the existing message with new components
did i miss something on my code ?
even at my interaction.followUp
Are you using ts?
yes
You need to specify what the ActionRowBuilder contains
ahh i see
but seeing MessageActionRowComponent made me curious
cuz Message is removed from everything like MessageEmbed to Embed
It’s from discord-api-types
ahh i see
👀
How did you do that?
wait
by setting the type
new ActionRowBuilder<ButtonBuilder>()
fixed this tho
Try on the constructor, not just the type
ah i see
yea fixed
thanks 😉
btw how to push a button inside a actionrow array ?
this is what i got
dont mind the code being weird
Uhhhh you probably have to toJSON() it
oh ok then
thanks
u mean JSON the message or the components ?
because u cant JSON an array
the btn
oh ok
now this
Yeah no idea then
I don't use builders
Shit like this is why
oops ok
Why are you pushing instead of using addComponent though
its an actionrow component from a existing message
yeah
Oh
Yeah in that case you cant modify it
You need to construct a new builder using ActionRowBuilder.from(the one from the message)
wait but i did in v13
ahh i see
that's wrong u r mutating the cache
oops, forgot that
But youre not in v13 anymore
u should reconstruct it
ok
is this ok ?
yeah
ok then, thanks
how to add an new row to a existing message
with components already
i have msg.components already
[ ...oldMessage.components, newRow ]
oh yea u can do that
wait but the components are already an array
That’s what the spread operator is for
ahh i see
thank u
hmm
ok worked
You can’t type rowe w/ that constructor?
??
new ActionRowBuilder<ButtonBuilder>()…
ok this worked
yea yea thanks
I want every permission to get removed. What should I put in permissions:?
role.guild.roles.cache.get("role id").edit({
permissions: ,
})
0
Okay, Thanks
Should I put it like permissions: PermissionsBitField.Flags.0 or only permissions: 0?
just 0, there is no such thing as empty permissions in PermissionsBitField
I have tried putting 0, but it didn't work out
"0" or 0n
ok
escapeMarkdown isnt a thing anymore?
i can see the options for it though
It’s prob in the Formatters
should be a top level function in latest dev
Huh, not in Formatters
for some reason search isn't showing up
yeah checked other functions, searching functions don't show up
@woven grove ^ looks like top-level functions may not be indexed by search?
And #archive-site-discussion message
Why you deleted the Util class @uncut kelp
I didn't
Who deleted
Who indeed
who to git blame 😲
Strange
Ill look at the github commits maybe Ill find it out somehow
Who is suneettipirneni
Developer
He deleted it
they* dont assume gender smh
- made it top level
util wasn't even deleted, it was moved
Yes I need to know why
because
Can you tell me why they deleted Util if you know
because having a class like that with purely static methods is an anti-pattern
🤷 this wasn't done sooner since our documentation didn't support displaying top level functions, is all
Thank you @silent hedge your the only one who knew why they deleted
is Interaction.isAutoComplete() removed from v14 ??
how do i define this
Import it
why is this not working js client.user.setActivity(`your stats | /help`, { type: 'Watching' })
it works if i remove the type and then it sets it to playing
use the enum? read the docs to see which enum type takes in
Ok
no
that's v13 🤠
it worked ty (ActivityType.Watching)
can someone help and me and explain why isModalSubmit() doesn't exist
I have already made sure I am running discord.js@dev as I also noticed isCommand() doesn't exist
Because they got removed, check .type instead
👍
Why isButton is a thing but isModalSubmit isnt
Because isButton needs two comparisons (type and componentType) while ModalSubmit doesn’t
Ok
check pins
hello
who can help me in discord js coding
hi, is it possible to invoke a command after a slash command(chaining commands)?
for examble i want to make a slash command (addNumberOption), and base on the input number i wanna chain another command.
how can i do that?
this isn't quite what you wanted to do, but it could help you accomplish something similar
https://discord.com/developers/docs/interactions/application-commands#autocomplete
https://discord.js.org/#/docs/discord.js/main/class/AutocompleteInteraction
Interactions: Building and responding with modals
read more
look at warning
@ebon boughjs docs#1083
Sorry
ETA on stable v14?
When it's ready™️
is it soon enough that i should be basing new work on it or on v13?
welp no one knows when but you can choose to work on v14 early or stay using v13 until it's released
the api churn frustrates me, every year or two i have to rewrite everything or my bots all break
well we can't do anything about that 🤷♂️
will the migration to v14 be as dramatic as the migration to v13?
well, every version has breaking changes if this answers your question
though you can check all changes of v14 in this guide: https://deploy-preview-1011--discordjs-guide.netlify.app/additional-info/changes-in-v14.html
if you start to upgrade from v13 to dev now, the changes are small, just keep up with the commits to the dev version
My upgrade was pretty smooth, but having TypeScript complain to you helps a lot
I mean that’s lot of lines of code…
You should have seen my v12 to v13 upgrade
Maybe I should’ve
Context: I was writing in pure JS before, no typescript
thanks
thanks
For the modals, can you like show different questions based on previous answers?
You cannot change the modal midway through if thats what you are asking
So I need to send separate ones after they answer the previous ones
You cant send a modal on a modal submit tho
What if I await for the modal to be submitted from the interaction that sent the modal in the first place
How do I get the guild avatar url and guild banner url of a user? I mean the avatar and banner which nitro users can set in different guilds
You cant send a modal on a modal submit
neither can you send a modal on an interaction already replied with a modal
o_o
guildmember.displayAvatarURL()
you cant get the guild banner iirc
Oh okay.
Is that a discord limitation or discord.js limitation
discord
Guess im sticking with messages containing buttons
I don't know why it's not working but .displayAvatarURL() works fine
please
dont blindly cope paste
interaction.member
Thanks
hey guys
one question, can i add buttons to embed in discord.js?
no, you can add it under at the bottom
not related to one another
like this right? I'm looking for this but i'm not sure if this is possible through embeds
buttons and embeds are both something you attach to messages
and they are placed as such
content are above embeds are above components
oh sorry
i didn't mean embed, i meant webhooks
they aren't mutually exclusive, you can add embeds and not buttons, buttons and not embeds or both they're really not connected
is it possible to put buttons on webhooks?
i think i confused the two sorry
yes, you can
how may I do that?
if the webhook is created by your bot, it can have all types of buttons
what if its not, i just made the webhook myself
not using any bot, is that possible?
think about it, the button needs to be handled, if the webhook isn't attached to an application, what's going to handle the button when you press it?
if you don't have an application connected to the webhook, you can just make it use a url button afaik
Thats true, but i'm not looking for any action to call, mostly just a hyperlink
url button? is that just https://website.com?
the invite button here is a "link style button"
what they do is simple, just redirects the user to a link
can i add that to an webhook?
yes you should be able to
how can I do that? I couldn't find anything on it at github
tysm btw!
if its not application-owned you cant send any components
so no link style buttons to embeds?
thank you!
are you sure about that? weren't you able to just send url buttons? since they don't really need handling it made sense
yes, no
Why do I get undefined?
User#bannerURL()
A link to the user's banner. See [User#banner](<https://discord.js.org/#/docs/discord.js/main/class/User?scrollTo=banner>) for more info
Read the documentation, you must force fetch the user to get bannerURL
Okay
I want to ask whether the default emoji from the discord must be used like this too?
.setEmoji({ id: "969419421644902431" })```
Default emojis dont have ids they have names
You need to pass the unicode emoji to name
ok, I get it
roles.highest shows the highest role. But if I want to see the highest role of a user which contains role icon how can I get that?
roles.icon 😲
👍🏻
anything new added to v14? havent check since more than a month
check the commits i guess 
well, i hate those but ig if nobody can tell i'll do that
i mean a lot has been added in the past month
it's not covered in the guide completely, there isn't really a changelog yet
so there tyou go
okay suppose the highest role don't have any icon. then it would return null, So the bot will check which higher role have icon. and it will give that.
How can I do that?
role.icon -> The role of the member used to set their role icon
it'll give you the highest role with an icon
ight thanks
let me try this
quick question when is it going to release?
as always, no eta
may i know what are the features that are available in djs@dev?
Check the pins
I'm getting this error: TypeError: interaction.isAutocomplete is not a function
What's the correct name of this function?
Or I should now use the type property?
type property
😔
😔
https://thumbsnap.com/i/LaCzQ4sQ.png how do I define other types for the interaction parameter? it's just that not only chatinput commands will come here, but also buttons and menus.
else if(interaction.isAnotherType())
whatever that might be
the fact is that the interaction parameter will accept only the interaction that is specified, the main one, and the component itself will not show, or does it not work that way?
https://thumbsnap.com/i/kWjnfTF6.png Ah, that's how it works, got it
"Invalid Token Used"
I am Keep On generating the Tokens Again And Again But This Is Saying The Same Thing As Before
@knotty plover , Help Me, Sir
no
Please, Sir
no
Why, Sir
Read the server rules, specifically rule 6
oh, Um Okay
umm hehe
Sorry, Sir
Can You Still Help Me Out?
still no
ok Sir
how do i call the new ColorResolvables in v14 inside of embed objects?
lets say i want to use the random string
AttachmentBuilder i think
discord.js exports Colors
ah
Colors.Random?
not sure about random, but you can use colors like Colors.DarkGreen or Colors.Blue etc
nope random doesn't exist
oh
you can use resolveColor('Random') to get a random color
idk if it works tho, always gives me black
then it doesn't work
ohhhh
any library i need for this?
are you on the latest dev release
i think so
did you import the func from djs
the Colors func or the resolveColor?
nvm nvm i figured it out, thanks
worksss
try RANDOM
oh ok you already fixed
the Util class has been removed?
the functions should now be exported directly as top level functions, iirc
like constant {someUtilMethod} = require("discord.js")
xactly
Is that a feature or a bug ?
don't think autocompletes have min values?
people just type things and you respond with up to 25 things to select from
the type determines if the value is a string or a number
Yeah
so what do you expect a min value to be?
But with autocomplete you can as well input custom values
And in my case it's a withdraw command and the minimum amount is 10
But I check that bot-side now
you need to, there are no min values for autocomplete
you being able to bypass it by tabbing before anything comes up is more of a quirk than a feature
you're not really supposed to input custom things there, you're supposed to wait for the list to select things from
🤔
I think this is okay
Because in my case you would have to only choose between to withdraw only all or half your game money that would be annoying
sounds like you don't want autocomplete in the first place, tbh
if it's just a numerical value, you can specify min and max and call it a day
there is no reason for autocomplete there
This is just a plus, if the user wants to withdraw half, or in the case of a deposit command, he will be able to choose to deposit all at once rather than making another command to know how much he can deposit and then write the exact number
On PC that's not a big deal but on mobile that's a lot more intuitive and easy to use
did they updated commands interface for new member and dm permission in dev version, last time I checked only the builder has it
Yes, the command managers have them now too
cool
I'd be surprised if the API doesn't accept it
since the autocomplete results are more like suggestions
Hi, anyone have an idea why bot emoji do not work on 1 server, and on others?
If it's in an interaction reply, the @everyone role needs the Use External Emojis permission for the bot to be able to use them
okay, ty
does it do anything? if so, builders need a PR i guess
but if custom values past what you send in autocomplete are considered a valid use case the implementation is whack
I think it's documented that you can do custom values
then the UX is... interesting, to say the least
How do I send messages in channels now? channel.send() is gone...
no it isnt
very cropped image
and the error is?
what is channel?
I'm guessing unresolved promise
let channel = interaction.client.channels.fetch(pingChannelId)
Even the documentation no longer mentions the send method
I was right, unresolved promise
Ill do a console.log real quick
Documentation suggestion for @spiral agate:
TextChannel#send()
Sends a message to this channel.
seems there to me
I read the wrong channel object did i
I am missing an await then
yes, fetch returns a promise
Yep I was
must have missed it while I was refactoring my code
fetch always returned a promise
v13 and v14
Now I can't seem to display a modal because at ModalBuilder.toJSON (/mnt/DATA/general_programming/CL bot/Club-League-Bot/node_modules/@discordjs/builders/dist/index.js:756:35) { validator: 's.string', given: undefined
The modal displays its components all right in the console log but when I try to display it this happens
[
ActionRowBuilder {
data: { type: 1 },
components: [ [SelectMenuBuilder] ]
}
]
the modal components
something expects a string, but it got undefined
yea but where is the string supossed to be
const modal = new Discord.ModalBuilder()
.setCustomId(`setteam`)
.setTitle('Select team')
let teams = []
for (let team of await sql.fetchteams()) {
teams.push(team.name)
}
console.log(teams)
const teamSelect = new Discord.SelectMenuBuilder()
for (let teamname of teams) {
let option = new Discord.UnsafeSelectMenuOptionBuilder()
.setLabel(teamname)
.setValue(teamname)
.setEmoji(':white_check_mark:')
teamSelect.addOptions(option.toJSON())
}
const actionRow = new Discord.ActionRowBuilder()
.addComponents([teamSelect])
modal.addComponents([actionRow])
console.log(modal.components)
await interaction.showModal(modal)
select menus are not supported in modals
bruh
even if it works, it is not released
you telling me I spend 2 hours for nothing?
Is it at least coming soon or discord API wont allow it?
Guess im using buttons
I mean it's not documented anywhere so what made you think it would work
I needed some way to display a select menu that you do not know what its contents will be
I thought this would work
Since slash commands cannot be updated on the fly without refreshing the entire thing...
you can send select menus in messages
Oh dam thats a type of interaction
I thought I could avoid listeners with the awaitModal() thing that I have spotted
but nevermind I guess
awaitModalSubmit() uses listeners under the hood
InteractionResponse#awaitMessageComponent()
Collects a single component interaction that passes the filter. The Promise will reject if the time expires.
you can also use this
I mean manually making the listener and then having to delete it
oh that exists as well?
There goes some of the work I did in the past
does
const tempEmbed = new EmbedBuilder(interaction.message.embeds[0])
no longer work?
you can use EmbedBuilder.from(<Message>.embeds[0])
nvm found the issue
just needed to put .data after [0]
thanks poor reading skills
await interaction.awaitMessageComponent()
^
TypeError: interaction.awaitMessageComponent is not a function
at Object.execute (/mnt/DATA/general_programming/CL bot/Club-League-Bot/src/commands/team management/setteam.js:60:27)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
uh
I thought command interaction implements InteractionResponses
how do you edit a message to be ephemeral whilst the reply is deferred?
you cannot edit ephemeral
welp, guess i have to stick to non-ephemeral
if interaction is a CommandInteraction, it's not a function
I am pretty sure that what I brought up is a CommandInteraction
well it's not a function.
The console log says that its type is 2
from interaction.type
ok?
isn't awaitMessageComponent a method on messages?
yes
also on the InteractionResponse class iirc
console.log(interaction.type == Discord.InteractionType.ApplicationCommand)
returns true
well I do guess that because awaitMessageComponent is not documented on CommandInteraction it is not available
Regular messages it is
how do you edit a button that you've already created?
parameter needs to be APIButtonComponent
edit the button, edit the message with the new button
try .components[0].data
-->
- client.on('message', message => { ... });
+ client.on('messageCreate', message => { ... });
- client.on('interaction', interaction => { ... });
+ client.on('interactionCreate', interaction => { ... });
Im having trouble with this.
Where do i need to change it and what do i need to change exactly
My Event Handler: https://srcb.in/cwhr1YwLNT
My Bot.JS File: https://srcb.in/yPG7teFcnP
- people have already explained this to you in #djs-help-v14
- don't crosspost please
- the above statement:
- client.on('message', message => { ... });
+ client.on('messageCreate', message => { ... });
- client.on('interaction', interaction => { ... });
+ client.on('interactionCreate', interaction => { ... });
already tells you what to do in different parts of your code, get rid of client.on('message', message => { ... }); and client.on('interaction', interaction => { ... }); and replace them with client.on('messageCreate', message => { ... }); and client.on('interactionCreate', interaction => { ... });
looks like doing this fixed it
But i dont know where i can change it.
Don't you already have the builder if you just created it?
iirc don't you need to get the button component from the ActionRowBuilder?
I changed it and still doesnt work for me
nevermind, didn't disable the button (no errors)
how to fix this error?
my bot is not responding
"changed it" what did you change it to
#8038 in discordjs/discord.js by nyapat opened <t:1654651775:R> (approved)
fix(webhooks): revert webhook caching (and returning Message)
📥 npm i nyapat/discord.js#revert-webhook-caching
@undone yew ^
okay
thanks
that command doesnt work btw (the npm i ..)
just wait for it to be merged and released
any errors?
no changes
that command doesnt work btw (the npm i ..)
just wait for it to be merged and released
what should I do?
just wait for it to be merged and released
bot not responding
we know
i need to fix this error
you are on a dev version
Best not to use webhook until it is resolved
sure
i have some problems in modal of discord.js
Tag suggestion for @lilac bluff:
To help you we need more information:
• What are you trying to do?
• What is your code?
• What errors and debug logs do you have?
i can send here the code ?
You can clearly
ok
1 min
@red mountain@steel haven hi have a somethig
client.on('messageCreate', message => { ... });
and
client.on('interactionCreate', interaction => { ... });
None thats the problem
that's v13 code
well this support is only for v14 clearly
even category says so
screenshot it
yes
well, you're most likely looking for v13 support #djs-help-v14
this channel is only for v14 support
it's a wip
yea, tho i do not recommend to use dev for now since it's unstable so you should prolly stick to v13 until official release of v14 (unless you love the risk of getting your bot broken with a new dev update)
What is the difference between @napi-rs/canvas and node-canvas ?
That is not related to discord.js
That's related to the guide of discord.js
Uhh rule 3 exists
I'm asking why do you use this library rather than the classical one in your guide
its "faster and better" - core djs contrib
its explained here https://github.com/discordjs/guide/pull/1059#issue-1163518414
How can I return something when a user doesn't have a status? What should I put after ===? I have tried null, undefined. But none worked
if (user.presence?.activities === ) return "No Status Available"
check activities.length
means if the length is 0 then there would be no status?
depends what you mean by status
but yes
okay
since the AutoMod feature has been released (https://discord.com/developers/docs/resources/auto-moderation) the status of this PR https://github.com/discordjs/discord.js/pull/7938 can be changed to "Open" no?
No
A pull request should be ready to review when it is ready to review |:
CombinedError (2)
Received one or more errors
1 CombinedPropertyError (2)
| Received one or more errors
|
| input.label
| | MissingPropertyError > label
| | A required property is missing
|
| input.value
| | MissingPropertyError > value
| | A required property is missing
2 ExpectedValidationError > s.instance(V)
| Expected
|
| Expected:
| | [class UnsafeSelectMenuOptionBuilder]
|
| Received:
| | { setValue: 'general',
| | setLabel: 'Genel Destek',
| | setDescription: 'Genel destek almanızı sağlar.',
| | emoji: undefined }
const selectMenu = new ActionRowBuilder()
.addComponents(
new SelectMenuBuilder()
.setCustomId('ticket-msg')
.setPlaceholder('Lütfen bir kategori seçiniz.')
.addOptions(
[
{
setValue: "general",
setLabel: "Genel Destek",
setDescription: "Genel destek almanızı sağlar."
}
]
)
)
what's the problem?
it should be function not property
use value, label, description, instead of setX
Documentation says it is not optional, so yes
https://discord.js.org/#/docs/discord.js/main/typedef/SweepOptions
in discord ^14.0.0-dev.1655381041-4df491c the ready event appears 2 times why?
Maybe you're listening to it twice
hm that's weird
nvm idk why I thought it'd work like that
don't send it here either, there's help on the dev branch discord.js
Man
Util#resolveColor is removed?
Util is removed, now resolveColor() and other functions from Util are top level
Thanks
You can import them like this import { resolveColor } from 'discord.js, instead of import { Util } from 'discord.js'
i set
It should work
Is your dev version up-to-date? The AttachmentBuilder no longer takes just the name as the second parameter, and it instead needs a { name } object
Hi, can someone tell me whats wrong?
const configAds = new EmbedBuilder();
switch (guildConfig.verified) {
case true:
status = '[2;31m[2;32mZAAKCEPTOWANA[0m[2;31m[0m';
embedColor = '00FF00';
configAds.addFields(
{ name: 'KANAŁ', value: guildConfig.adsChannelId }, { name: 'REKLAMA', value: guildConfig.adContent || 'Brak' },
);
break;
case false:
status = '[2;31mODRZUCONA[0m[2;31m[0m';
embedColor = 'FF0000';
break;
case null:
status = '[2;31mNIE ZWERYFIKOWANA[0m[2;31m[0m';
embedColor = 'FF0000';
configAds.addFields(
{ name: 'KANAŁ', value: guildConfig.adsChannelId }, { name: 'REKLAMA', value: guildConfig.adContent || 'Brak' },
);
break;
default:
break;
}
addFields is expecting an array
okay, ty
Is there any way to view archived private threads? Channel.threads.cache seems to only include unarchived / public threads
Edit: nvm, seems like now thats including archived private ones? weird.
I don't why I get this error. This error started to came since I added thumbnail in the embed. Can anyone help me out?
run: async (ctx) => {
const role = ctx.interaction.options.getRole("role");
await ctx.interaction.reply({
embeds: [
{
author: {
name: `${role.name}'s Information`,
icon_url: ctx.client.user.displayAvatarURL()
},
fields: [
{
name: "__General Info__",
value: `**Role Name:** ${role.name}\n**Role ID:** ${role.id}\n**Role Position:** ${role.position + 1}\n**Hex code:** ${role.hexColor}\n**Created At:** <t:${~~(role.createdTimestamp / 1000)}:R>\n**Mentionability:** ${role.mentionable ? "True" : "False"}\n**Separated:** ${role.hoist ? "True" : "False"}\n**Integration:** ${role.managed ? "True" : "False"}\n`,
inline: false
},
{
name: "Allowed Permissions",
value: `${role.permissions.toArray().map(e => e).join(", ")}`,
inline: false
},
{
name: `Role Members [${role.members.size}]`,
value: `${role.members.map(e => `<@${e.id}>`).length > 15 ? "More than 15! won't show" : `${role.members.map(e => `<@${e.id}>`).join(", ")}`}`,
inline: false
}
],
footer: {
text: `Requested by ${ctx.interaction.user.tag}`,
icon_url: ctx.interaction.user.displayAvatarURL()
},
color: 0x2F3136,
thumbnail: {
url: role.iconURL()
}
}
]
})
}
When I use directly use image link instead of role.iconURL() in thumbnail it works fine.
Read your error closely
data.embeds[0].fields[1].value[BASE_TYPE_REQUIRED]: This field is required
So it has nothing to do with your role icon URL. Look at your 2nd embed field's value
Hey here
what the status of automod feature ? is anything available in dev version or not yet ?
You can look at the pull request on GitHub
oh mb
Anyone know why ts is giving me an error?
ButtonBuilder.from(ActionRowBuilder.from(row).components[0].data).setDisabled(false);
- Argument of type 'Partial<APIButtonComponent> | Partial<APISelectMenuComponent> | Partial<APITextInputComponent>' is not assignable to parameter of type 'APIButtonComponent | JSONEncodable<APIButtonComponent>'.
- Type 'Partial<APIButtonComponentWithCustomId>' is not assignable to type 'APIButtonComponent | JSONEncodable<APIButtonComponent>'.
-Type 'Partial<APIButtonComponentWithCustomId>' is not assignable to type 'APIButtonComponentWithCustomId'.
-Types of property 'custom_id' are incompatible.
-Type 'string | undefined' is not assignable to type 'string'.
-Type 'undefined' is not assignable to type 'string'.ts(2345)
is SlashCommandBuilder part of djs 14?
yes
- const { SlashCommandBuilder } = require('@discordjs/builders')
+ const { SlashCommandBuilder } = require('discord.js')
all builders are now intergrated into the main package
so make sure to remove @discordjs/builders to avoid version conflicts
wut, updated dev version and got this error
so it should be like this ?
interaction.type == InteractionType.ModalSubmit
thanks
I got this err
use AttachmentBuilder
Hey, how do I edit the permission overwrites of a channel?
https://c.lunish.nl/T2Un.png
you have to typeguard interaction.channel
as the error is telling you, DMChannels dont have permission overwrites
ah yeah I have it (interaction.channel as TextChannel)
I tried (interaction.channel?.permissionOverwrites as TextChannel) at the beginning for some reasons lol
(dump ik)
unsure where to ask this, so i ended up asking here:
will djs v13 be discontinued like v12 when v14 officially releases, i have been thinking to work on v14 early before it becomes stable since late may (i might forget sometimes the answer)
Afaik v13 is supposed to work for some time
Doubt support will be removed right when v14 is released
ty for answer
This is what I do
if (!interaction.isChatInputCommand()) return;
if (!interaction.inCachedGuild()) return;
if (!interaction.channel) return;
// do stuff here
u must check type insted of isChatInputCommand()
if (interaction.type !== Discord.InteractionType.ApplicationCommand || interaction.commandType !== Discord.ApplicationCommandType.ChatInput) return;
I love being excessively verbose
isChatInputCommand() was not removed
That or will always be true… logic error my bad, read that wrong
dw TS would tell me if it would, I fucking love ts
okey
Only those that are replaceable with one single comparison statement were.
That should be an &&
Oh wait
It’s negated
needs to be ||
Yeah I thought it was if it was initially
Someone mind letting me know if plain text in certain Message embed areas (Like the footer) are completely deprecated in v14, I understand it’s better practice to use an object but I have several commands with embeds using plain text I’d like to know if I should update
Yes they are
Is all the rest stuff gonna be in djs instead of a separate package now
Like is the package not gonna get updated anymore
No?
It's part of the single GitHub monorepo but it deploys separate packages
Oh I see
Is this will work??js if (file.type === 'ChatInput') file.type.replace('ChatInput', 1)
i guess
Could just use the enum though
I like this better that enums
Utterly pointless but sure
it'll be a string of one though "1"
is this will not work, no 😦 use enums, that's just easier, don't start liking hacky solutions that don't work
If you want to have this unecessary converter, use file.type = 1
But you're building a workaround for the very reason enums exist - to have a readable string-like value representing a number
Ohh yes thanks!
properties of objects cant be constants though, thats from something else
Nevermind
what new in djs v14?
Pins
ok
How can I convert PermissionFlagsBits.SendMessages enum to just "Send Messages" ( a string )
If you have it in a PermissionsBitField use its toArray() method. If not where do you get it from?
if not, you can just use new Permissions(....).toArray()
then turn it from PascalCase to whatever you want
That sounds like v13 not v14
whatever the permissions class is now
but you can still pass the permission to it's constructor and call toArray on it
Okay thanks
Is defaultMemberPermissions can recieve an array?
yes
I mean defaultMemberPermissions: ['Administrator', 'KickMembers']
depends on where you're passing it
Wdym?
what's the greater context? where's this defaultMemberPermissions being passed to? is it a data for a method?
Ye
okay what method
ApplicationCommandData
i asked what the method was but oh well i'll assume this is the djs one which takes in permission resolvable, yeah it should work in that case, try it out
Okay
is there a change in the deploy commands.js in v14, i know its supposed to be using api version 10
i guess now globals are instant too?
other than the changes on builders, i really don't see any more changes (code wise)
since the guide‘s version of deployment uses REST and not discord.js itself it isn’t really an v14 change in itself
ah ic, welp at leat i only need to worry about 3 discord library dependencies rn. discord.ja, api types, and rest
those and the intents
what intents?
i am so confused
you missed the context, i asked where that specific guide mentions the intents
If you scroll down it should be there
Go to the guide not the doc
what doc 😭 what are you talking about 😭 we're talking about changes in the deploy-commands.js
which does not use intents
i know what intents are and how they changed stop confusing me
They’re supposed to be instant across all versions
Oh
Could you show me where
If you know
Kinda interested
no i am going to sleep, find it yourself
Ok
I mean I wanted to see also but I guess not
I think I found it
I still dont understand
Rest client needs no intents
Hey, I have one problem with collectors. I tried making a collector based on defined TextChannel, but it doesn't collect any messages (end event works).
Can anyone help?
const timeoutEmbed = new EmbedBuilder()
.setDescription(`> You got late! To complete the order press the button below!`)
.setColor(0x7c6bf3);
const timeoutActionRow = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setStyle(ButtonStyle.Success)
.setLabel('Complete the order')
.setCustomId('order-complete')
.setEmoji({ name: '🔗' })
)
const collector = new MessageCollector(channel, { time: 15000 });
collector.on('collect', m => {
console.log(`Collected ${m.content}`);
});
collector.on('end', cl => {
// @ts-ignore
msg.edit({ embeds: [timeoutEmbed], components: [timeoutActionRow] })
})```
do you have the necessary intents to receive message events and perms to view the channel?
lmao
youre genius
is there an update log for each new dev version?
github commits
ah okay thank you
How can I check how many members are banned in a server?
can I have the documentation of v14 ?
Im just sending an array of buttons because action rows throw an error ?
// Action Row Example
message.channel.send({
content: `text`,
components: [new ActionRowBuilder()...]
})
// Buttons
new ButtonBuilder()
.setLabel(`${i}`)
.setCustomId(`${i}`)
.setStyle(ButtonStyle.Secondary)
your buttons need to be in an actionrow
actionrows didnt work lemme try them again
what's not working exactly, and show some code when you're trying to do it
And the error is just an type error
missing the toJSON 
or what IS the type error?
yep
added toJSON onto the action row and still the same thing
change new ActionRowBuilder() to new ActionRowBuilder<ButtonBuilder>()
in order to avoid type conflicts
thanks
you dont need toJSON if sending message/interaction reply
oh right, that's not rest 
Hi, what is AnyInteraction ? 
a union of all different types of interactions, will be renamed to Interaction later
Ok, but how fix it ? 
what do you want to fix?
Why it throws this error?
Code:
const embed = new EmbedBuilder()
.setTitle("Uncaught Exception")
.setDescription("At: " + origin)
.setColor(15548997)
.setFields([
{
name: "Error Name",
value: error.name ?? "Unknown",
inline: true
},
{
name: "Error Message",
value: error.message ?? "Unknown",
inline: true
},
{
name: "Error Stack",
value: error.stack ?? "No Stack",
inline: false
}
]);
type your interactions as AnyInteraction and compare the type property
catch and console.log the error, it will be more readable than that
How compare the type property ?
OHHH
Okey thanks
Anyone know why?
Cannot reproduce
Reinstall maybe
Why replied stay false ? Yet I use interaction.reply
replied will only be set after reply resolves
I used interaction.deferReply, then interaction.editReply. But he tell me : Error [INTERACTION_NOT_REPLIED]: The reply to this interaction has not been sent or deferred. 
did you await the deferReply call?
ye
are you sure deferReply resolved? do you let it error silently?
Yeah, I sure
await interaction.deferReply({ ephemeral: true, fetchReply: true });
if (interaction.type = InteractionType.ApplicationCommand){
interaction.editReply(replyData).catch(console.error);
} else if (interaction.isButton()) {
interaction.editReply(replyData).catch(console.error)
}
why do you fetch the reply and why is there a single "="?
are you sure the error is from one of those lines?
Most likely a missing = sign
Happened to me too more than I’d like to admit 
No response 
Yes
Can I use defaultMemberPermissions: []? Or no?
What are some important new things in the dev branch
Theres nothing new in v14 they only renamed some things and stuff like that
check pins, there's a link with the changes from v13->14
defaultMemberPermissions are a string, "" might work
"0", it needs to be a string containing a BigInt
wouldn't that disable it for everyone instead of enabling it for everyone
Well, if you don’t want to put any permissions needed you simply shouldn’t include the field at all
Where can I find any documentation about what will be new in djsv14?
See pins
Ok ty
how do you make these checklist type things?
thats a select menu
you can make them using select-menus??? never knew that
use setMinValues(..) and setMaxValues(…) to be able to select more than (or less than) one item only
MessageEmbed was removed right
use EmbedBuilder
thx
i think there is a misake in the website
feel free to mention it in 
#1146 in discordjs/guide by lolollllo opened <t:1654279479:R> (review required)
Update v14 guide
How do i kick a user with v14, as when i instantiate a kick using my kick command, it says: user.kick() is not a fucntion
you have to call .kick() on a member object
not a user
thanks, is there a way to resolve a user given the id or do i just interaction.guild.members.fetch(interaction.options.getUser('user'))?
interaction.options.getMember('user')
tysm
what is it now?
its a exported at top-level now
const { escapeMarkdown } = require('discord.js')
Oh
if (!message.guild.me.permissionsIn(message.channel).has(PermissionsBitField.Flags.SendMessages))```
Cannot read properties of undefined (reading 'permissionsIn')
bumping
i've already tried ButtonBuilder.from(ActionRowBuilder.from(row).components[0].data).setDisabled(false);
gives me the same error
I'm having a direct image/video or what ever url, how can I upload this as a file? (without seding the link itself)
interaction.isModalSubmit is not a function``` it changes to what ?
nothing, do a regular type check
interaction.type === InteractionType.ModalSubmit
How do I use AutoComplete?
if (interaction.type === InteractionType.ApplicationCommandAutocomplete()) {}
this?
remove the () at the end of InteractionType.ApplicationCommandAutocomplete, it isn't a function
Someone know why it worked before and now there is an error?
because that method was removed
check .type === ChannelType.GuildText instead
because it's been removed, you now need to use c.type === ChannelType.GuildText
Like this?
yes

.
Documentation suggestion for @empty urchin:
AttachmentBuilder
Represents an attachment builder
@forest elm ..?
?
and what actually doesn't work?
editReply
.send({ files: ['url'] })
you cannot use editReply after you have responded to the interaction
you can put deferReply at the beginning of the code and use editReply in some parts of your code
ok how can i edit the reply ?
what should be awaited ?
await inter.deferReply()
await inter.editReply({content: `Loading ...`, fetchReply: true})
then editReply when i want to edit loading ?
yes
awaited ?
yes
sure you can?
well yes. That's about what I did
you said "you cannot" ._.
not working
and so I meant that after reply it is no longer possible to use editReply and deferReply
upload your team to that site completely
'Chu want boi
after reply it’s possible to use editReply
that’s.. logic
Hey, I get this Error inside of my Command Handler:
TypeError: interaction.isCommand is not a function```
//Verwende und Antworte auf Slash-Commands
client.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return;
const command = client.commands.get(interaction.commandName);
if (!command) return;
try {
await command.execute(interaction);
} catch (error) {
console.log(error)
await interaction.channel.send({
content: 'Tut mir leid! Während ich veruscht habe diesen Command auszuführen ist mir ein Fehler unterlaufen... Probiere es gerne noch einmal.',
ephemeral: true
});
}
});
Thx
אהלן
TypeError: MessageAttachment is not a constructor :
const attachment = new MessageAttachment(canvas.toBuffer(), `deck.jpg`);```
new AttachmentBuilder(canvas.toBuffer(), { name: 'deck.jpg' })
thx
bumping again...
If you already have the row constructed it would be much easier to edit the JSON instead of rebuilding from JSON like that…
ohh okay
guess i'm dumb lol
Hey, why isnt this working:
I get a TypeError: Cannot read properties of undefined (reading 'Flags') Error in this Code:
if (!member.permissions.has(discordjs.Permissions.Flags.Ban_Members)) {
interaction.reply('Du hast keine Rechte, diesen Benutzer zu bannen!')
return
}
I also tried FLAGS.BAN_MEMBERS
PermissionFlagsBits.BanMembers
Thanks! I couldnt find that in the new Guide
Is .setField not a function anymore?
addField*
.addFields([{}, {}])
addField got removed?
yes
Ahh oke
Please attach the code, according to the error screen, nothing is clear to me.
attachment is this: ```ts
if (reaction.message.attachments.first()?.url.endsWith('.png')
|| reaction.message.attachments.first()?.url.endsWith('.jpg')
|| reaction.message.attachments.first()?.url.endsWith('.jpeg')
|| reaction.message.attachments.first()?.url.endsWith('.gif')
) attachment = reaction.message.attachments.first()?.url;
else if (reaction.message.attachments.first()?.url.endsWith('.mp4')
|| reaction.message.attachments.first()?.url.endsWith('.mp3')
|| reaction.message.attachments.first()?.url.endsWith('.mov')
) {
attachment = reaction.message.attachments.first()?.url;
asFile = true;
};
`urlData`, `url` is this: ```ts
urlData = reaction.message.embeds.find((object: any) => ['acticle', 'gifv', 'image', 'video'].includes(object.type));
if (urlData?.type === 'video') urlData.video?.url;
else url = urlData?.thumbnail?.url;
embeds are just 1-2 message embeds, shouldn't matter here;
const message: Message | undefined = await (channel as TextChannel).send({
embeds: embeds,
files: urlData?.type === 'video' || asFile ? [attachment || url || ''] : []
});
Long code short, I copy the uploaded files from a user (starboard)
this is the video it tried to copy (70mb) https://c.lunish.nl/zdr2.png
smaller files work without any issues https://c.lunish.nl/v2zE.png
so I assume that it times out because the file is just large and takes long to upload
( @thorny haven )
@empty urchin can you tell in which part of the code the problem occurs?
await (channel as TextChannel).send(..)
To begin with, try putting channel as TextChannel in a separate variable
const channel = channel as TextChannel
the issue is that it times out with large files and not the typing lol
small files or no files at all work
I don't know yet, maybe there is a limit.
@empty urchin Discord bots are able to send files with a size of <8mb or =8mb by default, if there are boosters on the server, then the size of the files being sent increas
From the 3rd level of boost, bots will be able to send files <=100mb on your server
well the limit in my server is 50mn atm, maybe there should be a more clear error that the file is too big instead of just letting the request timeout
In the first screenshot, your file weighs 69 mb
yeah I know
then the file size is just the limit, but was I said^
I'll give you a tip, you can use pm2 if you want your bot to reboot instead of shutting down 🙂
I use pm2
this error is just local testing
I would still just want to get rid of errors lol
Well, maybe something else happened, but still, as you say, the limit of files you have is 50mb, so your bot will not send files over 50mb
yeah I noticed that, that's why I said that it would be helpful to get a clear error that tells you that the file is too large instead of just letting the request timeout
const newclient = new Client({
allowedMentions: {
parse: ["roles", "users"],
repliedUser: false,
},
failIfNotExists: false,
presence: {
activity: {
name: `Dm for Help & Support`,
type: "WATCHING",
},
status: "online"
},
partials: ["CHANNEL", "MESSAGE", "REACTION", ""],
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.DirectMessageReactions
]
});``` Strange the bot doesn't get a notification when someone dms him (newclient.on("messageCreate", async message => {console.log(message.content)) ...
Have you tried displaying message first?
yep he is able to react with guild messages
This is understandable, but when a bot is written to the dm, does something come to you?
Partials are wrong
As well as your activity type
(the problem is you need the Channel partial)
thx all
Hey, why doesnt this Permission Check recognise, that I have Permissions and Administrator rights?
//Get User from Interaction
var user = interaction.options.getUser("user")
//Bekomme Guild Object
let guild = interaction.guild
//Prüfe, ob der Benutzer die nötigen Rechte hat
await guild.members.fetch(user.id).then(member => {
(async() => {
console.log(member)
let user_perms = await member.permissions.has([discordjs.PermissionFlagsBits.BanMembers, discordjs.PermissionFlagsBits.Administrator], true)
console.log(user_perms)
if (user_perms == false) {
interaction.reply('Du hast keine Rechte, diesen Benutzer zu bannen!')
return;
}
//Check if Bot can Manage the User ( Ban the User )
if (member.manageable == false) {
interaction.reply('Der Bot hat keine Rechte, diesen Benutzer zu bannen!')
return;
}
//Ban User
guild.members.ban(user)
//Reply to Slash Command
interaction.reply("Der Benutzer " + user.username + " wurde gebannt!")
})()
})
user_perms is just "false"
every time
There's no point checking if someone has both ban members and administrator, since the latter supersedes the former
Also I cannot reproduce that with your exact code
Hmm okay. I will do some debugging again
How to defer interaction without sending loading message and other messages?
i think you have to reply to a interaction in some way
I don’t think you can
Based on what I know about the api
Yeah, Discord forces you to provide a good user experience
You only can defer message component interactions without sending messages
Users should know that the command was received
Initial response is a no but responses after can use deferUpdate()
Like if you want to respond to someone hitting a button and need more than 3 seconds then deferUpdate() would work pretty sure
Will djs 14 make it easier to make slash commands? Also will the prefix commands will be the same +don't expect a response until like 6-8hrs
No real change to either of those other than permissions v2
Hmm I'll take a look at docs when v 14comes out
I don't even need to chnage any coded only in permission handler Soo it. Be esay update for me
some structure names was changed
and some methods removed/moved
i rewritten my bot to djs v14 alr
const i = GatewayIntentBits;
const p = Partials;
const intents = [
i.GuildMessages,
i.DirectMessages,
i.GuildMembers,
i.MessageContent,
i.GuildScheduledEvents,
];
const partials = [
p.Channel,
p.GuildMember,
p.Message,
p.User,
];
Hey! So this is what I'm importing into my client, but I'm not receiving the messageCreate event. Can anyone help?
it says i cant send an empty message ```js
let image = await create(song.name, song.thumbnail)
let attachment = image
await interaction.followUp({
attachment: [attachment],
});```
How can i declare the new permission bitfield ? ( [BITFIELD_INVALID]: Invalid bitfield flag or number: VIEW_CHANNEL.)js await interaction.channel.permissionOverwrites.edit(interaction.member, { VIEW_CHANNEL: true, SEND_MESSAGES: false, SEND_TTS_MESSAGES: false });
gotta need the Guilds intent pretty sure
it's like the base intent for other guild intents
oh i see; thanks
TypeError: Cannot read properties of undefined (reading 'custom_id')
I don't use custom_id i use customId
can you show the full error and the code please
TypeError: Cannot read properties of undefined (reading 'custom_id')
at TextInputComponent.get customId [as customId] (C:\Users\utente\Desktop\IFireBot\node_modules\discord.js\src\structures\TextInputComponent.js:16:22)
at Object.run (C:\Users\utente\Desktop\IFireBot\src\SlashCommands\Owner\eval.js:15:47)
at Object.run (C:\Users\utente\Desktop\IFireBot\src\events\interaction\interactionCreate.js:9:31)
at Client.<anonymous> (C:\Users\utente\Desktop\IFireBot\src\handler\events.js:19:54)
at Client.emit (node:events:390:28)
at InteractionCreateAction.handle (C:\Users\utente\Desktop\IFireBot\node_modules\discord.js\src\client\actions\InteractionCreate.js:81:12)
at Object.module.exports [as INTERACTION_CREATE] (C:\Users\utente\Desktop\IFireBot\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (C:\Users\utente\Desktop\IFireBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:350:31)
at WebSocketShard.onPacket (C:\Users\utente\Desktop\IFireBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:476:22)
at WebSocketShard.onMessage (C:\Users\utente\Desktop\IFireBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:320:10)
I made my own function (to make my job easier) but it gave such an error, how can I fix it?
I'm fixed
thx
yikes
hey so i get this error TypeError: Cannot read properties of undefined (reading 'path') when i run ```js
let image = await create(song.name, song.thumbnail)
let attachment = new Attachment (image)
await interaction.followUp({
files: [attachment],
});```
new AttachmentBuilder(image)
create() is a fucntion i made w canvas
oh ight ty
I you pinged me because of this why?
to help me
read the rules thanks
ight sorry
?
code?
const code = new TextInputComponent().customId('code').setLabel('Code').setStyle('PARAGRAPH');
.setCustomId not customId
I recommend you see the documentation
if i use it return error
I recommend you see the modal guide: https://deploy-preview-1060--discordjs-guide.netlify.app/interactions/modals.html
TypeError: (intermediate value).setCustomId is not a function
Are you using the code from v13?
No
use TextInputBuilder, or whatever's the builder counterpart to the component
ok
TextInputComponent v13
TextInputBuilder 14
const member = interaction.user;
if (member.permissions.has([Permissions.FLAGS.ADMINISTRATOR])) {```
`TypeError: Cannot read properties of undefined (reading 'has')`
users dont have permissions, members do. Use interaction.member instead.
ohh
hm TypeError: Cannot read properties of undefined (reading 'FLAGS') now
check the pinned guide for updating
alright
I see this in the guide PermissionsBitField
do I use this instead of the previous Permissions or?
what does the guide tell you? idk i don't code
oh
ah i'm not supposed to use flags when using PermissionsBitField 
no?
i may not be able to code anymore but i can read docs
PermissionsBitField.Flags.whatever
https://discord.js.org/#/docs/discord.js/main/class/PermissionsBitField?scrollTo=s-Flags
if (interaction.member.permissions.has([PermissionFlagsBits.Administrator])) {```
FlagsBits, read what you said again
this works ^^
my query is resolved, tyvm.
PermissionsBitField.Flags is PermissionFlagsBits
thank you for reiterating the fact
as it is undefined, fancy
you're not really supposed to create your own ActionRow instances, create ActionRowBuilders
not working...
Read the update guide, specifically enums
GameType.Watching
yes
I changed it as follows, but the playing part does not appear.
Not a discord.js issue, you just have to wait
You're doing that... every 5 seconds? Jeez, why?
so what?
I view that as API spam
Especially since setting presences are blocking in the gateway iirc
status is loaded, but activity no found
so i had a question should i use fetch instead of cache since fetch returns the accurate value for what i look forward to but takes a lot of time so either way i wanna know is there any way i can make my fetching faster?
try importing ActivityType from discord.js, and replace ActivityFlagsBitField.Flags.Play with ActivityType.Playing
That will have no effect
oh
its worked
thanks
No way
Oh actually ActivityFlagsBitField is something completely different @_@
is there any updates with the permissions of the slash commands w/ v14, i find it very restrictive to make slash commands permissions be tied to PermissionBits or smth, rather than a role
that is how discord decided to implement permissions going forward
roles can be set by the server staff
if you want to change that (server settings) as a bot dev you need oauth2 by someone with that permission (manage guild) to do it in their name
as a dev you are limited to default permissions with bits - which staff can change whenever they want
- anyone with manage guild permission cannot be prevented from using any command anywhere (as long as it is deployed globally or to the specific guild, of course)
if (interaction.type === InteractionType.Autocomplete) {}
Auto complete don't work
Well, InteractionType.Autocomplete doesn't even exist, so yes, it won't work
- if (interaction.type === InteractionType.Autocomplete) {}
+ if (interaction.type !== InteractionType.ApplicationCommandAutocomplete) {}```
i view it on guide
and? what are you supposed to do?
Where in the guide is that?
the changes in v14
Will change it, thank you
Can I be a contributor to the guide?
That's not my call to make
Solution?
Use InteractionType.ApplicationCommandAutocomplete
thank you
"contributor on the guide"? we take prs, knock yourself out
the v14 guide is however a deploy preview, meaning it is tied to a particular PR
so a comment/suggestion on that is better than opening your own
This is normal if the Intents have not been updated on the guide deploy-preview-1011 ?
https://deploy-preview-1011--discordjs-guide.netlify.app/creating-your-bot/command-handling.html#reading-command-files
Oh there is lot's of preview
, thanks :D
How can I do that only the full car options can be entered
The what now
This isn't really v14 stuff, but I'm using v14:
my bot does not ping the role specified
interaction.channel.send({
content: `<@&${pingID}>`
})```
I have also tried putting the role ID directly into the content section; it does not work.
I have the role in the server, and the bot has admin.
How can I do that in /commands I can only put some valid options
Maybe you instantiated your client with no allowed mentions
alr, i'll check
yeah 
wdym by "valid options"
It is possible that a person can select a string only from these options
Yes
const possibleChoices = choices.map(i => { return i.value })
if (possibleChoices.includes('string')) {}
Where should I put it?
where you need. The main thing is to have access to the array choices
You can do that in slashcommands by providing exactly that in your slashcommands JSON. It’s choices
How do i provide a custom hex color in the embed color?
0xHexColor
not been keeping up with the library for a while so sorry if this is a redundant question, have most of the isWhatver() typeguards been removed from structures?
Yes
ah thanks! just what i needed
so this new way doesn't "apply" the typeguards or am i doing something wrong?
The type of int is wrong
It should be AnyInteraction
ohhhh never knew that existed
It's a recent change. Are those types not inferred there already?
if you mean this event file will always be an autocomplete, no
Heyy, a quick question, cause ts is showing that isModalSubmit method doesnt exists any more, so what is the other method to check if interaction is a modal?
// docs too
Check the type of interaction
Look above
Defer can be used with showModal?
no
both are initial replies to an interaction
do you have to write your own type guard functions for TS now that they've been removed from DJS? checking the type property doesn't narrow down the actual type.
Type for what?
channels and interactions
change Interaction to AnyInteraction
Likewise, Channel to AnyChannel
The former is the base class, the latter is a union, allowing ts to know which type correspond to which subclass
Which is why I think there is a PR to rename them to Base* right now
ah, thanks. what about the remaining functions like isButton()? are they going to be removed too?
Yea
is ModalBuilder supposed to only work when using its functions instead of the constructor? or is it a bug?
// doesn't work
const modal = new ModalBuilder({
customId: 'string',
title: 'string',
components: [new ActionRowBuilder<TextInputBuilder>({ components: [nameInput] }), new ActionRowBuilder<TextInputBuilder>({ components: [descriptionInput] })],
});
// works
const modal = new ModalBuilder()
.setCustomId('string')
.setTitle('string')
.setComponents([new ActionRowBuilder<TextInputBuilder>({ components: [nameInput] }), new ActionRowBuilder<TextInputBuilder>({ components: [descriptionInput] })]);
I'm assuming that the first variant should work, since every other builder class behaves like this.
@velvet jasper maybe? ^
Maybe ActionRowModalData is just missing title? Not too sure
where is the builder imported from?
discord.js
this is a type issue btw, the first variant works just fine when ignoring the TS error/forcing transpilation.
hey I think I came across a bug: https://sourceb.in/r15atGFcs7
14.0.0-dev.1655770161-94f7ca9
My token is valid but for some reason I can't login
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.MessageContent] });
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('messageCreate', message => {
console.log(message);
});
client.login('token');```
Lol
Yikes
That is indeed a bug
I'll open an issue I guess
Please do
I think I found the problem though
const invalidToken = new Error(ErrorCodes.AuthenticationFailed);
This line is causing the issue
That error code doesn't exist
Opened a pull request to correct the error code, so it's all good for now
nice
This is all that needs changing, lol
packages/discord.js/src/client/websocket/WebSocketManager.js:133
- const invalidToken = new Error(ErrorCodes.AuthenticationFailed);
+ const invalidToken = new Error(ErrorCodes.TokenInvalid);
lol
This error keeps happening when I start the bot.
This is where the error line is
It's a bug. Just downgrade
Or do the diff above