#djs-in-dev-version

1 messages · Page 28 of 1

red mountain
#

perfect

scarlet tangle
#

quite a bit, look at the pinned messages to see the guide

red mountain
#

wait i actually used prefix method but alr, i will also check that

#

It worked, Ty

manic lynx
#

Im not using slash command builder. @scarlet tangle

#

addFields() not addField()

#

and also its returns array

red mountain
#

Welp alr

spiral mauve
#

I assume there is no way to determine if a Modal was cancelled? Is this an oversight or a limitation of Discord API?

nocturne kayak
#

the latter

spiral mauve
#

Wow, that's quite terrible. How can Discord claim this to be a "replacement" for the awaitMessages way of collecting a response when there's glaring flaws like this.

copper jetty
#

You cant determine if someone didnt sent a message too btw

exotic nexus
#

I think they mean the time option that collectors have

spiral mauve
#

You can work around that by simply waiting for the message to arrive (or filter for the response you want) or awaitMessages to time out. Even if the user fucks up and types something incorrectly, you can work with that by showing an error, or just filtering the messages so that only the correct message gets collected. With Modals, once the user cancels the Modal, there is no going back. The user can't open it again, and has to wait for the collector to time out before they can attempt again.

#

This sounds like some massive oversight on Discord's part, unless I'm missing something here.

forest elm
#

tbh to them, the interaction type is called MODAL_SUBMIT

spiral mauve
#

So what are developers supposed to do if a user accidentally cancels the Modal or decides that they want to cancel it and press a different button (which should bring out a different Modal)?

knotty plover
#

Just have a timer on waiting for the modal

#

And make sure your Modal customIds are unique so your listeners don't overlap and duplicate

#

I do this by putting the interaction I'd in it

spiral mauve
# knotty plover Just have a timer on waiting for the modal

I do have a timer on it. I'm currently using awaitModalSubmit for all my modals. The problem here is that the code won't continue unless the timer runs out, or the modal is submitted. I suppose I will have to switch to collectors for this.

knotty plover
#

I'm not sure how that will change things

#

With collectors, wouldn't it be continuing before they've submitted in this situation?

nocturne kayak
#

so im using awaitModalSubmit() to collect modal interaction.
how would i prevent multiple collectors (persists if the user cancelled the modal) responding to 1 single modal interaction?

knotty plover
#

Use unique customIds

#

I do this by putting the interaction id that launched the modal in the modals custom id

cinder bane
#

components[0].components[5][COMPONENT_LAYOUT_WIDTH_EXCEEDED]: The specified component exceeds the maximum width?

copper jetty
exotic nexus
#

^ max 5 in one row

cinder bane
#

yeah i remember now, the limit is 5

copper jetty
#

Max 5 buttons or 1 select menu or 1 text input

thick dew
brazen knoll
#
(node:3909536) ExperimentalWarning: buffer.Blob is an experimental feature. This feature could change at any time
    at emitExperimentalWarning (node:internal/util:224:11)
    at new Blob (node:internal/blob:138:5)
    at _RequestManager.resolveRequest (/root/Bots/Ayako-v1.5/node_modules/@discordjs/rest/dist/index.js:887:36)
    at _RequestManager.queueRequest (/root/Bots/Ayako-v1.5/node_modules/@discordjs/rest/dist/index.js:845:46)
    at REST.request (/root/Bots/Ayako-v1.5/node_modules/@discordjs/rest/dist/index.js:995:32)
    at REST.post (/root/Bots/Ayako-v1.5/node_modules/@discordjs/rest/dist/index.js:986:17)
    at TextChannel.send (/root/Bots/Ayako-v1.5/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:175:38)``` whats this
copper jetty
#

Its a warning but i think you should update node

forest elm
deep elk
#

So are modals introduced in v14? Or are they in v13 too

urban belfry
deep elk
#

Alright

urban belfry
#

there's a wip guide for it that's currently a pr

brazen knoll
round marsh
#

I want to be able to open a modal on button click or on select menu is that possible?

urban belfry
thorny haven
#

not guild members

#

i - command interaction

tame gazelle
#

if i is a CommandInteraction why are you doing i++

thorny haven
#

👌

brave dagger
#

How can I show another modal after the user replied to the 1st one?

velvet jasper
#

You can’t

frigid sleet
#

how i add choices to ín v14?

.addStringOption(option => 
        option
        .setName('item')
        .setDescription('A description')
        .addChoices([
            {
                name:'North Country Parka',
                value:'ncp'
            },
            {
                name:`Worker\'s Cap`,
                value:'wc'
            },  
            {
                name:'Angry Rain Boots',
                value:'arb'
            },]
        )
pallid ice
#

so I'm not sure if this is intended or not or if maybe I'm just dumb.

since the perms v2 change, I've continued to use defaultPermission: false and when doing so the command will show in the Integrations tab as denied for everyone as expected. with the d.js changes merged for perms v2 I decided to move to the new system and use default_member_permissions: '0' instead.

I found that using my existing method of Guild#commands.set was having no effect and the commands were still usable by others

so I moved my command registration to the preferred method of rest and find that yes now people without the overwrites/admin etc can no longer use the command(s) however in Integrations it still shows the command as allow for everyone and I don't know why

urban belfry
frigid sleet
urban belfry
#

first,uninstall builders and update djs to the latest commit

#

wait what the heck, now it takes a rest parameter? 😭
@frigid sleet don't pass an array, pass multiple parameters

frigid sleet
pallid ice
#

thanks for the clarification. I assumed as much but just wanted to check here in case

#

oh ty ty!

river harbor
#

How do I import the user class?

#

I'm trying to run checks with instanceof

copper jetty
river harbor
copper jetty
#

it depends

dark minnow
#

It's safe to use the client rest to deploy guild commands, instead of creating a new rest

urban belfry
#

if you call the method through djs, you're most likely going to be making needless api calls leading to api spam leading to you getting rate limited

#

it's just considered best practice, that's all

dark minnow
#

Got it, thanks

urban belfry
#

we highly recommend the approach in the guide

river harbor
#

I'm making a program that actually reads the command deployment json, compares it to the currently registered commands and then makes any changes needed.

#

So you could do something like that.

#

(shit im very late to this)

river harbor
knotty plover
#

numbers can be text

#

You cant restrict it to just numbers though

#

How to... not doing something? I did say "cant"

#

IntentsBitfield in v14

#

If you're looking at the v14 changes preview guide sure

#

See pins

#

Just that page

granite yacht
#

Does .setRequired(true) exist in modals?

copper jetty
#

No

granite yacht
#

Alr

#

Uhm, how do i fix this?

copper jetty
#

Dont use getTextInputValue method on undefined

granite yacht
#

What do i use then?

copper jetty
#

Call this method on ModalSubmitFieldsResolver

granite yacht
#

???

#

Wdym? @copper jetty

plain roverBOT
granite yacht
#

soo

#

interaction.ModalSubmitFieldsResolver.getTextInputValue("value")?

thorny haven
copper jetty
#

<ModalSubmitInteraction>.fields is ModalSubmitFieldsResolver

thorny haven
#

interactionModal.getTextInputValue("value")

granite yacht
#

do i have to import anything from the djs package to get it to work?

copper jetty
#

No

granite yacht
copper jetty
#

interaction.fields.getTextInputValue(name)

granite yacht
#

I get the getTextInputValue undefined

thorny haven
granite yacht
thorny haven
granite yacht
#

I get this now in interactionCreate

thorny haven
granite yacht
#

Works now

#

, i had a deferreply that i wasnt supposed to have 🤣

granite yacht
#

Whats the new GUILD_TEXT on channel

#

as im trying to check if its the right channel type

#

chnl.type !== "GUILD_TEXT"

#

this is the one currently

#

worked in djs v13, but not v14

vague coyote
#

GuildText probably

granite yacht
#

Ill try that

#

Didnt work

granite yacht
#

const chnl = interaction.options.getChannel("channel")

#

thats the code for the chnl

vague coyote
#

why do you need that anyway, just use the typeguard, chnl.isText()

granite yacht
#

Soo

#

if(chnl.isText()) {
console.log("true")

#

Like that?

vague coyote
#

that would be one way, yes

granite yacht
#

ill test that

#

That worked 😄 Ty ❤️

#

Im currently changing from djs v13 to djs v14

#

bc of modals xD

dawn phoenix
#

pst, modals are on v13 blobshh

vague coyote
#

we srsly need that announcement

granite yacht
#

I SPENT MUCH TIME SWITCHING TO DJS V14 AND U SAY IT NOW AAAAAAAAAAAAAAAAAAAAAA

#

Well, fuck it, its alr,

#

now that work, with channel set

dawn phoenix
#

on the bright side, less work when new features only release to v14

granite yacht
#

Im mad.

scarlet tangle
#

Did they really do it? We can't use HEX color now?

forest elm
#

import the builder from discord.js

scarlet tangle
#

oh, yeah, didn't see. thanks.

granite yacht
#

Does anyone know how to use canvacord in djs v14

#

this is the code

#

error

#

worked on djs v13

forest elm
granite yacht
#

how i fix doe?

forest elm
#

1 is certainly not a bufferresolvable

tame gazelle
#

maybe data ? ._.

granite yacht
#

wat

#

how it went to 1

forest elm
#

because you put it there

granite yacht
granite yacht
#

or something

forest elm
#

since the error is coming from canvas, it probably is failing at rankcard.build(), or even before that

granite yacht
#

then what do i do to fix?

forest elm
#

¯_(ツ)_/¯

#

doesn't seem related to discord.js

granite yacht
#

Hm, what can i use instead of canvacord?

copper jetty
#

Canvas

granite yacht
#

alr

forest elm
lilac cloud
#

what is wrong

#

btw i reseted token

jaunty vault
lilac cloud
#

can i pls get help

#

im bad at js

vagrant dome
#

The key of your token is the token itself? That looks wrong

lilac cloud
#

what do i need to do?

jaunty vault
forest elm
#

just pass the token to the client.login() function

lilac cloud
#

k htanks

night latch
#

how do I fix this

outer bane
#

you are passing a builder where an array of builders is expected, most likely add/setComponents

#

for the second one ActionRowBuilder takes a generic

night latch
#

any guide for the dev branch?

night latch
#

okay thanks

ripe jackal
marsh matrix
#

Is there a reason for no announcement about that?

broken glacier
#

is SlashCommandBuilder#setDMPermission working correctly?

tame gazelle
#

yep

#

I use it and it works

wintry bear
#

embed.from effectively clones the embed right

velvet jasper
#

make the input embed mutable, yeah

copper jetty
vague coyote
#

you can only check if they boosted your server

halcyon nest
#

I mean you could check if they have a banner, they can only have one if they have nitro

#

right

vague coyote
#

you can only check if they boosted your server

#

everyhing else is oauth2

jaunty vault
#

Not how it works

#

Not afaik

nimble glacier
#

can u limit visibility of commands to permissions

plain roverBOT
hoary fox
noble kernel
#

why is interaction.options.getMember("user").avatarURL({ extension: "png", size: 512 }); logging null?

noble kernel
jaunty vault
noble kernel
hoary fox
jaunty vault
knotty plover
#

Such as?

forest elm
#

you don't

knotty plover
#

Anything that was removed is probably because Discord removed it or bots weren't meant to see it or something

forest elm
#

discord undocumented them

knotty plover
#

What even was a sync id

#

I don't remember the details but I know Spotify integrations changed

#

I still see it on the docs for main though so

#

It doesn't look removed to me

forest elm
dull mulchBOT
forest elm
#

i would know that they were removed

knotty plover
#

Maybe mine didn't refresh then

forest elm
#

when did i say discord or spotify removed it?

forest elm
knotty plover
#

We're not going to add undocumented things back to discord.js

forest elm
knotty plover
#

Dude stop

#

It's not in discord.js, we're not adding it back to discord.js, it's not up to us to find hacky broken solutions for you

hardy wind
#

Hi guys, just a quick question.
Is permissions v2 fully complete yet?
My default_member_permissions and dm_permission properties don't seem to be taking affect and I don't see these properties in the command transformer in djs.

forest elm
#

if you use @discordjs/rest to deploy your commands it should work

#

the latest dev version of builders has support for them too

dawn phoenix
forest elm
#

for discord.js itself

hardy wind
forest elm
#

there's a pull request for it

dull mulchBOT
hardy wind
hardy wind
#

Lets hope it's merged soon.

dawn phoenix
#

you'd need to set the fields after finalizing the builder, i suppose

#

(so after the #toJSON call)

#

using them at the correct endpoint should still work

forest elm
#

builders already has support for the new properties

dawn phoenix
#

oh, we're in at-dev, right

hardy wind
dawn phoenix
#

at least for default member permissions i have tested them and cannot reproduce any issues with them applying, apart from the GUI in server settings

forest elm
#

they use the djs manager to create the commands

dawn phoenix
#

guess we don't transform the snake case then?

forest elm
#

the command object creation is hardcoded if that makes sense

#

"unknown" properties arent passed to the api at all

dawn phoenix
#

firT ew

#

if you don't want to wait for the PR you could always use the rest route directly, i guess

hardy wind
knotty plover
#

Then it is wrong

#

Or its ephemeral

#

Or its already been deleted

uncut kelp
#

Something seems fishy here. You're getting a unknown message error but you're saying the message id isn't wrong :thinking:

#

Oh right, nice Promise chain

knotty plover
#

well that code is incorrect

#

But yes, its coming from the fetch, because the id is wrong

#

or not in that channel or something

uncut kelp
#

Couldn't you just do ButtonInteraction#message#delete()?

uncut kelp
#

Is that the message id

#

The error comes from Discord so... something is wrong

knotty plover
#

I really cant see any reason you wouldnt be able to fetch that message if the id is actually correct

#

Does the bot have READ_MESSAGE_HISTORY permission?

uncut kelp
#

That'd probably be a missing permissions error

#

Is it even in the same channel? :thinking:

knotty plover
#

Not a DM channel is it?

#

Yup well we're really only back to one possibility. The only reason Discord would return a 404 Unknown Message is if the id you provided doesn't match a message

#

and how is it stored in your code

#

as what column type

#

Looks a bit like a number

#

Needs to be stored as TEXT or VARCHAR or whatever mysql calls it

#

Unless theres some weird shit going on where slash command response messages cant be fetched using regular message fetching, which I'm definitely not aware of there being any such limitation

#

no

minor dagger
#
const member = interaction.options.getMember('member');

        const userFlags = member.user.flags.toArray();

error:

Property 'user' does not exist on type 'GuildMember | APIInteractionDataResolvedGuildMember'.
  Property 'user' does not exist on type 'APIInteractionDataResolvedGuildMember'.
tame gazelle
tame gazelle
minor dagger
#

i gotta add that below the member constant ?

tame gazelle
#

at the top of your code after interaction is defined

minor dagger
tame gazelle
#

you can receive interactions in a non-cached guild and get a the API GuildMember object

minor dagger
#

also is it better to use a type guard return object or ? when object is null ?

tame gazelle
#

dunno

minor dagger
#

alr thanks

ripe jackal
jagged marsh
#

full code?

#

and what line is the error

white nebula
#

are you deferring within 3 seconds of receiving the interaction?

jagged marsh
#

if it’s on the first then you are deferring too late as Squid said

minor dagger
#

heck wdym ?

#

that's very unrelated ;-;

vapid agate
#

hello, I have a little problem with the dev version of discord.js

scarlet tangle
#

what problem

vapid agate
#

I can't use options in my / commands

copper jetty
#

Maybe you didnt add them

scarlet tangle
vapid agate
#
import {
  ApplicationCommandType,
  CommandInteraction,
  GuildMember,
  InteractionResponse,
} from "discord.js";
import { BaseClient } from "../../client/BaseClient";
import { Command } from "../../utils/structures/Command";

class Emit extends Command {
  constructor() {
    super({
      name: "emit",
      description: "Emit event.",
      type: ApplicationCommandType.ChatInput,
      options: [
        {
          name: "eventName",
          description: "Name of the event",
          type: 3,
          required: true,
          choices: [
            {
              name: "test",
              value: "test",
            },
          ],
        },
      ],
    });
  }
  run(
    client: BaseClient,
    interaction: CommandInteraction
  ): Promise<InteractionResponse> {
    console.log(interaction.options);
    const eventName = interaction.options.get("eventName")?.value;
    switch (eventName) {
      case "guildMemberAdd":
        client.emit("guildMemberAdd", interaction.member! as GuildMember);
        interaction.reply({
          content: "guildMemberAdd event emit with success.",
          ephemeral: true,
        });
        break;
      case "guildMemberRemove":
        client.emit("guildMemberRemove", interaction.member! as GuildMember);
        interaction.reply({
          content: "guildMemberRemove event emit with success.",
          ephemeral: true,
        });
        break;
    }
    return interaction.reply({ content: "DEBUG FUCK DISCORD !" });
  }
}

module.exports = Emit;
#

logs of my commands collection

#

first command is not available in my server, second is available but I don't have options

#

I just have the last reply when I execute the command

thorny haven
#

I'm too lazy to read

vague coyote
thorny haven
#

I'm trying to understand what he wrote but I don't understand

#

@vapid agate well, it seems like everything should work according to the code

#

I can't figure out what the problem is yet

vapid agate
#

me too

thorny haven
#

and the command is not being created or what?

vapid agate
#

in fact, commands with options are not register in my server

thorny haven
vapid agate
#

all commands are register only in my dev server, not globally

#
console.log(client.commands.size); // 3
console.log(devGuild?.commands.cache.size); // 0
thorny haven
#

try creating a command manually

vapid agate
#

I don't understand why the second log returns 0 because I have 2 commands actually available in my server

obtuse crater
#

Well did you fetch the guild commands?

vapid agate
#

with fetch method, I see 2 commands

#

options of the second command (emit) is empty

obtuse crater
#

so that's your answer why you don't see the options

vapid agate
#

but why ? 🤔

obtuse crater
#

you prob registered the guild commands without options

vapid agate
#

when i start the bot, commands are registered again

obtuse crater
#

guild commands or global ones

vapid agate
#

problem is : I can't register commands when they have options

#

I use only guild commands for dev

obtuse crater
#

well the code should be working fine

#

which djs version are you on

vapid agate
#

"discord.js": "^14.0.0-dev.1652702635-5e9b757"

#

I discover this bug with the emit command :
in a first time, i try to register command with options : command does not appear in my server (not register)
I remove options => no problems, command is register
I retry with options => command is register and appear in my server but without the options (because the options array is empty)

obtuse crater
#

Seems like option name must be all lowercase

vapid agate
#

it's works but not really

#

my bad, it's works ! Thanks

#

😭 just for a lowercase

proven forge
#

interaction.guild.me do not exist anymore?

jaunty vault
#

it's now interaction.guild.members.me in v14

proven forge
#

thanks bro 🤝

copper jetty
#

you forgot to close the bracket after fetch()

#

and its client.users not client.user

jaunty vault
#

This shouldn't even work at all
It should be a different error
TypeError or SyntaxError

dim moss
#

what is this err?

vague coyote
#

dont see an error

dim moss
#

so what is it?

vague coyote
#

you tell me

jaunty vault
#

Looks like a get gateway bot log

vague coyote
#

you should know what you are logging

gloomy kayak
#

Why are you using type?.stack instead of just type (it's a string)

#

Also multipleResolves is deprecated actually

idle galleon
#

Promise.race() can trigger a 'multipleResolves' event

plain roverBOT
ancient hound
#

Is there any replacement for Util.splitMessage?

vague coyote
#

No

dawn phoenix
#

yes

plain roverBOT
#

mdn String.prototype.split()
The split() method divides a String into an ordered list of substrings, puts these substrings into an array, and returns the array. The division is done by searching for a pattern; where the pattern is provided as the first parameter in the method's call.

copper jetty
#

why you remove splitMessage() 😠

dawn phoenix
uncut kelp
#

I thought it already did that

#

It doesn't look like it's set there?

#

Do you guys think it's worth opening a PR to have the return type set to number if required is set to true

knotty plover
#

isnt that what required already does

#

hmm

#

This line should be doing that already

uncut kelp
#

I can't reproduce that

knotty plover
#

You clearly arent setting required though, yeah

#

uhhh.... I dont know what that line is, you've wrapped it in your own function?

#

...where

#

this is not set to true

#

....no

uncut kelp
#

Doesn't that overload say if it is not there, then it is number | null? It looks like it's working as expected to me

knotty plover
#

Its showing you both possible overloads

#

Thats not how that works

#

It doesnt know what option you defined in a JSON builder

#

Its telling you that the method takes two parameters, the second one being a boolean

#

Which you did not provide

#

So its false

#

.getNumber('amount', true)

#

Gonna ask you not to use that word, but glad the issue is fixed

uncut kelp
#

Wrong guild id, or bot not in guild

#

So logging above gives you the name?

#

That doesn't make sense

rich cipher
#

return null

slow storm
#

Then this error isn't coming from this fetch. Also why u need to fetch a guild. Iirc All the guilds are cached anyway

rich cipher
#

full error so we can know what is it missing access for

hexed lichen
#
        discord.GatewayIntentBits.Guilds,
                                  ^

TypeError: Cannot read properties of undefined (reading 'Guilds')
    at Object.<anonymous> (D:\Other\Coding\discord\ChatBot\ChatBot Alpha - (v2 testing)\V14-DJS\index.js:15:28)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47```
Is it not `Guilds` anymore?
plain roverBOT
hexed lichen
#

oh nvm it seems i installed d.js v13 when trying to install some other package 💀

#

mb

snow acorn
#

Can I somehow retrieve the customId I set for a ButtonBuilder, I used to just get it from the ButtonComponent but it's constructor is now private, so I cannot use ButtonComponent anymore

knotty plover
#

Builder.data.custom_id?

#

try that

snow acorn
#

not in the list

knotty plover
#

custom_id

#

intellisense is not documentation

snow acorn
#

Its Typescript

knotty plover
#

though im not sure builders are documented so

#

Well not all buttons have a custom id

#

So it's not going to show up unless it can narrow the types

snow acorn
#

Shouldve mentioned that sorry :)

#

Yeah I could cast it to APIButtonComponentWithCustomId but that's ugly

#

Its strange because

export declare type APIButtonComponent = APIButtonComponentWithCustomId | APIButtonComponentWithURL;
#

but custom_id is not one of the properties I can chose from even though the e.data is an APIButtonComponent

#

So I cant even narrow it :/ right?

knotty plover
#

Its because the types arent narrowed

idle galleon
#

custom_id is not available on url buttons

knotty plover
#

Its still a union, meaning it doesnt know which one of the two it is unless you check the type first

snow acorn
#

yeah but then custom_id would be undefined | string no?

knotty plover
#

no

idle galleon
#

That’s not how ts works

#

If a property doesn't exist (on a possible type), it's an error

snow acorn
#

So how could I narrow it if I cant check if the property exist? Cannot even ?. it

#

I can use the in keyword, never knew that existed, thanks Monbrey and KinectTheOctopus

gloomy kayak
#

Or you can use button.style !== ButtonStyles.Link

scarlet tangle
#

Why am I getting this error?

forest elm
#

what is embed

#

show how you defined it

scarlet tangle
#

const embed = message.embeds[0]

forest elm
#

EmbedBuilder.from(embed) returns a builder from the original embed, you'll have to use that instead, e.g. EmbedBuilder.from(embed).setColor()

scarlet tangle
#

ah

urban belfry
#

and don't you need to have EmbedBuilder imported from discord.js instead to use Builder.from?

scarlet tangle
#

how can i delete the content of the message and edit the embed?

urban belfry
scarlet tangle
scarlet tangle
urban belfry
#

you're welcome 🤠

junior jungle
#

Hey all, is there a way to convert a permission string (any format) to a PermissionFlagBit?

jaunty vault
#

show an example of a "permission string"

urban belfry
#

use the resolve method on the permissions class?

junior jungle
jaunty vault
#

you need to first convert to PascalCase then resolve

urban belfry
junior jungle
#

Got it!
let permissionResolvable = PermissionsBitField.resolve(command.permissions as PermissionResolvable);. I had to "typecast" the string array to PermissionResolvable since i'm using TypeScript

#

Thanks for the help :)

uneven grove
#

Hi, how can i check bot permissions in v14?

jaunty vault
uneven grove
#

thank you

scarlet tangle
jaunty vault
scarlet tangle
#

Uh sorry

brave dagger
#

Is textInput the only component that we can use in modals?

urban belfry
#

for now

forest elm
buoyant pecan
#

how can i collect modals using a collector

plain roverBOT
regal mason
#

Do you know how I can start my bot (in typescript) with pm2, or is there an alternative ?

knotty plover
#

You should be compiling it to JS anyway

kind pulsar
#

How can i fix this?

plain roverBOT
cinder bane
#
DiscordAPIError[10062]: Unknown interaction
    at SequentialHandler.runRequest (C:\Users\ABHISHEK\Desktop\Celestial\node_modules\@discordjs\rest\dist\index.js:709:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async SequentialHandler.queueRequest (C:\Users\ABHISHEK\Desktop\Celestial\node_modules\@discordjs\rest\dist\index.js:512:14)
    at async ChatInputCommandInteraction.deferReply (C:\Users\ABHISHEK\Desktop\Celestial\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:68:5)  
    at async Play.InteractionRun (file:///C:/Users/ABHISHEK/Desktop/Celestial/commands/music/play.js:50:13) {
  rawError: { message: 'Unknown interaction', code: 10062 },
  code: 10062,
  status: 404,
  method: 'post',
  url: 'https://discord.com/api/v10/interactions/976736461518954506/aW50ZXJhY3Rpb246OTc2NzM2NDYxNTE4OTU0NTA2OjVPU29PN0ZHdjhOWGRsb1RQaXlIQUxMSWZPbEk5M1V3SmJ6OGlHVHpYT3VKNUNTanh2V2dYNnBNVnZJdzBKMFRUNzZwV0kxV1lVeVdyV0t0TmZSa3J5QXA0RFdKTTZ4VjJWYVJOcHVtZWk1MGhLNjlPbDJSNEFJS2lVbElqTmc1/callback',
  requestBody: { files: undefined, json: { type: 5, data: [Object] } }
}

Im receiving this error on interaction.deferReply() the time it takes to execute the code before interaction.deferReply() ranges from 5-10 ms so I am sure that it does not cross the 3 second limit. and after it sends the error, the bot also sends a message using interaction.editReply() below in the code. Im not sure how interaction.deferReply() creates an Unknown Interaction error but proceeds to send an reply using editReply() right afterwards.

#

does anyone know whats happening?

#

also if i try doing interaction.reply() after interaction.deferReply() it shows this error

DiscordAPIError[40060]: Interaction has already been acknowledged.
    at SequentialHandler.runRequest (C:\Users\ABHISHEK\Desktop\Celestial\node_modules\@discordjs\rest\dist\index.js:709:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async SequentialHandler.queueRequest (C:\Users\ABHISHEK\Desktop\Celestial\node_modules\@discordjs\rest\dist\index.js:512:14)
    at async ChatInputCommandInteraction.reply (C:\Users\ABHISHEK\Desktop\Celestial\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:110:5)      
    at async Util.error (file:///C:/Users/ABHISHEK/Desktop/Celestial/structures/Util.js:169:17) {
  rawError: {
    message: 'Interaction has already been acknowledged.',
    code: 40060
  },
  code: 40060,
  status: 400,
  method: 'post',
  url: 'https://discord.com/api/v10/interactions/976736461518954506/aW50ZXJhY3Rpb246OTc2NzM2NDYxNTE4OTU0NTA2OjVPU29PN0ZHdjhOWGRsb1RQaXlIQUxMSWZPbEk5M1V3SmJ6OGlHVHpYT3VKNUNTanh2V2dYNnBNVnZJdzBKMFRUNzZwV0kxV1lVeVdyV0t0TmZSa3J5QXA0RFdKTTZ4VjJWYVJOcHVtZWk1MGhLNjlPbDJSNEFJS2lVbElqTmc1/callback',
  requestBody: { files: [], json: { type: 4, data: [Object] } }
}
#

but i dont understand how the interaction has been acknowledged if it errors on interaction.deferReply() itself?

dawn phoenix
#

would suggest you are trying to defer an interaction that has already been replied to

#

also if i try doing interaction.reply() after interaction.deferReply() it shows this error
that is expected. if you defer, you have to edit, not reply
if you reply that's an initial response, but defer is also an initial response, having two of those will result in "already been acknowledged"

cinder bane
#

Code

console.log(interaction.isRepliable(), interaction.deferred, interaction.replied)

Console

true false false
cinder bane
dawn phoenix
#

unknown interaction would imply that the webhook token for that interaction is expired firT

cinder bane
#

it takes 5-10ms

#

not more than 3seconds

dawn phoenix
#

do you get the red "interaction failed" in the client?

cinder bane
#

nope

#

it executes all the code

dawn phoenix
#

that suggests the interaction was acknowledged

#

so the unknown interaction error has to come from another interaction

cinder bane
#

let me check, I am further editing the message after replying to the interaction so that might cause the error

cinder bane
#

works now

scarlet tangle
obsidian thistle
#

@d.js docs#1083

plain roverBOT
#

discord **How to Get Your Game on Discord: **
read more

vague coyote
dapper forum
#

How stable is v14? Is it okay to be used in prod?

nocturne kayak
#

no one here will recommend you to use dev ver over stable for prod

dapper forum
#

true

ancient light
# dapper forum How stable is v14? Is it okay to be used in prod?

So I Switched to v14 for my bot which I started developing 3 months ago. It is stable enough for the development and I assume v14 will become stable when I am done with the feature implementation. So if you already plan to do A major rewrite of your bot, I think you should at least have a look at the dev branch but for a complete production environment I would definitely not use it.

exotic nexus
#

it's just that things can change unexpectedly

dapper forum
#

sadly i just co-finished a major rewrite to v13 from python codebase I inherited 💀

urban belfry
#

not to mention that moving to v14 is a horrible idea

dapper forum
vague coyote
#

so far yes

#

doesnt mean that will stay like that

tight wasp
#

When discord.js v14 will be realesed?

vague coyote
#

when its done

#

we dont do etas

exotic nexus
#

discord v14 🤔

tight wasp
#

Discord.JS

#

@d.js docs#1083

vague coyote
jaunty vault
#

why are you trying to ping the bot

pseudo garnet
#

How do I need to use GatewayIntentBits?

vague coyote
#

You can just import IntentsBitField from djs

plain roverBOT
pseudo garnet
#

Okay thanks

dim moss
#

what is this err for?

vague coyote
uncut kelp
#

It looks like an internal server error, judging from the status code

pseudo garnet
#

Why does it tell me that TypeError: MessageEmbed is not a constructor? I am using discord.js@14.0.0-dev.1652918983-adf461b.

This is the code:

const { MessageEmbed } = require('discord.js');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { NLD } = require('./parteien.json');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('partei')
        .setDescription('Zeigt Informationen über Parteien an.'),
    async execute(interaction) {
        const partei = "NLD";

        const parteiEmbed = new MessageEmbed()
            .setTitle(`Über ${partei.Name}`)
        await interaction.reply({ embeds: [ parteiEmbed ] });

    },
};
vague coyote
#

Its EmbedBuilder now

pseudo garnet
#

ah okay

copper jetty
#

Import ChannelType enum from discord-api-types and use ChannelType.GuildCategory instead of numbers

gusty gorge
pseudo garnet
#

I think I have found a bug or is it just me with my bad coding skills, I tried to add fields but it just throws this error at me

vague coyote
#

you passed objects instead of an array

#

selectbox probably

pseudo garnet
#

aj

#

ah, I am stupid lol

pseudo garnet
vague coyote
#

then show your code

pseudo garnet
#
const parteiEmbed = new EmbedBuilder()
            .setTitle(`Über ${partei.Name}`)
            .addFields(
                { name: 'Name', value: `${partei.Name}`, inline: true },
                { name: 'Kürzel', value: `${partei.Kuerzel}`, inline: true },
                { name: 'Vorsitzende', value: `${partei.Vorsitzende}`, inline: true },
            )
        await interaction.reply({ embeds: [ parteiEmbed ] });

works fine without the .addFields() section

vague coyote
#

that takes an array as well

copper jetty
#

you didn't pass array array is []

pseudo garnet
vague coyote
#

It was changed

pseudo garnet
#

oh

vague coyote
#

I mean you are using a dev version

#

changes happen all the time

pseudo garnet
#

yeah, the problem is I have to use the dev version just for one thing and that is interaction.options.getAttachment()

pseudo garnet
#

I tried but it didn't work, in @builders there is already the option to add it as an option to your slash command but in the default library there wasn't a way to get it

vague coyote
#

its in 13.7

pseudo garnet
#

ah

brazen knoll
#

Where is the typing for Message Payloads using EmbedBuilders?
cuz on Discord.MessageOptions Embed.data doesnt exist (since its an API Embed)

vague coyote
brazen knoll
#

yes

vague coyote
#

EmbedBuilder.from(apiembed)

#

afaik

brazen knoll
#

wrong answer, i already have the embed from a message

#

i need the Message payload typing where <msg>.embeds.[0].data exists

vague coyote
#

EmbedBuilder.from(msg.embeds[0])
that gives you an embed where you can call .data on

#

or what exactly are you trying to do

brazen knoll
#

i want to define typing

#

for TypeScript

#

but using Discord.MessageOptions TS errors with this

copper jetty
#

i think the type is Embed

vague coyote
#

so why would you define it

brazen knoll
#

im not trying to define embed.data, im trying to find the correct typing where embed.data exists on the payload

hybrid crest
#

getting this error repeatedly, wasn't getting this in earlier releases of v14 (running Button.interaction.deleteReply, Button.interaction.update): DiscordAPIError[10015]: Unknown Webhook```
{
rawError: { message: 'Unknown Webhook', code: 10015 },
code: 10015,
status: 404,
method: 'DELETE',
url: 'https://discord.com/api/v10/webhooks/967521712931487754/aW50ZXJhY3Rpb246OTc2OTg1MjQ2NDI1ODMzNTEyOlNjczZFa0Y0ajkyeVZLYWpRSEoybzFkM0dyRHJFNWRPbXNuZmtkZFFBem04VEpDVzlYclZBZWhVQWsxclRvY2dhSnNOZEV5N3NkV0RTVnJlWHNkN0VZY1dRQXNRT2JnRHNOMjdBTFlld0xsQmJZenZrUTdXQngxejVYYm9tbzVw/messages/@original',
requestBody: { files: undefined, json: undefined }
}

#

this only occurs after the three seconds that the bot has to reply before the interaction times out

uncut kelp
#

this only occurs after the three seconds that the bot has to reply before the interaction times out
Isn't that your issue then?

hybrid crest
uncut kelp
#

But... isn't that your issue?

#

You said it only occurs after the three second window. Why would it even work after that?

pine sentinel
#

Attempting ```js
let guild = client.guilds.cache.get(guildCfg)
let member = await guild.members.fetch(user)
console.log(member, member.nickname)

Returns: ``@pine sentinel``, ``null``, Not really sure what's going on.
uncut kelp
#

Cannot reproduce

pine sentinel
#

Which version?

uncut kelp
#

I could ask the same to you, since you didn't provide any (':

pine sentinel
#

Running discord.js@14.0.0-dev.1652918983-adf461b

uncut kelp
#

I'm on the same commit

pine sentinel
#

Interesting

exotic nexus
#

will also try to repro, hold on

uncut kelp
#

Member fetching hasn't changed in version 14. You're doing something wrong

idle galleon
#

Are you sure the user has a nickname set?

uncut kelp
#

Is that the concern? My concern was them logging the mention instead of the whole object

pine sentinel
#

Apparently I am fucking dumb.

#

Using member.user.username worked.

idle galleon
#

You could’ve done user.username or member.displayName

uncut kelp
#

T_T btw, logging member won't be the mention, I thought that was the issue you were having

pine sentinel
idle galleon
#

Did you override console.log?

uncut kelp
#

Uwot

pine sentinel
#

Anyway it's not a big deal ig

idle galleon
#

nickname is only set if the member changed it

#

displayName is nickname ?? user.username

pine sentinel
idle galleon
#

Felt like you guys have alr spoken before

uncut kelp
#

Ah

hardy vale
#

i love discord js

knotty plover
#

cool

latent lion
prisma kiln
#

Is there any guide about new permissions system and how can I use them in slash commands creation

urban belfry
#

currently a pr i think

prisma kiln
#

k thx

stuck fiber
#

TextInput aka modal is considered a MessageComponent?

outer bane
#

no

stuck fiber
#

so why is TextInput under ComponentType? is there a difference?

#

dunno why its ringing up as any

dim moss
#

ig I found a bug in djs v14 :/
video soon

outer bane
#

it's a component but not a message component

#

it showing up as any is an issue with your IDE, maybe cached typings?

stuck fiber
#

oo ok ok, but it still has the componentType.TextInput as its commandType?

#

just to confirm^

outer bane
stuck fiber
#

thanks 👍

#

one more question,
so one of the ComponentTypes is ComponentType.ActionRow. and lets say i have an interactionCreate event on, would any interaction have a commandType of ComponentType.ActionRow?

outer bane
#

Interaction#commandType is one of ChatInput, User or Message (the latter two for context menus)

#

Interaction#componentType is the component that triggered an interaction, either a button or a select menu

#

action rows are only container for components, they do not trigger interactions

stuck fiber
#

ah ok, thanks

#

and with the included ComponentType.TextInput, im guessing that triggers with the ModalSubmitInteraction?

dim moss
#

it should give the role when I dont have the role and if I have it it should remove it :/

the result of console.log
Code:

if (!mMember.roles.cache.has(selectedRole)) {
    await mMember.roles.add(selectedRole).catch(e => console.log(e))
    await interaction.editReply({ content: `Role ${selectedRole} be ${mMember} dade shod` })
    return collector.stop()
}

if (mMember.roles.cache.has(selectedRole)) {
    await mMember.roles.remove(selectedRole).catch(e => console.log(e))
    await interaction.editReply({ content: `Role ${selectedRole} az ${mMember} gerefte shod` })
    return collector.stop()
}

Full Code: https://sourceb.in/2b2xqGu6E8

#

any idea? 0.0

hoary fox
outer bane
stuck fiber
#

alright, ty for clarification

outer bane
dim moss
#

tnx <3

proud wigeon
#

Hi guys,
What can cause this problem ? DiscordAPIError[50001]: Missing Access
I'm trying to register a slash command in my guild.
Here is the ready event :

module.exports = {
    name: 'ready',
    once: true,
    async execute(client) {
        const guildId = await Config.findOne({ where: { name: 'guildId'} } );
        client.guilds.cache.get(guildId?.value).commands.set(client.commandsArray);
    },
};```
Here is my command handler :
```js
module.exports = (client) => {
    client.handleCommands = async (commandFolders, path) => {
        for (folder of commandFolders) {
            const commandFiles = readdirSync(`${path}/${folder}`).filter(file => file.endsWith('.js'));
            for (const file of commandFiles) {
                const command = require(`../Commands/${folder}/${file}`);
                client.commands.set(command.data.name, command);
                client.commandsArray.push(command.data);
                console.log(`✅ Commande ${command.data.name} chargée !`);
            }
        }
    };
}```
And finally, a command :
```js
module.exports = {
    data: {
        name: 'relancer',
        description: 'Permet de redémarrer le régent.',
        type: ApplicationCommandType.ChatInput,
    },
async execute(interaction, client) {
    await interaction.reply({ content: `⚠️ Redémarrage en cours... ⚠️`, ephemeral : true }).then(() => {
        process.exit();
    });
},
}```
urban belfry
proud wigeon
#

ok thanks 🙂

urban belfry
#

you don't need to kick, just make an invite link and use that again

proud wigeon
#

Works ! Thank you !

urban belfry
#

no thank you!

proud wigeon
#

Anyone knows howto get random color in embed using Colors constants ?

#

before, i used .setColor("RANDOM") but now, we shouldn't use strings so...

proud wigeon
#

Yup, .setColor('Random') works

dim moss
#

what is this err for? 🤔

uncut kelp
#

When you respond to an interaction too late

dim moss
#

ok tnx <3

hybrid crest
proud wigeon
#

How can i change a specific field from an embed ?
I've tried this :

        const { message } = interaction;
            const embed = EmbedBuilder.from(message.embeds[0]);
            if (!embed) return;
            embed.fields[1] = { name: `⛔ Status`, value: `Refused` };```
```TypeError: Cannot set properties of undefined (setting '1')```
plain roverBOT
proud wigeon
#

ohhh...

hybrid crest
# copper jetty Your replying twice

i'm not replying twice, i'm not even replying a second time -- i'm just running ButtonInteraction.deleteReply(), exactly as Monbrey had suggested/recommended a while back

plain roverBOT
hybrid crest
#

while this method is also present on ChatCommandInteraction, the update method is not, and that method is also failing in the same manner (unknown webhook)

note that the contents for the ButtonInteraction.update() and ChatInputCommand.reply() are gotten via the same non-deterministic calls (they request a random post from a site's API using a custom wrapper I wrote), so contents of these messages should not be the issue

#

i've just tested using ButtonInteraction.followUp, same exact result. i'm starting to wonder where the Webhook tokens are stored for command replies

unreal blaze
#

Hi, im getting this random error for some reason. I dont know why its happening, there is no was to find any my code.

#

Anyone knows how to debug this please?

jaunty vault
unreal blaze
#

Ye, i get that. But how can I know, where its happening

#

I have large bot

jaunty vault
#

It's a fetch
I can't really say anything else because stack doesn't show it

unreal blaze
#

Ok, i have commented one fetch that is not under tryCatch

#

lets see, thanks

hybrid crest
#

just to humor everyone who's been saying ButtonInteraction.message.delete, I tried that. it works in servers but not in DMs, and I need this to work in DMs as well

#

using an empty ButtonInteraction.message.edit does not work either, as i get a 50006 "Cannot send an empty message" API error

#

and because it's finally gotten to the point where i cannot see a way forwards without it, code

// file "main.js"
import * as Commands from "./commands/commands.js";
import * as Buttons from "./buttons/buttons.js";
// ...
client.on("interactionCreate", async (interaction) => {
    if (interaction.isChatInputCommand()) return handleChatInputCommand(interaction);
    if (interaction.isButton()) return handleButton(interaction);
});
async function handleChatInputCommand(command) {
    return await Commands[command.commandName](command);
}
async function handleButton(button) {
    return await Buttons[button.customId](button);
}
// file "buttons.js"
export {new_random_post} from "./newRandomPost.js";
export {delete_message} from "./deleteMessage.js";
// file "deleteMessage.js"
export async function delete_message(button) {
    return await button.message.delete();
}
outer bane
#

so you want to delete the message attached to a button interaction? I am doing something similar in my bot with ButtonInteraction#deferUpdate followed by ButtonInteraction#deleteReply

hybrid crest
#

that's actually precisely it, could i peek at the relevant portions of your code?

#

wait, deferUpdate? that's a new one

#

that is ridiculous

#

deferUpdate has just magically solved my problems

outer bane
#

you need a reply to use deleteReply, and deferUpdate is just that

hybrid crest
#

the weird thing is i never had to do that on earlier versions of v14

#

what if i wanted to check the ID of the user before doing an update, to verify it was the same user?

vague coyote
#

message.interaction.userId is a thing, but I'm not sure if the userId is part of the partial data

#

nvm that

hybrid crest
#

so something along the lines of button.message.interaction.user.id !== button.user.id?

vague coyote
#

yep, but dont know if the user is on message.interaction, will have to try that

hybrid crest
#
return await button.deferUpdate({fetchReply: true}).then(async (reply) => {
        tags = Tags.fromURL(button.message.embeds[0].url);
        return button.update(ReplyBuilder.embed(await SiteApi.getRandomPost(tags)));
    });/*
```this is giving me an issue of "reply to this interaction has already been sent or deferred". how do i un-defer it to reply to it?
would i use the reply parameter as `reply.update` instead?
#

or would i await and then reply outside of it?

plain roverBOT
prisma hearth
#

I feel dumb for not understanding the changes to actionrowbuilders committed 2 days ago, apparently .addComponents doesn't exist anymore?

vague coyote
#

still exists

prisma hearth
vague coyote
#

last changes I see are from 29 days ago

prisma hearth
#

even setting the type as a button builder <ButtonBuilder> it still complains

prisma hearth
#

so frustrating

knotty plover
#

Have you restarted TS Server/VSC?

brazen knoll
#

whats the name of the collector typing for the MessageComponentCollector

#

oh i guess its the InteractionCollector

prisma hearth
knotty plover
#

Yeah if you change a version of something and the typings are weird, just restart it first

brazen knoll
#

what does this mean? Why cant i set inline to boolean or undefined

vague coyote
brazen knoll
#

a boolean.. at least it should be

vague coyote
#

Can you show it?

brazen knoll
#

it loops through the fields of another embed and sets them on a new one

#
embedToUse.data.fields.forEach((...[name, value, inline]) => {
          if (!embed.data.fields) embed.data.fields = [];

          embed.data.fields.push({
            name: name ? mod(name, { [option[0]]: option[1] }) : null,
            value: value ? mod(value, { [option[0]]: option[1] }) : null,
            inline: Boolean(inline) || undefined,
          });
        });```
#

Boolean() fixed it

manic lynx
#

PermissionResolvable why its doesnt work?

knotty plover
#

gonna have to give waaaaaaaay more detail than that

manic lynx
plain roverBOT
manic lynx
#

and also this I think this is a error from discord.js

jaunty vault
#

It's not
It's from undici

knotty plover
#

I mean, its a core djs dep

#

But generally this just means your internet is down or something

#

Its not djs at fault

manic lynx
#

okay thanks

latent lion
#

What is EnumResolvers now

#

Did it get renamed

knotty plover
#

removed

latent lion
#

Then how

#

ButtonStyle?

#

If I do buttonstyle this happens

knotty plover
#

Thats not a button style

#

Thats not anything

#

ButtonStyle.Secondary

latent lion
#

Nope

#

I defined

#

secondary

#

That should work, right?

knotty plover
#

Well that seems very pointless but okay, that would have been very relevant to know before

#

Its because youre not passing an array to addComponents

latent lion
#

Oh

manic lynx
#

how do I get a autocomplete for slash cmd options?

nocturne kayak
#

specify autocomplete: true on string/number option

manic lynx
nocturne kayak
#

not sure what you are trying to achieve
can you elaborate again

manic lynx
#

BTW how do I get a enums

ruby dagger
manic lynx
ruby dagger
urban belfry
forest mulch
#

TS2339: Property 'me' does not exist on type 'Guild'.

nocturne kayak
#

it's <Guild>.members.me now

forest mulch
#

oh okay

#

TS2304: Cannot find name 'IntentsBitField'.

nocturne kayak
#

IntentsBitfield

forest mulch
#

oh- my bad

rich cipher
sterile hemlock
#

✨ Breaking Changes ✨

forest mulch
#

error TS2339: Property 'guild' does not exist on type 'never'.

forest mulch
#

Property 'members' does not exist on type 'VoiceState'. Did you mean 'member'?

forest mulch
prisma kiln
#

um ur using typescript ?

#

define the types of objects

rich cipher
plain roverBOT
manic lynx
manic lynx
hoary fox
manic lynx
tame gazelle
manic lynx
manic lynx
white nebula
#

Uncaught DiscordjsError RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: GUILDS.

manic lynx
white nebula
mental inlet
#

or intentbitfields, whichever you're using idk

white nebula
mental inlet
#

in v14 you don't use strings or magic numbers, you use enums

white nebula
#

oh ok

mental inlet
#

np

tame gazelle
mental inlet
tame gazelle
#

yep

#

intents: ['Guilds']

mental inlet
#

oh never knew that, thought everything got switched to enums 😂

#

btw is there a github page for v14?

gloomy kayak
#

There's a guide (wip) in the pinned messages

mental inlet
#

that isn't what I mean, I meant is there a github page to report bugs and issues?

velvet jasper
#

Yes the GitHub, the dev code is based on the main branch

random cobalt
#

Where can I find the patch to see localized slash commands?

copper jetty
random cobalt
#

do you have an invite link to that?

copper jetty
exotic wind
#
client.user.setActivity('text', { type: ActivityType.Watching });
```does not work
uncut kelp
#

Works for me

dusky agate
#

<guild>.me was removed?

copper jetty
#

Yes

#

Use <Guild>.members.me if you want to get the bot as GuildMember object

dusky agate
#

ok thx

chilly zephyr
#

I don't get what's going wrong

let embed = EmbedBuilder.from(JSON.parse(json));```
```json
{
  "title": "Embed Title",
  "description": "Test Description",
  "color": 16741839
}```
```data.embeds[0].description[BASE_TYPE_REQUIRED]: This field is required```
jaunty vault
#

The embed of the message has no description

chilly zephyr
#

Yeah I got that memo too. Printing embed returns the following:

EmbedBuilder {
  data: {
    title: 'Embed Title',
    description: 'Test Description',
    color: 16741839
  }
}```
knotty plover
#

EmbedBuilder.toJSON when sending maybe?

#

I'm not certain on builders

#

You could just send that json directly though too

chilly zephyr
#

I need to add my own value later on like adding a text field to the builder. Would that still work this way?

knotty plover
#

Yeah

chilly zephyr
#

That seems exciting

#

Will give it a shot, thank you

manic lynx
#

Is there a autocomplete for client events?

nocturne kayak
#

too much vague question. what are you trying to do?

manic lynx
knotty plover
#

There's an enum iirc

manic lynx
thorny haven
#

I think it's User/Message ContextMenu

idle galleon
#

Is the method naming not self-explanatory?

#

They both trigger isContextMenu

#

Then there’s the more specific methods to target them individually

thorny haven
#

zaebis okay

idle galleon
#

isCommand should include chat input too

thorny haven
#

Yes, I already understood that the context menu, thank you

livid raft
#

Hey, so I am making a userinfo command in which I am getting the user's custom status emoji but when i display it in embed, it says NaN

dawn phoenix
#

that'd suggest you are converting it to a number somewhere

thorny haven
#

for some reason, guild.commands.fetch() is running for a very long time

#

sometimes there is no response from this function at all

thorny haven
#

and where did EnumResolvers go in the latest version?

tame gazelle
#

it has been removed

thorny haven
proud wigeon
#

Guys, how can i use EmbedBuilder.setImage() with a local file so that the image will be inside the embed and not outside like a normal attachment ?

plain roverBOT
#

Suggestion for @proud wigeon:
guide Popular Topics: Attaching images
You can then reference and use the images inside the embed itself with attachment://fileName.extension.
read more

proud wigeon
#

thanks 🙂

prisma kiln
#

why ChatInputApplicationCommandData doesnt contain properties for member permissions

knotty plover
#

Because that PR isn't merged yet

prisma kiln
#

:(

#

but can I do it with builders ?

knotty plover
#

Dunno, I dont use them

dawn phoenix
#

i mean, just #toJSON and then stitch it onto the object

thorny haven
#

please explain how to add options to addChoices() (SlashBuilder)

white nebula
#
.addChoices(
                    { name: 'name1`', value: 'value1`' },
                    { name: 'name2', value: 'value2' },
                  

                )
                .setRequired(true)```
thorny haven
#
const events = [
    "Коднеймс",
    "Шляпа",
    "Своя игра",
    "Бункер",
    "Дурак онлайн",
    "Крокодил",
    "Кто я?",
    "Монополия",
    "Покер",
    "Пазлы",
    "Сломанный телефон",
    "JackBox",
    "Шпион"
]

new SlashCommandStringOption()
                    .setName("name")
                    .setDescription("Укажите название ивента")
                    .addChoices(events.map(x => ({ name: x, value: x })))
                    .setRequired(true)``` I wanted to do something like this, but the builder gives an error
forest elm
#

and what is the error

thorny haven
#

in fact map should give .addChoices() like this -> [{ name: "", value: "" }, { name: "", value: "" }] but that doesn't happen

copper lodge
thorny haven
#

and through what should I add an array with objects

copper lodge
#

like this

.addChoices({name: "Коднеймс", value: "Коднеймс" }, {name: "Шляпа", value: "Шляпа"} ...)

not this

.addChoices([{name: "Коднеймс", value: "Коднеймс" }, {name: "Шляпа", value: "Шляпа"} ...])
thorny haven
copper lodge
idle galleon
#

.members.me

copper lodge
#

ok thx

copper jetty
copper lodge
copper lodge
amber sequoia
#

Why is client.user.setActivity not working on this version ?? it sends a response back with null on other client properties for activity and doesn't set it on status

uncut kelp
#

Cannot reproduce

copper jetty
copper lodge
#

oh

copper lodge
gentle bane
#

when i send an embed it give an error like that 14.0.0-dev.1653091711-fdeac9d

umbral slate
proud wigeon
#

So they changed addChoices again... Fine. Did they changed EmbedBuilder.addFields() so that we can pass objects instead of array of objects ?

copper jetty
mental inlet
#

is 14.0.0-dev.1653091711-fdeac9d the latest version?

#

for dev branch i mean

dawn phoenix
mental inlet
#

oh alright ty 👍

gentle bane
limpid stratus
#

When is v14 considered ready? Is it when their are comming less prs or when alot of the issues are solved or when crawl feels like it or what?

umbral slate
#

Their

limpid stratus
limpid stratus
umbral slate
#

It seems more likely to be the latter tbh

#

The reviewers have been kinda inactive too so when they feel like reviewing all the current prs ig

limpid stratus
#

k

weak ridge
#

Hi! How can I have a member's banner?

plain roverBOT
weak ridge
#

The banner of a member who is only on one server

copper jetty
dark light
#

oh, yeah that's not available

weak ridge
#

There really is no way?

copper jetty
#

they can send their banner in chat input command attachment option

weak ridge
dawn phoenix
#

for some reason discord lets you read the global one, but not the in-guild one

thorny haven
#

Is it possible to convert message.member.permissions to a collection and then apply hasAll?

thorny haven
#

So I need to put an array of permissions into the function to check if this user has 2 or more of these rights at the same time

mental scarab
#

Hey, I get TypeError: MessageEmbed is not a constructor when trying to create a new MessageEmbed().

#

Was this changed in the Dev Build?

uncut kelp
#

Yes, a long long time ago

mental scarab
#

It now uses arrays right?

haughty path
mental scarab
uncut kelp
uncut kelp
mental scarab
haughty path
#

thats the guide for v13

uncut kelp
#

That's not the update guide pinned

mental scarab
#

The Screenshot is from this URL

uncut kelp
#

No it's not

uncut kelp
mental scarab
#

Oh sorry my fault. It redirected me

#

Hey, I now get ```js
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```

#

With this Code: js let server_embed = new EmbedBuilder() .setTitle(`:game_die: Server Manager`) .setDescription(`Du hast ${server_amount} Server! Verwalte die Server indem du den jeweiligen Server im Select Menü auswählst!`) .setColor(0x00FFFF) .addFields([ { name: 'one', value: 'one' }, { name: 'two', value: 'two' } ])

#

And the addFields Code is copied from the new Guide

copper jetty
#

whats your discord.js version

mental scarab
uncut kelp
#

Hmm that's a ~month old

mental scarab
#

oh

#

ill run npm i

#

discord.js@14.0.0-dev.1653091711-fdeac9d

proven wolf
mental scarab
proven wolf
#

Hello,
I have been trying for a while to send attachments from one message to another (for ticket support). However I still get the same error and I can't find a solution.

DiscordAPIError[50035]: Invalid Form Body
attachments[0].id[BASE_TYPE_REQUIRED]: This field is required
private convertAttachment = (attachment: DatabaseTicketMessageAttachment): Attachment => {
  const discordAttachment: Attachment = new Attachment(attachment.attachment_url);
  if (attachment.attachment_name) {
    discordAttachment.setName(attachment.attachment_name);
  }
  return discordAttachment;
}
export type DatabaseTicketMessageAttachment = {
    id: number,
    ticket_message_id: number,
    attachment_url: string,
    attachment_id: Snowflake,
    attachment_name: string | null
}
outer bane
#

seems like you try to send them inside the attachments instead of the files array

proven wolf
# outer bane seems like you try to send them inside the attachments instead of the files arra...

I get them in the attachments of a message but I have to send them as a file?

if (message.attachments.size > 0) {
  for (const attachment of message.attachments.toJSON()) {
    await this.contactStaff.repositories.ticketMessageAttachements.create({
      ticket_message_id: ticketMessage.id,
      attachment_url: attachment.url,
      attachment_name: attachment.name,
      attachment_id: attachment.id
    }, false);
  }
}
outer bane
#

files to send new attachments, attachments to edit existing ones (that's why the id is required)

proven wolf
#

oh ok thanks

bronze garden
#

would it be safe for me to run v14 and override rest and ws version to use api v9 until the end of august? or is there something that would actually break when substituting in v9? from my limited testing it seems to work fine

idle galleon
#

Why would you use api v9 on dev?

bronze garden
#

can't toggle message content intent on since my bot was previously whitelisted without it

scarlet tangle
#

You need to instead apply for the intent by going in the developer portal

bronze garden
#

i know that, but v10 is enforcing it already whereas v9 isn't, or am i wrong?

#

like if your bot was whitelisted without it, you basically can't use v10 and get message content without applying and being accepted for it even though it isn't required yet

#

because the UI prevents you from toggling it on

#

and with a bot that isn't whitelisted, you can just freely toggle it on and off

idle galleon
#

Hence, you should apply for the intent

scarlet tangle
bronze garden
#

not really looking for a lecture, i understand the situation and was just asking a simple question

scarlet tangle
idle galleon
#

You can ask the discord dev server

#

Most api version changes aren't backwards compatible

bronze garden
#

the only change i've really seen is just the message content stuff, one message from advaith points to it possibly being backwards compatible so i figured someone might know if that's true or not

scarlet tangle
#

if advaith says it then it's probably fine

idle galleon
#

I trust him

knotty plover
#

yeah except he said that because discord.js apparently doesn't accept a ws version lol

#

So you can only change the API, not the ws

bronze garden
#

ah okay, thanks

cinder bane
#

which permission is required by bot to unban members?

#

BanMembers?

#

or none

dawn phoenix
#

yes, if you can do it, you can undo it

rich cipher
#

What if I used v10 on v13

granite yacht
#

How does timeout work in discord.js v14?

dawn phoenix
#

not too differently from before

plain roverBOT
granite yacht
#

I use the package called ms

#

Any idea how to fix?

dawn phoenix
#

because you supply something that's not a number where a number is expected

granite yacht
#

Uhm what?

#

Think i found out why

#

now it changed from nan to the footer

#

Fixed

ivory tartan
#

Yo

client.on('ready', async () => {
    console.log(`Ready!`);
 client.user.setPresence({ activities: [{ name: 'New Members :eyes:', type: 'WATCHING' }], status: 'idle' });
});

the name isnt loading but status loaded, why tho?

proud wigeon
#

Try this and tell me if it's working

ivory tartan
outer bane
#

you have to use the ActivityType enum instead of a string

ivory tartan
outer bane
#

this channel is for v14 support

little beacon
#

just out of curiosity, are there major changes from the v13 code and commands or they are same but with new version of discord api?

forest elm
#

wip guide in the pins

unreal stump
scarlet tangle
#

hi so i have a messageCreate event and when i console log a message's content, it's blank

#
client.on('messageCreate', async (message) => {
  if (message.author.bot) {
    return
  }

  console.log(message.content)
  console.log(message.content.toLowerCase().includes('w/l'))
  
  if (message.channelId === '781682961556832326') {
    if (message.content.toLowerCase().includes('w/l') || message.content.toLowerCase().includes('w/f/l')) {
      await message.react('🇼')
      await message.react('🇫')
      await message.react('🇱')
    }
  }
})
#

i'm not sure what's up with that

knotty plover
#

You probably havent specified the MessageContent intent

scarlet tangle
quasi dew
#

im confused , how do i set Streaming status ( yes i use Dev version and not v13 ),
loike i tried 1 as discord dev docs suggested for enum and its either says playing or none at all,
i pass thr url property, my twitch link btw i also tried 0,2,3,4 and i only got playing, watching, listening, thats all.
lmk if it changes or just me being dum. ping if reply

#

No worries, its just me being not patient, its update soo slow :/

#

its enum 1

buoyant pecan
#

how can i receive messages of a channel and all of its threads

hoary fox
buoyant pecan
#

how can i find a specific message in a thread

copper jetty
#

<ThreadChannel>.messages.cache.get(id) <ThreadChannel>.messages.fetch(id) <- this is better

hoary fox
buoyant pecan
copper jetty
buoyant pecan
#

ohhh

#

i had it like that but it didnt find my message....

copper jetty
#

maybe the message wasn't in cache

noble kernel
#
const msg = await webhookClient.send({ embeds: [embed], username: message.author.tag, avatarURL: message.author.displayAvatarURL() });
await msg.react("978724308610351154");
await msg.react("978724321092571186");

TypeError: msg.react is not a function?

neat pier
#

Ye

wary holly
#

Invite bot, screen shows null when done, how to show discord screen instead of blank page and null?

knotty plover
#

Not discord.js related

proud wigeon
#

Why don't you use setPresence ?

wheat sequoia
#

hi, when i mention channel in message collector, bot doesn't see this channel. I tried log message content, all mentions, channels mentions and nothing. Do anyone know how to fix this?

wheat sequoia
#

yes yes, I got lost and wrote nonsense, that's the way it should be

#

and this returns undefined

#

although I mention the channel

gloomy kayak
#

Do you have message content intent?

wheat sequoia
#

yes

wheat sequoia
#

full code

forest elm
#

you went back to the "nonsense"

#

m.content is a string, it doesn't have an id property

wheat sequoia
amber sequoia
#

is it possible to add a video from url to an embed?

proven wolf
amber sequoia
#

how do u do that rounded screenshot thing?

proven wolf