#djs-in-dev-version
35223 messages · Page 24 of 36
Separate question: Is v13's Permissions.resolve() now PermissionsBitField.resolve() in v14?
Permissions is PermissionsBitField
Thanks
Hmm. In the TS types there doesn't appear to be anything that satisfies JSONEncodable<AtachmentPayload>, which is the type expected for MessageOptions.attachments. Both Attachment and AttachmentBuilder have toJSON(): unknown. Possibly a bug in the definitions?
Not sure if this is a v14 thing or not: I'm coding a command that restricts permissions for regular members, but my bot gets the Missing Permissions error when attempting to execute channel.permissionOverwrites.set(). My bot has Manage Roles and is not trying to edit overwrites for a role higher than its own. I followed the v14 upgrade guide as well, so I'm using the latest syntax.
That error is from Discord, not discord.js
That's fair. I guess I should ask on Discord Devs then.
I wish it would tell me which permission was missing. 
TypeError: Cannot read properties of undefined (reading 'path')
at findName (/app/node_modules/discord.js/src/structures/MessagePayload.js:240:17)
at Function.resolveFile (/app/node_modules/discord.js/src/structures/MessagePayload.js:254:31)
at /app/node_modules/discord.js/src/structures/MessagePayload.js:221:85
at Array.map (<anonymous>)
at MessagePayload.resolveFiles (/app/node_modules/discord.js/src/structures/MessagePayload.js:221:56)
at TextChannel.send (/app/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:174:50)
at logEmbed (file:///app/util/functions.js:52:46)
at Object.execute (file:///app/events/loggers/messageUpdate.js:36:68)
at Client.<anonymous> (file:///app/structures/handlers/events.js:24:67)
at Client.emit (node:events:527:28)
what could be causing this issue?
all I'm doing is running:
client.channels.cache.get(targetChannel).send({ embeds: [embed], files: attachments });
(targetChannel is a string of the channel ID)
related to https://github.com/discordjs/discord.js/issues/8031 possibly?
note that this issue only appeared very recently, after some update (unsure which)
it only happens when sending an attachment from what I can tell
How are you defining attachments
Also it needs to be an array
When was the last update for dev version?
6 hours ago
new AttachmentBuilder(…)
AutocompleteInteraction (extends Interaction)
Represents an autocomplete interaction.
@regal mason #app-commands
nvm
What's the problem in this?It says invalid bitfield flag or number
Can you show the full error?
Can you show line 13? The error is from there.
It was my handler issue and I fixed it
since modals got released in v13.7.0 what are new features in v14 other than renamed stuff
pins
thx
ah thanks!
wait so arrays of Attachments can't be used anymore?
I think you just can’t build it
at least looking at https://discord.js.org/#/docs/discord.js/main/typedef/BaseMessageOptions seems you can, but that might be outdated I'm not sure
alright after more digging I assume it has something to do with this commit: https://github.com/discordjs/discord.js/commit/dfadcbc2fd50be64c8a0c1cae3be10f83678c5ee
so I will use new AttachmentBuilder() instead, thanks!
djs v14 is coming shall i keep learning v13 or wait for v14
You just need to learn logic and js. V13, v14 doesn't matter u just need to rename some stuff and change some logics. So just learn v13 now and migrate to v14 when it comes.
Ehm??
did it change name??
It was removed
What
What is it now then ;-;
Just check the type of interaction instead
Breh
How should i check for the type then
nvm fixed it
I'm trying to narrow down an Interaction to be either a AutocompleteInteraction or CommandInteraction. Before I used to do this with two typeguards: if(!interaction.isCommand() && !interaction.isAutocomplete()) return;, but #8027 removed both of these. What I got from the other PR mentioned in #8027 is that you can just typecheck by comparing the type field, but that doesn't seem to work:
if (
interaction.type !== InteractionType.ApplicationCommand &&
interaction.type !== InteractionType.ApplicationCommandAutocomplete
)
return;
const { commandName } = interaction; // TS Err: Property 'commandName' does not exist on type 'Interaction<CacheType>'
// 'interaction' is still of type Interaction
So, how do I now typeguard interactions?
How many TextInputs i can add on modal? is it 5 or 25 like other interaction
5
well rip
cant replicate
but actually why is the type "Interaction"
if you're using the interactionCreate event, it should be AnyInteraction
Yeah exactly what Almeida said
oh yeah, using AnyInteraction fixes it, thank you! I was handling the interaction in a separate utility function where I passed it as Interaction
I just updated the discord.js and it throws me this
something changed?
i set the client type to the Client you can import from djs and i get this error, anyone know why?
If it's meant to be a ready client, type it to be Client<true>
ty! that fixed it
I think the preview needs to be updated
8027
has interaction.isChatInputCommand() been removed?
and interaction.isModalSubmit()?
if so ill change those
yes
ight
wait no
only isModalSubmit
isChatInputCommand is still around
I confirm
but... what replaces the isModalSubmit?
interaction.type === InteractionType.ModalSubmit

ty
uhm what am I supposed to use now that interaction.isAutocomplete() is removed?
not sure if its a problem on my side but interaction.options.getSubcommand() isn't working, is it removed or something?
interaction.type === InteractionType.ApplicationCommandAutocomplete
What does "isn't working" mean
oh thanks
showing an error: interaction.options.getSubcommand() is undefined
hold on let me check if its an error on my side
undefined is definitely a developer issue
okay yeah its an error on my side
fixed it 👍
Is InteractionType.ApplicationCommand the proper replacement for isChatCommand()?
That never existed
Is that directed at me?
what? if you enter something bigger than 2000 characters in the slash command option you get an api error
is there a way to prevent this?
...don't?
isChatInputCommand still exists
what if a user does the same? you know what ill try to put it in a try catch block
Sorry, that's the one I meant. So that isn't one of the typeguards that was removed?
I don't understand how that will affect your bot
Nope
I see. Well... I guess I could use it, but now my code is inconsistent. lol
I miss the method type guards tbh, they looked cleaner
I liked them, too. I'm sure there is a good reason for removing them, but I wonder why some were removed and not others.
What are you even doing here? I don't understand how you get this error if someone just passes 2,000 characters in an option. You must be doing something
The ones removed were the ones that just checked for one single type
isChatInput for example was kept bc it checks type and commandType
Ah I see. OK, that makes sense.
I'll live with my command handler looking a bit odd.
okay here's what i do to recreate: copy and paste a paragraph or something that's more than 2000 characters like this
You can still do it manually if you want consistency
and I get an invalid form body api error
But that's just a client issue
What's that gotta do with discord.js
o,o
Yeah I'm considering it, heh.
Where did you get that error from?
discord api
Was it sent to your bot?
wat
if (
interaction.type === InteractionType.ApplicationCommand &&
interaction.commandType === ApplicationCommandType.ChatInput
) { ... }
@cyan jewel
I'm thinking you were sending a message that was too long, and didn't handle it
harder to know without the full error
Discord just doesn't send you errors like that, you're doing something with the data that is
If a user can send it, so be it
Probably looks like you just tried to resend the message
Yeah that's what I was thinking. A lot more verbose, though. Autocomplete is the only outlier that needs the new syntax, so I think I'll just leave it for now. Don't want to bikeshed this when I'm so close to shipping. 😅
Well chatinput is a method as well
interaction.reply(`**${interaction.options.getString('message')}** has been translated to: **${res.data.binary}**.`);
Is it because I'm getting past the message character limit due to the user sending a long option?
YES
That is it
knew it
how can I prevent this?
by checking the length
or catching
what? if you enter something bigger than 2000 characters in the slash command option you get an api error
This message was missing a LOT of context in what you were doing for your error, hence the confusion
ah okay
sorry about the confusion, english isn't my first language lol
Well, now you know
I meant autocomplete is the only check in my command handler that no longer has a method. All the rest still have methods.
Bots can only send 2,000 character messages, but embed descriptions can have up to 4,096 characters
still sending the same error even after i check the length, could be my problem
Probably checking in the wrong place
Also look what you sent above
#djs-in-dev-version message
You're sending whatever the user puts alongside text already. You need to check for a number less than 2,000
did the presence stuff change bcs my bot isnt setting the presence js client.user.setPresence({ activities: [{ name: "your favorite vibes • /help", type: "LISTENING" }], status: "idle", });
it only sets that its idle
I believe the type of activity is a number
and where do i get that number from
Documentation
ty
https://discord-api-types.dev/api/discord-api-types-v10/enum/ActivityType
Or use this enumerable
You would do import { ActivityType } from "discord.js" then in your type put ActivityType.Listening
aight ty
how do I get an interaction's customId?
Property 'customId' does not exist on type 'Interaction<"cached"> & InteractionResponseFields<"cached">'
@velvet jasper shouldn't this narrow the type or am i just missing something really obvious?
Hmmm, it definitely seems unintended
Shouldn't it be AnyInteraction
@velvet jasper
Yeah, are you on the latest dev version?
yeah I just updated
what's the difference between Interaction and AnyInteraction?
oh it's just a union of every interaction lol
Yeah class hierarchies are open, unions are closed
TypeError: Cannot read properties of undefined (reading 'resolve') when dealing with webhooks..?
known issue
what's the recommended fix for now?
don't deal with webhooks for now or use an earlier commit
alr
https://sean.does-co.de/QTwxAKF6 whats that?
Flags are PascalCase in v14, not SCREAMING_SNAKE_CASE
How can I access them?
PermissionsBitField.Flags.ViewChannel
or PermissionFlagsBits.ViewChannel
ok
ok so its from VIEW_CHANNEL to ViewChannel?
and from SEND_MESSAGES SendMessages?
Yup
global? 🤔
Uncaught Error Error: Cannot find module './INTEGRATION_CREATE'
Require stack:
- c:\Users\jpedr\Desktop\Visual Code\Node.js\Botter V4.1\node_modules\discord.js\src\client\websocket\handlers\index.js
- c:\Users\jpedr\Desktop\Visual Code\Node.js\Botter V4.1\node_modules\discord.js\src\client\websocket\WebSocketManager.js
- c:\Users\jpedr\Desktop\Visual Code\Node.js\Botter V4.1\node_modules\discord.js\src\client\Client.js
- c:\Users\jpedr\Desktop\Visual Code\Node.js\Botter V4.1\node_modules\discord.js\src\index.js
So this error keeps the discord js library to load at all, djs version: discord.js@14.0.0-dev.1654906231-c7391db
Yea, we're aware
Oh, I didn't know, sorry for bothering
No, you're not bothering
You're actually the first person I've seen to talk about this lol
We welcome things like this ^^
🙂
I will downgrade my version, do you know any that works?
Anything before commit c7391db
Okk, I will look for it, thanks
This version works 14.0.0-dev.1654862727-0415300, for anybody seeing that error: npm i discord.js@14.0.0-dev.1654862727-0415300
Nice!
The method <Interaction>.isAutocomplete() has been removed?
Oh, got it, thanks
<guild>.me is depreciated in the dev build?
Is it <guild>.members.me now?
Yea
thanks
How to use isModalSubmit() and isAutocomplete() after https://github.com/discordjs/discord.js/pull/8027 ?
Help
ok, i found answer, tysm
read like several messages above
interaction.type === InteractionType.ApplicationCommand?? Did I need to import the InteractionType?
no... downgrade your djs
wdym?
^
or wait till https://github.com/discordjs/discord.js/pull/8065 get merged
BTW wdym downgrade?
install a lower version of djs which doesn't has the bug, see what Jiralite said
How do I install it?
receiving this error when using AttachmentBuilder
assuming that AttachmentBuilder is the v14 version of MessageAttachment of v13
Look this
ah thanks
right i updated the version before using it
Hi guys, with the latest dev release the integration event handlers are missing from /src/client/websocket/handlers.
I have to comment out the requirements in order to successfully start my bot.
wait till https://github.com/discordjs/discord.js/pull/8065 get merged
Also I'm getting bigint serialisation errors when trying to create commands with default member permissions, whether I stringify the permissions or not.
if you manually provide it as a string, how would that error out on json serialisation for bigints?
I have no idea at all.
After making changes to the command transformer I was able to make it work, I'll submit a PR.
Interaction has already been acknowledged.
await interaction.deferReply({ fetchReply: true });
await interaction.editReply({ embeds: [embed], components: [menu] });
const msg = await interaction.fetchReply();
const collectorMenu = msg.createMessageComponentCollector({ componentType: ComponentType.SelectMenu, time: 180000 });
collectorMenu.on('collect', async i => {
if (i.user.id === interaction.user.id) {
if (i.customId === 'menu') {
switch (i.values[0]) {
case 'shop_option': {
const menuShop = new ActionRowBuilder().addComponents([
new SelectMenuBuilder()
.setCustomId('menuShop')
.setPlaceholder('Select roles')
.addOptions(Components),
]);
await i.update({ content: 'Select roles from the menu below', components: [menuShop], ephemeral: true });
const msg1 = await i.fetchReply();
const collectorMenuShop = msg1.createMessageComponentCollector({ componentType: ComponentType.SelectMenu, time: 180000 });
collectorMenuShop.on('collect', async shop => {
if (shop.user.id === interaction.user.id) {
for (const value of Components) {
if (shop.values[0] === value.values[0]) {
await shop.update({ content: 'Like a successful purchase :)', embeds: [], components: [], ephemeral: true });
}
}
} else {
shop.update({ content: 'This menu does not belong to you!', ephemeral: true });
}
});
} break;
}
}
} else {
i.reply({ content: 'This menu does not belong to you!', ephemeral: true });
}
});
You should stop collectorMenu when updating, since it’s still the same Message and both collectors will collect the next SelectMenuInteraction
didn't help, same error
Which of those many lines gets you the error though? Hard to determine with three different interactions in your code… Show full error stack
DiscordAPIError[40060]: Interaction has already been acknowledged.
Tag suggestion for @upper stirrup:
• DiscordAPIError: Interaction has already been acknowledged
• [INTERACTION_ALREADY_REPLIED]: The reply to this interaction has already been sent or deferred.
You have already replied to the interaction.
• Use <Interaction>.followUp() to send a new message
• If you deferred reply it's better to use <Interaction>.editReply()
• Responding to slash commands / buttons / select menus
error referencing this line:
await i.update({ content: 'Select roles from the menu below', components: [menuShop], ephemeral: true });
any update on webhook bug?
DiscordAPIError[40060]: Interaction has already been acknowledged referencing this line await i.update({ content: 'Select roles from the menu below', components: [menuShop], ephemeral: true });
collectorMenu and collectorMenuShop collects the same select menu interaction and both replies to it.
well, I need to have another menu in one menu, how can I do this so that there is no error
Guess you acknowledge that interaction somewhere else (maybe in your interactionCreate event?)
Oh, you don’t check customId in second collector…
hi
I cannot install @discordjs/opus on replit
what does it mean with Path??
new AttachmentBuilder(…)
i Replace this with that??
hi
I cannot install @discordjs/opus on replit
yep
new AttachmentBuilder('url', { name: 'attachment.jpg' }) for example
Ok Thanks
not something we can fix, replit is just bad
Its merged now
const { InteractionType } = require('discord.js');
client.on('interactionCreate', async interaction => {
if (interaction.type === InteractionType.Autocomplete) {
if (interaction.commandName === 'sourcebin') {
const focusedValue = interaction.options.getFocused();
const choices = ['JavaScript', 'TypeScript', 'HTML', 'CSS', 'Text', 'Java', 'Ruby', 'Phyton', 'C#', 'C+', 'C', 'JSON'];
const filtered = choices.filter(choice => choice.startsWith(focusedValue));
await interaction.respond(
filtered.map(choice => ({ name: choice, value: choice })),
);
}
}
});```Why its not working?
And also what is InteractionType.Ping for?
It’s an interaction discord sends to make sure the client is still responding. Djs responds to it internally only HTTP interaction handlers get it so it never fires in interactionCreate event
Ok
Already fixed my lib :)
Is there a reason that the type isn't getting narrowed to AutocompleteInteraction, or can I just assume that this is a vscode issue?
mine its working
so probably just an issue with the IDE, got it
is interaction typed as AnyInteraction?
Ah, I had it as just normal Interaction
That fixed it, thanks!
InteractionType.ApplicationCommandAutocomplete
components[0].components[1][COMPONENT_LAYOUT_WIDTH_EXCEEDED]: The specified component exceeds the maximum width
const row = new ActionRowBuilder()
.addComponents([
new ButtonBuilder()
.setLabel("Modifier")
.setStyle("Primary")
.setCustomId("edit_product-" + res.id),
new SelectMenuBuilder()
.setPlaceholder("Modifier le statut")
.setCustomId("edit_status-" + res.id)
.addOptions([
{
label: "Public",
value: "publish"
},
{
label: "Brouillon",
value: "draft"
}
]),
new ButtonBuilder()
.setLabel("Images")
.setStyle("Primary")
.setCustomId("add_images-" + res.id),
])```
an action row can only have 1 select menu
or 5 buttons
you cant have buttons and a select menu in the same action row
How can I check if a user has permission to run a command in perms v2?
const { MessageEmbed, Permissions } = require('discord.js')
if (!message.guild.me.permissions.has([Permissions.FLAGS.SEND_MESSAGES])) {
return message.reply({
embeds: [
new MessageEmbed()
.setTitle("***You don't have the permission to do that!***")
.setColor("#cc0000")
]
});
} ```
you specify default_member_permissions field on your command and discord will hide those cmd from those who doesnt have perms (unless server admins overwrite that)
No I want to check if a user have permission to use the command which is set by an admin
discord hides commands for those without the required permission
ik but I want to use it for other purpose
like if a member uses my message cmd, I want to check if they've perms to use my slash cmd
if they've only then run the command
/check-perms command?
?
There is literally no answer to your question other than what Almeida said? :thinking:
Discord hides it from people who don't have permission, so how were you expecting to test them running the command
run my message cmd (prefix cmd) with the same name. And I want to see if they've perms to use my slash cmd (with that name) then run the prefix cmd
Yeah, exactly, this would be the workaround. Make a command that checks the permission of the command they want to use but that sounds ugly imo
You aren't getting what I mean
But this is exactly what I said
no lol
see I'm giving an example.
like I've a cmd a. This command can be used from/a or using my prefix like !a. Now an admin can set permission for the slash cmd. And that command will be hidden. But that user can still use my message command. So before running my message command, I want to see if the slash command is available to that user then run the message command else don't
easy, delete your message command and tell your users to not disable slash command suggestions instead, that way they will get /a if they type !a or ~a or really any other common or uncommon prefix
well I also don't want to use a lot's of extra lines of code to make my command message and slash compitible but my users don't uses slash command lol. But nvm I'll figure out
There's an error when sending dynamique autocomplete with Integer argument
The interaction is not received on the event interactionCreate
how to fix?
That's way too big. If you really think there's an error, make a minimal reproduction sample. You're also on an old dev verison
2 bots won't login
help me
hey
how to fix?
Dont ask every few minutes the same question repeatedly 
hi how can i check if the user that ran the interaction is alone in a vc
interaction.member.voice.channel.members.size would be 1 (add some checks or optional chaining to make sure they actually are in a VC before)
ty
no look what should i do?
Tag suggestion for @undone yew:
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?
my code?
attach a listener to debug (client) and rateLimited (client.rest)
Client#rest
The REST manager of the client
debug
I'm added rest.on
no changes
what should I do?
good question, so it's just stuck at preparing and never gets past that?
What exact version are you on?
any updates on the webhook fix?
"discord.js": "14.0.0-dev.1654689812-1afae90",
i updated discordjs latest version
no changes
yes
ModalSubmitFields
Represents the serialized fields from a modal submit interaction
Do I need to throw away the client definitions?
?
Is there a reason why the message.content is empty, when it's not??
do you have the message content intent enabled?
Attach to the restDebug event of client.rest too please and try again
i will try tomorrow
yes
in the dev portal and in your code?
yes
Guys I have a page system with buttons from v13 and It dont work in the current dev version + dont drop errors before I post code here Is there a change between v13 and v14 with collectors?
the bot receives the message from the api, but then when I console log it, it's empty.
hmm that shouldn't happen if you have it enabled
Only that an ignore event was added, but no breaking changes in collectors itself that I‘m aware of
Without code, we cannot tell either what the issue may really be
Yeah all good I post the code now I had the hope that there was a change or something xd
Thats my code (a snippet from the actual event) https://sourceb.in/GywBj9MKll
client.sendE is a function to send a embed (reply with editReply check)
Yeah, that's why I'm confused.
So you have GuildMessages and MessageContent intent?
And is your bot verified?
no
Very weird indeed then…
Yeah, message content is empty when I log it
did u save after fixing the intents "typo"? :P
const client = new Discord.Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildBans,
GatewayIntentBits.GuildEmojisAndStickers,
GatewayIntentBits.GuildIntegrations,
GatewayIntentBits.GuildWebhooks,
GatewayIntentBits.GuildInvites,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildPresences
],
})``` I think so
Did you already show how you receive and log the message anywhere? @kind carbon
No
if (message.author.bot) return;
console.log(message.content)
})``` Rn just testing to see why it isn't working
yeah yeah
do u have message content intent?
Yes, it's enabled on the dashboard
So no MessageContent intent here
it also must be in client constructor
Alright, fixed. Thanks
Anyone know why this dont response?
Add some console.log and find out what part gets or doesn’t get called
ok
When sending a message through a webhook, I'm getting this error. return this.client.channels.resolve(this.channelId);
does the bot have permissions to see this channel?
yes
What error? I only see a line of code
that line is the error
How is that an error
TypeError: Cannot read properties of undefined (reading 'resolve')
nvm that was the first thing that came up in the error lmao
Are you sending the webhook message before the client is ready?
nope, the webhook message is sent in the messageDelete event
Mind showing the full errorstack?
yeah, webhooks are broken
Oh, okay that explains it
uh how di i fix that lol
https://c.lunish.nl/95Fc.png
I dont find anything for that in the guide is there a change? or why this dont work?
https://sean.does-co.de/1AlfLVtS

AttachmentBuilder
thx
AttachmentBuilder
Represents an attachment builder
Plas help how to display the number of deleted messages and how to delete a message after a certain time has passed.
The timeout option has been removed from the Message#delete method.
- message.delete(5000)
- message.delete({ timeout: 5000 })
+ setTimeout(() => { message.delete() }, 5000)
deleted messages from bulk delete?
No, deleting messages in a specific chat, with a specific value
so... from bulk delete?
I surely can't be the only one with some weird issue like this, can I
downgrading typescript worked somehow
When I try to send a saved webhook this error comes?
https://sean.does-co.de/1zpo0i4E
That's a discord.js bug. This will fix it: https://github.com/discordjs/discord.js/pull/8038
So I need to wait? or what?
:eyes:
It needs to be merged. Then released. Then you install it. Then all's good with the world
or downgrade (to pre 7917)
Wouldent that fucks my whole code?
It's dev. Anything will fuck with your code
xD
Downgrade or manually implement that pull request's fix - up to you
I mean thats currently the only problem I got with dev
And a collector bug but thats something diffrent
We do not provide any help with third party libraries
Buttons and Modals are supported natively.
• Buttons: learn more
• Modals: learn more
why does this not work? it just return as a file.jpg file
That’s the default name
You should set the name of the attachment
What is this?
https://sean.does-co.de/8zL2MBxG
you passed 10 as a number to an embed field value without stringifying it
Ahh ok thx
And whats with that?
https://sean.does-co.de/sxsxJqLZ
Is there a way to check this cuz its a user config value?
Call parseInt on it manually
Okay thank you
Any suggestion how do I convert the Enums to String? Because I want string in my slash cmd type instead an Enums
Enums aren't strings though and it doesn't accept strings anymore
I mean js if (file.type === 'ChatInput') file.type.replace('ChatInput', 1)
IDK if that works
i guess?
But thats string to enum/number, not enum to string
u r using replace instead of assigning
I'm attempting to update my old canvas code and have been testing by following this:
https://discordjs.guide/popular-topics/canvas.html#basic-image-loading
For some reason, line #15 is returning attachment: undefined
I have replaced MessagedAttachment with Attachment
Any ideas what my mistake is?
How would I achieve something similar in the dev version?
Like alternative to BaseCommand / ContextMenu interaction
Thanks! What about the ContextMenu one?
Ah seems to be ContextMenuCommandInteraction
Why was this done? How can I use getBoolean now 🤔
I see, I try to differentiate using the type property but I guess this type error is blocking:
All fixed now 👌
How do you use these now?
U want to replace string with enum right? If u use replace, It'll be a string ('1') and not a number (1).
So what do I need to do?
Thanks for this, do you have a example for the interactionCreate event by any chance or would you be able to help rewriting my old one? https://sourceb.in/aZxpeKPMf2 I can rewrite the type guard parts like isCommand but for the other stuff I have no clue, there's also no type alternative to isContextMenu
Seems like it was isContextMenuCommand, I rewrote it to this now: https://sourceb.in/XB7y4JwKmE
I see so the second check is not needed
Yup but I'm further narrowing more down
Currently I have this: https://sourceb.in/gbbh9DqMlE and I only get errors wherever I refer to interaction in my try block
not sure why this didnt narrow the type
Any idea how to check for this properly?
Smaller version ```ts
const isSlashCommand =
interaction.type === InteractionType.ApplicationCommand &&
command.type === ApplicationCommandType.ChatInput
try {
if (isSlashCommand) {
if (command.conditions) {
const conditionsResults = await Promise.all(
// condition: (interaction: ChatInputCommandInteraction<"cached">) => Promise<boolean>
command.conditions.map((condition) => condition(interaction))
)
Argument of type 'ChatInputCommandInteraction<"cached"> | MessageContextMenuCommandInteraction<"cached"> | UserContextMenuCommandInteraction<"cached">' is not assignable to parameter of type 'ChatInputCommandInteraction<"cached">'.
Type 'MessageContextMenuCommandInteraction<"cached">' is not assignable to type 'ChatInputCommandInteraction<"cached">'.
Types of property 'commandType' are incompatible.
Type 'ApplicationCommandType.Message' is not assignable to type 'ApplicationCommandType.ChatInput'
```
ChatInput is an application, but not a slash command
How can I check if it's a slash command properly?
are you already checking this
I may be wrong, but you need to assign the type CommandInteraction
// condition: (interaction: CommandInteraction<"cached">) => Promise<boolean>
CommandInteraction (extends Interaction) (implements InteractionResponses)
Represents a command interaction.
Thanks, not sure why that is the case though. This errors too:
await command.execute(interaction, interaction.locale)
Argument of type 'ChatInputCommandInteraction<"cached"> | MessageContextMenuCommandInteraction<"cached"> | UserContextMenuCommandInteraction<"cached">' is not assignable to parameter of type 'ChatInputCommandInteraction<"cached">'.
Type 'MessageContextMenuCommandInteraction<"cached">' is not assignable to type 'ChatInputCommandInteraction<"cached">'.
Types of property 'commandType' are incompatible.
Type 'ApplicationCommandType.Message' is not assignable to type 'ApplicationCommandType.ChatInput'.
The else if (isContextMenuCommand) { part does work, for some reason it's not narrowing properly in the if block
Okay I had to change the check to
const isSlashCommand =
interaction.isChatInputCommand() &&
command.type === ApplicationCommandType.ChatInput
```Let me know if I can refactor / improve something 😅 https://sourceb.in/yz3LJB1OD3
help js .addRoleOption(option => option.setName('role') .setDescription('The role that will become the dj role') .setRequired(true) .addChoices({ name: 'role', value: 'role' })),
im unable to disable a select menu
I dont think you can add choises ro role options
Only integer, number and string iirc
ok ty
[
SelectMenuBuilder {
data: { type: 3, custom_id: 'info', max_values: 1, disabled: true },
options: [
[UnsafeSelectMenuOptionBuilder],
]
}
]
this is the select menu builder data after i disable it, it still does not get disabled even though it says disabled: true
Did you edit the message with the edited components?
return interaction.editReply({ components: [InfoEmbedComponents, InfoButtonComponents] }).catch(() => null);
yes
oh
my bad, i didnt defer
nvm
defer isnt needed as long as i have replied within 3 seconds right?
i can still edit after i have replied to it
You can edit after reply yes
Remove the .catch and see if it errors
ok found the error
[
ButtonBuilder {
data: { type: 1, components: [Array], emoji: undefined, disabled: true }
}
]
in here emoji is undefined
RangeError: Buttons must have a label and/or an emoji
but i have given an emoji
Why is that ButtonBuilder of type ActionRow?🤔
because i did, InfoButtonComponents.toJSON()
so basically JSON of ActionRowBuilder
Then it shouldn’t show ButtonBuilder anymore though
yeah i just realised that but i cant do InfoButtonComponents.components since it doesnt take an array
and i have 2 emojis so i can do InfoButtonComponents.components[0] either
InfoEmbedComponents = new ActionRowBuilder()
.addComponents([
SelectMenuBuilder.from(InfoEmbedComponents.components ? InfoEmbedComponents.components[0] : InfoEmbedComponents).setDisabled(true)
]);
InfoButtonComponents = new ActionRowBuilder()
.addComponents([
ButtonBuilder.from(InfoButtonComponents.components ? InfoButtonComponents.toJSON : InfoButtonComponents).setDisabled(true)
]);
toJSON**()**
it was .toJSON() already, i was editing the code
toJSON gives undefined in emoji
Because you access the whole ActionRow there, not a button inside of it
then tell me, what can I do to access two buttons
Maybe not build a row and rebuild it from that row later on but build it once you know what you need?
i only need to disable the buttons of that row, so..
see, I have two buttons, it works perfectly fine if i do InfoButtonComponents.components[0] but that would only disable 1 button of that ActionRow and I have two buttons instead of 1 so how do I disable both at once?
OH
i could just add another .addComponents
nvm, thanks
no changes
how to fix this issue?
what's the problem here? I don't see her yet
I fixed it here: #djs-in-dev-version message
Needed a isChatInputCommand() check to check if it's a slash command
Look, ChatInput is not a command, but a message or user interaction, you need to use the checks provided by the library and then everything will work for you
Does the hook send the information though?
But this is from the library?
And the check works, besides that I trust TS which didn't give me any error so should be fine now
no channel is empty
apologize. I just got something mixed up. to check that the interaction came from the slash command, use .isChatInputCommand(), and if you have an interaction from the application, then use .isMessageContextMenuCommand() or .isUserContextMenuCommand()
Yup that's what I applied in the end
I'm not sure if I can improve the code https://github.com/daniellwdb/akira/blob/development/src/events/interaction-create.ts, I have a duplicate if / else-if block only to satisfy TS :/
So REST isn’t sending anything from your host apparently
could you open a network monitoring tool of some kind to find out if the REST requests do even get send and/or if something is blocking them or their responses from arriving at its destination? Because at this point I‘m unsure if it’s your network or a djs bug. @undone yew
aaaaaaaaa how to check now that the interaction is Autocomplete
interaction.isAutocomplete() there used to be this function, where did it go?
Let me check the firewall, maybe it's blocking it.
compare its type property to InteractionType.Autocomplete
@exotic rain do you need help with something else or did you succeed?
So?
alright then
and the problem is not the webhook
2 bots not logging in
It's all good now, thanks, if you have any code improvements I sent the full file above
Is there any solution to my problem?
What did your research regarding firewall/network traffic show?
i thought there was no nodejs ni authorization on the firewall but there is
I will run netstat -an in cmd for 1 minute
I couldn't find any results. Is it okay if we ask the Contributors for help?
not much they can do either
if you are listening to debug and aren't even getting here "Fetched Gateway Information":
https://github.com/discordjs/discord.js/blob/main/packages/discord.js/src/client/websocket/WebSocketManager.js#L132-L144
there isn't much we can do - you could attempt to put logs or breakpoints in the source code to find out where exactly it's stuck, following it all the way from Client#login
from what i saw you got here https://github.com/discordjs/discord.js/blob/main/packages/discord.js/src/client/Client.js#L229-L234
at "Preparing to connect to the gateway..."
and the next thing that happens, is this #connect call
so you must be stuck somewhere inbetween there
so the only line that i could imagine feasibly hanging is https://github.com/discordjs/discord.js/blob/main/packages/discord.js/src/client/websocket/WebSocketManager.js#L138
what exactly do i need to do?
set breakpoints or logs around that area, see where execution reaches, what the values are, etc.
so how do i set the breakpoint?
#resources > debugging, we can't teach you how to use your IDE here
as said, you can also set console.logs
I run it with VSC's debug mode and still no details :|
In my eyes the most important next step would be to find out if the node process sends any network packets at all. I still think there might be something blocking the rest call to reach discord‘s API. VSC should have a way to monitor network traffic from the debug process
wow
working but error
how to fix?
I'm fixed
👍🏽
thank you for your help
At least tell what the source of your error was. In case others get the same
I added listener with process.on, I couldn't solve this resolve issue
Webhooks are broken
most likely yes, they are sending a message to the channel with this error
How do I do that???
Is it not any docs about it??
new AttachmentBuilder(...).setName
Hmm ok
or new AttachmentBuilder('url', { name: 'attachment.jpg' })
I did that
It still said file.jpg
Ahh now it works weird i forgot to change it But thanks
help
i have the following type error. What can I do to only get the GuildMemberRoleManager?
you want to use the interaction.inCachedGuild() typeguard to narrow the interaction to be on a cached guild
since on raw member objects, .roles would be an array of ids
on a cached guild, interaction.member would be a djs GuildMember and .roles on that would be the manager
does djs automatically cache the guild?
if you have the Guilds intent then yeah
okay. thanks
does someone know about this problem?
I have a silly question
I left coding 3 Months Back, So Did Anything Get a Major Change
I have Discord.js version discord.js@14.0.0-dev.1646914074.dcd4797
read the pinned messages to find the guide
kk
This is the 3 months old djs version
where is the discord.js v14 guide
check pins
Well, ApplicationCommandData is no export from djs. Where do you want to use it?
@manic lynx
how to dismiss a modal after clicked on submit
if you submit a modal that will cause another interaction, respond to it
dismissing it is on the user, nothing you can do about that
Oh wait, it is actually, but only in typings. Doesn’t make much sense in CommonJS import
~~Hey,
I'm trying to create a webhook in a TextChannel https://c.lunish.nl/a8DH.png
But I'm getting this error https://c.lunish.nl/EB8A.png~~
nvm I fixed it
https://c.lunish.nl/VAzz.png
Type is a not an option btw
TextChannel#awaitMessages()
Similar to createMessageCollector but in promise form. Resolves with a collection of messages that pass the specified filter.
Is the permission now like this or is it different?
they now use the flags from PermissionBitFields
I got it
const filter =
/**
*
* @param {Message} m
* @returns {Boolean}
*/
(m) => m.author.id == member.user.id;
const msgs = await channel.awaitMessages({
filter,
max: 1,
time: 6_000,
errors: ["time"]
})
console.log(msgs);
const images = msgs.first().attachments.map(a => a.url);
console.log(images)```
Output :
Collection(0) [Map] {}
Are you sure that you're logging the correct thing? .map(...) returns an array, not a collection
console.log(msgs);
its a collection of messages
but there is no msgs :/
Ah, I thought that was images
Do you have the GuildMessages intent?
hmm, ill check
no 😅
i just added
ok so now i have the msg, but there is not attachments ...
should i add MessageContent intent ?
yes
Error [DisallowedIntents]: Privileged intent provided is not enabled or whitelisted.
when i add MessageContent
you need to enable the intent in your application panel
k
nope
thats not work -_-
so what can i do ...?
Are you sure that's the right application, and the error is still the Disallowed Intents one?
no wait
TypeError [COLOR_CONVERT]: Unable to convert color to a number.
The line: .setColor("RANDOM")
Try "Random" instead
how can i be so dumb 😑, it was the wrong app
worked thz vry much
It worked. Thanks!
let role = interaction.options.getRole('role')
``` is not a function
what is interaction.options then?
data: new SlashCommandBuilder()
.setName("dj")
.setDescription("Sets the new DJ role")
.addRoleOption(option =>
option.setName('role')
.setDescription('Loop mode')
.setRequired(true)),```
Where are you declaring interaction
async execute(interaction, guildQueue, discord, client){```
Tag suggestion for @small light:
The order of function parameters must match between definition and function call.
function execute(client, message, args) { ... };
execute(message, client, args);
• mismatch! you pass a Message where the client is expected
• mismatch! you pass the Client where a Message is expected
Wherever you run execute from a different file, you need to pass parameters in the same order
ok ty
const images = msgs.first().attachments.map(a => a.url);
await client.put("products/" + productId + "/images", {
images: images
}).then(async (res) => {
message.embeds[0].data.thumbnail = images[0]
await message.edit({
embeds: [message.embeds[0]]
})
channel.send({
content: "**Les images ont été ajoutées avec succès !**"
})
})```
embeds[0].thumbnail[MODEL_TYPE_CONVERT]: Only dictionaries may be used in a ModelType
works
Are you trying to get an embed from a message?
tysm
in raw embed data thumbnail is not a string
Then it'll be much easier if you just use the EmbedBuilder
k
EmbedBuilder.from(message.embeds[0]) I believe, then you can use .setThumbnail(url)
thz
EmbedBuilder.from(message.embeds[0])
TypeError: (intermediate value).from is not a function
but when i go to EmbedBuilder i see that
.
const e = new EmbedBuilder().from(message.embeds[0])
nope
oh ok
works thz
Attachment
Represents an attachment
so. found something with the discord.js@14.0.0-dev.1654949087-96053ba
// Require the necessary discord.js classes
const { Client, Collection, Intents } = require('discord.js');
const { token } = require('./config.json');
// Create a new client instance
const teamBotIntents = new Intents();
teamBotIntents.add(Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.DIRECT_MESSAGES);
const client = new Client({ intents: teamBotIntents, partials: ['CHANNEL'] });
module.exports = client;
PS C:\Users\A1CBe\Documents\realm_bot> node .
C:\Users\A1CBe\Documents\realm_bot\index.js:8
const teamBotIntents = new Intents();
^
TypeError: Intents is not a constructor
at Object.<anonymous> (C:\Users\A1CBe\Documents\realm_bot\index.js:8:24)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
Why is typescript saying EmbedBuilder, Colors, SlashCommandBuilder, etc. aren't an export module of discord.js? I'm using discord.js@14.0.0-dev.1654949087-96053ba
Read pins
Cannot reproduce on the same version. Is it your IDE that is saying it or really TypeScript?
Step 1. Go to pinned messages in this chan
Step 2. Open guide "changing in v14"
Step 3.
They've already been told that, look above
thanks! 🙂
ah, see, alright
src/commands/Info/help.ts:2:10 - error TS2305: Module '"discord.js"' has no exported member 'Colors'.
Dunno what's wrong. Reinstall or something
Are you sure you're on version 14?
Have you tried reinstalling
So idk what the issue is
Works fine on my end
Maybe you have multiple discord.js packages somehow with different versions, I've seen people have that for some reason...
Ok I fixed it by completely reinstalling discordjs and restarting my IDE
@tidal quest Unrelated ||I saw your rpc when you were playing Roblox, who were you? In my laptop, it shows that Roblox is in maintenance (website)||
beta client prob
so im trying to send a message to a specific channel id but i am kind of new to discordjs and i have tried so many examples on forums but none of them work at all and im kinda in need of it
Tag suggestion for @civic badge:
const channel = client.channels.cache.get("222086648706498562");
const channel = client.channels.cache.find(channel => channel.name === "general");
• Caches in discord.js are Collections which extend the native Map structure.
• learn more
then channel.send("Hello There!")
❤️
no errors still doesnt work
i can send whole commands'
Alert messy code
const { SlashCommandBuilder, channelMention, SlashCommandSubcommandBuilder} = require('@discordjs/builders');
const { MessageEmbed, Permissions, memberPermissions } = require('discord.js');
const { TextChannel } = require('discord.js')
const KickPermissionEmbed = new MessageEmbed()
.setTitle('Insufficient permissions')
.setDescription('You do not have enough permissions to kick someone')
.setFooter({ text: 'Bot made by TheSwedishMeatball!' });
const KickUnableEmbed = new MessageEmbed()
.setTitle('Unable to kick')
.setDescription('You are unable to kick this user')
.setFooter({ text: 'Bot made by TheSwedishMeatball!' });
const KickWrongEmbed = new MessageEmbed()
.setTitle('Unable to kick')
.setDescription('This member has a higher or equal rank as you so u cannot kick them!')
.setFooter({ text: 'Bot made by TheSwedishMeatball!' });
module.exports = {
data: new SlashCommandBuilder()
.setName('kick')
.setDescription('you are able to kick users')
.addUserOption((option) =>
option
.setName("user")
.setDescription("Who you want to kick")
.setRequired(true)
)
.addStringOption((option) =>
option
.setName("reason")
.setDescription("The reason you want to kick for")
.setRequired(true)
),
async execute(interaction) {
if (!interaction.memberPermissions?.has(Permissions.FLAGS.KICK_MEMBERS))
return interaction.channel.send({ embeds: [KickPermissionEmbed]})
const user = interaction.options.getUser('user')
const member = interaction.guild.members.cache.get(user.id) || await interaction.guild.members.fetch(user.id).cache
const reason = interaction.options.getString('reason')
const { client } = interaction
if(!member.bannable || member.user.id === client.user.id)
return interaction.reply({ embeds: [BanUnableEmbed]})
if(interaction.member.roles.highest.position <= member.roles.highest.position)
return interaction.reply({ embeds: BanWrongEmbed})
const banned = new MessageEmbed()
.setTitle('Kicked')
.setDescription(`**${member.user.tag}** was kicked from the server for the reason **${reason}**`)
.setColor('RED')
.setTimestamp()
.setFooter({ text: 'Bot made by TheSwedishMeatball!' });
await member.user.send({ embeds: [banned]})
member.kick({ reason })
return interaction.reply({embeds: [banned]})
const channel = client.channels.cache.get("985537873342234624");
channel.send({ embeds: [banned]})
},
};```
2 different channels
the second one is logs
Less talking more looking
not sure what im not seeing
If you return the code after return wont run
so i put it before?
Yes
💀 💀 💀
https://thumbsnap.com/i/M3xwWkuU.png What am I doing wrong?
Pins
After updating my djs package to latest dev version I am getting this error.
My code:
if (interaction?.isAutocomplete()) {
if (interaction?.commandName === "help") {
const focused = interaction.options.getFocused(true);
let choices;
if (focused?.name === "command") {
choices = [...new Set(client.slashCommands.map((cmd) => cmd.name))]
}
const filtered = choices.filter((choice) => choice.startsWith(focused?.value)).slice(0, 24).sort();
await interaction.respond(
filtered.map((choice) => ({
name: choice,
value: choice
})),
).catch(console.error)
}
}
I am getting this error now.
My option in help interaction
options: [
{
name: "command",
description: "Provide the command you want to get more information on!",
type: 3,
required: false,
autocomplete: true
}
]
did u get option in autocomplete interaction
you used .getFocused() but it says there is no focused option
yes, idk why
RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: SEND_MESSAGES.
SendMessages
Thanks
I'm not sure but should defaultMemberPermissions be a boolean?
export interface BaseApplicationCommandData {
name: string;
nameLocalizations?: LocalizationMap;
dmPermission?: boolean;
defaultMemberPermissions?: PermissionResolvable;
}```
No
So how do i set default permissions to false now?
"0"
You mean defaultMemberPermissions: ['0'] ?
defaultMemberPermissions tells discord what Permissions a member should have to use that command (until the admins set it to something else)
But i don't see that feature on discord. It's not configurable from the client?
Any PermissionResolvable
PermissionResolvable
Data that can be resolved to give a permission number. This can be: (more...)
Sure is. Integrations tab in server settings
Yes but i can't set permissions like ('Manage servers') in the ssettings of an application command
This is where i'm lost
Yea
I can only set members, roles or channels
The defaultMemberPermissions are what the developer sets as a recommendation for the application command. You can choose MANAGE_GUILD for example and the command will only be viewable to those with that permission. This is not reflected in the UI and you cannot change that
Alright. That is the answer i was looking for. It's now possible to see it in the UI. I guess that it will be available later as it's not cool to not see the required permissions of a command xD
But kinda curious on how overwrites works on that
If i set 'Administrator' only and the server owner changes the permission for everyong to true
Which will be used?
Well, for the above example, you can toggle it so that @everyone can view it. It supersedes it, it's like a default configuration
Discord doesn't show that in the UI, don't know why, it's been called a bug and in the backlog, and lol
And if i want to create my command with everyone to false, should i just use Syjalo example of ['0']?
Admins can always see your command though
Yea
So if you want no one to see your command but them, specify just them
Hoo, i see
You can just set it to "0" without an array
Right
Dunno if 0n or 8n has the same effect though. 0n sounds like it'd work
I'll use Admin instead
is it for the current version like this?\\
you can also check i.type === InteractionType.MessageComponent
Hello. I've seen the past answer before but can't remember when. How do I put characters that are not normally allowed in a text channel name (like discord.js@dev)?
It was due to an API bug. It's not possible
was it possible recently?
Yes it was due to an API bug
I am looking at building slash commands with permissions, but I cannot find it in the guide yet, but I know it had a github pr to do so. Is this still being looked at or is the guide outdated for slash commands?
With the latest update, how can i identify ModalSubmit and AutoComplete from an interaction as .isModalSubmit() and .isAutoComplete() have been removed?
Check the type
Ok. So no plan to bring back those getters? Is there a reason why they have been removed?
TypeScript don't like just comparing the type
I seriously doubt that
Ho nvm
I'm dumb
TypeError: interaction.isModalSubmit is not a function
Just asked that
Read last messages xD
xd
So they were eliminated?
To the messages above:
- interaction.isModalSubmit()
+ interaction.type === InteractionType.ModalSubmit
A ok
But for TypeScript, this is not the way to go
As it will still provide an error.
thats incorrect
that is the way to go
With Typescript, it gives me errors
did you type interaction as AnyInteraction?
incorrect. i use typescript and i don't get any of these errors
Hmm
i'm using AnyInteraction
as the type of interaction
that doesnt answer my question
You are right
About the AnyInteraction
My bad!!! This fixes it
when using .setDefaultMemberPermissions(permissions) would it accept 8 as the value for administrator or do I have to actually use the full bitfield value from the discord dev portal?
8 is administrator, why wouldn't it accept that o_O
It works with
if (!interaction.ModalSubmit) return;
I don't know if it works in typescript
wat
interaction.ModalSubmit is a thing??
Wtf
because the portal says the following
what?? what version of discord.js are you using?
yeah... you don't see the 8 right there?
It worked for me so now I'm left with a xd
14.0.0-dev.1654949087-96053ba
Just asking if I have to use the full value.
just use 8..
oh man, never knew it existed!
I installed it a while ago
??
TSError: ⨯ Unable to compile TypeScript:
events/interactionCreate.ts:15:8 - error TS2367: This condition will always return 'false' since the types 'ChannelType.GuildText | ChannelType.GuildVoice | ChannelType.GuildNews | ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread' and 'ChannelType.DM' have no overlap.
15 if (interaction.channel?.type === ChannelType.DM) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Gasps
i'm trying to check if the type of the channel is a DM, however I get ts complaining
anyone know why?
did you use a guild typeguard
like inGuild() or .inCachedGuild()?
Use this interaction.channel?.isDMBased()
alright, ill try that
I can't reproduce that so I'm keen on saying you're doing something you don't know you're doing then
I have it different I have it as
if(interaction.channel.type === 1)
interaction is typed as AnyInteraction
Wym see if that changes anything
What would it be if not AnyInteraction
this fixed it ty, however i'm not sure if it'll stay long since typeguards like that might be removed
(iirc)
mean I replace both with this?
🤞
It shouldn't fix it
Because it's removed
Not removed yet
Just updated and it's still there
I'm on the latest version, still there
Oh wait, on the channel
You can also use this if (interaction.channel instanceof DMChannel)
Yes
yes
But I'm not getting your TypeScript error
message.content is undefined although i have the intents are enabled ( under 75 servers ) and the partials?
the intent
You need more than 1 intent
Don't you need the message content intent and the guild messages intent
These are the intents that im using if that helps
Need the MessageContent one
ohhh thanks
allowedMentions: {
parse: [
"roles",
"users",
"everyone"
],
repliedUser: false
},
partials: [
Partials.User,
Partials.Channel,
Partials.GuildMember,
Partials.Message,
Partials.Reaction,
Partials.GuildScheduledEvent,
Partials.ThreadMember
],
intents: [
GatewayIntentBits.DirectMessageReactions,
GatewayIntentBits.DirectMessageTyping,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildBans,
GatewayIntentBits.GuildEmojisAndStickers,
GatewayIntentBits.GuildIntegrations,
GatewayIntentBits.GuildInvites,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildMessageTyping,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildScheduledEvents,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildWebhooks,
GatewayIntentBits.Guilds,
GatewayIntentBits.MessageContent
]
});```
const { GatewayIntentBits, Partials } = require("discord.js");
Object.keys(IntentsBitField.Flags).filter(f => f.startsWith("Guild")).concat("MessageContent")
i just use this, saves space
yes it's up to you which one you want to use
I just want to give you what I use

When sending a webhook message, djs tries to get the message from the function new (getMessage())(this.client, d); which returns an error on js get channel() { return this.client.channels.resolve(this.channelId); }
Known bug
Is there a temp workaround?
Don't use the version the bug is on
😦
it is in use but not labeled in any way
Can you rephrase that? Do you have a question of any kind?
The allowed mention part doesn't work so it doesn't throw tags.
The guide still says to use SlashCommandBuilder from DiscordJS/Builders is this now part of Discord.js and I dont need to import builders for v14?
yes, all builders from @discordjs/builders are now included in discord.js
Did you console.log that config['whitelist-role'] and make sure it’s the roleId for the role you try to ping?
In djs v13, we had DMPermission which used to disable slash cmds in DM, how to do that in v14? same question about DefaultMemberPermissions
dmPermission still exists, so does defaultMemberPermissions
👍🏻
The slash didn't get disabled
defaultMemberPermissions are only for new guilds the bot joins afaik, and the permissions can be overwritten by guild owners anyway, so I wouldn’t use it for eval commands. IMHO if you need to have an eval command you should definitely make it a Guild command and only deploy to guilds you own yourself
Verified bots aren't allowed to register guild commands. Also I have added this, so it's won't be a problem. But I wanted it to get disabled as many places I getif ```js
(!ctx.client.owners.includes(ctx.interaction.user?.id)) return ctx.interaction.reply({
content: ${process.env.FAILURE_EMOJI} | The command is only for the developers of ${ctx.client.user?.username} bot,
ephemeral: true
})
Verified bots definitely shouldn’t have an eval slashcommand in my eyes
ya, I think I should put it in text commands
Why is interaction.IsCommand() not working?
Like what was it replaced by?
it doesn't exist anymore
you have to compare interaction type
thanks
was MessageEmbed() removed? I am being told new MessageEmbed() isnt a constructor.
EmbedBuilder
thanks
This is just setting to DND
What about MessageActionRow and MessageSelectMenu? I get the same error on this two also
yep, they've been changed to ActionRowBuilder and SelectMenuBuilder
👍🏻
Ok but why is .setPresence not working to set the activity? Was it changed to not be activities anymore?
Maybe you're doing it wrong
whats the difference between PermissionBitFlags & PermissionsBitField?
I’ve used this way since v13 and I can’t see any documentation that it was changed other than using bitfield values instead of playing etc.
Where did PermissionBitFlags come from
This is your screenshot right
https://cdn.discordapp.com/attachments/937420598383108167/985954561481146448/unknown.png
Yes
Isn't that wrong
That’s old commenting.
I am using the bitfield
As you can see here
Works fine for me
sry i meant PermissionsBitField
So your question is what is the difference between PermissionsBitField and PermissionsBitField? 
hmm thanksk
Could just be a delay in it being updated. The gateway be like that
Not half an hour delay.
whats the difference between PermissionFlagsBits & PermissionsBitField?, thats my question 💀
Can you try “1” as your type?
i think that is the issue
But... that wouldn't work
You need to pass a Twitch URL, for example, to have that status
nope
watching is 3
You said 1
Now I'm confused, what is it you want to use
1 or 3
The former is the import from the discord-api-types package. The latter is from discord.js with its own stuff on it
They change every hour
There are 3 entries in a database and the values change from 1 to 3 etc. but the value isnt being used from the database result properly and it’s failing because type isn’t being set.
OK so set it then
Just as a FYI, if you are in fact using 1, it will never work for you
Why? 1 works when it’s not in the botConf[0].statusType
You need to pass a Twitch URL, for example, to have that status
And if you don't include that, it still doesn't work, just tested that now
1 is not watching, it is playing...
...no
1 is STREAMING
wait...
Just another reason to not use magic numbers (':
but then you have the issue of using a database to make the values.
Shrugs how you implement whatever you're doing is on you
What is followUp() renamed to in v14? Can I get a link to docs of v14 of select menus
Documentation suggestion for @green plume:
SelectMenuInteraction (extends MessageComponentInteraction)
Represents a select menu interaction.
O_o
It didn't get renamed?
Ok why won’t type in activities accept anything but the magic number even if the variable I pass in is the magic number?
the type has to be a number, not a string
ok...
i can sort that
just use the ActivityType enum
Doesn’t work with the database.
why do you need a database for storing your own bots activity? how many activities do you have
It doesn't send a reply
const row = new ActionRowBuilder()
.addComponents(
new SelectMenuBuilder()
.setCustomId('select')
.setPlaceholder('Nothing selected')
.addOptions([
{
label: 'Antinuke',
description: "Get information on the Antinuke command",
value: 'first_option',
},
]),
);
if (ctx.interaction.value === 'first_option') {
await ctx.interaction.followUp({ content: 'Something was selected!'});
}
12
interaction.value doesnt exist
interaction.value isn't a thing
interaction.value? selectmenu's have a values array
So, how can I send a followup, when users selects the Antinuke menu option?
interaction.values is an array with the values the user selected
Okay
What happened that the js new ActionRowBuilder().addComponents([ new ButtonBuilder() //..code ])This error is issued: TypeError: component.toJSON is not a function
All builders are exported not from discord.js, and from @discordjs/builders
can you show the error stack and the rest of the code that's causing it?
Hey, I'm trying to create a channel and it's saying it expects only 1 argument. I checked the docs and there are 2.
I checked the docs and there is only 1
it's changed, it takes one option now
What are you looking at? Send a link
they're probably looking at stable
where can I find the dev docs?
Thanks!
will v14 drop MessageEmbed MessageButton MessageActionRow... builders? will we be required to use the djs builders package? and if so, how will the message object represent embeds, buttons, menus without djs builders package? or will it be sub package like collection?
hi
yes, they'll have read only Embed ButtoonComponent etc classes
EmbedBuilder.from(message.embeds[0])
never mind I just found the site, it says djs will be internally included 🙂 ||https://deploy-preview-1011--discordjs-guide.netlify.app/additional-info/changes-in-v14.html||
okay thanks
which branch is the v14 one? I heard taht v14 will be ts rewrite but in main branch I dont see any ts
You heard wrong
Main branch is the right branch
there's really no definite "ts rewrite" version, back when we had v13 in dev, they'd say probably v14, there's no telling which version ends up getting the ts rewrite
ok
realistically I dont think it will be rewritten I was just curious if its really happening . The updates we're getting now are taking quite long time and they are not that huge. If they start working on ts rewrite that will take very long time and in the meantime discord's api will get many updates and additions making the package obsolete
Well, I now updated my code with this, still the interaction is not responding. But I don't get any error.
const collector = msg.createMessageComponentCollector({
componentType: "SELECT_MENU" })
collector.on("collect", async (collected) =>
{ const value = collected.values[0]
if(value === "first_option") {
collected.reply({embeds: [emb1]});
}
if(value === "second_option") {
collected.reply({embeds: [emb2]});
}
if(value === "third_option") {
collected.reply({embeds: [emb3]});
}
})
console.log(value) in there maybe?
Thanks, finally it worked
Hmm, strange though, ActionRowBuilder doesn't want to issue json. The picture in green shows the toJSON code from ActionRow.ts, and then by research I found out that I need to follow this path: js return { ...this.data, components: this.components.map((component, index) => component[index].toJSON()) } I may be working with the builder incorrectly, but still, the design I changed will work in the test attempts.
Any ideas because I am stumped as to why it is an invalid string format.
can't have upper case in names
that would be it. thanks
@outer bane look at my message, maybe you know what's wrong
I apologize if I was distracted 😦
I don't understand what your issue is exactly
The fact is that I create an ActionRow in the message itself, and here I get the error component.toJSON() is not a function
and what version of d.js and builders do you use?
Here I am trying to attach a button to a message, but ActionRow gives the component the wrong way, or rather it does not put the component in the message
discord.js - ^14.0.0-dev.1654949087-96053ba
package builders - "^0.16.0-dev"
Phew, I finally copied it
.setDefaultMemberPermissions(8) sets the comman to admins only, how would I modify this to only allow the specific user ID to see it? Or is this not possible with v14?
not possible with perms v2. you either need a bearer token or manually add user perms in your guild's integration settings
what does npm why @discordjs/builders show? I cannot reproduce the error with the above code, works fine for me
ill leave id check to in the command then as its an eval command
"discord.js-selfbot" ?
And damn, I didn't erase everything
Lmaooooooooooooooooooo
sus
Don't pay attention!
why you making a selfbot?
erasing it wouldn't change the fact that's that is most likely the issue here
I think they mean blur it out
you cant have buttons on a user message lol
ik, but the issue is multiple versions of builders
So there are different packages
isnt there something about selfbots... hmm...
Well, I mean that different packages use different versions of builders, it seems to work like this.
except it doesn't work, otherwise you wouldn't have the aforementioned issues
besides that, no support for selfbots here
No one wanted to show it to you at all, but since the problem is in the builders, I'll put the prefixes now 🙂
good luck keeping your account because I am pretty sure selfbots are against tos or something
This library is not even used by me, I am developing a normal bot. Therefore, it's not for me to worry
whys it in your project folder then?

Well, maybe because I'm not the only one working on this hosting? And with another developer.
well you should probably report that developer
Again, stop.
Not gonna say it again.
Keep the channel on topic.
Thank you who helped, in the end, because of this library, everything broke.
You might wanna look into how your applications being worked on get the node modules as if you have different library versions for different apps this issue will repeat.
Thank you, sometimes for some reason the disparity of versions does not break anything
Actually, it's possible.
That’s a bot
Well, yes, I was asking for a bot, how would we all write bots here, right?
yeah
They said a user's message
i said on a user message, you showed a bot message
Ah, got it 😔
👍
dont ping me im sleeping
Goodnight!
how would I extract the permission bitfield of the roles a user has as I am trying to make a role info command that can list all the info for the roles you have or the role you mention. But it is not letting me see the bitfield of the permissions for each role with the interaction.member.roles.cache script.
It shows me all the data except the permissions of the role.
It's right there though...
its just showing PermissionsBitField... I need the bitfield.
PermissionsBitField#bitfield
Bitfield of the packed bits
You shouldn't rely on outputs for your documentation, as it leads to this exact conversation
That doesn't fully help if I can't extract the value with the other information from the roles.
What are you still unable to find?
So interaction.member.roles.cache has all the info I need in it. But I need to be able to extract the permissions bitfield
