#djs-in-dev-version

1 messages · Page 25 of 1

hoary fox
#

okey

scarlet tangle
#

Why content property is empty in messageDelete event?My bot is unverified btw.

mint latch
#

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

urban belfry
#

why do you create a new ButtonComponent?

#

you can just pass the ButtonBuilder on addComponents

mint latch
#

oh alr

#

is that the problem

copper jetty
#

yes

mint latch
#

alr thanks

scarlet tangle
urban belfry
copper jetty
#

i think if the message isnt cached it shouldnt fire the messageDelete event

scarlet tangle
#

is there a way to know if the User dms are open or closed?

jaunty vault
scarlet tangle
scarlet tangle
pallid ice
#

if it was cache or intent related then content would be null

copper jetty
#

its empty string if you dont have message content intent

tame gazelle
pallid ice
scarlet tangle
copper jetty
#

it doesn't look like discord.js to me

narrow lagoon
#

i choose current for node 16.9?

pallid ice
#

LTS is fine

proven wolf
narrow lagoon
#

okey starting my journey with v14 today

proven wolf
#

But all bots need intents

narrow lagoon
#

will i have to unistall earlier version of node i had?

#

or it auto remove older version

lunar robin
#

@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

narrow lagoon
#

i use windows

lunar robin
#

yeah then just use the binary on the website

#

i dont think its necessary to uninstall old node

narrow lagoon
#
const client = new Client({ intents: 32767 });```
does that still work?
copper jetty
#

yes

narrow lagoon
#

thanks

stuck fiber
#

is there a method to check if an interaction is chatinput or user/msg contextmenu only? ( application command )

plain roverBOT
stuck fiber
#

literal poggers

#

thanks

zenith terrace
#

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

copper jetty
#

no

plain roverBOT
stuck fiber
#

ty, but i needed chatinput | ctxmenumsg | ctxmenuuser

velvet jasper
#

Oh you wanted both ok

vague coyote
#

thats why I linked isCommand() kekw

tame gazelle
#

@slender hull

copper jetty
tame gazelle
grim hawk
#

do command translation gonna be in the v14 ?

copper jetty
#

Yes

grim hawk
#

nice

#

The v will be released when ? (if there is a date)

copper jetty
#

no date

grim hawk
#

ty

cyan jewel
#

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.

dawn phoenix
#

sure, you can't deploy "traditional" slash perms for users and roles anymore, that's it

cyan jewel
#

OK great, that's what I figured. Then I can just remove perm updating from my framework for now.

dawn phoenix
#

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

cyan jewel
#

Oh! I already use raw payloads in my framework. I guess I can use the new default perms then.

dawn phoenix
#

sure, those are bitfields for required perms
side note: the UI is very broken and displays allow on everyone, regardless

cyan jewel
#

I saw those mentioned in #769862166131245066 but wasn't sure if that was a raw thing or a d.js thing.

cyan jewel
#

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.

opal cloak
#

help please

copper jetty
opal cloak
#

do you need my code?

copper jetty
#

Undefined doesnt mean not defined, undefined means its defined but it has no value

scarlet tangle
scarlet tangle
dusky agate
#

why it says the option is invalid?

onyx cove
opal cloak
#

ApplicationCommandOptionType.SubCommand I got an error using that

tame gazelle
#

better to send the error instead of having that you have one

scarlet tangle
opal cloak
vocal wadi
#

Does .addField have any changes

#

It is showing an error for me

small mica
#

Yeah it takes arrays now, also .addFields()

slow storm
winged hull
#

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?

unreal blaze
#

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

nocturne kayak
#

your discord client didnt cache that user
nothing to do with djs

winged hull
unreal blaze
dawn phoenix
#

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))

flat tulip
#

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

mint latch
#

did the GUILDS intent change for v14?

tame gazelle
#

Guilds

mint latch
#

is it not all caps anymore

nocturne kayak
#

SCREAMING_SNAKE_CASE => PascalCase

fierce hatch
#

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

silk topaz
fierce hatch
#

yea

silk topaz
#

still those are not valid, you should use the enums provided by the library

fierce hatch
#

when i did Intents.FLAGS.GUILDS it raised TypeError: Cannot read properties of undefined (reading 'FLAGS')

fierce hatch
#

i see, let me try

tame gazelle
tame gazelle
#

new Client({ intents: ['Guilds', 'GuildMessages', 'MessageContent' })

fierce hatch
#

let me try that too then

silk topaz
#

that looks so weird when you are used to all caps

tame gazelle
#
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?

nocturne kayak
#

empty string description, it seems

tame gazelle
#

yeah that was it

mint latch
#

what does this mean

tame gazelle
#

import it from discord.js

mint latch
tame gazelle
#

ah I thought it was a context menu command

mint latch
#

ah alright

scarlet tangle
#
[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
hoary fox
tame gazelle
#
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)
hoary fox
tame gazelle
hoary fox
copper jetty
scarlet tangle
grim bay
#

any major differences i should know about before using v14?

dawn phoenix
#

pins

copper jetty
grim bay
#
                             ^^^^^^^
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.```
tame gazelle
grim bay
#

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

hoary fox
green plume
#

Why I am getting this error?

TypeError: Cannot read properties of undefined (reading 'delete')
elder sluice
#

Will there be breaking changes from v13 to v14?

nocturne kayak
#

very breaking changes, yes

urban belfry
#

instead what you could use is channel.messages.delete("ID") and catch the error in case

green plume
#

okay

elder sluice
urban belfry
#

check pins

scarlet tangle
#
[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
mint latch
#

i keep getting this error, anyone know why?

const Embed = new EmbedBuilder()
            .setImage(board)       
interaction.reply({embeds: [Embed]})
vague coyote
scarlet tangle
vague coyote
#

how should I know

#

this isn't dpy

scarlet tangle
#

is there any way to do it using the rest api? please let me know

gritty citrus
#

make a patch request on the same endpoint url for vanity, with the form body of the code

urban belfry
#

discord doesn't document it and so djs doesn't have a method for it

gritty citrus
#

ye, since they don't think it is necessary

mint latch
vague coyote
#

it very much isn't, setting the vanity url isn't something a bot should be able to do

signal rampart
#

how do i put an default discord emoji in a select menu like 🟥 or something

urban belfry
#

setEmoji({name: "🟥"})

signal rampart
#

oh okay

scarlet tangle
urban belfry
#

again the official docs don't document it

vague coyote
#

its not documented, if its not documented, its not gonna be in djs

kind pulsar
#

How can i fix this?

hoary fox
kind pulsar
#

hmm

#

let me try

#

Woah, it worked. Thanks!

umbral slate
#

not quite djs but still thats bad practice

umbral slate
#

no it's not he should be using optional chaining on all

mighty nacelle
umbral slate
#

no it's just dumb

mighty nacelle
mighty nacelle
umbral slate
#

i was literally suggesting what you just said

mighty nacelle
plain roverBOT
#

Documentation suggestion for @haughty lava:
class ActionRowBuilder
Represents an action row builder.

sharp wave
#

Can someone give me a class on how to code a bot with replit?

latent olive
#

This server is for discord.js. We are not able to assist you with unrelated libraries.

wintry bear
#
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

knotty plover
#

You must be on an older version that doesn't take arrays yet

vital vine
#

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

hoary fox
#

PascalCase

austere radish
#

How to make slash commands to bot with perms v2?

#

Nevermind

knotty plover
#

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

vital vine
steel haven
#

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' });
urban belfry
steel haven
#

After some research, the enum has changed its name
AuditLogAction -> AuditLogEvent. Well I think, in V14

plain roverBOT
covert cipher
#
    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>)

urban belfry
#

Okay and did it not work @steel haven

steel haven
outer bane
covert cipher
#

thats an annoying change

#

i'll just switch to an array instead of a builder in that case

urban belfry
#

Yep they straight up just push them on addComponents, they don't resolve the json to a builder

covert cipher
#

should i make a PR that accepts raw objects

outer bane
#

I think adding them in the constructor should work, though you should either use builders or objects everywhere

covert cipher
#

it seems to just run toJSON so i suppose i can just make it not do that if its already the json?

outer bane
#

then you'd end up with non builders in the components array. the better approach would be to use createComponent inside addComponents imo

covert cipher
#

createComponent?

outer bane
#

a function from builders

urban belfry
#

Look at how the constructor works

covert cipher
outer bane
#

functions are not picked up by the docgen

urban belfry
#

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

covert cipher
#

ah i see

covert cipher
#

createComponent is in the main lib

#

anyway i think i'll just switch to objects instead of builders

urban belfry
#

Yeah your choice, I'd do it too
There is discord api types, With ts, it wouldn't be an issue

covert cipher
#

yeah ik about dapi types, ive written a lot of it mmlul

#

i think this should be Discord.ButtonComponentData[] tho

urban belfry
#

Nice
The only downside is maybe losing the internal sanitation from the builders before sending the api requests ig

fierce hatch
#

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?

idle galleon
fierce hatch
#

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?

idle galleon
#

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 Thinkeng

fierce hatch
#

so it's because cancelling the modal does not stop my collector and thus it keeps on going?

idle galleon
#

Yes

fierce hatch
#

would doing ```js
const collector = new InteractionCollector(this.interaction.client,{time: 60_000})
collector.on('collect', async i => {
// code
})
collector.stop()

idle galleon
#

That just renders the collector useless

fierce hatch
#

damn

idle galleon
#

I usually avoid collectors altogether

fierce hatch
#

then how else could i do it?

idle galleon
#

I just store enough data in the customId and message (e.g. embeds, content) to be able to respond properly

fierce hatch
#

but i need the user's input for this

idle galleon
#

That’s in the interaction.fields

fierce hatch
#

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?

idle galleon
#

You can’t

fierce hatch
#

:I

idle galleon
#

That’s why I avoid collectors, at least for modals

fierce hatch
#

is this a discord or a discord.js limitation?

idle galleon
#

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

fierce hatch
#

i found a way :D ```js
if(!i.fields){
input.stop()
}

idle galleon
#

Any interaction could cause that to stop

knotty plover
#

All collectors/promises are tied to the interaction that launched them that way

idle galleon
#

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

fierce hatch
#

oh, well that is certainly annoying

idle galleon
#

Actually, you would be fine if you filtered out interactions not by the user and only those from the message

knotty plover
#

You could still run into the double collector issue. Same user, same message, same button

idle galleon
#

They would cancel the collector if a non-modal submit interaction was received

fierce hatch
#

oh great, i will try to add that. Thank you again

idle galleon
#

Tho, you should use interaction.isModalSubmit() instead to check

cinder bane
idle galleon
#

You would add it to the customId

cinder bane
#

oh

idle galleon
#

E.g. .setCustomId(`vote:${buttonInteraction.id}`)

cinder bane
#

i see, thanks

cinder bane
#

guild.invites.fetch() also includes the custom invite as well right?

quiet axle
#
TypeError: channel.children.map is not a function
silk topaz
quiet axle
silk topaz
#

ahhhh I keep swapping this channel with the v13 ones

silk topaz
quiet axle
#

Thanks

celest dagger
#

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>

proven wolf
scarlet tangle
#

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?

wheat valve
fallow flicker
scarlet tangle
glacial jungle
#

how i use the attachment type

tame gazelle
#

.addAttachmentOption

glacial jungle
#

I'm not using builder 🙂

tame gazelle
#

type: ApplicationCommandOptipnType.Attachment

glacial jungle
#

like

name: "img", 
descriprion: "the image you want", 
type: "ATTACHMENT", 
required: false 
#

and

let img = interaction.options.getAttachment("img");
copper jetty
#
name: "img", 
description: "the image you want", 
type: ApplicationCommandOptionType.Attachment, 
required: false 
scarlet tangle
#

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'),
    }]
})
opal cloak
#

help me

spare fiber
#

i already answer you, addComponents now takes array

void burrow
#

is it possible to add buttons to a modal?

copper jetty
#

NO

#

only text inputs

scarlet tangle
#

V14 release estimated time?

urban belfry
acoustic temple
#

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

copper jetty
acoustic temple
#

I use this on event ready

#

But no error

#

The strange is that only one command appear, the wiki command.

#

The ping command, not

acoustic temple
hasty gorge
#

anybody has an idea?

#

i get it here

white nebula
hasty gorge
#

ooh

hasty gorge
acoustic temple
#

@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?

wintry bear
#
onlineEmbed.setFields({name:`User ${player}`, value: `went online`})```TypeError: Found non-callable @@iterator
huh
acoustic temple
#

@wintry bear 💁🏻‍♂️

wintry bear
#

pain

acoustic temple
#

😔

honest eagle
#
                             ^

Error [CLIENT_REQUIRED]: No Client was provided on the showModal method options.```
#

Ignore the A in the middle, misclick

plain roverBOT
#

Tag suggestion for @honest eagle:
We do not provide any help with third party libraries like discord-buttons.
• Discord.js supports buttons natively: guide

forest elm
#

discord.js@dev has modals builtin

acoustic temple
#

@forest elm Can u help me on my strange problem?

acoustic temple
#

The program? Or the package?

copper jetty
#

the program

acoustic temple
#

I'll install PTB version

weak ridge
#

Hi! Is it possible to use name_localizations?

copper jetty
#

yes

weak ridge
#

How?

plain roverBOT
weak ridge
#

Ok

#

Like that?

nameLocalizations: { "fr": "texte" },
weak ridge
#

It does not change anything

weak ridge
#

No

copper jetty
#

click the green Apply button

weak ridge
#

That works, thanks !

#

It works but only when I search for the default name of the command

acoustic temple
#

@copper jetty On mobile it shows all the commands, I tested here. But on PC, not. 🤣

copper jetty
#

you could ask in discord developers server

acoustic temple
#

where?

copper jetty
weak ridge
#

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);
urban belfry
copper jetty
#

addComponents takes array...

#

its pretty obvious

weak ridge
urban belfry
#

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

weak ridge
#

Ok, thank you!

acoustic temple
#

@copper jetty There are a lot of people having the same issue like me.

acoustic temple
scarlet tangle
gloomy kayak
#

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?

scarlet tangle
gloomy kayak
#

Oh ok lol

green plume
#

Is it possible to get role icon picture link in DJS?

plain roverBOT
#

Documentation suggestion for @green plume:
method Role#iconURL()
A link to the role's icon

tame gazelle
#

already available in stable version ^

green plume
#

Thanks

ivory tartan
#

is there way I can get list of all invite the server has?
I tired to find but don't found one

plain roverBOT
ivory tartan
#

Thanks

ivory tartan
#

How do I make that code doesn't crash on an error

nocturne kayak
#

handle errors with try catch block or catch() for promises rejection

ivory tartan
nocturne kayak
#

this is more like basic js

plain roverBOT
#

mdn 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.

#

mdn 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(() => {}).

scarlet tangle
#

how can i use attachment(slash)

tame gazelle
#

.addAttachmentOption

scarlet tangle
#
        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?

dark minnow
#

You are creating:

[0] new ButtonBuilder
[1] new ButtonComponent (Here is your error)
[2] new ButtonBuilder

#

@scarlet tangle

scarlet tangle
#

omg..

#

okay, I understand

hoary fox
urban belfry
#

wait how come the builder doesn't error for being empty

scarlet tangle
urban belfry
#

@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
scarlet tangle
urban belfry
#

yes

scarlet tangle
#

^0.13.0

hoary fox
dark minnow
urban belfry
#

makes sense

mint latch
#

can i use .showModal on a modalsubmitinteraction?

#

nvm i can't

scarlet tangle
upper stirrup
#

(intermediate value).setColor(...).from is not a function

copper jetty
urban belfry
#

note that it should be imported from discord.js

const {EmbedBuilder} = require("discord.js")
```then from is a function
upper stirrup
#

Yes

urban belfry
#

this is how you defined it?

#

or did you get it from builders?

upper stirrup
#

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 ] });
upper stirrup
#

TypeError: Found non-callable @@iterator

new ActionRowBuilder()
    .addComponents(
    new ButtonBuilder()
    .setCustomId('open')
    .setLabel('Open')
    .setStyle(ButtonStyle.Secondary),
);
copper jetty
#

array

urban belfry
#

Now the addX and setX methods where X would be components, options etc take in arrays exclusively

junior jungle
#

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

junior jungle
#

cheers, ill just build on that then migrate to stable once official release

upper stirrup
#

DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[1][COMPONENT_LAYOUT_WIDTH_EXCEEDED]: The specified component exceeds the maximum width

dawn phoenix
#

that's a modal?

#

one text input per row only

upper stirrup
#

yes

hallow violet
#

how do i get the user from context command interaction?

dawn phoenix
#

the first row has at least 2 entries according to that error

plain roverBOT
dawn phoenix
#

wait, you mean the target? then not that one

hallow violet
#

yes, the target

upper stirrup
plain roverBOT
junior jungle
#

Are there any D.JS docs for v14?

jaunty vault
junior jungle
#

those docs are for v13 tho

jaunty vault
#

change "stable" to "main"

junior jungle
#

oh lol im dumb

#

thanks, sorry

undone yew
#

how to fix?

proven wolf
#

Dont have duplicate value in your select menu

#

Thats explicit

undone yew
hardy wind
#

Hi guys, is there an example on how to listen for messages in voice channels with the latest dev release?
Many thanks.

proven wolf
undone yew
#

my values

proven wolf
#

Dont have duplicate value

#

An option must have a unique value

undone yew
#

ok

haughty lava
undone yew
#

i fixed

#

thx

haughty lava
#

👍🏽

hardy wind
upper stirrup
#

When I click the Submit button in the modal window, I get this error, no errors in the console

noble kernel
#

why is my message content empty?

upper stirrup
gritty citrus
noble kernel
#

i do

gritty citrus
#

u dint

noble kernel
#

yes i do

gritty citrus
#

u dont ..

noble kernel
#

ok then how do i add it?

#

@gritty citrus

plain roverBOT
#

class Intents (extends BitField)
Data structure that makes it easy to calculate intents.

idle galleon
noble kernel
#
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] });```
idle galleon
#

I don’t see it

#

It’s its own intent called MessageContent iirc

noble kernel
#

oh

#

ohh it is

#

ty

onyx merlin
#

modals are added to discord.js or no?

silk delta
#

yes

onyx merlin
#

where i don't see it in the docs @silk delta

upper stirrup
#

RangeError: Invalid time value
timestamp: new Date(),

regal mason
#

Very clear

gloomy kayak
urban belfry
#

leaderboard.ts line 50

regal mason
#

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

forest elm
#

forEach with async callbacks probably doesn't work as you expect it to

regal mason
#

ah ?

urban belfry
#

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(...))

forest elm
#

for loop

urban belfry
#

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

regal mason
#

I want them to be ran one after another

forest elm
#

this is more of a js question than discord.js at this point

regal mason
#

Actually my problem is fetching users one after another and store it in an array

forest elm
#

we already told you what your problem actually is

#

with solutions i might add

regal mason
#

Promise the <array>.map() doesn't fix the problem

forest elm
#

show the updated code

regal mason
vague coyote
#

why is that a promise

forest elm
#

that's not even the same code...? you don't have an async callback on the map

vague coyote
#

why is that a promise

regal mason
#

this doesn't changed

forest elm
#

but that's the problem

vague coyote
#

again, forEach doesnt work async, use a for...of loop or similar

regal mason
#

Yes but Ben talked about the .map()

fluid summit
#

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?

urban belfry
forest elm
regal mason
#

There was no other .map() in the code that I showed initially

forest elm
#

you were meant to replace the forEach with what ben sent

regal mason
#

Oh I see

#

I switched for a for loop, thanks

#

Got this error when trying to show a modal

urban belfry
regal mason
#

Ah

plain roverBOT
regal mason
#

How I can receive submissions from modals ?

urban belfry
plain roverBOT
copper jetty
#

you can use this

void abyss
#

How can i send Attachment in v14 there isn't MesageAttachment() function

urban belfry
void abyss
#

Okay thanks

proven wolf
proven wolf
# proven wolf 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();
});
silver robin
#

Module '"discord.js"' has no exported member 'Intents'.

#

verison hash: ^14.0.0-dev.1651493371-4ba0f56

scarlet tangle
opal cloak
#

How do I make modals in djs v14?

knotty plover
#

see pins

opal cloak
#

okay

hybrid crest
#

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

knotty plover
#

nah just setEmoji

#

There is no emoji style

hybrid crest
#

👍

scarlet tangle
#

Is there anything new in 14 to really benefit the switch ?

nocturne kayak
#

most notable thing must be api v10 and various other things

hybrid crest
#

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

tame gazelle
scarlet tangle
#

What about the guide edleast ?

tame gazelle
#

didn’t get

#

if the guide is finished?

chilly zephyr
#

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?

opal cloak
#

How do I get an attachment to slash commands?

#

is it interaction.options.getAttachment('the name')

knotty plover
#

Cant finish a guide if the version isnt released

knotty plover
chilly zephyr
#

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

knotty plover
#

huh, and the full error stack?

chilly zephyr
#
                        ^

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
}```
hybrid crest
#

button.message.delete() appears to fail in DMs

chilly zephyr
dim moss
#

hi in V14 how can I define slashCommandBuilder if we shouldnt use Builders

- const { SlashCommandBuilder } = require('@discordjs/builders');
+ const { SlashCommandBuilder } = require('discord.js');

??

urban belfry
hybrid crest
dim moss
#

I mean they say its highly recommended that you uninstall the package

urban belfry
#

what, where

urban belfry
#

i'm missing context

hybrid crest
#

i've found you can use ApplicationCommandsManager to handle commands instead, but it does take notably longer (completion-wise) to do that

urban belfry
#

yeah because v14 uses builders internally so you should use the version the version uses

dim moss
urban belfry
#

yes djs reexports the same builders with added functionality

#

if you do use djs you can just import from that

hybrid crest
#

i can't find the SlashCommandBuilder from DJS@dev actually

dim moss
#

can I do this?

const Discord = require('discord.js');

module.exports = {
    data: new Discord.SlashCommandBuilder()
hybrid crest
urban belfry
dim moss
#

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

dim moss
#

what is the problem?

tame gazelle
# dim moss

.addChoices({ name, value }, { name, value })

dim moss
#

oh addChoice removed?

tame gazelle
#

yeah

#

same for addField and all things like that

dim moss
#

yes I saw addFields and addOptions but didnt saw this

tame gazelle
#

.addChoice has been removed in the latest stable builders version aswell

dim moss
#

okay tnx

dim moss
dim moss
tame gazelle
#

pins

dim moss
#

Oh srry

#

tnx for your help

#

what is this err for?

dim moss
haughty lava
#

check

dim moss
haughty lava
dim moss
#

so?

#

addChoice is different

haughty lava
#

just use addChoice

dim moss
#

addChoice has been removed :/

#

I use addChoice at first !

haughty lava
#

just add a "s" and use the same as before

tame gazelle
#

read it

dim moss
dim moss
tame gazelle
#

if it's a string option yes

#

otherwise value must be an integer

dim moss
#

well as far asI remember they are string options but now:

tame gazelle
#

.addChoices({ name: 'Warn', value: 'Warn' }, { name: 'DM', value: 'DM' })

dim moss
#

oh

#

ok got it also what about this one:

#

role.edit({ color: 'RANDOM' })

tame gazelle
#

Util.resolveColor('Random')

dim moss
#
    const Util = require('discord.js')
    role.edit({ color: Util.resolveColor('Random') })

?

tame gazelle
#

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

dim moss
tame gazelle
#

const { Util }

dim moss
#

oh Ok

#

am I need to do it for embed setColor too?

#

.setColor("RANDOM") I mean

dawn phoenix
nocturne kayak
dim moss
tame gazelle
dim moss
tame gazelle
uncut kelp
#

You probably aren't updated

#

Hm nvm CR

uncut kelp
dim moss
#
.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?

nocturne kayak
#

addChannelTypes expects rest param iirc

dim moss
nocturne kayak
#

you should have expected what will happen when you choose to use an unstable dev ver over a stable one

dim moss
#

well what should I do now feelsTenseMan

#

also the ready event will run but there is no activity

await client.user.setPresence({ activities: [{ name: 'Starting...', type: 'WATCHING' }], status: 'idle' })
tame gazelle
uncut kelp
#

No

tame gazelle
#

ok thanks

dim moss
uncut kelp
#

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

tame gazelle
dim moss
#

oh ok

tame gazelle
#

it looks like the TextChannel#send() changes

uncut kelp
#

It's also how the guild ban manager fetches bans exactly, so it's a consistent feel <:

dim moss
#

2 different err what are the problems?

uncut kelp
#

First one states your style is wrong. Second states you added fields improperly

dim moss
#

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?

tame gazelle
#

it takes an array of objects

#

as you can see in the guide

dim moss
#

oh ic

#

so ([
//fileds
])

tame gazelle
#

yep

dim moss
#

and what for the err from guildMemberAdd?

tame gazelle
#

guildMemberAdd.js line 12
show it

dim moss
#

nvm found it !

#

I dono why vs code didnt change here...

opal cloak
#

how do I get a attachment using slash cmds?

nocturne kayak
#

interaction.options.getAttachment('optionName')

opal cloak
#

thanks

dim moss
#
if (message.channel.type === 'DM' || message.guild.id !== '553528389898862594') return;
#

how guild is null :/

outer bane
#

Message#guild is a getter from cache using Message#guildId

dim moss
#

okay tnx <3

outer bane
#

and channel types use numbers/enums instead of strings

dim moss
outer bane
#

use enums instead of magic numbers

dim moss
outer bane
#

if you only want the id yes, no need to invoke the getter

dim moss
#

tnx

outer bane
#

same goes for Message#channel(Id)

tame gazelle
outer bane
#

or remove the first check and only use the guild id

dim moss
#

hmmm tnx

dim moss
#

how should I set emoji for buttons?

outer bane
#

are you sure you are on the latest version of dev? that should work afaik

dim moss
#

am I ?

outer bane
#

oh, Util.parseEmoji doesn't work for only ids. pass { id: '' }

dim moss
#

setEmoji({ id: 'ID HERE' })
?

#

but for default emojis setEmoji('😂') is enough am I right?

hoary fox
dim moss
#

what for menu emojis?

hoary fox
dim moss
#
{ 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" } },

???

tall verge
tall verge
#

is correct the first one

regal mason
#

What is the equivalent of dynamic: true, in D.js v14 ?

#

In v14 the options disapeared

nocturne kayak
#

it's dynamic by default

regal mason
#

oh ok

tall verge
primal lava
#

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 😅

buoyant pecan
#
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? think

nocturne kayak
#

one of your cmd doesnt have a description

nocturne kayak
buoyant pecan
#

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`
buoyant pecan
dim moss
#

the problem is from .addChannelTypes([ChannelType.GuildText, ChannelType.GuildNews])

#

what is this err for

buoyant pecan
#

try it like that:
.addChannelOption(option => option.setName('channel').setDescription('Select a channel to setup :statue_of_liberty:').addChannelTypes(ChannelType.GuildText, ChannelType.GuildNews))

dim moss
opal cloak
#

Ill try logging the embed but IDK why its not working.

tame gazelle
opal cloak
opal cloak
plain roverBOT
#

Documentation suggestion for @opal cloak:
method (static) EmbedBuilder.from()
Creates a new embed builder from JSON data

copper jetty
#

you can't call setColor on Embed

opal cloak
copper jetty
#

EmbedBuilder.from(<Embed>.data) and then you can call setColor() on it

opal cloak
copper jetty
#

yes

vague depot
#

how can i cheak bot member count while using eval command

plain roverBOT
#

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)
opal cloak
# copper jetty yes
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??
copper jetty
#

and you should make your folders names camelCase

copper jetty
#

EmbedBuilder.from(embed.data) do that

opal cloak
#

okay

opal cloak
copper jetty
#

replace fields[1] = { name: 'Status', value: 'Accepted'} with data

copper jetty
#

EmbedBuilder.from(embed.data)

opal cloak
#

EmbedBuilder.from(embed.data.fields) i think because I try to log the embed and this happend

tame gazelle
copper jetty
#

you need to use spliceFields because EmbedBuilder don't have fields property

opal cloak
hybrid crest
hybrid crest
opal cloak
#
        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
hybrid crest
nocturne kayak
opal cloak
hybrid crest
#

tbh that change threw me for a while as well, it seems fairly arbitrary imo

copper jetty
#

.addFields() does the same thing thats why

#

they changed it addField was taking an object too in dev version

scarlet tangle
#

guyss, how can I register a context menu command using djs v14?

copper jetty
#

you can do .addFields([{ name, value }]) it does the same

forest willow
#
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

jaunty vault
forest willow
#

wasn't it working with previous versions?

forest elm
#

no, client.commands was never a thing, so you'd have to have added that yourself

forest willow
#

weird, it was working in all m previous works

#

anyways whats the fix can you guide please

forest elm
#

no? how would i know what client.commands is

forest willow
#

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

copper jetty
#

i think your looking for <Client>.application.commands

dim moss
copper jetty
# dim moss

your passing rest parameters instead of array into addComponents

cinder bane
#

what's the Enum for PresenceStatus?

copper jetty
#

idk

mental inlet
#

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] })
        });
plain roverBOT
#

Tag suggestion for @mental inlet:
We do not provide any help with third party libraries like discord-buttons.
• Discord.js supports buttons natively: guide

cinder bane
#

is there no Enum for PresenceData in v14?

mental inlet
#

@rain bramble ah alright, might switch to v14 anyways

copper jetty
dim moss
copper jetty
#

probably

dim moss
#

okay so let me check

forest willow
#
const command = await interaction.client.application.commands.cache.get(interaction.commandName);```

still command is undefined
outer bane
#

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

forest willow
#

thanks

cinder bane
#

is there any PresenceStatus Enum in discord.js v14?

#

i can only find it in v10 api-types package

forest willow
outer bane
#

remove cache

outer bane
forest willow
cinder bane
outer bane
#

an application command is the discord structure of the command, it won't have such a method

cinder bane
#

should i create an issue on github?

mental inlet
outer bane
cinder bane
#

okay

cinder bane
mental inlet
cinder bane
#

👍

mental inlet
#

@cinder bane wait what is it called?

cinder bane
#
const { PresenceUpdateStatus } = require('discord-api-types/v10');
mental inlet
#

ah thank you

cinder bane
#

use the /v10

mental inlet
#

kk

dim moss
#

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

hoary fox
dim moss
# hoary fox 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 :(

nocturne kayak
dim moss
mental inlet
#

what do you replace .addComponents() with?

#

i probably missed it in the guide ngl

dim moss
#

addComponents take array now

mental inlet
#

OH its an array now

dim moss
#

yes

mental inlet
#

ty

dim moss
#

yw

forest willow
outer bane
#

Message, not GuildMember

dim moss
#

I use it everywhere instead of guild.id 🤦🏻‍♂️

dim moss
plain roverBOT
dim moss
#

ok tnx <3

green plume
#

Is it possible to unregister slash command?

jaunty vault
green plume
plain roverBOT
green plume
#

Thanks

#

How do I get command ID?

plain roverBOT
jaunty vault
green plume
#

Can I get the command ID using command name?

hoary fox
green plume
#

Okay

mental inlet
#

anyone know why the button wont be disabled before showing the modal?

void abyss
#

Hi This is possible to handle Missing Permissions error from interaction.member.roles.add('xxxxxxxxxxxx') in try catch?

hoary fox
dim moss
#

what is this err for?

uncut kelp
#

It's a warning - not an error

void abyss
hoary fox
void abyss
#

ah okay

uncut kelp
#

You should probably check the permissions before adding it

void abyss
#

Okay now it's works fine thanks

hoary fox
#

:)

buoyant bear
#

what are the requirements for djs v14?

hoary fox
dim moss
tame gazelle
#

it’s an internal warning

noble kernel
#

Error: Invalid string length?

hybrid crest
noble kernel
#
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);
hybrid crest
#

and where is it throwing the error?

noble kernel
#

at await interaction.showModal(modal);

hybrid crest
noble kernel
#

alr ty

hybrid crest
#

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

amber sleet
#

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:

knotty plover
hybrid crest
knotty plover
#

I doubt that it does but why would you do that instead of just... using delete?

hybrid crest
#

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

knotty plover
#

np

plain roverBOT
tender quest
rancid dagger
#

hi, can i know reason and duration when someone give sb timeout, any event or smth?

tender quest
plain roverBOT
#

Documentation suggestion for @rancid dagger:
event (event) Client#guildMemberUpdate
Emitted whenever a guild member changes - i.e. new role, removed role, nickname.

rancid dagger
#

thanks

#

ok, I can see if someone have communicationDisabledUntil, but can i have reason of timeout?

idle galleon
#

Check audit logs

plain roverBOT
hybrid crest
#

^this, there's unfortunately not a better way to get a notification of it with the reason

wintry bear
#

anyway to make modal fields not required/optional?

rancid dagger
#

.setRequired(false)?

wintry bear
#

that exists? e

rancid dagger
#

r u using discord-modals?

#

i mean i have smth like that

wintry bear
#

yea it worked, just forgot it existed

rancid dagger
rancid dagger
tender quest
bitter schooner
#

What does this mean after 14.0.0-dev?

rancid dagger
tender quest
bitter schooner
#

Oh

#

Thanks anyways

#

I guess this number is a timestamp

#

But running it though new Date() gets a weird time

rancid dagger
bitter schooner
#

Ok

#

Thanks :)

rancid dagger
indigo fable
#

how do i include components?

#

my row

nocturne kayak
#

specify the type of components inside your ActionRowBuilder
example ActionRowBuilder<SelectMenuBuilder>

indigo fable
#

jesus christ that's something

#

how do i show a modal on an interaction already sent?

#

showModal just says interaction already replied to

nocturne kayak
#

you cant

indigo fable
#

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

knotty plover
#

You dont close modals, the user does

indigo fable
#

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

knotty plover
#

Does it show an error like it wasnt received?

indigo fable
#

yep

knotty plover
#

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

indigo fable
#

on submit, it says this message has not been sent or deferred

knotty plover
#

Yeah try changing editReply to update

indigo fable
#

Property 'update' does not exist on type 'ModalSubmitInteraction<CacheType>'.ts(2339)

knotty plover
#

it... should

indigo fable
#

okay so

#

on deferring it, then using editing reply, behavior works

knotty plover
#

lemme look into that, seems like a bug

indigo fable
#

👍 thank you monbrey

knotty plover
#

uhh I think theres a typeguard

indigo fable
#

i'm wanting to edit the original interaction

#

deferring and editing sends a new interaction

knotty plover
#

interaction.isFromMessage() should typeguard it to allow for update()

indigo fable
#

oh wait im so stupid one sec

knotty plover
#

its a typeguard not a promise

#

if(interaction.isFromMessage())

indigo fable
#

beautiful

#

that worked thank you so much

knotty plover
#

I wrote the v13 version which has less strict types so I forgot about the typeguards

opal cloak
tame gazelle
opal cloak
tame gazelle
#

yep

opal cloak
#

message is defined and also is evel command working in slash cmds?

green plume
#

Why I am getting undefined?

vague coyote
#

Only on guild channel

opal cloak
vague coyote
# opal cloak 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

opal cloak
vague coyote
#

Read my message again

reef rose
#

What is "Guild_messages” name at dev

reef rose
tame gazelle
#

SCREAMING_SNAKE_CASE => PascalCase

cinder bane
#

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] });
knotty plover
#

why would it not work?

cinder bane
#

im not getting the image in my embed

knotty plover
#

Are you getting any errors?

cinder bane
#

nope

#

path is correct as well

knotty plover
#

Can't see why it wouldn't work

cinder bane
#

btw, can we do the same for the iconURL paramerter in setAuthor()?

cinder bane
#

okay thanks

cinder bane
# knotty plover Can't see why it wouldn't work
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] });
knotty plover
#

It works for me, and it threw an error when the path was wrong

knotty plover
#

¯_(ツ)_/¯

cinder bane
#

:/

dim moss
#

what is this err for?

scarlet tangle
#

why client.application.owner returns null?

rain bramble
hallow violet
scarlet tangle
heady leaf
#

Hello!
How can I send an ephemeral message when using modals?
The ephemeral: true doesnt work

#

Can anyone help me?

dim moss
#

ticketName and topic return a string