#djs-in-dev-version
1 messages · Page 34 of 1
How do I fix this?
const Buttons = new ActionRowBuilder()
.addComponents([
new ButtonBuilder()
.setCustomId('suggest-accept')
.setLabel('Accept')
.setStyle(ButtonStyle.Success)
])
.addComponents([
new ButtonBuilder()
.setCustomId('suggest-decline')
.setLabel('Decline')
.setStyle(ButtonStyle.Danger)
])```
type the action row as ActionRowBuilder<ButtonBuilder> iirc
new ActionRowBuilder<ButtonBuilder>()
I even tried:
let panels = new client.discord.ActionRowBuilder().addComponents(new client.discord.SelectMenuBuilder()
.setCustomId("panels")
.setPlaceholder("Select a panel to edit...")
.setMaxValues(1)
)
for (let p of foundPanels) {
panels.components[0].toJSON().options.push({
label: p.name,
description: "",
value: `${p.id}`,
});
};
But panels.components[0].toJSON().options stiill returns an empty Array.
just use .addOptions() instead of this hacky stuff
Does that work in a forLoop too?
Nope!
for (let p of foundPanels) {
panels.components[0].addOptions({
label: p.name,
description: "",
value: `${p.id}`,
});
};
look like it takes an array
I found an alternative.
let options = []
let panels = new client.discord.ActionRowBuilder().addComponents(new client.discord.SelectMenuBuilder()
.setCustomId("panels")
.setPlaceholder("Select a panel to edit...")
.setMaxValues(1)
)
for (let p of foundPanels) {
options.push({
label: p.name,
value: `${p.id}`,
})
};
if(options.length) {
panels.components[0].addOptions(options)
}
are there v14 events that are similar to v13's apiRequest and apiResponse events?
I believe it’s in the rest package
There is response event in REST, but no request event afaik
only invalidRequestWarning
And restDebug
There’s also response
How could I covert PermissionsBitField to readable array of permissions strings?
.toArray() ?
PermissionsBitField#toArray()
Gets an Array of bitfield names based on the permissions available.
Are you using version 14
I got the intent sooo x)

hey, does the Embed.setDescription etc. still exist in dev version?
no, you now use EmbedBuilder for all the setting
and the docs are usually not wrong so check those for questions like this
yeah the docs dont mention the functions anywhere and my intellisense doesnt suggest anything so i assume its not there anymore?
Embed only holds received api data
to construct an embed you have to use EmbedBuilder
welp, i had it then removed it, thanks!
Why .voice doesn't exists ?
typeguard the interaction
use the inCachedGuild typeguard or type interaction as cached if it is
CommandInteraction#inCachedGuild()
Indicates whether or not this interaction is both cached and received from a guild.
I see, thanks
how I can get styles for textinputbuilder?
you can import TextInputStyle from discord.js
what discord.js are you using? npm ls discord.js
I'm about to lose my mind, anybody wanna help out
/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Invalid Form Body
embeds[0].description: This field is required
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
at async Client.<anonymous> (/home/container/index.js:112:9) {
method: 'post',
path: '/channels/992756088376147989/messages',
code: 50035,
httpStatus: 400,
requestData: {
json: {
content: null,
allowed_mentions: { parse: [], repliedUser: true },
flags: null,
embeds: [
MessageEmbed {
type: 'rich',
title: null,
description: '',
url: null,
color: null,
timestamp: null,
fields: [],
thumbnail: null,
image: null,
video: null,
author: null,
provider: null,
footer: null
}
]
},
files: []
}
}```
if(message.channelId === "992756088376147989") {
let log = client.channels.cache.get("992542980261032006");
await log.send("```Nápad od " + message.author.tag + " (" + message.author.id + ') "' + message.content + '" bol úspešne vytvorený!```')
var embed = new MessageEmbed()
embed.setDescription(message.content)
await message.channel.send({ embeds: [embed] }).then(function (message) {
message.react('✅');
message.react('❌');
message.startThread({
name: message.content + " - Diskusia",
autoArchiveDuration: 4320,
});
});
message.delete();
}
That message probably doesn’t have a content
It does
Strangely enough the embed sends and the description is there
the thread however, is only the second part
Then the error stems from another place
but what could it be
You delete the message before you react to it and start the thread with it… nvm, didn’t see the await🤦♂️
different messages
But that's outside the function. And it did that even when commented out
the message was sent to 992756088376147989
that's the correct channel
it tried sending an embed with an empty string as the description
I'm gonna show you what it does
are you 100% sure the error is coming from that code?
The error comes from your log send (which you didn’t show us) not the thread
This is what happens. The second reaction doesn't get added. After this it just crashes. The embed used to be created with just " - Diskusia" but it does nothing now.
are you ignoring messages sent by the bot?
Well, this is the whole code. Can't send because code blocks don't work well inside code blocks
Do you have a messageReactionAdd event?
huh?
Nope
is that in a messageCreate event?
Yes
and are you ignoring messages sent by bots
something like if (message.author.bot) return
that doesnt stop the message.channel.send()
Still the same error tho, except the thread gets created in a half assed way
..is there some new API method for preventing messages being sent? I haven't developed anything in the Discord API for almost 2 years (If that's what you're refering to)
it tried sending an embed with an empty string as the description
the bots message does not have content
and you're not ignoring it
that's here
I like to check just for the single bot due to level up messages
unless you're cropping something after the if condition, no its not
this is not new
why not?
because the problem is in message.channel.send()
- your bot sends a message with an embed containing the content of a message
- your bot will receive the message it just sent, which does not have content, just the embed
- it tries creating a new embed with the content that doesnt exist, and sends another message, and fails
Ohhhhhhhhhhhhhhhhhhh
That makes a lot of sense
well shit
Thanks man. Would've never thought of that lol
Although the thread name is still a bit wacky
that's another story, i was solely trying to tell you why you got that first error
And what's the story about
show the updated code
here you are mate
if(message.channelId === "992756088376147989") {
if(message.author.id === client.user.id) return;
let log = client.channels.cache.get("992542980261032006");
await log.send("```Nápad od " + message.author.tag + " (" + message.author.id + ') "' + message.content + '" bol úspešne vytvorený!```')
var embed = new MessageEmbed()
embed.setDescription(message.content)
await message.channel.send({ embeds: [embed] }).then(function (message) {
message.react('✅');
message.react('❌');
message.startThread({
name: message.content + " - Diskusia",
autoArchiveDuration: 4320,
});
});
message.delete();
}
Async nature of node. The second react and thread creation happen while the second message gets handled, so all only happened half when the bot crashes
It doesn't crash anymore, but message.content seems to be non-existent in the thread
Oh nevermind, I see it now
no content, again
Because you override message in that scope
what's the cache meaning inInteraction<cache>
whether or not it was made in a cached guild
if it wasn't cached, you'd have raw data like the raw guild member object instead of a GuildMember
all guilds are cached, aren't they ?
ohhh, I get it thanks
Bots don’t have to a member of the guild to receive slash commands and other interactions
Like when we paste a large text in discord chat it suggests us to send the text as an attachment, how todo it in bot?
guide/ docs?
you do it yourself, write message to file, send file
and whats new name of messageAttachments?
i was hoping a way where i dont need to make a temporary file
found it, AttachmentBuilder
@paper sparrow "temporary file" as in "in your file system"?
there's no need for that, you can send buffers as attachments
like AttachmentBuilder("text here") ?
Buffer.from("text here") and keeping in mind that newlines are best \r\n in files
Hmmm Thanks for letting me know!
strings are interpreted as path/url https://discord.js.org/#/docs/discord.js/main/typedef/BufferResolvable
now how will i reply to interaction? .reply({attachments:[attach]})?
alright!
When is it releasing?
Idk
Same
Relatable
Does anyone know the full list of user flags?
These are the only ones I know atm.
const badges = [
"HypeSquadOnlineHouse1",
"HypeSquadOnlineHouse2",
"HypeSquadOnlineHouse3",
"CertifiedModerator"
];
Thanks.
EmbedBuilder.from(embed).spliceFields(embed.fields.length - 2, 1, [
{ name: 'Reason', value: reasons[1], inline: true }
])
Did you manage to fix this? I'm stuck on the same thing
It’s not supported. Only text fields are
Ah gotcha, thanks
EmbedBuilder.from(embed).spliceFields(embed.fields.length - 2, 1, { name: 'Reason', value: reasons[1], inline: true })
this is valid code
Yeah, I eventually figured it out. Thanks!
np
I'm new to discord.js
I'm a python pro but a js noob
Anyone can point me in the correct direction to get started with JS?
Thanks!
Thank you
how do you check if a user has a certain UserFlag? like, is there an interaction.user.flags or something?
Documentation suggestion for @mental inlet:
User#flags
The flags for this user
what... exactly are you trying to do
i'm trying to loop through the user's flags and see what UserFlags they have
so i'm converting it into an array
You can do as any
WOW ok i'm dumb, thank you lol
click and read
probably should've checked the methods..
DiscordAPIError[50035]: Invalid Form Body
embeds[0][LIST_ITEM_VALUE_REQUIRED]: List item values of ModelType are required
at SequentialHandler.runRequest (/home/remi/Documents/mavis/node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:475:11)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.queueRequest (/home/remi/Documents/mavis/node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:201:11)
at async REST.request (/home/remi/Documents/mavis/node_modules/@discordjs/rest/src/lib/REST.ts:319:20)
at async TextChannel.send (/home/remi/Documents/mavis/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:175:15)
at async Context.sendEmbed (/home/remi/Documents/mavis/src/Context.ts:23:68)
at async StatsCommand.run (/home/remi/Documents/mavis/src/commands/stats.ts:7:3)
at async Context.runCommand (/home/remi/Documents/mavis/src/Context.ts:51:3)
at async Context.parse (/home/remi/Documents/mavis/src/Context.ts:30:3)
at async Client.onMessage (/home/remi/Documents/mavis/src/Mavis.ts:81:10)
What is that error ? List item values ?
show Context.ts:23
async sendEmbed(embed: Partial<Embed>): Promise<Message> { return await this.msg.channel.send({ embeds: [Object.assign(new EmbedBuilder(), embed)] }); }
In v13 I had this async sendEmbed(embed: Partial<MessageEmbed>): Promise<Message> { return await this.msg.channel.send({ embeds: [Object.assign(new MessageEmbed(), embed)] }); } and it was working
i dont understand the purpose of that Object.assign()
on both cases
why can't you just pass embed to embeds?
That was maybe when I was passing objects I needed to do that.. It's true that it should work without that
Yeah it works
That was a weird error anyway
const filter = (i) => i.user.id === interaction.user.id;
const collector = interaction.channel.createMessageComponentCollector({
filter,
componentType: "SELECT_MENU",
time: 18000,
});
console.log('after interaction')
collector.on("collect", (interaction) => {
console.log('after collection')```
so I use the interaction, and it logs `after interaction` but not `after collection`...
i'm using interactions not messages in channels btw
not sure if this is enough information, lmk if I should send more of the code
The component type is a number
ah
| CombinedPropertyError (2)
| Received one or more errors
|
| input.value
| | [MissingPropertyError: value]
|
| input.name
| | [MissingPropertyError: name]```
```js
const components = (state) => [
new ActionRowBuilder().addComponents(
new SelectMenuBuilder()
.setCustomId("help-menu")
.setPlaceholder("Select a category...")
.setDisabled(state)
.addOptions(
{
label: "Information",
value: "information",
},
)
),
];
const initialMessage = await interaction.reply({
embeds: [embed2],
components: components(false),
});```
components needs to be an array of ActionRow not just an ActionRow ignore me
Are you sure the error stems from that part of your code?
at InteractionCollector.handleCollect (/home/runner/v14/node_modules/discord.js/src/structures/interfaces/Collector.js:109:12) Promise {
idek tbh, I just went through message history for the same error and it appeared to be around the select menu builder
sorry for the late reply
The code you sent was how you sent the SelectMenu, not the collect event where you handle the interaction… the error seems to be in there.
hi, is there like a class that contains all the enums?
No, they are all top level exports
I think it's this part maybe
const categoryEmbed = new EmbedBuilder()
.addFields(
category.commands.map((cmd) => {
return {
name: `**${cmd.name}**`,
value: ` ${cmd.description}`,
inline: false,
};
})
)```
the error had name: value:
yeah i mean i saw a (util) class called EnumHolder was it removed or it totally did not exist at all?
The error was talking about missing name/value though…
I don’t recall any class like that, doesn’t mean it didn’t exist at some point, so 🤷♂️
you mean EnumResolvers? it didn't hold all the enums, but it was removed anyway
so I set my client.commands like this
const commandFiles = await globPromise(`${__dirname}/../SlashCommands/**/*.js`);
commandFiles.map((value) => {
/**
* @type {Command}
*/
const file = require(value);
const splitted = value.split("/");
const directory = splitted[splitted.length - 2];
if (file.name) {
const properties = { directory, ...file };
this.client.commands.set(file.name, properties);
}
});```
so everything has a name and value (name and description)
Slashcommands have no value property… choices would, or embed fields… and maybe some other payloads that don’t come to mind immediately
oh alright
what would you suggest I do then?
basically trying to get a help command that automatically updates for slash commands
Did you ever show/look through the full error stack? Because I don’t remember seeing it. There’s usually more information telling you about the source of your error than what you provided up until now
Received one or more errors
input[0]
| CombinedPropertyError (2)
| Received one or more errors
|
| input.value
| | MissingPropertyError > value
| | A required property is missing
|
| input.name
| | MissingPropertyError > name
| | A required property is missing
at ArrayValidator.handle (/home/runner/v14/node_modules/@sapphire/shapeshift/dist/index.js:400:70)
at ArrayValidator.parse (/home/runner/v14/node_modules/@sapphire/shapeshift/dist/index.js:114:88)
at EmbedBuilder.addFields (/home/runner/v14/node_modules/discord.js/node_modules/@discordjs/builders/dist/index.js:244:57)
at InteractionCollector.<anonymous> (/home/runner/v14/SlashCommands/Information/help.js:87:10)
at InteractionCollector.emit (node:events:402:35)
at InteractionCollector.emit (node:domain:475:12)
at InteractionCollector.handleCollect (/home/runner/v14/node_modules/discord.js/src/structures/interfaces/Collector.js:109:12) Promise {
<rejected> CombinedPropertyError (1)
Received one or more errors
input[0]
| CombinedPropertyError (2)
| Received one or more errors
|
| input.value
| | [MissingPropertyError: value]
|
| input.name
| | [MissingPropertyError: name]
at ArrayValidator.handle (/home/runner/v14/node_modules/@sapphire/shapeshift/dist/index.js:400:70)
at ArrayValidator.parse (/home/runner/v14/node_modules/@sapphire/shapeshift/dist/index.js:114:88)
at EmbedBuilder.addFields (/home/runner/v14/node_modules/discord.js/node_modules/@discordjs/builders/dist/index.js:244:57)
at InteractionCollector.<anonymous> (/home/runner/v14/SlashCommands/Information/help.js:87:10)
at InteractionCollector.emit (node:events:402:35)
at InteractionCollector.emit (node:domain:475:12)
at InteractionCollector.handleCollect (/home/runner/v14/node_modules/discord.js/src/structures/interfaces/Collector.js:109:12)
}```
there's the full error
help.js line 87 is?
const categoryEmbed = new EmbedBuilder() //86
.addFields( //87
category.commands.map((cmd) => { //88
return { //89
name: `**${cmd.name}**`, //90
value: ` ${cmd.description}`, //91
inline: false, //92
}; //93
}) //94
) //95```
Take that whole map code and console.log its result
And then fix whatever you‘ll find that doesn’t do what you expect it to do
alr
[
{
name: '**help**',
value: " A help menu, to check out all of the bot's commands.",
inline: false
}
]```
that's what it logged
I presume it shouldn't have [ ] but not sure
it can, in the latest-ish version
oh
Which version are you on though?
"discord.js": "^14.0.0-dev.1656860905-cdd9214",
cdd9214 in discordjs/discord.js by Jiralite committed <t:1656855415:R>
fix: Remove global flag on regular expressions (#8177)
oh I got it to work
this happens every time I run the code
—————————————————————————————————
resolve Promise {
{
url: 'wss://gateway.discord.gg',
shards: 1,
session_start_limit: {
total: 1000,
remaining: 937,
reset_after: 12481008,
max_concurrency: 1
}
}
} undefined```
looks good
whats the issue?
is it not multiple resolves?
@forest elm
I'm getting this on every slash command resolve Promise { Uint8Array(0) [] } undefined
didn't have this issue before I updated to newest v14...
i dont see any error
oh alright.. I thought it would be an error
This just looks like you're logging the client.login promise
I have no idea what AntiCrash is
oh that's just for process.on("multipleResolves", (type, promise, reason) => {
alr
Okay then this is just expected output
yep
and I'm not sure if this is a djs question but I'm getting (node:5329) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time every like 5 runs of my code, not sure what it means (it's just a discord bot, not using stream or web)
node 16.9
is there still the client.on('ratelimit') within discord.js@dev ?
or an way to detect it
rateLimited on rest as emitter
npm releases for at-dev are happening at 00:00 and 12:00 UTC
the docs for this PR are under https://discord.js.org/#/docs/discord.js/main/typedef/ApplicationCommandOption
if you want to use it with builders, it seems like that's not merged yet
the PR is merged but the docs haven't deployed since
where did my message content gone?
i enabled the intent and specified that number in intents
const client = new Client<true>({
intents: [
'GuildMembers',
'GuildMessages',
1 << 15,
32767 // message content intent
]
})
without 32767, messageCreate dont even work
you need the Guilds intent
32767 isn't the message content intent, is it?
add Guilds and add MessageContent
32768 is message content and does not influence messageCreate apart from the content being empty
oh
Better not to use magic numbers
new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setStyle(ButtonStyle.Link)
.setLabel('Invite')
.setURL('https://discord.com/api/oauth2/authorize?client_id=id&permissions=8&scope=bot%20applications.commands')
)```
`data.components[0].components[BASE_TYPE_REQUIRED]: This field is required`
you forgot the []
new ActionRowBuilder().addComponents([ new ButtonBuilder().setStyle(ButtonStyle.Link).setLabel('Invite').setURL('https://discord.com/api/oauth2/authorize?client_id=id&permissions=8&scope=bot%20applications.commands')])
you don't need to wrap in inside an array, addComponents takes rest params or an array
oh :/
it went back and forth and now simply takes both
Ok
as per the error, name is required
It takes a single object https://discord.js.org/#/docs/discord.js/main/class/TextChannel?scrollTo=createWebhook
This error is keep happening, TypeError: Cannot destructure property 'components' of 'undefined' as it is undefined. Can you help?
(also ignore that red line in front of components: [comp] it's nothing)
That would be an empty message. You need to have either content, embeds, files or stickers
Oh ok
Oop, same error
This is where the error is coming from
Your setting custom id twice
How can i make Embed !?
any experts with node js pls ping me
This isn't nodejs support sir
Import EmbedBuilder from either discord.js or @discordjs/builders
Then like in v13.
thank you ✨
EmbedBuilder (extends UnsafeEmbedBuilder)
Represents a validated embed in a message (image/video preview, rich embed, etc.)
is there like a specific reason of why creating embeds like in previous versions was removed?
it was a builder all along, the builder has been moved to the (new) builders package
Oh lol
Message<true> is a message in a cached guild right?
Yes
- It’s meant to be ActionRowBuilder
- You are setting the customId twice in your button
that but with @ dev stuff
Documentation suggestion for @distant relic:
SelectMenuBuilder#setPlaceholder()
Sets the placeholder for this select menu
interaction.values
its not a selectmenuinteraction
whatever interaction is, is either undefined or not a SelectMenuInteraction
That’s only doable by guild owners/admins
#rules 6
How to do it as guild owner?
In server settings->Integrations->your bot
select menus are not supported in modals
read the warning in the beginning of that section
I should really brush up on reading magic numbers… didn’t see that
const components = (state) => [
new ActionRowBuilder().addComponents(
new SelectMenuBuilder()
.setCustomId("help-menu")
.setPlaceholder("Select a category...")
.setDisabled(state)
.addOptions(
{
label: "Information",
value: "information",
},
{
label: "Requests",
value: "requests",
},
{
label: "Dank Memer",
value: "mankdemer",
},
{
label: "Configuration",
value: "serverconfiguration",
},
{
label: "Statistics",
value: "statistics",
},
{
label: "User Specific",
value: "user_specific",
}
)
),
new ActionRowBuilder().addComponents([
new ButtonBuilder()
.setStyle(ButtonStyle.Link)
.setLabel("Invite")
.setURL(
"https://discord.com/api/oauth2/authorize?client_id=id&permissions=8&scope=bot%20applications.commands"
)
]),
];
const initialMessage = await interaction.reply({
embeds: [embed2],
components: [components(false)],
});```
`DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[BASE_TYPE_REQUIRED]: This field is required`
You have a level of array too many. Your function returns an array of ActionRow which you put into another array…
oh alr
so how come ```js
const components = (state) => [
new ActionRowBuilder().addComponents(
new SelectMenuBuilder()
.setCustomId("help-menu")
.setPlaceholder("Select a category...")
.setDisabled(state)
.addOptions(
{
label: "Information",
value: "information",
},
{
label: "Requests",
value: "requests",
},
{
label: "Dank Memer",
value: "mankdemer",
},
{
label: "Configuration",
value: "serverconfiguration",
},
{
label: "Statistics",
value: "statistics",
},
{
label: "User Specific",
value: "user_specific",
}
)
),
];
let component2 = new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setStyle(ButtonStyle.Link)
.setLabel("Invite")
.setURL(
"https://discord.com/api/oauth2/authorize?client_id=958848741790609468&permissions=8&scope=bot%20applications.commands"
)
);
const initialMessage = await interaction.reply({
embeds: [embed2],
components: [components(false), component2],
});```
doesn't work either? if I remove the button row it works fine...
Because you still have an array containing an array of ActionRow and a ActionRow…
Please fix your components structure yourself. This is getting into basic JS territory now
ah, that makes much more sense.
how to fix?
How to access interaction's command ?
interaction.command
where'd AnyInteraction go?
ver 14.0.0-dev.1656936300-f6db285 btw
Well, guess how
.message do not exists, you are funny
What kind of interaction are we talking here?
ChatInput
Yes. They don’t have a message. What would you expect it to be?
It‘s Interaction now
ohh alright, ty!
probably being really dumb right now
typeguard interaction
Documentation suggestion for @mental inlet:
CommandInteraction#inCachedGuild()
Indicates whether or not this interaction is both cached and received from a guild.
same error even if i check if it's in a cached guild
nvm
fixed, ty!
sorry if i'm asking too many questions but
ill remove that part in the message i guess, thanks for the clarification because i'm absolutely braindead lol
fixed
is there a way to leave the bot typing in the chat in message.reply();?
TextChannel#sendTyping()
Sends a typing indicator in the channel.
How can i fix this?
Your filter should return a boolean, and right now, it's returning nothing (void)
Then what do I do?
Make it return true or false, or use a function like forEach(...) if you're not trying to filter the collection
this should probably really be coll.filter(predicate).size
Looks like you have different versions of discord-api-types
Than the one used by /builders
But the builders version isn't
Builders aren't using the latest discord-api-types
Discord.js does
Downgrade your version or override the /builders version
hi, i tried to use discord.js@dev version. But the messageCreate event dont fire unless I tag the bot. I already turn intents on.
This is my intents list on the bot
import { GatewayIntentBits } from 'discord.js';
export default [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildBans,
GatewayIntentBits.GuildEmojisAndStickers,
GatewayIntentBits.GuildIntegrations,
GatewayIntentBits.GuildWebhooks,
GatewayIntentBits.GuildInvites,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildMessageTyping,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.DirectMessageReactions,
GatewayIntentBits.DirectMessageTyping,
];
the event does fire, you just don't get any content without the MessageContent intent if your bot isn't mentioned
How are you creating your commands?
It doesnt accept a bigint there?
Which say what, string?
Yeah so its just the bitfield bigint
But in a string
toString()
What is it typed as and how are you deploying it?
Okay, so using the djs manager
To me, looks like it should be working fine
It accepts bigint
Yeah can try that but it should be the same as FlagsBits I would have thought...
Can also try it in an array
I'll take a look at the source though
Whats your dev version?
It serialises it to string 
Are you sure this is where the error is coming from
Oh you're deploying with REST though?
I misread the code snippet earlier then, yeah that only shows me where you load them into event handling
Yeah if you're doing a REST deployment its default_member_permissions for one, gotta use the raw API snake case
And it definitely needs to be made a string yourself
I mean its probably just the wrong type
I don't use builders myself but also haven't updated to the new permissions yet. Builders would be handling the serialisation for you, yes
You could import Permissions from discord.js to handle it
new Permissions(Flags).bitfield.toString()
But also could just toString() whatever flag it is
its definitely a class lol
with a constructor
or did we rename that lmao
PermissionsBitfield maybe?
yeah that one, my bad
Uhh not aware of that issue
I'd expect the versions to be brought in line before a stable release
Label is probably too long
any idea why channelTypes: [ChannelType.GuildNews, ChannelType.GuildText] isn't working? the option is showing all channels
this wasn't an issue before
just checked older commands I set up months ago that also use channelTypes, they are also now showing all channels like categories and voice etc on both stable and canary
Are you using the rest package to deploy?
I am. and I use rest parameters to make my commands
I've redeployed to be sure
You should be using channel_types then
oh? when did that change?
channelTypes is a d.js thing
It changes the casing for you. Discord api doesn’t do that
I’m asking what you are using to deploy the commands
ah
Either the @discordjs/rest package or just d.js
You can only call that when the client is ready
I know. it's how I used to deploy my commands but I was advised by someone to use REST instead
in hindsight, I should've just left it unchanged. if it ain't broke, don't fix it
You prob could’ve just find all and replace
I could, but I've very recently tried getting more done with typescript and the typings are suited for d.js formatting
if that makes sense, it does in my head
You don’t use the provided typings?
I do
🤔
which show channelTypes, not channel_types
and defaultMemberPermissions as opposed to default_member_permissions as two examples
Ur prob using ApplicationCommandData
I am
APIApplicationCommand should have the correct props
ah ok thanks
Magic strings for permissions are not valid in v14 anymore
Use PermissionsBitField.Flags.ManageMessages instead
That is code?
Oh right, not all caps
*.Flags.ManageMessages
You use that in lieu of magic string
(static) PermissionsBitField.Flags
Numeric permission flags.
Thats not it at all
That’s the v13 way
V14 uses PermissionsBitField.Flags.ManageMessages
How did you define PermissionsBitField?
(didnt)
it's PermissionsBitfield in v14
check out other changes in pins
Flags
How can I detect which subcommand has been ran in my slash command?
CommandInteractionOptionResolver#getSubcommand()
Gets the selected subcommand.
Doesn't appear for me
use interaction.isChatInputCommand() typeguard
role.managed shows all managed role which a bot creates during server join also the server booster role. is it possible to see only only the roles which bot created not the server booster role?
Anyone knows how to get a string of a Command Interacion Options?
you need a ChatInputCommandInteraction
Thanks! <3
was isAutocomplete removed?
Yes, use interaction.type === InteractionType.ApplicationCommandAutocomplete instead
How could i put the embed color on RANDOM?
“Random”
does anyone know how to edit the embed when the person clicks the button
I'm using discord js in typescript, but I couldn't solve the error, can you help? how to fix?
Wouldn't it just mean message is not a Message
show how you're passing the parameters to that event
i have this intents and partials but GuildMemberManager#cache does not have all the members of the server, as in the v13. Any solution?
fetch the members, <Guild>.members.fetch()
Do I always need to fetch them? Wouldn't it be enough with the gateway events that bring new members to the cache?
something other than the interfaces
new members will be cached
members that join/are updated will be cached, but thats it
you only have to fetch them once if you're not using sweepers/limiting the cache
okay, ty 👍
how to fix my issue?
show the actual code, not the ts interfaces
but your issue has nothing to do with discord.js anyway, you're just not passing a message to the run method in your event listener
so can i fix this?
do the opposite of what i just said
i.e. pass the message from messageCreate to the run method in your event listener
Is it normal that when I click the submit button of the modal, it doesn't close automatically?
{ name: 'that' }
Since
interaction#isAutocomplete()
and
interaction#isModalSubmit()
have been removed, what do I replace em with?
typeof?
check the type
DiscordAPIError[50035]: Invalid Form Body
4.options[0].type[NUMBER_TYPE_COERCE]: Value "STRING" is not int.
4.type[NUMBER_TYPE_COERCE]: Value "CHAT_INPUT" is not int.
at SequentialHandler.runRequest (D:\Sapphire\sapphiredev\node_modules\@discordjs\rest\dist\index.js:743:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.queueRequest (D:\Sapphire\sapphiredev\node_modules\@discordjs\rest\dist\index.js:555:14)
at async REST.request (D:\Sapphire\sapphiredev\node_modules\@discordjs\rest\dist\index.js:989:22)
at async D:\Sapphire\sapphiredev\handlers\slashCommand.js:46:5 {
rawError: {
code: 50035,
errors: { '4': [Object] },
message: 'Invalid Form Body'
},
code: 50035,
status: 400,
method: 'PUT',
url: 'https://discord.com/api/v9/applications/992880300327719033/guilds/992878975615504466/commands',
requestBody: {
files: undefined,
json: [ [Object], [Object], [Object], [Object], [Object], [Object] ]
}
}
use the enum or the type number instead of the string
type: 'CHAT_INPUT' should be what?
D:\Sapphire\sapphiredev\commands\misc\screenshot.js:8
type: ApplicationCommandType.ChatInput,
^
ReferenceError: ApplicationCommandType is not defined
at Object.<anonymous> (D:\Sapphire\sapphiredev\commands\misc\screenshot.js:8:11)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Module._load (node:internal/modules/cjs/loader:827:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at D:\Sapphire\sapphiredev\handlers\slashCommand.js:23:26
at Array.forEach (<anonymous>)
at module.exports (D:\Sapphire\sapphiredev\handlers\slashCommand.js:19:32)
Node.js v18.3.0
Then define it.
._.
type check it to make sure ctx.member is a GuildMember and not an APIGuildMember
ctx.inCachedGuild() typeguard should be enough
you shouldnt return anything from the event listener
you're still returning something
A message or promise<message>
D:\Sapphire\sapphiredev\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:176
if (!this.deferred && !this.replied) return Promise.reject(new Error(ErrorCodes.InteractionNotReplied));
^
Error [InteractionNotReplied]: The reply to this interaction has not been sent or deferred.
at ChatInputCommandInteraction.followUp (D:\Sapphire\sapphiredev\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:176:64)
at Object.run (D:\Sapphire\sapphiredev\commands\misc\screenshot.js:42:25)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Client.<anonymous> (D:\Sapphire\sapphiredev\events\interactionCreate.js:58:6) {
[Symbol(code)]: 91
}
Node.js v18.3.0
You're using followUp before deferring or replying to the interaction
error says you are
You're checking if they do have Administrator
CombinedError (2)
Received one or more errors
1 ValidationError > s.nullish
| Expected undefined or null
|
| Received:
| | PassThrough {
| | _readableState: [ReadableState],
| | _events: [Object: null prototype],
| | _eventsCount: 5,
| | _maxListeners: undefined,
| | _writableState: [WritableState],
| | allowHalfOpen: true,
| | [Symbol(kCapture)]: false,
| | [Symbol(kCallback)]: null }
2 ValidationError > s.string
| Expected a string primitive
|
| Received:
| | PassThrough {
| | _readableState: [ReadableState],
| | _events: [Object: null prototype],
| | _eventsCount: 5,
| | _maxListeners: undefined,
| | _writableState: [WritableState],
| | allowHalfOpen: true,
| | [Symbol(kCapture)]: false,
| | [Symbol(kCallback)]: null }
at UnionValidator.handle (D:\Sapphire\sapphiredev\node_modules\@sapphire\shapeshift\dist\index.js:1061:23)
at UnionValidator.parse (D:\Sapphire\sapphiredev\node_modules\@sapphire\shapeshift\dist\index.js:137:88)
at EmbedBuilder.setThumbnail (D:\Sapphire\sapphiredev\node_modules\@discordjs\builders\dist\index.js:292:49)
at Object.run (D:\Sapphire\sapphiredev\commands\misc\screenshot.js:34:14)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Client.<anonymous> (D:\Sapphire\sapphiredev\events\interactionCreate.js:58:6)
not djs but
add let fetched = Buffer.from(await body.arrayBuffer()); after u declare body and change .setThumbnail(body) to .setThumbnail(fetched)
TypeError: body.arrayBuffer is not a function
at Object.run (D:\Sapphire\sapphiredev\commands\misc\screenshot.js:29:50)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Client.<anonymous> (D:\Sapphire\sapphiredev\events\interactionCreate.js:58:6)
idk sorry
not DJS related, see #useful-servers
Hi, i test 32768 intents but it no work, the messageCreate no work 
iirc 32768 is only the MESSAGE_CONTENT intent and nothing else
Which is why you should use actual separated intents and not a magic number
Mon pulled out the bit calculator for that one
No actually lol
32767 was the old all-intents and therefore 32768 is the singular next intent
1 << 15
Because permissions are bigints
1n << 40n might work
Needs to be a string
Thats probably coming from your @discordjs/rest deployment of commands
It normal ? 
The JSON payload for /rest needs it to be a string, since JSON.stringify doesn't parse bigints
client isnt logged in, therefore no client.application
BigInt.toString() if its available
I cant remember lol
Getting this, how to fix
there's more info below that
oh, screenshots are flipped, there's still more info below that
- what's your relevant code?
That's all
Code :
const options = res.tracks.slice(0, 25).map((track, index) => {
return {
label: `${track.title} [${ms(track.duration, {
colonNotation: true,
showMilliseconds: false,
})}]`,
value: index + 1,
};
}),
const menu = new SelectMenuBuilder()
.addOptions(options)
.setCustomId('search')
.setPlaceholder('Make a selection');
anyone know if timeouts will be a feature in the v14?
Timeouts are already a feature?
in v13?
yes?..
Why do I get this error while sharding?
https://srcb.in/N7ixtgSAli
Means you either replied twice or took too long to reply
Ur making tmr and getting rate limited
tmr?
I just rename my index.js file to bot.js and created a new index.js file with this content
const { ShardingManager } = require('discord.js');
const manager = new ShardingManager('./bot.js', { token: process.env.TOKEN });
manager.on('shardCreate', shard => console.log(`Launched shard ${shard.id}`));
manager.spawn();
How did you obtain the Response?
while running on the bot using node .
What code did you use to get the Response object?
"main": "bot.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "node bot.js"
}
So that’s a no?
emm, didn't got what u told
What code inside of the bot (specifically a js file) did you add to get the shown log?
const Component = require("../../Structures/Core/Component");
const Rolex = require("../../..");
const { inspect } = require("util");
module.exports = new Component({
name: "unhandledRejection",
/**
* @param {Rolex} client
*/
run: async (client, reason, p) => {
console.log('——————————[Unhandled Rejection/Catch]——————————\n', reason, p)
}
})
nvm I got it
Hey guy does the function how to send images in embeds got changed cuz my embeds looks like this: https://sean.does-co.de/9vxYhnEr
The Image should be in the Embed.
Code:
// embed
.setThumbnail(`attachment://color.png`)
// files reply
files: [await makeFile()]
I can't show you the code exactly but I can tell u it worked in v13...
this in 100% works in setImage but i dont know if in thumbail
it dont...
I have the same problem with setImage....
Thats a other cmd with setImage
make sure makeFile returns an AttachmentBuilder with 'color.png' name
and yes this works too fine in v13
it does
Wait you guys changed how to create attachments
it now only takes a object.... 
I had the same problem yesterday didn't fix it yet
this
it takes now a object
"image.png" => {name: "image.png"}
so
.setImage{( name: "screenshot.png" )}
No. setImage gets a URL. If you get passed a URL like you did in your code yesterday just use that directly, no need to fetch it
Will the subcommand name recieved by interaction.options.getSubcommand() be influenced by locales?
Or is it always the original name
It‘s always the standard name
Thank god lol
Everything else would make no sense
You need to pass fetchReply: true in the options of followUp() to get a message object back.
@vague coyote Same error 😔
You can‘t delete an ephemeral message, did you deferReply Before?
The followUp message isn't ephemeral
Was the message deleted by some other bot before you did maybe? Or your own bot somewhere else?
If not show your updated code
I'm deleting message before timeout complete, in timeout callback I want to prevent this error using msg.deletable
That won’t work. That only checks if you have permissions to delete it, not if it still exists (since that would be an API call)
By catching the error from the delete
how do i get if there is a subcommand in the options, and, in that case, the subcommand?
interaction.options.getSubcommand() returns the subcommand name
it's v14
you need to typecheck that its a ChatInputCommandInteraction
um i think MessageAttachment is removed, is there any function to replace it ?
its not removed, its AttachmentBuilder
Hello, I had this code in v13 for permission handling, like for the interactionCreate event,
if (command.UserPerms) if (!member.permissions.has(command.UserPerms)) return
and in the command file,
module.exports = {
name: "ban",
description: "Permanently bans a member from the server",
UserPerms: "BAN_MEMBERS",.....
But in djs v14 this isn't working, I checked the new PermissionsBitField but still got no solution, any help?
I used "BanMembers" instead but still no
as i said its BanMembers
also look at pins
Ok
How do you get the options passed in the command interaction?
interaction.options ( like in v13 )
Yeah but they removed getString() getUser() etc…
my code how would i fix this error
D:\Sapphire\sapphiredev\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:176
if (!this.deferred && !this.replied) return Promise.reject(new Error(ErrorCodes.InteractionNotReplied));
^
Error [InteractionNotReplied]: The reply to this interaction has not been sent or deferred.
at ChatInputCommandInteraction.followUp (D:\Sapphire\sapphiredev\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:176:64)
at Object.run (D:\Sapphire\sapphiredev\commands\misc\screenshot.js:49:25)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Client.<anonymous> (D:\Sapphire\sapphiredev\events\interactionCreate.js:58:6) {
[Symbol(code)]: 91
}
Node.js v18.3.0
• 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
This is not my error
ah u must reply before followUp
or await this reply
wdym
pretty sure it is your error
umm it's different
nevermind
yea mb
or wait i don't understand what you mean kahm
little off topic but whats that theme 
await reply
Discord Theme
and change first followUp to reply
ty 
nice theme :)
I use typescript and on top of my function I set the type of interaction as CommandInteraction since I already filter out the interactions in my command handler
ChatInputCommandInteraction? Because else it could be a ContextMenu too
ty
like dis?
sure
not djs related but you know how the site would display in that [The site]
and is value required by default?
Tag suggestion for @hoary tree:
You can use markdown syntax to display clickable links in embeds, webhook messages and interaction responses without showing the url:
"[text](url)"
'[text](url "optional hovertext")'
"[text](url 'optional hovertext')"
• Embeds only support this in description and field values
what am I doing wrong?
[Error] DiscordAPIError[50035]: Invalid Form Body
components[0].components[0].style[BASE_TYPE_REQUIRED]: This field is required
components[0].components[1].style[BASE_TYPE_REQUIRED]: This field is required
components[0].components[2].style[BASE_TYPE_REQUIRED]: This field is required
components[0].components[3].style[BASE_TYPE_REQUIRED]: This field is required
I always get this error
Quick question, when you use GuildMember.createDM() will that throw an error if there's already a DMChannel between the bot and the user or not?
I don't think so, no. There isn't a way to fetch DMs either
Alr, I guess I'll try and see
followed it like in djs guide
How could i put an image into an embed?
This is the dev branch so the guide ain't updated.
How do I do it then
You didn’t, since you don’t provide a setStyle
ooh
Forgot to put the style: <Button>.setStyle() nvm already answered
I started getting this error on the dev versions, not the latest but I can check which one I'm running on
seems to be 14.0.0-dev.1655640259-358c3f4
does anyone know what can cause this? This happened after my bot had been running for a few hours
Iirc this is fixed in latest dev
Is there a current changelog for v13 -> v14?
pins, is what we have and update, not accurate at all times, since at/dev ist still udner development
pogs
i wish modals had more options like role selection
And I wish I was a unicorn🤷♂️
What's wrong with my addFields() ?
i think needs to be array?
not anymore
oh
What error do you get?
catch and console.log it
npm ls @discordjs/builders please. You might have incompatible builders version
Okay. Then it’s probable that one of your two things you pass into name/value isn’t a string
and possibly undefined
catch and console.log it
Catch embed builder 😔
yes? try catch
then use an ide that can show you additional error properties
After try catch + the command is already try catched by the handler
Trying to add an image to my message but I don't know how to create the attachment.
Attachment
Represents an attachment
what is that theme?
That doesn't help as I cannot create the attachment using canvas from what I read there.
AttachmentBuilder
Represents an attachment builder
This one
Thanks
Followed the guide, my code freezes at the builder here and then doesn't continue.
Not sure what canvas.create is
no idea
it has made the buffer, so not sure why setFile isnt working. I see no error.
Ok to add attachments its .send({content: 'blah', attachment: file}) correct?
files: [attach]
yep found it thanks.
This code const res = new ModalSubmitFieldsResolver(interaction.components)gives this error:
TypeError: ModalSubmitFieldsResolver is not a constructor
Is there a dev build that fixes this. I am on
14.0.0-dev.1657109083-8198da5
you don't have to instantiate that class yourself, use ModalSubmitInteraction#fields
is there a reason why <GuildAuditLogsEntry>.action returns an AuditLogAction (string form) instead of an AuditLogEvent (number)? seeing as most other things use enums rather than string representations now. if not I'll open a PR and change it, personally think that makes more sense
Not all interactions have a commandName
So what can I do
It depends on the context
You can either change the Interaction type to a sub class of the one ur actually using, or you can just check the .type
ModalSubmitInteraction (extends Interaction)
Represents a modal submit interaction.
@restive crypt #app-commands
How can I deny a role permission? Not channel overwrites, but a role.
Role#setPermissions()
Sets the permissions of the role.
That‘s the right one
Sorry.
@steel haven Doesn't that overwrite the current permissions with the PermissionResolvable that's passed into the permissions parameter?
Yes? So get <Role>.permissions, add/remove what you want and pass that into setPermissions
How can I pass in embedjson in the embeds option from editReply? Do I need to use EmbedBuilder.from() or anything?
Aight thanks
Im getting this error now
[ERROR] • unhandledRejection
DiscordAPIError[50035]: Invalid Form Body
embeds[0][MODEL_TYPE_CONVERT]: Only dictionaries may be used in a ModelType
at SequentialHandler.runRequest (/Users/nikan/Ultimates/node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:475:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (/Users/nikan/Ultimates/node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:201:11)
at async REST.request (/Users/nikan/Ultimates/node_modules/@discordjs/rest/src/lib/REST.ts:319:20)
at async InteractionWebhook.editMessage (/Users/nikan/Ultimates/node_modules/discord.js/src/structures/Webhook.js:316:15)
at async UserContextMenuCommandInteraction.editReply (/Users/nikan/Ultimates/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:150:21)
needs to be in an array
console.log(embedjson) and make sure it is what you want.
lol nvm already
is djs v14 guide there?
pins
in djs guide?
How much time it takes to the command permissions to update?
instant just like how you deploy your cmd
ty
can bot send message to a channel despite having no message intents
Yes.
Cool thx
oh sorry
Anybody else experiencing issues with app permissions (v10 gateway)?
Got a test application (using the latest v14 build) which fails to change it's own nickname.
Invited the app with bot and app-commands scope, permissions: 67193856 (includes change own nickname).
Double checked the permissions on the server integration and roles menu.
The API does always throws a missing permissions error:
rawError: { message: 'Missing Permissions', code: 50013 },
code: 50013,
status: 403,
method: 'PATCH',
url: 'https://discord.com/api/v10/guilds/xxx/members/xxx',
requestBody: {
files: undefined,
json: {
nick: 'my new nickname',
communication_disabled_until: undefined
}
}
The action is triggered by a ModalSubmitInteraction
The app permissions in the object are appPermissions: PermissionsBitField { bitfield: 1071832878657n }
Those also include the permission to change the nickname.
Method being called within the interaction interaction.guild.members.me.setNickname(...);
Kicked the bot; reinvited; left guild; created 2nd test guild; etc.
The API always throws that error. Idk why, doesn't happen on the v9 gateway (djs v13.8.1)
Changing client's nickname is bugged right now
looks like it is also sending the timeout key communication_disabled_until , wouldn't be surprised if that's the missing perm
Yeah that's a bug right now in dev
The current major PR fixes it but it's still pending
oh, it's not an API issue?
Nah
sometimes permissions in guilds are fucked up, i was always wondering
nah, the api just checks against all changed keys in the payload
is there already a known issue about this? couldn't find one
"sometimes permissions in guilds are fucked up" that is a very blanket and unverifiable statement
well assigned permissions to users or apps sometimes don't seem to make it from the guild to discords backend, as the API sometimes returns different permissions than I have actually set
removing and reinvited users usually fixes that
well that is just wrong on so many levels
well, doesn't change the fact this issue is happening quite a lot
at least on small test guilds, for some reason
anyways if changing the nickname is bugged, I got my answer
so thanks for that
if there was an issue with perms updating and reinviting things would fix it, the platform at large would have some major problems
i have never, in my 4 years in bot development and discord meta heard about that, apart from simultaneous role updates that get packed into one in the backend
well, must be just me then experiencing this sort of issues (quite often)
that assigned permissions to an app, for example via. editing it's roles are not up-to-date with the permissions the API returns for this app on any interaction
interaction might be the wrong word here
then what is the right word? what are you doing to get wrong permissions?
in this context it means, the permissions I receive for the guild member are wrong in any possible case, in the message & interaction event etc.
any time I log the permissions they're, what I called fucked up, which means they're not up-to-date with the actual permissions set in the guild
only reinviting does fix
editing/removing permissions doesn't for some reason
how do you check perms? where do you get them from?
well depends on where I log them of course, in the case of a message event, I log the current permissions for that member in the channel
for interactions I'm logging the memberPermissions property
appPermissions as of now
Would it make more sense if <Client>.login(<TOKEN>) returned Promise<Client> instead of Promise<TOKEN>?
I want to ask to add emojis to the server, right here there must be const { Util } = require("discord.js") Util.parseEmoji(rawEmoji). I tried that in v14, it doesn't work, maybe someone knows if there's something new
It’s a top level export now, so it’s const { parseEmoji } = require(“discord.js”);
thanks man
it actually doesn't make sense the same, however...
When you use client.login() you surely already have the client but you may not have the token (as it defaults to env.DISCORD_TOKEN or it may have been set before as client.token). On the other hand, returning the client would help Typescript users with casting using Cluent<true> (which is however the parameter of the ready event)
how can I know if an interaction is an autocomplete
check interaction.type
okay thanks that worked, do you know how to know the name of the option from the interaction? so for example i have an equip command with autocomplete option backpack, how do i know from the interaction that they're looking for backpack option
Documentation suggestion for @hasty gorge:
CommandInteractionOptionResolver#getFocused()
Gets the focused option.
i meant like the name of the option interaction.something is "backpack" for example
What
ok ok wait
basically interaction.commandName is equip, but the autocomplete option is for the option backpack, how do i get "backpack"
like get the name of the option
With this
ooh, my bad, i thought it was just a string lol
It needs to be .getFocused(true) btw for the full option
yes i see that
thanks!
👍
I seem to be doing something wrong with this type but I'm not sure how to do it properly, any tips?
use Extract<> instead of Pick<>
how do i use the new AttachmentBuilder
look at changes in v14 ( pins )
thanks!
with v14 how do you do addFields i get this
ExpectedConstraintError > s.number.le
Invalid number value
Expected: expected <= 25
Received:
| NaN
at Object.run (/mnt/sd/Projects/LampV2/node_modules/@sapphire/shapeshift/dist/index.js:702:72)
at /mnt/sd/Projects/LampV2/node_modules/@sapphire/shapeshift/dist/index.js:113:66
at Array.reduce (<anonymous>)
at NumberValidator.parse (/mnt/sd/Projects/LampV2/node_modules/@sapphire/shapeshift/dist/index.js:113:29)
at validateFieldLength (/mnt/sd/Projects/LampV2/node_modules/@discordjs/builders/dist/index.js:133:24)
at EmbedBuilder.addFields (/mnt/sd/Projects/LampV2/node_modules/@discordjs/builders/dist/index.js:243:5)
at module.exports.execute (/mnt/sd/Projects/LampV2/commands/help.js:11:10)
at module.exports (/mnt/sd/Projects/LampV2/events/interactionCreate.js:38:17)
at Client.emit (node:events:537:28)
at InteractionCreateAction.handle (/mnt/sd/Projects/LampV2/node_modules/discord.js/src/client/actions/InteractionCreate.js:81:12)
update to the latest @dev
i thought i had latest but ok
le 
bun add discord.js@dev?
bun remove discord.js
no
Yes
no
Yes
no
Hey for some reason .setauthor aint working ```js
const embed = new Discord.EmbedBuilder()
.setTitle("Command's")
.setDescription(Heyyy, Heard You Needed Help Using Me. Here Are My Command's)
.setColor('#AD1457')
.addFields(
{ name: 'My Commands', value: ${commands}, inline: true },
{ name: Webpage Command's, value: 'Coming Soon', inline: true },
)
.setAuthor('NeroGizmo')
return interaction.reply({ embeds: [embed]});
error:
ValidationError > s.object(T)
Expected the value to be an object, but received string instead
Received:
| 'NeroGizmo'
at ObjectValidator.handle (/mnt/sd/Projects/LampV2/node_modules/@sapphire/shapeshift/dist/index.js:1158:25)
Im using discord.js@14.0.0-dev.1657152699-10ba008
setAuthor takes an object
EmbedBuilder#setAuthor()
Sets the author of this embed
lol im doing this all other memorie and i havent done this in a while
It doesn't work with discord.js anyway
It's lacking some core stuff that'll make discord.js crash on launch / crash eventually
If I have a message with 2 select menus and I get an interaction from one of them will interaction.values include the values in both menus or only the one that was interacted with?
it's hard for me to check atm, how would I see the overall values?
It'd only be the select menu from which the interaction was sent by
And the values would be an array of all the selected options
So if previously, 5 options were selected and you deselected them all, you'd receive an empty array as the values, as nothing was selected
i am trying to make a bot that plays a certain song when a user joins the call now the bot joins the call successfully but the music for some reason doesnt play i have installed sodium and ffmpeg
so how do I get the options that were selected in the other menu?
Interactions are sent one after the other o_O
Multiple select menus in a message doesn't change that
well yeah but is there a way to know what the other select menu has selected when one is interacted with
this is the code
Not sure if you can look in the message's components and see if it has their default options changed... but if that doesn't work, I don't think so
hm alright, thanks
i fixed it
There is a way to resize discord default image for example I have this link: https://cdn.discordapp.com/embed/avatars/4.png that I got from User.displayAvatarURL()
I tried to add object with size in it but it didn't work
They cannot be resized
Yeah I saw it now on the docs anyway thank you
No problem
Hello!
resolve undefined Promise {
{
url: 'wss://gateway.discord.gg',
shards: 1,
session_start_limit: {
total: 1000,
remaining: 968,
reset_after: 29827236,
max_concurrency: 1
}```
Now, whenever I turn on the bot, this error appears.
thats not an error
Was <Activity>.syncId removed with v14 version?
https://lency.is-a.fail/5Bg8nJrEX.png
Yes. You can read here too
https://deploy-preview-1011--discordjs-guide.netlify.app/additional-info/changes-in-v14.html
hey don't know if im doing this correct but i get this when doing array.join CombinedPropertyError (1)
Received one or more errors
input[0]
| CombinedPropertyError (1)
| Received one or more errors
|
| input.value
| | ExpectedConstraintError > s.string.lengthGreaterThanOrEqual
| | Invalid string length
| |
| | Expected: expected.length >= 1
| |
| | Received:
| | | ''
my version is discord.js@14.0.0-dev.1657152699-10ba008
Seems there was nothing in the array
And you're joining nothing into an empty ring
Show code?
it works and shows the stuff in array
Because it received an empty string
strange
Not really. You join the array before you put anything in the array
Variables aren't dynamic
Getting this error even though ROLE_ICONS is a valid guild feature, any ideas?
use the GuildFeature enum
this is a string array, not an enum
it comes straight from discord with no modification, so what im doing is correct
the types should be fixed instead
The types reflect what exactly can and can not be sent by discord in there. So they are indeed correct in this case
im trying create a voice channel, but:
type[NUMBER_TYPE_COERCE]: Value "VoiceChannel" is not int.```
ChannelType
{
'0': 'GuildText',
'1': 'DM',
'2': 'GuildVoice',
'3': 'GroupDM',
'4': 'GuildCategory',
'5': 'GuildNews',
'10': 'GuildNewsThread',
'11': 'GuildPublicThread',
'12': 'GuildPrivateThread',
'13': 'GuildStageVoice',
'14': 'GuildDirectory',
'15': 'GuildForum',
GuildText: 0,
DM: 1,
GuildVoice: 2,
GroupDM: 3,
GuildCategory: 4,
GuildNews: 5,
GuildNewsThread: 10,
GuildPublicThread: 11,
GuildPrivateThread: 12,
GuildStageVoice: 13,
GuildDirectory: 14,
GuildForum: 15
}```• d.js `14.0.0-dev.1656677097-741b3c8` • Type: `object` • time taken: `0.110528ms`
tks!
an enum(eration) is a mapping from property keys to values (numbers here) and the other way around
await client.guilds.cache.get("925996740044288020").channels.create({name:`${client.users.cache.get(newChannel.id).username}`,
ChannelType: 2,
permissionOverwrites: [
{
id: newChannel.id,
allow: ["ManageChannels"],
},
], parent: "994720502482472960"
})```
Whats the error?
i think you misunderstood
ow :/
i printed the mappig for you
the error told you it expects a number
the mapping is ChannelType.GuildVoice > 2
that way you can supply the number but still know what it means
if you don't care about that verbosity you can also just supply 2
you do still supply it under the type option key
collector.on('end', collected => {
menumsg.edit({ embeds: [menumsg.embeds[0].setDescription(`~~${menumsg.embeds[0].description}~~`)], components: [] })
});
Error
TypeError: menumsg.embeds[0].setDescription is not a function
what is menumsg
EmbedBuilder.from
<Message>.embeds is now an array with readonly embeds
you have to use EmbedBuilder.from() on the embeds to be able to edit them
they're not because guild.features.includes("ROLE_ICONS") is a valid statement and TS is saying it isn't
On main, the type is pointing to discord-api-types where it appears to be a string enum. In TS though I would think that it doesn't know that string literal is of the enum type?
The generic string type isn't strict enough for TS to accept it as a string enum type I would have thought
Hi, so I am trying to specify a type as to what payload is but, I have no clue on what to specify it as. Does anyone know what I should specify it as?
MessageOptions?
but this function is for an interaction?
you were asking for the payload's type right?
ohhh ok
InteractionReplyOptions
Options for a reply to an [BaseInteraction](<https://discord.js.org/#/docs/discord.js/main/class/BaseInteraction>).
👍
Received one or more errors
input[1]
| CombinedPropertyError (1)
| Received one or more errors
|
| input.value
| | ExpectedConstraintError > s.string.lengthGreaterThanOrEqual
| | Invalid string length
| |
| | Expected: expected.length >= 1
| |
| | Received:
| | | ''
at ArrayValidator.handle (/home/container/node_modules/@sapphire/shapeshift/dist/index.js:439:70)
at ArrayValidator.parse (/home/container/node_modules/@sapphire/shapeshift/dist/index.js:137:88)
at EmbedBuilder.addFields (/home/container/node_modules/@discordjs/builders/dist/index.js:262:57)
at logging (/home/container/functions/logging.js:14:23)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)```
Whats this mean
You didn’t pass anything (or an empty array) into addFields
line 14 is if (fields) embed.addFields(...fields)
console.log(fields) then
console.log(await msg.guild.roles.fetch("123")) -> null
console.log(await msg.guild.members.fetch("123")) -> DiscordAPIError[10013]: Unknown User
Isn't it supposed to throw an error like unknown role ?
No, because discord API doesn’t support fetching single roles
const filter = (i) => i.author.id === user.id
const collector = await channel.createMessageCollector({ filter, time: ms("29m")})
I made this message collector in v14, and when I'm collecting with
collector.on("end", async collected => {
collected.forEach(x => console.log(x.content))
.....
It's returning empty contents
Anybody help? It was working fine in v13
So djs fetches all roles and gets your result from that response
Oh okay.. So I'm supposed to see if the result is null and throw an error accordingly
If you want to throw an error sure…
I have a custom CommandError and every time it throws that, the error is caught and displayed in a nice embed x)
Anyway thanks
MessageContent intent?
Yes I've given
Do I need to pass anything in bot code?
Also in discord dev portal?
Yep
Yes, the intent
I used the intents: 32767,
Don’t
So I manually add the array?
Yes. And only add the intents you actually use
Ok
Thanks it worked... <3
am I missing something or the limit was like 50?
TypeError: interaction.isCommand is not a function
It was removed - if you want to check if the interaction is from an application command use interaction.type === InteractionType.ApplicationCommand
ty
That's probably a Discord bug (the typo). It also appears to be an undocumented error code. I'd probably make an issue about it
https://discord.com/developers/docs/topics/opcodes-and-status-codes#json-json-error-codes
I mean, I really don't think I have 50 commands lol, I may have 20 but surely not 50 😂
iirc there's a limit of 5 for each type of context menu commands
Makes better sense
Ah I see, probably I have 6 user commands, thanks!
Sorry, I'm here again 😄
I'm using an attachment option for my command and my question is: if I need that file sent, should I fetch it using the url or the proxy url?
hi, is there a way to set the text in voice channel for only who join in a VC can chat/see inside ?
hi, according to this message, the ratelimit is only for channel name/topic edit. Permission editing is not affected by this rate limit. I'm I right?
yes, but afaik it's hard or impossible to discern these, so once you are ratelimited for the naming other changes are under it as well
cc @uncut kelp , maybe? if not imma bonk vlad
Yeah permission overwrites are unaffected by that name/topic rate limit
TypeError [ColorConvert]: Unable to convert color to a number.
I wonder what caused this error, I just upgraded to v14 dev version, I don't know
well, what do you supply as color(s)?
#2f3136
and in what context?
I write to setColor part of embed
https://i.imgur.com/LMdWXrC.png
How do you import the embed?
it's the not main lib one isn't it, but the builders one, which doesn't resolve
const { EmbedBuilder, ButtonBuilder, ActionRowBuilder, SelectMenuBuilder, Colors } = require("discord.js");
so what should i do
EmbedBuilder { data: { color: 3092790 } }```• d.js `14.0.0-dev.1656677097-741b3c8` • Type: `object` • time taken: `0.950853ms`
what version (commit) are you on?
^14.0.0-dev.1657325401-33ae7df
33ae7df in discordjs/discord.js by suneettipirneni committed <t:1657310600:R>
feat(website): add detailed property and method documentation (#8252)
oh, that is newer than... sec
Unsafe builders recently got removed
That shouldn’t affect the color validation since djs extends the regular builders
cannot repro on 33ae7df
Cannot reproduce on discord.js@14.0.0-dev.1657325401-33ae7df
so which version should i download right now?
The latest
the one you have, interestingly enough
Also do you have your full code sample
Should I delete and reinstall?
Interactions: Slash command permissions
reads like it expects a string, but got a number