#djs-in-dev-version
1 messages · Page 25 of 1
so I have this: ```js
const row1 = new ActionRowBuilder({components:[
new ButtonComponent(new ButtonBuilder().setLabel('1').setCustomId('00').setStyle("Primary").toJSON()),
new ButtonComponent(new ButtonBuilder().setLabel('2').setCustomId('01').setStyle("Primary").toJSON()),
new ButtonComponent(new ButtonBuilder().setLabel('3').setCustomId('02').setStyle("Primary").toJSON()),
]}).toJSON()
and I keep getting this error, anyone know why?
it's coming from the .toJSON, and I have no idea why because I already have a label
why do you create a new ButtonComponent?
you can just pass the ButtonBuilder on addComponents
yes
alr thanks
Please help
because it's deleted, the only thing that would be guaranteed would be the id, the channel and the guild if it exists since the three ids are all discord gives you
you getting the content solely depends on the message data being cached
i think if the message isnt cached it shouldnt fire the messageDelete event
is there a way to know if the User dms are open or closed?
attempt to send and catch err
any other way?
no
Ok but why is the content empty here
because the message is empty. did you send a file by any chance?
if it was cache or intent related then content would be null
its empty string if you dont have message content intent
has has it ^
oh I didn't know that, I assumed it'd be null as it just doesn't get provided to the client at all. good to know
Is it need if my bot is not verified?
yes
it doesn't look like discord.js to me
i choose current for node 16.9?
LTS is fine
If your bot is unverified you can enabld intents manually, il is a verified bot you need to ask to Discord support for intent enabling
okey starting my journey with v14 today
But all bots need intents
will i have to unistall earlier version of node i had?
or it auto remove older version
@narrow lagoon you can just use n
npm cache clean -f
npm install -g n
sudo n stable
actually idk what os u r using but thats what i use on ubuntu
i use windows
yeah then just use the binary on the website
i dont think its necessary to uninstall old node
const client = new Client({ intents: 32767 });```
does that still work?
yes
thanks
is there a method to check if an interaction is chatinput or user/msg contextmenu only? ( application command )
Documentation suggestion for @stuck fiber:
Interaction#isCommand()
Indicates whether this interaction is a [CommandInteraction](<https://discord.js.org/#/docs/discord.js/main/class/CommandInteraction>).
Is there any date on when model interactions will be available in the stable version of DJS? I’m sorry if this is a question you get asked regularly
no
Documentation suggestion for @stuck fiber:
Interaction#isChatInputCommand()
Indicates whether this interaction is a [ChatInputCommandInteraction](<https://discord.js.org/#/docs/discord.js/main/class/ChatInputCommandInteraction>).
ty, but i needed chatinput | ctxmenumsg | ctxmenuuser
Oh you wanted both ok
thats why I linked isCommand() 
@slender hull
don't ping them their busy people
are they?
do command translation gonna be in the v14 ?
Yes
no date
ty
With perms v2 in effect, can I still deploy a bot in the next week or so that uses v14? Do I just forgo setting defaults, deploy it, then configure it on my server with the UI?
It's not a public bot so I don't have to worry about that. It's bespoke for just my server.
sure, you can't deploy "traditional" slash perms for users and roles anymore, that's it
OK great, that's what I figured. Then I can just remove perm updating from my framework for now.
there will be default member and dm permissions, which are not currently supported by builders, so you'd need to switch to raw payloads for your command deploying, if you need that
Oh! I already use raw payloads in my framework. I guess I can use the new default perms then.
sure, those are bitfields for required perms
side note: the UI is very broken and displays
on everyone, regardless
I saw those mentioned in #769862166131245066 but wasn't sure if that was a raw thing or a d.js thing.
Oh boy. 🙃
That'll be fun.
Doesn't seem like there's a choice since the new perms are fully released and the endpoint for setting perms is gone.
I saw a follow-up post on api-docs regarding the perms rollout. I guess that bug is probably one of the reasons.
Thanks for your help. Seems like I'll be good to go since I'm not using builders for my commands.
And thanks for the tip re: the broken UI, heh.
help please
interaction is undefined
what do you mean I already defined it
do you need my code?
Undefined doesnt mean not defined, undefined means its defined but it has no value
Ok
Actually I too used to get this error, is has something to do with the parameters.
why it says the option is invalid?
probably a discord slate v2 bug
ApplicationCommandOptionType.SubCommand I got an error using that
better to send the error instead of having that you have one
It's Subcommand not SubCommand
can I have a documentations for that?
Yeah it takes arrays now, also .addFields()
addField is removed use .addFields instead
Hello. Recently I read that there can be only one text option inside an action row for models. But how many action rows can there be in a model?
Hi, anyone knows why that user tag on left side is not working as should? Its working sometimes but then its changed for its uuid form
latest dev version
your discord client didnt cache that user
nothing to do with djs
5
Hmm ok
So, can I somehow fix it? Or best I can do, is put there name instead of tag?
if you actually mention them in message content (not the embed) the message payload includes the member data so the client can resolve it
that's the only way to ensure it - and i doubt you'd want to actually mention the person for this use case
(unless the feature is placed in a locked channel that people generally can't read anyways (think modmail, for example))
Error: TypeError [INVALID_TYPE]: Supplied parameter is not a User nor a Role.
Code:
const category_name = interaction.options.get('category_name').value;
const category = await interaction.guild.channels.create(`${category_name}`, {
type: 4,
permissionOverwrites: [
{
id: interaction.guild.id,
deny: ['ViewChannel'],
},
{
id: 'my role id here',
allow: ['ViewChannel', 'SendMessages', 'ReadMessageHistory', 'EmbedLinks', 'AttachFiles', 'AddReaction'],
}
]
});
pls help
Thanks, will do that. 
did the GUILDS intent change for v14?
Guilds
is it not all caps anymore
SCREAMING_SNAKE_CASE => PascalCase
so i have a messageCreate event: js bot.on('messageCreate', (message)=>{ console.log(message) }) for some reason it's not logging anything, intents: { intents: ['Guilds','MessageContent'] } i also have the intents on the dev portal enabled
those are not valid intents
wait i just realized this is v14
yea
still those are not valid, you should use the enums provided by the library
when i did Intents.FLAGS.GUILDS it raised TypeError: Cannot read properties of undefined (reading 'FLAGS')
Pins 📌
i see, let me try
yes they are valid intents
you still need GuildMessages intent
new Client({ intents: ['Guilds', 'GuildMessages', 'MessageContent' })
let me try that too then
that looks so weird when you are used to all caps
Error: Received one or more errors
at UnionValidator.handle (/root/ObitoInteractions/node_modules/@sapphire/shapeshift/dist/index.js:1467:23)
at UnionValidator.parse (/root/ObitoInteractions/node_modules/@sapphire/shapeshift/dist/index.js:110:88)
at EmbedBuilder.setDescription (/root/ObitoInteractions/node_modules/@discordjs/builders/dist/index.js:261:54)
at Object.execute (/root/ObitoInteractions/commands/utility/emoji.js:70:6)
at Object.execute (/root/ObitoInteractions/events/interactionCreate.js:56:31)
at Client.<anonymous> (/root/ObitoInteractions/Structure/Client.js:59:37)
at Client.emit (node:events:526:28)
at InteractionCreateAction.handle (/root/ObitoInteractions/node_modules/discord.js/src/client/actions/InteractionCreate.js:81:12)
at Object.module.exports [as INTERACTION_CREATE] (/root/ObitoInteractions/node_modules/discord.js/src/client/websocket/handlers/INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (/root/ObitoInteractions/node_modules/discord.js/src/client/websocket/WebSocketManager.js:355:31)
is the description empty?
empty string description, it seems
yeah that was it
what does this mean
use ApplicationCommandType.User instead
import it from discord.js
you mean ApplicationCommandOptionType.User? or is it just ApplicationCommandType
ah I thought it was a context menu command
ah alright
[Error: ENOENT: no such file or directory, stat '/home/container/4d6f6b6471f1b808cd3dc8d005509ed7'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: '/home/container/4d6f6b6471f1b808cd3dc8d005509ed7'
} Promise {
<rejected> [Error: ENOENT: no such file or directory, stat '/home/container/4d6f6b6471f1b808cd3dc8d005509ed7'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: '/home/container/4d6f6b6471f1b808cd3dc8d005509ed7'
}
}
``` do you know what does this mean it keeps coming when a guild is updated and i try to edit all the properties to the oldGuild parameter and this comes up
why?
await newGuild.edit({
name: oldGuild.name,
icon: oldGuild.icon,
features: oldGuild.features,
description: oldGuild.description,
premiumProgressBarEnabled: oldGuild.premiumProgressBarEnabled,
verificationLevel: oldGuild.verificationLevel,
explicitContentFilter: oldGuild.explicitContentFilter,
afkChannel: oldGuild.afkChannel,
systemChannel: oldGuild.systemChannel,
afkTimeout: oldGuild.afkTimeout,
splash: oldGuild.splash,
discoverySplash: oldGuild.discoverySplash,
banner: oldGuild.banner,
defaultMessageNotifications: oldGuild.defaultMessageNotifications,
systemChannelFlags: oldGuild.systemChannelFlags,
rulesChannel: oldGuild.rulesChannel,
publicUpdatesChannel: oldGuild.publicUpdatesChannel,
preferredLocale: oldGuild.preferredLocale,
reason: "Server Update | Not Whitelisted"
})
``` this is the way i am editing the guild
icon must be buffer
<guild>.icon is hash
so its looikng for file with name of your icon hash
DiscordAPIError[40005]: Request entity too large
at SequentialHandler.runRequest (/root/ObitoInteractions/node_modules/discord.js/node_modules/@discordjs/rest/dist/index.js:708:15)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (/root/ObitoInteractions/node_modules/discord.js/node_modules/@discordjs/rest/dist/index.js:511:14)
at async ChatInputCommandInteraction.reply (/root/ObitoInteractions/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:110:5)
at async Object.execute (/root/ObitoInteractions/commands/utility/avatar.js:39:28)
at async Object.execute (/root/ObitoInteractions/events/interactionCreate.js:56:17)
at async Client.<anonymous> (/root/ObitoInteractions/Structure/Client.js:59:25)
oh i see
Request entity too large. Try sending something smaller in size
I set 4096
it isn't good?
probably not
i think you can use Guild.iconURL()
i already fixed it
any major differences i should know about before using v14?
pins
many differences i can't even remember everything
^^^^^^^
SyntaxError: Named export 'Intents' not found. The requested module 'discord.js' is a CommonJS module, which may not support all module.exports as named exports.```
^^^^
intents: [GatewayIntentBits.GUILDS, GatewayIntentBits.GUILD_MESSAGES] but im getting RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: undefined.
ah nvm i see its not capitalized anymore
now its PascalCase e.g. GuildMessages
Why I am getting this error?
TypeError: Cannot read properties of undefined (reading 'delete')
Will there be breaking changes from v13 to v14?
very breaking changes, yes
the message just isn't cached
instead what you could use is channel.messages.delete("ID") and catch the error in case
okay
Is there any guildes?
check pins
Thanks, it got deleted.
[Error: ENOENT: no such file or directory, stat '/home/container/9cc3ab7cfe4321bd81a088e70507284a'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: '/home/container/9cc3ab7cfe4321bd81a088e70507284a'
} Promise {
<rejected> [Error: ENOENT: no such file or directory, stat '/home/container/9cc3ab7cfe4321bd81a088e70507284a'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: '/home/container/9cc3ab7cfe4321bd81a088e70507284a'
}
``` i get this error when i try to change the guild vanity code to the oldGuild vanity code parameter in guildUpdate event
i keep getting this error, anyone know why?
const Embed = new EmbedBuilder()
.setImage(board)
interaction.reply({embeds: [Embed]})
Setting the vanity url isn't possible with djs, so hows that djs related
how does dpy does it but?
is there any way to do it using the rest api? please let me know
make a patch request on the same endpoint url for vanity, with the form body of the code
discord doesn't document it and so djs doesn't have a method for it
ye, since they don't think it is necessary
nvm I'm stupid lmao i fixed it
it very much isn't, setting the vanity url isn't something a bot should be able to do
how do i put an default discord emoji in a select menu like 🟥 or something
setEmoji({name: "🟥"})
oh okay
well a wrapper should try to cover stuff that is available in the api itself i am not complaining that djs doesn't have it but yet while other libs have it why can't djs its the lib dev's choice but i think covering the all the possibilities will be nice shouldn't matter if its necessary or not :), Thank you
again the official docs don't document it
its not documented, if its not documented, its not gonna be in djs
How can i fix this?
Boolean(something)
why are you using optional chaining for one prop but not the other
not quite djs but still thats bad practice
it's good
no it's not he should be using optional chaining on all
that's because of typescript and djs types
no it's just dumb
if you use ```js
o.presence?.clientStatus?.desktop
you can't easily overcome partial types without "?" syntax
i was literally suggesting what you just said
oh sorry
Documentation suggestion for @haughty lava:
ActionRowBuilder
Represents an action row builder.
Can someone give me a class on how to code a bot with replit?
This server is for discord.js. We are not able to assist you with unrelated libraries.
CombinedPropertyError (1)
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
onlineEmbed.setFields([{name:`User ${player}`, value: `went online`}])
huh
You must be on an older version that doesn't take arrays yet
Not too sure where to ask this one, so here I go in this channel anyways... fooling around with permissions v2 and the default permissions, does anyone know if/where this property is visible on the client side on discord? As far as I can tell, it makes it look like the command is synced with the default application permissions, meanwhile it really only shows it to people corresponding with the set default field, kind of odd for the mods of a server to see if they aren't aware of how this may work
PascalCase
It's not 🙃
But we're not sure if thats a bug, because the interface doesn't really reflect API changes right now, or just not a feature
thanks, hopefully they do add it eventually for clarity's sake
Hi, i have a problem with channelUpdate.
Error:
Type 'string' is not assignable to type 'GuildAuditLogsResolvable'.
Code:
const logs = await n.guild.fetchAuditLogs({ limit: 1, type: 'CHANNEL_UPDATE' });
Check the docs for the method, it had the name for the enum
WhateverThatEnumIs.ChannelUpdate is what you'd use instead
After some research, the enum has changed its name
AuditLogAction -> AuditLogEvent. Well I think, in V14
Guild#fetchAuditLogs()
Fetches audit logs for this guild.
const actionRow = new Discord.ActionRowBuilder()
actionRow.addComponents([
{
type: ..., style: ..., ...
},
{
...
}
])
message.channel.send({
embeds: [embed],
components: [actionRow]
})
this is giving me TypeError: component.toJSON is not a function in v14; it worked in v13 with MessageActionRow
my code doesn't have a component variable
TypeError: component.toJSON is not a function
at ...@discordjs+builders@0.14.0-dev.1650931748-df64d3e\node_modules@discordjs\builders\dist\index.js:536:64
at Array.map (<anonymous>)
at ActionRowBuilder.toJSON ...@discordjs+builders@0.14.0-dev.1650931748-df64d3e\node_modules@discordjs\builders\dist\index.js:536:35)
at ...discord.js\src\structures\MessagePayload.js:135:109
at Array.map (<anonymous>)
at MessagePayload.resolveBody ...discord.js\src\structures\MessagePayload.js:135:49)
at TextChannel.send ...discord.js\src\structures\interfaces\TextBasedChannel.js:171:61)
at Observer.code (C:\Users\advai\Documents\GitHub\advaithbot\functions\observers\switch-to-slash.js:55:21)
at runMicrotasks (<anonymous>)
Okay and did it not work @steel haven
AuditLogAction no but AuditLogEvent yes
iirc components you add to an ActionRowBuilder need to be builders themselves, can't use pure objects
thats an annoying change
i'll just switch to an array instead of a builder in that case
Yep they straight up just push them on addComponents, they don't resolve the json to a builder
should i make a PR that accepts raw objects
I think adding them in the constructor should work, though you should either use builders or objects everywhere
it seems to just run toJSON so i suppose i can just make it not do that if its already the json?
yeah
then you'd end up with non builders in the components array. the better approach would be to use createComponent inside addComponents imo
createComponent?
a function from builders
Look at how the constructor works
functions are not picked up by the docgen
It is the better approach since if you end up just pushing the json, you have potentially both jsons and builders in .components
Would be better to stay consistent
ah i see
oh it's createComponentBuilder nowadays https://github.com/discordjs/discord.js/blob/679dcda9709376f37cc58a60f74d12d324d93e4e/packages/builders/src/components/Components.ts#L16
createComponent is in the main lib
anyway i think i'll just switch to objects instead of builders
Yeah your choice, I'd do it too
There is discord api types, With ts, it wouldn't be an issue
yeah ik about dapi types, ive written a lot of it 
i think this should be Discord.ButtonComponentData[] tho
Nice
The only downside is maybe losing the internal sanitation from the builders before sending the api requests ig
i am trying to work with modals, code: js if(btn.customId == "click"){ btn.showModal(Modal).then(async() =>{ const input = new InteractionCollector(this.interaction.client,{time: 60_000}) input.on('collect', async i => { const c = i.fields?.getTextInputValue("move") await btn.update({content: c}) }) }) } but it's raising this error: ```
if (this.deferred || this.replied) throw new Error('INTERACTION_ALREADY_REPLIED');
^
Error [INTERACTION_ALREADY_REPLIED]: The reply to this interaction has already been sent or deferred.
at ButtonInteraction.update (C:\Users\HiTech\Desktop\hjs\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:217:46)
at InteractionCollector.<anonymous> (C:\Users\HiTech\Desktop\hjs\commands\chess.js:108:39)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
[Symbol(code)]: 'INTERACTION_ALREADY_REPLIED'
}
what should i do?
You should be using the i interaction when replying
oh right, let me change that
hmm this is weird if i cancel the modal and then try to use it, it says 'Interaction has already been acknowledged.' below.
how could i prevent this?
You need to check the message id
Or smth, ur creating another collector
Would be nice it if stored which interaction id it came from 
so it's because cancelling the modal does not stop my collector and thus it keeps on going?
Yes
would doing ```js
const collector = new InteractionCollector(this.interaction.client,{time: 60_000})
collector.on('collect', async i => {
// code
})
collector.stop()
That just renders the collector useless
damn
I usually avoid collectors altogether
then how else could i do it?
I just store enough data in the customId and message (e.g. embeds, content) to be able to respond properly
but i need the user's input for this
That’s in the interaction.fields
mhm yea but as i stated above when the users cancels the modal it just breaks, how can i detect when they cancel the modal so i can manually stop the collection?
You can’t
:I
That’s why I avoid collectors, at least for modals
is this a discord or a discord.js limitation?
Discord
You could store the button’s interaction id in the customId and check for that in the filter
I think it’s the easiest way to make it work
i found a way :D ```js
if(!i.fields){
input.stop()
}
This is how I do it too
Any interaction could cause that to stop
All collectors/promises are tied to the interaction that launched them that way
InteractionCollector collects everything that fires the interactionCreate event
Would imagine one person clicks the button. And while that person is filling out the form, another person runs a slash command and causes the collector to stop
oh, well that is certainly annoying
Actually, you would be fine if you filtered out interactions not by the user and only those from the message
You could still run into the double collector issue. Same user, same message, same button
They would cancel the collector if a non-modal submit interaction was received
oh great, i will try to add that. Thank you again
Tho, you should use interaction.isModalSubmit() instead to check
how do you get the button's interaction id in the filter? I only use the customId as of now
You would add it to the customId
oh
E.g. .setCustomId(`vote:${buttonInteraction.id}`)
i see, thanks
guild.invites.fetch() also includes the custom invite as well right?
TypeError: channel.children.map is not a function
make sure channel is a category type channel
ahhhh I keep swapping this channel with the v13 ones
then it should be <categorychannel>.children.cache.map(), this is assuming that is a manager like the other ones
Yes, I have already found it, and figured it out
Thanks
Hello, I want the slash to have either file or user as an input but not both, is it possible in some way ?
/image <USER> or <FILE>
2 options not required and check in your code if they are one of option, not zero, not two
https://sourceb.in/vzdmulzV5y
so i have this code here i made a system where if someone adds a bot and is not whitelisted or is not a owner then they'll get banned also banning the bot but i have a issue here when the bot and the user is banned they again join the guild they get banned with the reason of bot add why? bcuz i am checking if the logs have the entries of a bot add or not does anyone know why? is this a bug?
Audit logs are not 100% reliable, sometimes an entry doesn't even get created, so that could be causing a problem here. I also didn't really understand your issue, your explanation is a bit confusing
I think that you have to check if after the "Add bot event" he's been already banned.
hmm any example how i can do that? cause i am limiting the entry to 1 and so everytime new entries get created and the first entry executor gets lost
hmm :/
how i use the attachment type
.addAttachmentOption
I'm not using builder 🙂
type: ApplicationCommandOptipnType.Attachment
like
name: "img",
descriprion: "the image you want",
type: "ATTACHMENT",
required: false
and
let img = interaction.options.getAttachment("img");
name: "img",
description: "the image you want",
type: ApplicationCommandOptionType.Attachment,
required: false
This should be fine idk why it says .ATTACHMENT
client.application?.commands.create({
name: 'ping',
description: 'tells The ping of the bot',
options: [{
name: 'ephemeral',
required: false,
description: 'Should the message be only visible to you or no?',
type: EnumResolvers.resolveApplicationCommandOptionType('BOOLEAN'),
}]
})
help me
i already answer you, addComponents now takes array
is it possible to add buttons to a modal?
V14 release estimated time?
there isn't any. we don't work on etas, it'll release when it's ready, no estimates at all
Guys, I'm getting problem on setting commands to guild. When I use only command name and description, the command is created, but using that option, the command doesn't appear.
The SlashCommandBuilder is from discord.js package
do you encounter any error while running this code
I use this on event ready
But no error
The strange is that only one command appear, the wiki command.
The ping command, not
This is the output of commands array used here
Thumbnails are objects, not simple strings
ooh
ig i should have payed more attention
@copper jetty The command is defined after I set only name and description. For example, I clear commands and then I create the ping command with option (I also tested int option) but the command isn't showed in Discord, but If I clear commands, create the ping command only with name and description, the command is showed in Discord, and after I add options to this and set, the command is showed with the options normally. This is so strange, can u help?
onlineEmbed.setFields({name:`User ${player}`, value: `went online`})```TypeError: Found non-callable @@iterator
huh
@wintry bear 💁🏻♂️
it takes an array of objects
pain
😔
^
Error [CLIENT_REQUIRED]: No Client was provided on the showModal method options.```
Ignore the A in the middle, misclick
Tag suggestion for @honest eagle:
We do not provide any help with third party libraries like discord-buttons.
• Discord.js supports buttons natively: guide
discord.js@dev has modals builtin
@forest elm Can u help me on my strange problem?
maybe update discord
The program? Or the package?
the program
I'll install PTB version
Hi! Is it possible to use name_localizations?
yes
How?
ApplicationCommandData
Data for creating or editing an application command.
yes
It does not change anything
No
click the green Apply button
That works, thanks !
It works but only when I search for the default name of the command
I made it, but not work 😔
@copper jetty On mobile it shows all the commands, I tested here. But on PC, not. 🤣
you could ask in discord developers server
where?
theres invite link in #useful-servers
Hi! Does anyone know why I got this error?
TypeError: Found non-callable @@iterator
at ActionRowBuilder.addComponents (C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\node_modules\@discordjs\builders\dist\index.js:526:21)
at Object.execute (C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\Commands\Bot\serverspages.js:20:52)
at Object.execute (C:\Users\felal\Desktop\PRODEFIX\Discord\Bot-Slash-3.0\Events\Interaction\Command.js:72:17)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Code:
const buttonPrev = new Discord.ButtonBuilder().setStyle(1).setLabel("◀").setCustomId('prev');
const buttonNext = new Discord.ButtonBuilder().setStyle(1).setLabel("▶").setCustomId('next');
const buttonDelete = new Discord.ButtonBuilder().setStyle(4).setLabel("❌").setCustomId('delete');
const row = new Discord.ActionRowBuilder().addComponents(buttonPrev.setDisabled(true), buttonDelete, buttonNext);
pass an array of buttons in the addComponents
Ok
Is this new? Because before it was not necessary to put an Array
dev version, now all the addX and setX builder method where X can be components, choices, fields etc etc are planned to take in arrays
Ok, thank you!
@copper jetty There are a lot of people having the same issue like me.
oh i got the person wrong
Issue about creating slash command that are not being showed?
what issue?
this
I feel like it's some sort of bug now, because if i type 5 in the value of the key type, it doesn't give any type errors but if i use the enumResolvers to do the same thing it doesn't work
Yeah because Typescript allow any number to be passed to an enum
So 5 is assignable to actually any enum (which uses numbers ofc), but, just out of curiosity, why aren't you using the enum directly?
I was testing EnumResolvers actually
Oh ok lol
Is it possible to get role icon picture link in DJS?
Documentation suggestion for @green plume:
Role#iconURL()
A link to the role's icon
already available in stable version ^
Thanks
is there way I can get list of all invite the server has?
I tired to find but don't found one
Guild#invites
A manager of the invites of this guild
Documentation suggestion for @ivory tartan:
GuildInviteManager#fetch()
Fetches invite(s) from Discord.
Thanks
How do I make that code doesn't crash on an error
handle errors with try catch block or catch() for promises rejection
How exactly, can you be more clear I am not getting you
this is more like basic js
try...catch
The try...catch statement marks a try block and a catch block. If the code in the try block throws an exception then the code in the catch block will be executed.
Promise.prototype.catch()
The catch() method returns a Promise and deals with rejected cases only. It behaves the same as calling Promise.prototype.then(undefined, onRejected) (in fact, calling obj.catch(onRejected) internally calls obj.then(undefined, onRejected)). This means that you have to provide an onRejected function even if you want to fall back to an undefined result value - for example obj.catch(() => {}).
how can i use attachment(slash)
.addAttachmentOption
const verificationRow = new ActionRowBuilder()
.addComponents([
new ButtonBuilder()
.setCustomId(`adAccept-${guild.id}`)
.setLabel('Zaakceptuj')
.setStyle(EnumResolvers.resolveButtonStyle('SUCCESS'))
.setEmoji({ name: '✅' }), new ButtonComponent(),
new ButtonBuilder()
.setCustomId(`adDeny-${guild.id}`)
.setLabel('Odrzuć')
.setStyle(EnumResolvers.resolveButtonStyle('DANGER'))
.setEmoji({ name: '❌' }),
]);
(02.05.2022 14:07:45) [ERROR]: DiscordAPIError[50035]: DiscordAPIError[50035]: Invalid Form Body
components[0].components[1][LIST_ITEM_VALUE_REQUIRED]: List item values of ModelType are required
can sb help me?
You are creating:
[0] new ButtonBuilder
[1] new ButtonComponent (Here is your error)
[2] new ButtonBuilder
@scarlet tangle
omg..
okay, I understand
Modals does not close when I fill out the form and press submit, how can I close it?
(https://deploy-preview-1060--discordjs-guide.netlify.app/interactions/modals.html I just tried the ones in this resource)
u must reply to it (this isn`t showed in guide)
okay what's the error, how do you fix it?
wait how come the builder doesn't error for being empty
so how can i do that? sorry for the tag
@scarlet tangle what version of the builders are you using?
new ButtonBuilder().toJSON()
// Uncaught RangeError: Buttons must have a label and/or an emoji
```you should be getting this error and not an api error
discordjs/builders?
yes
^0.13.0
<interaction>.reply(...)
He isnt using the builders for the [1] he is using the ButtonComponent
makes sense
I couldn't, I think I'll give up for now.
(intermediate value).setColor(...).from is not a function
remove .from()
show me how you defined the builder
note that it should be imported from discord.js
const {EmbedBuilder} = require("discord.js")
```then from is a function
Yes
I've already corrected and figured it out
const { EmbedBuilder } = require('discord.js');
const embed = new EmbedBuilder({ title: 'test' }).setColor(this.client.color);
await interaction.reply({ embeds: [ embed ] });
TypeError: Found non-callable @@iterator
new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('open')
.setLabel('Open')
.setStyle(ButtonStyle.Secondary),
);
array
Pass an array of button builders to addComponents
Now the addX and setX methods where X would be components, options etc take in arrays exclusively
Does anyone know how "stable" and close to release v14 currently is? I am about to start building a new bot and wondering if I should just build it on v14 or v13 and migrate
its pretty stable
cheers, ill just build on that then migrate to stable once official release
DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[1][COMPONENT_LAYOUT_WIDTH_EXCEEDED]: The specified component exceeds the maximum width
yes
how do i get the user from context command interaction?
the first row has at least 2 entries according to that error
ContextMenuCommandInteraction#user
The user which sent this interaction
wait, you mean the target? then not that one
yes, the target
yes
UserContextMenuCommandInteraction#targetUser
The user this interaction was sent from
Are there any D.JS docs for v14?
yes, already showed you
those docs are for v13 tho
change "stable" to "main"
how to fix?
Hi guys, is there an example on how to listen for messages in voice channels with the latest dev release?
Many thanks.
Value is on options
my values
ok
change the value of genel in the the third to smth else
👍🏽
Ah I see it now, as long as the channel has a message manager the isTextBased() method will return true, so I assume voice channel messages will be handled by the existing message events?
When I click the Submit button in the modal window, I get this error, no errors in the console
because you aren't responding
why is my message content empty?
how to fix it?
cus u dont have the intent
i do
u dint
yes i do
u dont ..
Did you add it in the code?
const bot = new Client({ partials: [Partials.Message, Partials.Channel, Partials.Reaction, Partials.User, Partials.GuildMember, Partials.GuildScheduledEvent], repliedUser: true, intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildBans, GatewayIntentBits.GuildEmojisAndStickers, GatewayIntentBits.GuildIntegrations, GatewayIntentBits.GuildWebhooks, GatewayIntentBits.GuildInvites, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildPresences, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.GuildMessageTyping, GatewayIntentBits.DirectMessages, GatewayIntentBits.DirectMessageReactions, GatewayIntentBits.DirectMessageTyping] });```
modals are added to discord.js or no?
yes
where i don't see it in the docs @silk delta
RangeError: Invalid time value
timestamp: new Date(),
Very clear
new Date().toISOString()
indeed, look at your embedbuilder.setDescription
leaderboard.ts line 50
Yeah but I have this forEach method where i'm fetching users, but when I remove the fetch method I don't get the error
key is a string containing the id the user
forEach with async callbacks probably doesn't work as you expect it to
ah ?
it doesn't wait for the forEach to be completely finished and jumps to the next lines
you may want to use await Promise.all(<array>.map(...))
for loop
and in this map you can use an async callback
yea that works, whatever you want
depends on what you want really, do you want them to be ran at the same time or one after another
I want them to be ran one after another
this is more of a js question than discord.js at this point
Actually my problem is fetching users one after another and store it in an array
Promise the <array>.map() doesn't fix the problem
show the updated code
why is that a promise
that's not even the same code...? you don't have an async callback on the map
why is that a promise
this doesn't changed
but that's the problem
again, forEach doesnt work async, use a for...of loop or similar
Yes but Ben talked about the .map()
I want a modal that pops up in the middle of a multi-step process.
showModal() has to be the first interaction response afaik. You can't deferReply() and use the modal further down the line. I guess one solution is to create a modal from a button click but that results in a 2nd message so I'll have to deleteReply() the first message.
Can anyone think of a better flow?
then go with what almeida said
ben wasn't talking about that map, you didn't even show that code before
There was no other .map() in the code that I showed initially
you were meant to replace the forEach with what ben sent
Oh I see
I switched for a for loop, thanks
Got this error when trying to show a modal
an empty modal? with no components?
Ah
ModalBuilder
Represents a modal builder.
How I can receive submissions from modals ?
interactionCreate you'd receive a ModalSubmitInteraction
MessageComponentInteraction#awaitModalSubmit()
Collects a single modal submit interaction that passes the filter. The Promise will reject if the time expires.
you can use this
How can i send Attachment in v14 there isn't MesageAttachment() function
currently there is Attachment
Okay thanks
You can use a InteractionCollector if you want
await interaction.showModal(modal);
const reply: Message | APIMessage = await interaction.fetchReply();
const collector: InteractionCollector<ModalSubmitInteraction> = new InteractionCollector<ModalSubmitInteraction>(yourDiscordClient, {
channel: interaction.channelId,
message: reply
});
collector.once('collect', async (modalInteraction: ModalSubmitInteraction): Promise<void> => {
//TODO: Treatment
collector.stop();
});
Module '"discord.js"' has no exported member 'Intents'.
verison hash: ^14.0.0-dev.1651493371-4ba0f56
see pinned message for v14 upgrading guide
How do I make modals in djs v14?
see pins
okay
I want to make an emoji button for an interaction in v14, do I need to setStyle to ButtonStyle.Emoji or something similar first?
using the new ButtonBuilder, I can't seem to locate the source for ButtonStyle either, it's just an endless chain of imports
👍
Is there anything new in 14 to really benefit the switch ?
most notable thing must be api v10 and various other things
there's also that fix that is going to crash bots if MessageComponentInteractions are used inside voice chat channels that 13.7 is going to fix, whenever it releases
Is v14 out
?
no
What about the guide edleast ?
I get Expected the value to be a string or number when trying to use a slash command. I got a required string option with choices and am collecting it with const action = interaction.options.getString("action");. Am I missing something?
How do I get an attachment to slash commands?
is it interaction.options.getAttachment('the name')
Cant finish a guide if the version isnt released
Would need to see more of your code
Command includes these string options (the only option): js .addStringOption(option => option.setName("action").setDescription("What would you like to do?").setRequired(true).addChoices( { name: "create", value: "create" }, { name: "delete", value: "delete" }, { name: "edit", value: "edit" }, { name: "show", value: "show" }, { name: "list", value: "list" }, { name: "import", value: "import" }, { name: "export", value: "export" }, { name: "guide", value: "guide" }, { name: "raw", value: "raw" } ));
console.log("1");
const action = interaction.options.getString("action");
console.log("2");
if (action === "edit") {
console.log("3");
const modal = new ModalBuilder().setCustomId("embedEdit").setTitle("Embed Manager - Editor");
const embedNameInput = new TextInputBuilder().setCustomId("embedName").setLabel("Embed's Name").setStyle(TextInputStyle.Short).setRequired(true);
const editOptionInput = new TextInputBuilder().setCustomId("embedOption").setLabel("Modification").setStyle(TextInputStyle.Short).setRequired(true);
const editValueInput = new TextInputBuilder().setCustomId("optionValue").setLabel("Value").setStyle(TextInputStyle.Long).setRequired(true);
const embedNameRow = new ActionRowBuilder().addComponents([embedNameInput]);
const editOptionRow = new ActionRowBuilder().addComponents([editOptionInput]);
const editValueRow = new ActionRowBuilder().addComponents([editValueInput]);
modal.addComponents([embedNameRow, editOptionRow, editValueRow]);
await interaction.showModal(modal);```
It logs 1, 2 and 3 but it also only errors out when using the edit choice. Everything else works fine
huh, and the full error stack?
^
ValidationError: Expected the value to be a string or number
at NativeEnumValidator.handle (D:\PlanetLily\node_modules\@sapphire\shapeshift\dist\index.js:1595:25)
at NativeEnumValidator.parse (D:\PlanetLily\node_modules\@sapphire\shapeshift\dist\index.js:110:88)
at validateRequiredParameters (D:\PlanetLily\node_modules\@discordjs\builders\dist\index.js:630:27)
at TextInputBuilder.toJSON (D:\PlanetLily\node_modules\@discordjs\builders\dist\index.js:706:5)
at D:\PlanetLily\node_modules\@discordjs\builders\dist\index.js:536:64
at Array.map (<anonymous>)
at ActionRowBuilder.toJSON (D:\PlanetLily\node_modules\@discordjs\builders\dist\index.js:536:35)
at D:\PlanetLily\node_modules\@discordjs\builders\dist\index.js:739:64
at Array.map (<anonymous>)
at ModalBuilder.toJSON (D:\PlanetLily\node_modules\@discordjs\builders\dist\index.js:739:35) {
validator: 's.nativeEnum(T)',
given: undefined
}```
button.message.delete() appears to fail in DMs
Are you trying to delete an ephemeral message?
hi in V14 how can I define slashCommandBuilder if we shouldnt use Builders
- const { SlashCommandBuilder } = require('@discordjs/builders');
+ const { SlashCommandBuilder } = require('discord.js');
??
who said we shouldn't use Builders?
the guide specifically has you uninstall builders (pins)
I mean they say its highly recommended that you uninstall the package
what, where
i'm missing context
i've found you can use ApplicationCommandsManager to handle commands instead, but it does take notably longer (completion-wise) to do that
yeah because v14 uses builders internally so you should use the version the version uses
so define slashCommandBuilder from djs?
yes djs reexports the same builders with added functionality
if you do use djs you can just import from that
i can't find the SlashCommandBuilder from DJS@dev actually
require it or import it?
can I do this?
const Discord = require('discord.js');
module.exports = {
data: new Discord.SlashCommandBuilder()
depends on if you're using CJS or EJS imports -- in your case use require
they're literally referring to the same thing
okay tnx
let lastStickyMessage = await message.channel.messages.fetch({ around: stickyData.Channel16, limit: 1 }).then(m => m.first());
stickyData.Channel16 is the ID
Im confused a bit can I Use this or need to change it
oh addChoice removed?
yes I saw addFields and addOptions but didnt saw this
.addChoice has been removed in the latest stable builders version aswell
okay tnx
and what about this?
you can use it
okay tnx <3
I use addChoices too :/
check
just use addChoice
^
addChoice has been removed :/
I use addChoice at first !
@dim moss I also gave an example
read it
oh I didnt saw it srry
name and value are string?
well as far asI remember they are string options but now:
.addChoices({ name: 'Warn', value: 'Warn' }, { name: 'DM', value: 'DM' })
Util.resolveColor('Random')
const Util = require('discord.js')
role.edit({ color: Util.resolveColor('Random') })
?
why channel.messages.fetch({ id: '970989158074040320' }) gives me a Collection of a lot of messages? and channel.messages.fetch('970989158074040320') gives me the right Message object
destructure it
wdym?
const { Util }
where did you get the "id" prop from?
providing an object probably turns it into a multifetch with default 50 limit (unless a "message" key is provided)
there's no id option
you mean message: 'id'?
but in the guide there is
it will be Random
so dont need to Util?
and also IntelliSense
The guide is wrong, you should be passing message, not id
.addChannelOption(option => option.setName('channel').setDescription('Select a channel to setup 🗽').addChannelTypes([ChannelType.GuildText, ChannelType.GuildNews])),
the problem is from addChannelTypes but what is the correct way?
addChannelTypes expects rest param iirc
the code was fine in v13
you should have expected what will happen when you choose to use an unstable dev ver over a stable one
well what should I do now 
also the ready event will run but there is no activity
await client.user.setPresence({ activities: [{ name: 'Starting...', type: 'WATCHING' }], status: 'idle' })
use the ActivityType enum
MessageManager#fetch(id) still works so it is really necessary to use the message option?
No
ok thanks
so type: 'Watching'
or
type: Discord.EnumResolvers.ActivityType('WATCHING');
The point of that change is that the second parameter has been removed. If you want to specify cache or force, you will need to supply an object in the first parameter and your message to fetch should be supplied with message
Discord.ActivityType.Watching
oh ok
I see thanks
it looks like the TextChannel#send() changes
It's also how the guild ban manager fetches bans exactly, so it's a consistent feel <:
2 different err what are the problems?
First one states your style is wrong. Second states you added fields improperly
second one:
.addFields(
{ name: `📡 Ping:`, value: `:Reply: ${client.ws.ping}ms`, inline: true },
{ name: `💾 Memory:`, value: `:Reply: ${Math.round((process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2))}/512MB`, inline: true },
{ name: `⏳ Uptime:`, value: `:Reply: <t:${Math.round(client.readyTimestamp / 1000)}:f> | <t:${Math.round(client.readyTimestamp / 1000)}:R>`, inline: false },
)
whats the problem?
and also what do you mean by style?
yep
and what for the err from guildMemberAdd?
guildMemberAdd.js line 12
show it
how do I get a attachment using slash cmds?
interaction.options.getAttachment('optionName')
thanks
if (message.channel.type === 'DM' || message.guild.id !== '553528389898862594') return;
how guild is null :/
Message#guild is a getter from cache using Message#guildId
okay tnx <3
and channel types use numbers/enums instead of strings
what numbers should I use?
what about here?
so use guildId instead of guild.id everywhere?
if you only want the id yes, no need to invoke the getter
tnx
same goes for Message#channel(Id)
you can also you use channel.isDMBased()
or remove the first check and only use the guild id
hmmm tnx
and what should I do for here?
how should I set emoji for buttons?
are you sure you are on the latest version of dev? that should work afaik
am I ?
oh, Util.parseEmoji doesn't work for only ids. pass { id: '' }
setEmoji({ id: 'ID HERE' })
?
but for default emojis setEmoji('😂') is enough am I right?
{ name: "🤣" }
this same
{ label: 'Landing Zone', value: 'Landing_Zone', emoji: "🥂" },
to
{ label: 'Landing Zone', value: 'Landing_Zone', emoji: { name: "🥂" } },
//or
{ label: 'Landing Zone', value: 'Landing_Zone', emoji: { id: "id here" } },
???
for the unicode emoji, just put name: "emoji", for the custom ones id: "1234567123891"
so this is correct
is correct the first one
What is the equivalent of dynamic: true, in D.js v14 ?
In v14 the options disapeared
it's dynamic by default
oh ok
is enabled by default, to make it static just put: forceStatic: true
Hey, just wanted to confirm that the following Typescript error is coming from the DJS types and not from my code
Type 'ActionRowBuilder<AnyComponentBuilder>' is not assignable to type 'APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>'.
Property 'type' is missing in type 'ActionRowBuilder<AnyComponentBuilder>' but required in type 'ActionRowData<MessageActionRowComponentBuilder | MessageActionRowComponentData>'.
When adding ts-ignore to the line, it works perfectly so I guess that's just one of the reason this build is still not stable 😅
ValidationError: Expected a string primitive
at StringValidator.handle (/home/massi/Schreibtisch/Projects/maid/public/node_modules/@sapphire/shapeshift/dist/index.js:1368:70)
at StringValidator.parse (/home/massi/Schreibtisch/Projects/maid/public/node_modules/@sapphire/shapeshift/dist/index.js:110:88)
at validateDescription (/home/massi/Schreibtisch/Projects/maid/public/node_modules/discord.js/node_modules/@discordjs/builders/dist/index.js:899:25)
at validateRequiredParameters (/home/massi/Schreibtisch/Projects/maid/public/node_modules/discord.js/node_modules/@discordjs/builders/dist/index.js:913:3)
at MixedClass.toJSON (/home/massi/Schreibtisch/Projects/maid/public/node_modules/discord.js/node_modules/@discordjs/builders/dist/index.js:1411:5)
at Object.run (/home/massi/Schreibtisch/Projects/maid/public/commands/global/setup/step2.js:29:44)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
validator: 's.string',
given: undefined
}
and thats the code:
const moderation_files = fs.readdirSync('./commands/moderation').filter(file => file.endsWith('.js'));
const tickets_files = fs.readdirSync('./commands/tickets').filter(file => file.endsWith('.js'));
const extensions_files = fs.readdirSync('./commands/extensions').filter(file => file.endsWith('.js'));
for (const file of extensions_files) {
const command = await require(`../../extensions/${file}`);
commands.push(command.data.toJSON());
}
if (extensions.includes(locale.extensions.moderation)) {
for (const file of moderation_files) {
const command = await require(`../../moderation/${file}`);
Line 29 » commands.push(command.data.toJSON());
}
}
what could be the problem? 
one of your cmd doesnt have a description
you must specify the type of what's inside that action row
for example ActionRowBuilder<ButtonBuilder>
hmmm
ty
is it normal that sequelize only creates one table?
code:
const sequelize = new Sequelize(config.database.database, config.database.username, config.database.password, {
host: config.database.hostname,
dialect: 'mysql',
logging: true,
});
const db_servers = sequelize.define('servers', {
id: {
type: Sequelize.STRING,
unique: true,
primaryKey: true,
},
enabled: Sequelize.BOOLEAN,
extensions: Sequelize.STRING,
});
const db_extensions = sequelize.define('extensions', {
name: {
type: Sequelize.STRING,
unique: true,
primaryKey: true,
},
guild: Sequelize.STRING,
enabled: Sequelize.BOOLEAN,
setup: Sequelize.BOOLEAN,
settings: Sequelize.STRING,
});
const db_users = sequelize.define('users', {
id: {
type: Sequelize.STRING,
primaryKey: true,
unique: true,
},
guild: Sequelize.STRING,
warns: Sequelize.NUMBER,
});
log:
[nodemon] starting `node index.js`
(node:151511) [SEQUELIZE0002] DeprecationWarning: The logging-option should be either a function or false. Default: console.log
(Use `node --trace-deprecation ...` to show where the warning was created)
Der Bot wurde gestartet!
Executing (default): CREATE TABLE IF NOT EXISTS `servers` (`id` VARCHAR(255) UNIQUE , `enabled` TINYINT(1), `extensions` VARCHAR(255), `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;
Executing (default): SHOW INDEX FROM `servers`
Anyone?
im looking at your code
the problem is from .addChannelTypes([ChannelType.GuildText, ChannelType.GuildNews])
what is this err for
try it like that:
.addChannelOption(option => option.setName('channel').setDescription('Select a channel to setup :statue_of_liberty:').addChannelTypes(ChannelType.GuildText, ChannelType.GuildNews))
aint djs related
maybe ask in #useful-servers
Ill try logging the embed but IDK why its not working.
you need an EmbedBuilder
I already did that
what do I need to do?
Documentation suggestion for @opal cloak:
(static) EmbedBuilder.from()
Creates a new embed builder from JSON data
??
you can't call setColor on Embed
i mean any examples how do I do that thing?
EmbedBuilder.from(<Embed>.data) and then you can call setColor() on it
<Embed> is the name of the embed right?
yes
how can i cheak bot member count while using eval command
Getting your bot's member count
• client.users.cache.size is unreliable because it will only return cached users
• The preferred method is using collection.reduce() on client.guilds.cache
client.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0)
const client = require("../index");
const { EmbedBuilder, CommandInteraction } = require('discord.js');
const { Suggestion } = require('../SlashCommands/Utils/suggest');
/**
* @param {CommandInteraction} interaction
*/
client.on("interactionCreate", async (interaction) => {
if (interaction.isButton()) {
const embed = interaction.message.embeds[0];
interaction.deferUpdate();
switch (interaction.customId) {
case 'suggest-accept' : {
embed.fields[1] = { name: 'Status', value: 'Accepted' }
interaction.message.edit({ embeds: [embed] })
}
break;
}
}
})``` BTW I using this code is this code working in v14??
you should convert embed to EmbedBuilder and use spliceFields(1, 1, { name: "Status", value: "Accepted" }) method on it
and you should make your folders names camelCase
??
EmbedBuilder.from(embed.data) do that
okay
EmbedBuilder.from(embed.fields[1] = { name: 'Status', value: 'Accepted'})
replace fields[1] = { name: 'Status', value: 'Accepted'} with data
wdym?
EmbedBuilder.from(embed.data)
EmbedBuilder.from(embed.data.fields) i think because I try to log the embed and this happend
const messageEmbed = interaction.message.embeds[0]
const embed = new EmbedBuilder(messageEmbed.toJSON())
embed.fields[1] = { name: 'Status', value: 'Accepted' }
interaction.message.edit({ embeds: [embed] })
you need to use spliceFields because EmbedBuilder don't have fields property
help
https://discord.js.org/#/docs/discord.js/stable/class/Permissions?scrollTo=s-FLAGS
what you have selected as a permission isn't a valid entry in the bitfield
my spelling is not wrong
can you provide the code that's causing the issue?
if (!interaction.member.permissions.has('ADMINISTRATOR')) return interaction.reply({ content: 'ONLY ADMINISTRATOR CAN CLICK THIS BUTTON!', ephemeral: true })``` and also this is a v14 not v13
try Permissions.FLAGS.ADMINISTRATOR instead of 'ADMINISTRATOR'?
all SCREAMING_SNAKE_CASE stuff has been changed to PascalCase
Administrator in your case
Ohh yeah I remember it im dumb lol
tbh that change threw me for a while as well, it seems fairly arbitrary imo
.addFields() does the same thing thats why
they changed it addField was taking an object too in dev version
guyss, how can I register a context menu command using djs v14?
you can do .addFields([{ name, value }]) it does the same
module.exports = {
name: 'interactionCreate',
async execute(interaction) {
if (!interaction.isChatInputCommand()) return;
const command = await interaction.client.commands.get(interaction.commandName);
await interaction.deferReply();
console.log(command);
command is undefined somehow
interaction.client.commands doesn't have that
wasn't it working with previous versions?
no, client.commands was never a thing, so you'd have to have added that yourself
weird, it was working in all m previous works
anyways whats the fix can you guide please
no? how would i know what client.commands is
i am checking if the evoked command is still registered to the client
the same as they had did in djs-v12 guide been following same format since then
i think your looking for <Client>.application.commands
no?
what's the Enum for PresenceStatus?
idk
hey im making a modal however the button wont be disabled when i show it, anyone know why? (this isnt the full code btw, only showing the collector bits)
const { SlashCommandBuilder } = require('@discordjs/builders');
const { CommandInteraction, MessageActionRow, MessageButton } = require('discord.js');
const { showModal, TextInputComponent, Modal } = require('discord-modals');
const collector = interaction.channel.createMessageComponentCollector({
componentType: 'BUTTON',
time: 60000,
});
collector.on('collect', async (i) => {
if (i.customId === 'yes-button') {
if (i.user.id === interaction.user.id) {
i.update({ components: [row2] })
showModal(modal, {
client: i.client,
interaction: i
});
} else {
i.reply('This isn\'t your button.')
}
} else if (i.customId === 'no-button') {
if (i.user.id === interaction.user.id) {
i.update({ components: [row2] })
} else {
i.reply('This isn\'t your button.')
}
}
});
collector.on('end', async () => {
await interaction.editReply({ components: [row2] })
});
Tag suggestion for @mental inlet:
We do not provide any help with third party libraries like discord-buttons.
• Discord.js supports buttons natively: guide
is there no Enum for PresenceData in v14?
@rain bramble ah alright, might switch to v14 anyways
componentType: ComponentType.Button
you mean here?
probably
okay so let me check
const command = await interaction.client.application.commands.cache.get(interaction.commandName);```
still command is undefined
the application command cache is not populated on ready, you'd need to manually fetch it and it would be cached by (command)id, not name
thanks
is there any PresenceStatus Enum in discord.js v14?
i can only find it in v10 api-types package
what did you meant by manually fetch? commands.cache.fetch(interaction.commandId)?
remove cache
if it's not being re-exported it's probably an oversight
now it says TypeError: command.execute is not a function (:
an application command is the discord structure of the command, it won't have such a method
should i create an issue on github?
same! that's what im trying to find
sure
okay
for now you can get it from api-types package
tysm
👍
const { PresenceUpdateStatus } = require('discord-api-types/v10');
ah thank you
use the /v10
kk
I Host my bot on RailWay how can I use this to see where is the warn?
member.guildId return String or Number?
my friend join to my server and bot only log first one
string, id`s are always string
so whats the problem
guildMemberAdd
if (member.guildId !== '553528389898862594' || member.user.bot) return;
guildMemberUpdate
if (oldMember.guildId !== '553528389898862594') return
in both it will return :(
you returned on that specific guildId which presumably is your target guild
no that was wrong code I just change it for a second
this is my code ^
OH its an array now
yes
ty
yw
I just need an interactionCreate event handler (: it's getting complicated
Message, not GuildMember
just message? what about interaction?
Interaction#guildId
The id of the guild this interaction was sent in
ok tnx <3
Is it possible to unregister slash command?
yes, you can delete
Can you tell me the method?
Documentation suggestion for @green plume:
ApplicationCommandManager#delete()
Deletes an application command.
CommandInteraction#commandId
The invoked application command's id
interaction.commandId
Can I get the command ID using command name?
fetch application commands and find command with this name
Okay
anyone know why the button wont be disabled before showing the modal?
Hi This is possible to handle Missing Permissions error from interaction.member.roles.add('xxxxxxxxxxxx') in try catch?
do().catch()
// or
try {
await do()
} catch (e) {
}```
what is this err for?
It's a warning - not an error
i knew that but when Missing Permissions error occurred in try catch entire app crashes
await
ah okay
You should probably check the permissions before adding it
I want to prevent this error in case the moderator puts the role in the wrong order. I don't want the entire application to crash
Okay now it's works fine thanks
:)
what are the requirements for djs v14?
node newer than 16.9.0
and nothing else
well what should I do for that? 👀
Error: Invalid string length?
context?
const split = interaction.customId.split("-");
const setting = bot.configTemplate[split[1]].find(obj => obj.value == split[2]);
const modal = new ModalBuilder()
.setTitle(`Change ${setting.name}`)
.setCustomId(interaction.customId)
const newValue = new TextInputBuilder()
.setCustomId(`${interaction.customId}-newValue`)
if(setting.type === "hex") {
newValue.setLabel("What would you like the new theme color to be? Please provide a valid hex color.")
newValue.setStyle(TextInputStyle.Short)
}
const modalRow = new ActionRowBuilder().addComponents([newValue])
modal.addComponents([modalRow]);
await interaction.showModal(modal);
and where is it throwing the error?
at await interaction.showModal(modal);
your title is too long, it can be at max 45 characters. see https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal
alr ty
i'm having an issue i found was exclusive to v14 yesterday, where I need to have the manage messages permission on a bot for it to delete its own reply to a ChatInputCommand
Anyone know how to import variable from another file in TypeScript?
export const X = 'Y' not working for me in this situation
I want import this variable to another file:
Slash Command responses are webhooks, I assume you're trying to use message.delete() which would require the permission rather than interaction.deleteReply() which should not, since it uses the webhook delete method
could i use interaction.update({}) instead? i remember something about empty edits deleting messages
and yes that's what i was trying to do
I doubt that it does but why would you do that instead of just... using delete?
there isn't a good reason other than i didn't read the docs carefully enough and notice the method differences, will do so for future
np
ApplicationCommandPermissionsManager#set()
Sets the permissions for one or more commands.
Is this method working as spected?
I'm using this:
await deployedSlashCommand.permissions.set({ permissions: botOwnersPermissions });
And I get:
DiscordAPIError[20001]: Bots cannot use this endpoint
I can share all the code if someone ask for it
hi, can i know reason and duration when someone give sb timeout, any event or smth?
Oh, ty
Documentation suggestion for @rancid dagger:
(event) Client#guildMemberUpdate
Emitted whenever a guild member changes - i.e. new role, removed role, nickname.
thanks
ok, I can see if someone have communicationDisabledUntil, but can i have reason of timeout?
Check audit logs
Guild#fetchAuditLogs()
Fetches audit logs for this guild.
^this, there's unfortunately not a better way to get a notification of it with the reason
anyway to make modal fields not required/optional?
.setRequired(false)?
that exists? e
yea it worked, just forgot it existed
do u know how to use a docs?
how can i get types, im too dumb for d.js docs XD
Something like this?
const { ChannelType } = require('discord.js');
if (interaction.channel.type == ChannelType.DM) {
//some code
}
https://discord.js.org/#/docs/discord.js/stable/search?query=typedefs
What does this mean after 14.0.0-dev?
maybe snapshot
yea, thank you
the part after the - is the commit on GitHub
The first part idk lol
Oh
Thanks anyways
I guess this number is a timestamp
But running it though new Date() gets a weird time
this numbers returns as timestmap
this is correct? sorry for ping
specify the type of components inside your ActionRowBuilder
example ActionRowBuilder<SelectMenuBuilder>
jesus christ that's something
how do i show a modal on an interaction already sent?
showModal just says interaction already replied to
you cant
yeah i know
i had to make a fucking button interaction lmao
how do i close the modal?
i'm trying to close the modal and edit the initial message
You dont close modals, the user does
sorry, let me rephrase my question - on submit it doesn't close
i think it's because of the awaitModalSubmit
i can see in the background it does what i want but it says the modal errors
Does it show an error like it wasnt received?
yep
Are you taking more than 15 seconds to submit it?
Otherwise I think it should be interaction.update to respond to the modal with an edit
on submit, it says this message has not been sent or deferred
Yeah try changing editReply to update
Property 'update' does not exist on type 'ModalSubmitInteraction<CacheType>'.ts(2339)
it... should
lemme look into that, seems like a bug
👍 thank you monbrey
uhh I think theres a typeguard
i lied, it doesnt work as expected
i'm wanting to edit the original interaction
deferring and editing sends a new interaction
interaction.isFromMessage() should typeguard it to allow for update()
I wrote the v13 version which has less strict types so I forgot about the typeguards
help?
.addFields
.addField() is deleted??
yep
noooooooo
message is defined and also is evel command working in slash cmds?
Why I am getting undefined?
There is no bulkDelete method on message
Only on guild channel
And also this
Well yes, it doesnt take an object
It takes 2 params, one being the messages or count and one being the boolean
message.channel.bulkDelete({ messages: 100, filterOld: true }) ??
Read my message again
What is "Guild_messages” name at dev
intent name*
GuildMessages
SCREAMING_SNAKE_CASE => PascalCase
in v14 does this not work anymore?
const attachment = new Attachment('path/to/image/file', 'image.png');
const embed = new EmbedBuilder()
.setImage('attachment://image.png')
return interaction.channel.send({ embeds: [embed], files: [attachment] });
why would it not work?
im not getting the image in my embed
Are you getting any errors?
Can't see why it wouldn't work
btw, can we do the same for the iconURL paramerter in setAuthor()?
okay thanks
Attachment {
attachment: 'C:\\Users\\ABHISHEK\\Desktop\\R6M\\assets\\emojis\\voice_joined.png',
name: 'voice_joined.png'
}
console logged my attachment and I dont think the path is wrong
My code
const voiceJoinAttachment = new Attachment(path.join(__dirname, '..', '..', 'assets', 'emojis', 'voice_joined.png'), 'voice_joined.png');
console.log(voiceJoinAttachment)
const joinVoiceEmbed = new EmbedBuilder()
.setAuthor({ name: 'Joined Voice Channel', iconURL: 'attachment://voice_joined.png' })
.setImage('attachment://voice_joined.png')
.setColor('Green')
.addFields([
{ name: 'Player', value: `${newState.member.displayName}`, inline: true },
{ name: 'Status', value: ':green_circle: Joined', inline: true },
{ name: 'Channel', value: `${newState.channel.name}`, inline: true }
])
.setFooter({ text: newState.guild.name, iconURL: newState.guild.iconURL() })
.setTimestamp();
newState.member.send({ embeds: [joinVoiceEmbed], files: [voiceJoinAttachment] });
It works for me, and it threw an error when the path was wrong
¯_(ツ)_/¯
:/
what is this err for?
why client.application.owner returns null?
Show the interactionCreate.js file 138 line
client.application.fetch() then do it again.
It will get cached after fetching or do I need to fetch it everytime ?
Hello!
How can I send an ephemeral message when using modals?
The ephemeral: true doesnt work
Can anyone help me?
ticketName and topic return a string