#djs-in-dev-version

35223 messages · Page 25 of 36

copper nymph

but whenever I add anything to try and get that information, it doesn't work and tells me its undefine.

white nebula

Make sure you treat the cache as a Collection<string, Role>
For instance, the full Collection does not have a .permissions property; only the Role entries within it

copper nymph

Ok well thats more complex then as I need to list all the roles and show their bitfield. I will play around and try to figure it out.

Like I need that output, but also need it to show the bitfield.

plain roverBOT
white nebula

you can map the Collection into each Role's permission bitfield

copper nymph

Thanks, that shows the bitfield now... But removes the rest of the output. I will go play around and see if I cant find a way to make it show all the data including the bitfield.

brazen knoll

why does <client>.decrementMaxListeners() remove 1 listener, doesnt that break some event?

nocturne kayak

isnt that private? that's meant to be used internally in the lib

brazen knoll

yes im aware, this question is lib internal

knotty plover

Those methods are used internally by collectors

increase listeners, bind collector

brazen knoll

i am also aware of that

knotty plover

when it ends, decrease again

So whats your question?

brazen knoll

so decrementing has to do with binding?

knotty plover

I mean

The max controls how many you can bind without it throwing warnings/errors

So to make sure collectors dont throw errors, it increments, binds, then when the collector is over, unbinds, decrements

brazen knoll

aha, i see.. i think

knotty plover

The default Node sets it to is 10 listeners per event

brazen knoll

cuz it kinda seemed weird how there are 6 .on() added, on end 6 removeListener() called and then one additional listener removed via decrement

knotty plover

Where is that?

knotty plover

If its 6 different .on then its fine, its the max per event

Yeah thats fine

brazen knoll

yeah im not saying its not, just trying to understand why its there

knotty plover

Its only adding 1 of each type of listener so the max only needs to increase by 1

brazen knoll

oh i didnt see the incrementMaxListeners CS_BRUH

knotty plover

Yeah

Its just reversing that when it ends

brazen knoll

yeah no nvm, thanks monbrey peepoLoveMonbrey

frigid flint

uhh ??

did sending a message with components changed ?

knotty plover

The typings might have, show your code?

frigid flint
idle galleon

Show how the row is defined

frigid flint

it just edits the existing message with new components

did i miss something on my code ?

even at my interaction.followUp

idle galleon

Are you using ts?

frigid flint

yes

idle galleon

You need to specify what the ActionRowBuilder contains

frigid flint

ahh i see

frigid flint

cuz Message is removed from everything like MessageEmbed to Embed

idle galleon

It’s from discord-api-types

frigid flint

ahh i see

👀

knotty plover

How did you do that?

frigid flint

wait

by setting the type

knotty plover

new ActionRowBuilder<ButtonBuilder>()

frigid flint

fixed this tho

knotty plover

Try on the constructor, not just the type

frigid flint

ah i see

yea fixed

thanks 😉

btw how to push a button inside a actionrow array ?

this is what i got

dont mind the code being weird

knotty plover

Uhhhh you probably have to toJSON() it

frigid flint

oh ok then

thanks

u mean JSON the message or the components ?

because u cant JSON an array

knotty plover

the btn

frigid flint

oh ok

now this

knotty plover

Yeah no idea then

I don't use builders

Shit like this is why

frigid flint

oops ok

knotty plover

Why are you pushing instead of using addComponent though

frigid flint

its an actionrow component from a existing message

knotty plover

yeah

Oh

Yeah in that case you cant modify it

You need to construct a new builder using ActionRowBuilder.from(the one from the message)

frigid flint

wait but i did in v13

ahh i see

slow storm
frigid flint

oops, forgot that

knotty plover

But youre not in v13 anymore

slow storm

u should reconstruct it

frigid flint

ok

frigid flint
slow storm

yeah

frigid flint

ok then, thanks

how to add an new row to a existing message

with components already

i have msg.components already

idle galleon
frigid flint

oh yea u can do that

wait but the components are already an array

idle galleon

That’s what the spread operator is for

frigid flint

ahh i see

thank u

hmm

ok worked

idle galleon

You can’t type rowe w/ that constructor?

frigid flint

??

idle galleon

new ActionRowBuilder<ButtonBuilder>()…

frigid flint

ok this worked

yea yea thanks

green plume

I want every permission to get removed. What should I put in permissions:?

role.guild.roles.cache.get("role id").edit({
                                    permissions: ,
})
dawn phoenix

0

green plume

Okay, Thanks

Should I put it like permissions: PermissionsBitField.Flags.0 or only permissions: 0?

viral rapids

just 0, there is no such thing as empty permissions in PermissionsBitField

green plume

I have tried putting 0, but it didn't work out

rain bramble
green plume

ok

forest mulch

escapeMarkdown isnt a thing anymore?

i can see the options for it though

idle galleon

It’s prob in the Formatters

outer bane

should be a top level function in latest dev

idle galleon

Huh, not in Formatters

urban belfry

for some reason search isn't showing up

yeah checked other functions, searching functions don't show up

uncut kelp
copper jetty

Why you deleted the Util class @uncut kelp

uncut kelp

I didn't

copper jetty

Who deleted

uncut kelp

Who indeed

urban belfry

who to git blame 😲

idle galleon

Strange

copper jetty

Ill look at the github commits maybe Ill find it out somehow

Who is suneettipirneni

rain bramble

Developer

copper jetty
shadow plume

they* dont assume gender smh

rain bramble
unreal stump

util wasn't even deleted, it was moved

copper jetty
scarlet tangle
copper jetty
silent hedge

because having a class like that with purely static methods is an anti-pattern

🤷 this wasn't done sooner since our documentation didn't support displaying top level functions, is all

copper jetty
amber sequoia

is Interaction.isAutoComplete() removed from v14 ??

amber sequoia

how do i define this

velvet jasper

Import it

amber sequoia

why is this not working js client.user.setActivity(`your stats | /help`, { type: 'Watching' })
it works if i remove the type and then it sets it to playing

urban belfry
amber sequoia

Ok

urban belfry

no

that's v13 🤠

amber sequoia

it worked ty (ActivityType.Watching)

tidal lichen

can someone help and me and explain why isModalSubmit() doesn't exist
I have already made sure I am running discord.js@dev as I also noticed isCommand() doesn't exist

steel haven
tidal lichen

👍

copper jetty
steel haven
marble barn

check pins

scarlet tangle

hello

who can help me in discord js coding

strange ruin

hi, is it possible to invoke a command after a slash command(chaining commands)?
for examble i want to make a slash command (addNumberOption), and base on the input number i wanna chain another command.

how can i do that?

scarlet tangle
plain roverBOT

guide Interactions: Building and responding with modals
read more

hoary fox

look at warning

proven forge

@ebon boughjs docs#1083
Sorry

ebon canyon

ETA on stable v14?
When it's ready™️

is it soon enough that i should be basing new work on it or on v13?

red mountain
ebon canyon

the api churn frustrates me, every year or two i have to rewrite everything or my bots all break

red mountain

well we can't do anything about that 🤷‍♂️

ebon canyon

will the migration to v14 be as dramatic as the migration to v13?

red mountain

well, every version has breaking changes if this answers your question

marble barn

My upgrade was pretty smooth, but having TypeScript complain to you helps a lot

velvet jasper

I mean that’s lot of lines of code…

marble barn

You should have seen my v12 to v13 upgrade

velvet jasper

Maybe I should’ve

marble barn

Context: I was writing in pure JS before, no typescript

spiral agate

For the modals, can you like show different questions based on previous answers?

vague coyote

You cannot change the modal midway through if thats what you are asking

spiral agate

So I need to send separate ones after they answer the previous ones

vague coyote

You cant send a modal on a modal submit tho

spiral agate

What if I await for the modal to be submitted from the interaction that sent the modal in the first place

green plume

How do I get the guild avatar url and guild banner url of a user? I mean the avatar and banner which nitro users can set in different guilds

vague coyote

You cant send a modal on a modal submit
neither can you send a modal on an interaction already replied with a modal

spiral agate

o_o

vague coyote
green plume

Oh okay.

spiral agate

Is that a discord limitation or discord.js limitation

tame gazelle

discord

spiral agate

Guess im sticking with messages containing buttons

green plume
vague coyote

please

dont blindly cope paste

interaction.member

green plume

Thanks

iron parrot

hey guys
one question, can i add buttons to embed in discord.js?

jaunty vault

no, you can add it under at the bottom

urban belfry

not related to one another

iron parrot

like this right? I'm looking for this but i'm not sure if this is possible through embeds

urban belfry

buttons and embeds are both something you attach to messages
and they are placed as such
content are above embeds are above components

iron parrot

oh sorry

i didn't mean embed, i meant webhooks

urban belfry

they aren't mutually exclusive, you can add embeds and not buttons, buttons and not embeds or both they're really not connected

iron parrot

is it possible to put buttons on webhooks?

i think i confused the two sorry

jaunty vault

yes, you can

iron parrot

how may I do that?

urban belfry

if the webhook is created by your bot, it can have all types of buttons

iron parrot

what if its not, i just made the webhook myself

not using any bot, is that possible?

urban belfry

think about it, the button needs to be handled, if the webhook isn't attached to an application, what's going to handle the button when you press it?

if you don't have an application connected to the webhook, you can just make it use a url button afaik

iron parrot

Thats true, but i'm not looking for any action to call, mostly just a hyperlink

urban belfry

the invite button here is a "link style button"

what they do is simple, just redirects the user to a link

iron parrot

can i add that to an webhook?

urban belfry

yes you should be able to

iron parrot

how can I do that? I couldn't find anything on it at github

tysm btw!

forest elm

if its not application-owned you cant send any components

iron parrot

so no link style buttons to embeds?

thank you!

urban belfry
forest elm

yes, no

green plume

Why do I get undefined?

plain roverBOT
scarlet tangle

Read the documentation, you must force fetch the user to get bannerURL

green plume

Okay

lusty cairn

I want to ask whether the default emoji from the discord must be used like this too?

.setEmoji({ id: "969419421644902431" })```
copper jetty

Default emojis dont have ids they have names

You need to pass the unicode emoji to name

lusty cairn

ok, I get it

green plume

roles.highest shows the highest role. But if I want to see the highest role of a user which contains role icon how can I get that?

green plume

👍🏻

hasty gorge

anything new added to v14? havent check since more than a month

urban belfry
hasty gorge
urban belfry

i mean a lot has been added in the past month
it's not covered in the guide completely, there isn't really a changelog yet
so there tyou go

green plume
urban belfry roles.icon 😲

okay suppose the highest role don't have any icon. then it would return null, So the bot will check which higher role have icon. and it will give that.
How can I do that?

urban belfry

it'll give you the highest role with an icon

plush pasture

quick question when is it going to release?

outer bane

as always, no eta

errant sail

may i know what are the features that are available in djs@dev?

acoustic temple

I'm getting this error: TypeError: interaction.isAutocomplete is not a function
What's the correct name of this function?

Or I should now use the type property?

vague coyote

type property

acoustic temple

😔

thorny haven

😔

thorny haven

https://thumbsnap.com/i/LaCzQ4sQ.png how do I define other types for the interaction parameter? it's just that not only chatinput commands will come here, but also buttons and menus.

knotty plover

else if(interaction.isAnotherType())

whatever that might be

thorny haven

the fact is that the interaction parameter will accept only the interaction that is specified, the main one, and the component itself will not show, or does it not work that way?

scarlet tangle

"Invalid Token Used"

I am Keep On generating the Tokens Again And Again But This Is Saying The Same Thing As Before

@knotty plover , Help Me, Sir

knotty plover

no

scarlet tangle
knotty plover

no

scarlet tangle
knotty plover

Read the server rules, specifically rule 6

scarlet tangle

umm hehe

Sorry, Sir

Can You Still Help Me Out?

knotty plover

still no

scarlet tangle
pine compass

how do i call the new ColorResolvables in v14 inside of embed objects?

lets say i want to use the random string

AttachmentBuilder i think

exotic nexus
pine compass

ah

Colors.Random?

exotic nexus

not sure about random, but you can use colors like Colors.DarkGreen or Colors.Blue etc

nope random doesn't exist

exotic nexus

oh

nocturne kayak

you can use resolveColor('Random') to get a random color

pine compass

idk if it works tho, always gives me black

exotic nexus

then it doesn't work

pine compass
nocturne kayak

are you on the latest dev release

pine compass

i think so

nocturne kayak

did you import the func from djs

pine compass
pine compass

nvm nvm i figured it out, thanks

worksss

scarlet tangle

oh ok you already fixed

tame gazelle

the Util class has been removed?

urban belfry

like constant {someUtilMethod} = require("discord.js")

tame gazelle
urban belfry

xactly

regal mason

Is that a feature or a bug ?

dawn phoenix

don't think autocompletes have min values?

people just type things and you respond with up to 25 things to select from

the type determines if the value is a string or a number

regal mason

Yeah

dawn phoenix

so what do you expect a min value to be?

regal mason

But with autocomplete you can as well input custom values

And in my case it's a withdraw command and the minimum amount is 10

But I check that bot-side now

dawn phoenix

you need to, there are no min values for autocomplete

you being able to bypass it by tabbing before anything comes up is more of a quirk than a feature

you're not really supposed to input custom things there, you're supposed to wait for the list to select things from

regal mason

🤔

I think this is okay

Because in my case you would have to only choose between to withdraw only all or half your game money that would be annoying

dawn phoenix

sounds like you don't want autocomplete in the first place, tbh

if it's just a numerical value, you can specify min and max and call it a day

there is no reason for autocomplete there

regal mason

This is just a plus, if the user wants to withdraw half, or in the case of a deposit command, he will be able to choose to deposit all at once rather than making another command to know how much he can deposit and then write the exact number

On PC that's not a big deal but on mobile that's a lot more intuitive and easy to use

prisma kiln

did they updated commands interface for new member and dm permission in dev version, last time I checked only the builder has it

white nebula

Yes, the command managers have them now too

prisma kiln

cool

covert cipher

since the autocomplete results are more like suggestions

scarlet tangle

Hi, anyone have an idea why bot emoji do not work on 1 server, and on others?

white nebula
scarlet tangle

okay, ty

dawn phoenix
covert cipher

I think it's documented that you can do custom values

dawn phoenix

then the UX is... interesting, to say the least

spiral agate

How do I send messages in channels now? channel.send() is gone...

spiral agate
zealous otter

very cropped image

jaunty vault

and the error is?

spiral agate
jaunty vault
spiral agate
let channel = interaction.client.channels.fetch(pingChannelId)

Even the documentation no longer mentions the send method

jaunty vault

I was right, unresolved promise

spiral agate

Ill do a console.log real quick

plain roverBOT

Documentation suggestion for @spiral agate:
method TextChannel#send()
Sends a message to this channel.

jaunty vault

seems there to me

spiral agate

I read the wrong channel object did i

I am missing an await then

jaunty vault

yes, fetch returns a promise

spiral agate

Yep I was

must have missed it while I was refactoring my code

jaunty vault

fetch always returned a promise
v13 and v14

spiral agate

Now I can't seem to display a modal because at ModalBuilder.toJSON (/mnt/DATA/general_programming/CL bot/Club-League-Bot/node_modules/@discordjs/builders/dist/index.js:756:35) { validator: 's.string', given: undefined

The modal displays its components all right in the console log but when I try to display it this happens

[
  ActionRowBuilder {
    data: { type: 1 },
    components: [ [SelectMenuBuilder] ]
  }
]

the modal components

jaunty vault
spiral agate

yea but where is the string supossed to be

        const modal = new Discord.ModalBuilder()
            .setCustomId(`setteam`)
            .setTitle('Select team')
        let teams = []
        for (let team of await sql.fetchteams()) {
            teams.push(team.name)
        }
        console.log(teams)
        const teamSelect = new Discord.SelectMenuBuilder()
        for (let teamname of teams) {
            let option = new Discord.UnsafeSelectMenuOptionBuilder()
                .setLabel(teamname)
                .setValue(teamname)
                .setEmoji(':white_check_mark:')
            teamSelect.addOptions(option.toJSON())
        }
        const actionRow = new Discord.ActionRowBuilder()
            .addComponents([teamSelect])
        modal.addComponents([actionRow])
        console.log(modal.components)
        await interaction.showModal(modal)
forest elm

select menus are not supported in modals

spiral agate

bruh

forest elm

even if it works, it is not released

spiral agate

you telling me I spend 2 hours for nothing?

Is it at least coming soon or discord API wont allow it?

Guess im using buttons

uncut kelp

I mean it's not documented anywhere so what made you think it would work

spiral agate

I needed some way to display a select menu that you do not know what its contents will be

I thought this would work

Since slash commands cannot be updated on the fly without refreshing the entire thing...

forest elm

you can send select menus in messages

spiral agate

Oh dam thats a type of interaction

I thought I could avoid listeners with the awaitModal() thing that I have spotted

but nevermind I guess

forest elm

awaitModalSubmit() uses listeners under the hood

plain roverBOT
forest elm

you can also use this

spiral agate

I mean manually making the listener and then having to delete it

oh that exists as well?

There goes some of the work I did in the past

tidal lichen

does

const tempEmbed = new EmbedBuilder(interaction.message.embeds[0])

no longer work?

outer bane

you can use EmbedBuilder.from(<Message>.embeds[0])

tidal lichen

nvm found the issue

just needed to put .data after [0]
thanks poor reading skills

spiral agate
await interaction.awaitMessageComponent()
                          ^

TypeError: interaction.awaitMessageComponent is not a function
    at Object.execute (/mnt/DATA/general_programming/CL bot/Club-League-Bot/src/commands/team management/setteam.js:60:27)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

uh

I thought command interaction implements InteractionResponses

mental inlet

how do you edit a message to be ephemeral whilst the reply is deferred?

jaunty vault
mental inlet
jaunty vault
spiral agate

I am pretty sure that what I brought up is a CommandInteraction

jaunty vault
spiral agate

The console log says that its type is 2

from interaction.type

jaunty vault

ok?

outer bane

isn't awaitMessageComponent a method on messages?

jaunty vault

yes

also on the InteractionResponse class iirc

spiral agate
console.log(interaction.type == Discord.InteractionType.ApplicationCommand)

returns true

well I do guess that because awaitMessageComponent is not documented on CommandInteraction it is not available

Regular messages it is

mental inlet

how do you edit a button that you've already created?

parameter needs to be APIButtonComponent

jaunty vault
jaunty vault
mental inlet
scarlet tangle
- client.on('message', message => { ... });
+ client.on('messageCreate', message => { ... });
- client.on('interaction', interaction => { ... });
+ client.on('interactionCreate', interaction => { ... });

Im having trouble with this.

Where do i need to change it and what do i need to change exactly

My Event Handler: https://srcb.in/cwhr1YwLNT

My Bot.JS File: https://srcb.in/yPG7teFcnP

mental inlet
scarlet tangle ``` - client.on('message', message => { ... }); + client.on('messageCreate', mes...
  1. people have already explained this to you in #djs-help-v14
  2. don't crosspost please
  3. the above statement:
- client.on('message', message => { ... });
+ client.on('messageCreate', message => { ... });
- client.on('interaction', interaction => { ... });
+ client.on('interactionCreate', interaction => { ... });

already tells you what to do in different parts of your code, get rid of client.on('message', message => { ... }); and client.on('interaction', interaction => { ... }); and replace them with client.on('messageCreate', message => { ... }); and client.on('interactionCreate', interaction => { ... });

mental inlet
scarlet tangle
uncut kelp
mental inlet
scarlet tangle
mental inlet
undone yew

how to fix this error?

my bot is not responding

zealous otter
dull mulchBOT

pr_open #8038 in discordjs/discord.js by nyapat opened <t:1654651775:R> (approved)
fix(webhooks): revert webhook caching (and returning Message)
📥 npm i nyapat/discord.js#revert-webhook-caching

forest elm

@undone yew ^

undone yew

okay

thanks

forest elm

that command doesnt work btw (the npm i ..)

just wait for it to be merged and released

zealous otter
undone yew

what should I do?

zealous otter
undone yew

bot not responding

zealous otter
undone yew

i need to fix this error

zealous otter

you are on a dev version

undone yew

Best not to use webhook until it is resolved

zealous otter

sure

lilac bluff

i have some problems in modal of discord.js

plain roverBOT

Tag suggestion for @lilac bluff:
To help you we need more information:
• What are you trying to do?
• What is your code?
• What errors and debug logs do you have?

red mountain

You can clearly

lilac bluff

ok

1 min

@red mountain@steel haven hi have a somethig

scarlet tangle
scarlet tangle
urban belfry
red mountain

well this support is only for v14 clearly

even category says so

lilac bluff
red mountain

this channel is only for v14 support

lilac bluff

what is change log of v14?

urban belfry

it's a wip

red mountain

yea, tho i do not recommend to use dev for now since it's unstable so you should prolly stick to v13 until official release of v14 (unless you love the risk of getting your bot broken with a new dev update)

scarlet tangle
regal mason

What is the difference between @napi-rs/canvas and node-canvas ?

uncut kelp

That is not related to discord.js

regal mason

That's related to the guide of discord.js

red mountain
regal mason

I'm asking why do you use this library rather than the classical one in your guide

zealous otter

its "faster and better" - core djs contrib

green plume

How can I return something when a user doesn't have a status? What should I put after ===? I have tried null, undefined. But none worked
if (user.presence?.activities === ) return "No Status Available"

vague coyote

check activities.length

green plume

means if the length is 0 then there would be no status?

vague coyote

depends what you mean by status

but yes

green plume

okay

tame gazelle
uncut kelp

No

A pull request should be ready to review when it is ready to review |:

wraith oyster
CombinedError (2)
  Received one or more errors

  1 CombinedPropertyError (2)
  |   Received one or more errors
  |
  |   input.label
  |   | MissingPropertyError > label
  |   |   A required property is missing
  |
  |   input.value
  |   | MissingPropertyError > value
  |   |   A required property is missing

  2 ExpectedValidationError > s.instance(V)
  |   Expected
  |
  |   Expected:
  |   | [class UnsafeSelectMenuOptionBuilder]
  |
  |   Received:
  |   | { setValue: 'general',
  |   |   setLabel: 'Genel Destek',
  |   |   setDescription: 'Genel destek almanızı sağlar.',
  |   |   emoji: undefined }
const selectMenu = new ActionRowBuilder()
                .addComponents(
                    new SelectMenuBuilder()
                    .setCustomId('ticket-msg')
                    .setPlaceholder('Lütfen bir kategori seçiniz.')
                    .addOptions(
                        [
                            {
                                setValue: "general",
                                setLabel: "Genel Destek",
                                setDescription: "Genel destek almanızı sağlar."
                            }
                        ]
                    )
                )

what's the problem?

hoary fox
forest elm
uncut kelp
dusky agate

in discord ^14.0.0-dev.1655381041-4df491c the ready event appears 2 times why?

uncut kelp

Maybe you're listening to it twice

dusky agate

hm that's weird

zealous otter
thorny haven

don't send it here either, there's help on the dev branch discord.js

scarlet tangle

Man

undone yew

Util#resolveColor is removed?

raven hazel
raven hazel

You can import them like this import { resolveColor } from 'discord.js, instead of import { Util } from 'discord.js'

undone yew

i set

raven hazel

It should work

white nebula

Is your dev version up-to-date? The AttachmentBuilder no longer takes just the name as the second parameter, and it instead needs a { name } object

scarlet tangle

Hi, can someone tell me whats wrong?

           const configAds = new EmbedBuilder();
            switch (guildConfig.verified) {
                case true:
                    status = 'ZAAKCEPTOWANA';
                    embedColor = '00FF00';
                    configAds.addFields(
                        { name: 'KANAŁ', value: guildConfig.adsChannelId }, { name: 'REKLAMA', value: guildConfig.adContent || 'Brak' },
                    );
                    break;
                case false:
                    status = 'ODRZUCONA';
                    embedColor = 'FF0000';
                    break;
                case null:
                    status = 'NIE ZWERYFIKOWANA';
                    embedColor = 'FF0000';
                    configAds.addFields(
                        { name: 'KANAŁ', value: guildConfig.adsChannelId }, { name: 'REKLAMA', value: guildConfig.adContent || 'Brak' },
                    );
                    break;
                default:
                    break;
            }
knotty plover

addFields is expecting an array

scarlet tangle

okay, ty

round root

Is there any way to view archived private threads? Channel.threads.cache seems to only include unarchived / public threads
Edit: nvm, seems like now thats including archived private ones? weird.

green plume

I don't why I get this error. This error started to came since I added thumbnail in the embed. Can anyone help me out?

    run: async (ctx) => {
        const role = ctx.interaction.options.getRole("role");

        await ctx.interaction.reply({
            embeds: [
                {
                    author: {
                        name: `${role.name}'s Information`,
                        icon_url: ctx.client.user.displayAvatarURL()
                    },
                    fields: [
                        {
                            name: "__General Info__",
                            value: `**Role Name:** ${role.name}\n**Role ID:** ${role.id}\n**Role Position:** ${role.position + 1}\n**Hex code:** ${role.hexColor}\n**Created At:** <t:${~~(role.createdTimestamp / 1000)}:R>\n**Mentionability:** ${role.mentionable ? "True" : "False"}\n**Separated:** ${role.hoist ? "True" : "False"}\n**Integration:** ${role.managed ? "True" : "False"}\n`,
                            inline: false
                        },
                        {
                            name: "Allowed Permissions",
                            value: `${role.permissions.toArray().map(e => e).join(", ")}`,
                            inline: false
                        },
                        {
                            name: `Role Members [${role.members.size}]`,
                            value: `${role.members.map(e => `<@${e.id}>`).length > 15 ? "More than 15! won't show" : `${role.members.map(e => `<@${e.id}>`).join(", ")}`}`,
                            inline: false
                        }
                    ],
                    footer: {
                        text: `Requested by ${ctx.interaction.user.tag}`,
                        icon_url: ctx.interaction.user.displayAvatarURL()
                    },
                    color: 0x2F3136,
                    thumbnail: {
                        url: role.iconURL()
                    }
                }
            ]
        })
    }

When I use directly use image link instead of role.iconURL() in thumbnail it works fine.

uncut kelp

Read your error closely
data.embeds[0].fields[1].value[BASE_TYPE_REQUIRED]: This field is required
So it has nothing to do with your role icon URL. Look at your 2nd embed field's value

reef meadow

Hey here
what the status of automod feature ? is anything available in dev version or not yet ?

uncut kelp

You can look at the pull request on GitHub

reef meadow

oh mb

mental inlet

Anyone know why ts is giving me an error?

ButtonBuilder.from(ActionRowBuilder.from(row).components[0].data).setDisabled(false);
- Argument of type 'Partial<APIButtonComponent> | Partial<APISelectMenuComponent> | Partial<APITextInputComponent>' is not assignable to parameter of type 'APIButtonComponent | JSONEncodable<APIButtonComponent>'.
- Type 'Partial<APIButtonComponentWithCustomId>' is not assignable to type 'APIButtonComponent | JSONEncodable<APIButtonComponent>'.
-Type 'Partial<APIButtonComponentWithCustomId>' is not assignable to type 'APIButtonComponentWithCustomId'.
-Types of property 'custom_id' are incompatible.
-Type 'string | undefined' is not assignable to type 'string'.
-Type 'undefined' is not assignable to type 'string'.ts(2345)
pine compass

is SlashCommandBuilder part of djs 14?

mental inlet

all builders are now intergrated into the main package

so make sure to remove @discordjs/builders to avoid version conflicts

prisma kiln

wut, updated dev version and got this error

prisma kiln

so it should be like this ?

interaction.type == InteractionType.ModalSubmit

thanks

white nebula

I got this err

forest elm

use AttachmentBuilder

empty urchin
forest elm

you have to typeguard interaction.channel

as the error is telling you, DMChannels dont have permission overwrites

empty urchin

ah yeah I have it (interaction.channel as TextChannel)

I tried (interaction.channel?.permissionOverwrites as TextChannel) at the beginning for some reasons lol

(dump ik)

red mountain

unsure where to ask this, so i ended up asking here:
will djs v13 be discontinued like v12 when v14 officially releases, i have been thinking to work on v14 early before it becomes stable since late may (i might forget sometimes the answer)

fluid bronze

Afaik v13 is supposed to work for some time

Doubt support will be removed right when v14 is released

red mountain

ty for answer

marble barn
hoary fox
marble barn
if (interaction.type !== Discord.InteractionType.ApplicationCommand || interaction.commandType !== Discord.ApplicationCommandType.ChatInput) return;

I love being excessively verbose

forest elm
steel haven
marble barn

dw TS would tell me if it would, I fucking love ts

hoary fox
steel haven

Only those that are replaceable with one single comparison statement were.

velvet jasper

Oh wait

It’s negated

marble barn
velvet jasper

Yeah I thought it was if it was initially

fallow patio

Someone mind letting me know if plain text in certain Message embed areas (Like the footer) are completely deprecated in v14, I understand it’s better practice to use an object but I have several commands with embeds using plain text I’d like to know if I should update

knotty plover

Yes they are

jaunty comet

Is all the rest stuff gonna be in djs instead of a separate package now

Like is the package not gonna get updated anymore

knotty plover

No?

It's part of the single GitHub monorepo but it deploys separate packages

manic lynx

Is this will work??js if (file.type === 'ChatInput') file.type.replace('ChatInput', 1)

knotty plover

i guess

Could just use the enum though

manic lynx
knotty plover

Utterly pointless but sure

urban belfry

is this will not work, no 😦 use enums, that's just easier, don't start liking hacky solutions that don't work

knotty plover

If you want to have this unecessary converter, use file.type = 1

But you're building a workaround for the very reason enums exist - to have a readable string-like value representing a number

knotty plover

properties of objects cant be constants though, thats from something else

manic lynx

Nevermind

surreal marten

what new in djs v14?

jaunty comet
surreal marten

ok

scarlet tangle

How can I convert PermissionFlagsBits.SendMessages enum to just "Send Messages" ( a string )

steel haven
urban belfry

if not, you can just use new Permissions(....).toArray()
then turn it from PascalCase to whatever you want

steel haven

That sounds like v13 not v14

urban belfry

whatever the permissions class is now

but you can still pass the permission to it's constructor and call toArray on it

scarlet tangle

Okay thanks

manic lynx

Is defaultMemberPermissions can recieve an array?

jolly birch

yes

manic lynx
urban belfry
manic lynx
urban belfry

what's the greater context? where's this defaultMemberPermissions being passed to? is it a data for a method?

urban belfry

okay what method

manic lynx
urban belfry

i asked what the method was but oh well i'll assume this is the djs one which takes in permission resolvable, yeah it should work in that case, try it out

pine compass

is there a change in the deploy commands.js in v14, i know its supposed to be using api version 10

urban belfry

i guess now globals are instant too?

other than the changes on builders, i really don't see any more changes (code wise)

steel haven
pine compass
urban belfry

what intents?

jaunty comet

Look in pins for more info

urban belfry

i am so confused

you missed the context, i asked where that specific guide mentions the intents

jaunty comet

Go to the guide not the doc

urban belfry

what doc 😭 what are you talking about 😭 we're talking about changes in the deploy-commands.js
which does not use intents
i know what intents are and how they changed stop confusing me

jaunty comet
jaunty comet

Could you show me where

If you know

Kinda interested

urban belfry

no i am going to sleep, find it yourself

jaunty comet

I mean I wanted to see also but I guess not

I think I found it

I still dont understand

Rest client needs no intents

scarlet tangle

Hey, I have one problem with collectors. I tried making a collector based on defined TextChannel, but it doesn't collect any messages (end event works).
Can anyone help?

const timeoutEmbed = new EmbedBuilder()
                .setDescription(`> You got late! To complete the order press the button below!`)
                .setColor(0x7c6bf3);
            const timeoutActionRow = new ActionRowBuilder()
                .addComponents(
                    new ButtonBuilder()
                        .setStyle(ButtonStyle.Success)
                        .setLabel('Complete the order')
                        .setCustomId('order-complete')
                        .setEmoji({ name: '🔗' })
                )
            const collector = new MessageCollector(channel, { time: 15000 });
            collector.on('collect', m => {
                console.log(`Collected ${m.content}`);
            });

            collector.on('end', cl => {
                // @ts-ignore
                msg.edit({ embeds: [timeoutEmbed], components: [timeoutActionRow] })
            })```
outer bane

do you have the necessary intents to receive message events and perms to view the channel?

scarlet tangle

lmao

youre genius

mental inlet

is there an update log for each new dev version?

outer bane

github commits

mental inlet

ah okay thank you

green plume

How can I check how many members are banned in a server?

supple ibex

can I have the documentation of v14 ?

boreal kraken

Im just sending an array of buttons because action rows throw an error ?

// Action Row Example
 message.channel.send({ 
content: `text`, 
components: [new ActionRowBuilder()...]
})
// Buttons

new ButtonBuilder()
.setLabel(`${i}`)
.setCustomId(`${i}`)
.setStyle(ButtonStyle.Secondary)
little burrow

your buttons need to be in an actionrow

boreal kraken

actionrows didnt work lemme try them again

little burrow

what's not working exactly, and show some code when you're trying to do it

boreal kraken

And the error is just an type error

dawn phoenix

missing the toJSON potatodetective

or what IS the type error?

boreal kraken
dawn phoenix

yep

boreal kraken

added toJSON onto the action row and still the same thing

scarlet tangle

in order to avoid type conflicts

boreal kraken

thanks

scarlet tangle
dawn phoenix

oh right, that's not rest potatodetective

steel haven

Hi, what is AnyInteraction ? thinkMan

outer bane

a union of all different types of interactions, will be renamed to Interaction later

outer bane

what do you want to fix?

somber mirage

Why it throws this error?

Code:

    const embed = new EmbedBuilder()
        .setTitle("Uncaught Exception")
        .setDescription("At: " + origin)
        .setColor(15548997)
        .setFields([
            {
                name: "Error Name",
                value: error.name ?? "Unknown",
                inline: true
            },
            {
                name: "Error Message",
                value: error.message ?? "Unknown",
                inline: true
            },
            {
                name: "Error Stack",
                value: error.stack ?? "No Stack",
                inline: false
            }
        ]);
steel haven

How to find them?

outer bane

type your interactions as AnyInteraction and compare the type property

outer bane
steel haven

How compare the type property ?

steel haven

OHHH

Okey thanks

amber sleet

Anyone know why?

uncut kelp

Cannot reproduce

Reinstall maybe

steel haven

Why replied stay false ? Yet I use interaction.reply

outer bane

replied will only be set after reply resolves

steel haven
outer bane

did you await the deferReply call?

steel haven

ye

outer bane

are you sure deferReply resolved? do you let it error silently?

steel haven
await interaction.deferReply({ ephemeral: true, fetchReply: true });

if (interaction.type = InteractionType.ApplicationCommand){
  interaction.editReply(replyData).catch(console.error);
} else if (interaction.isButton()) {
  interaction.editReply(replyData).catch(console.error)
}
outer bane

why do you fetch the reply and why is there a single "="?

are you sure the error is from one of those lines?

placid cliff

Most likely a missing = sign

Happened to me too more than I’d like to admit LUL

steel haven
manic lynx

Can I use defaultMemberPermissions: []? Or no?

silk root

What are some important new things in the dev branch

copper jetty

Theres nothing new in v14 they only renamed some things and stuff like that

little burrow
scarlet tangle
steel haven

"0", it needs to be a string containing a BigInt

scarlet tangle
steel haven
plush pasture

Where can I find any documentation about what will be new in djsv14?

knotty plover

See pins

plush pasture

Ok ty

mental inlet

how do you make these checklist type things?

mental inlet

you can make them using select-menus??? never knew that

steel haven

use setMinValues(..) and setMaxValues(…) to be able to select more than (or less than) one item only

pseudo thicket

MessageEmbed was removed right

forest elm

use EmbedBuilder

pseudo thicket

thx

fast jay

i think there is a misake in the website

forest elm

feel free to mention it in that

dull mulchBOT
pine compass

How do i kick a user with v14, as when i instantiate a kick using my kick command, it says: user.kick() is not a fucntion

vague coyote

you have to call .kick() on a member object

not a user

pine compass
vague coyote not a user

thanks, is there a way to resolve a user given the id or do i just interaction.guild.members.fetch(interaction.options.getUser('user'))?

vague coyote

interaction.options.getMember('user')

pine compass

tysm

split fulcrum

what is it now?

forest elm

its a exported at top-level now

const { escapeMarkdown } = require('discord.js')

split fulcrum

Oh

valid ledge
if (!message.guild.me.permissionsIn(message.channel).has(PermissionsBitField.Flags.SendMessages))```
Cannot read properties of undefined (reading 'permissionsIn')
forest elm
mental inlet
empty urchin

I'm having a direct image/video or what ever url, how can I upload this as a file? (without seding the link itself)

valid ledge
interaction.isModalSubmit is not a function``` it changes to what ?
dawn phoenix

nothing, do a regular type check

mental inlet
remote summit

How do I use AutoComplete?

if (interaction.type === InteractionType.ApplicationCommandAutocomplete()) {}
this?

mental inlet

remove the () at the end of InteractionType.ApplicationCommandAutocomplete, it isn't a function

amber sleet

Someone know why it worked before and now there is an error?

forest elm

because that method was removed

check .type === ChannelType.GuildText instead

mental inlet
mental inlet

yes

plain roverBOT

Documentation suggestion for @empty urchin:
class AttachmentBuilder
Represents an attachment builder

static stump

@forest elm ..?

forest elm

?

static stump
thorny haven
static stump
thorny haven

you can put deferReply at the beginning of the code and use editReply in some parts of your code

static stump
thorny haven
await inter.deferReply()
await inter.editReply({content: `Loading ...`, fetchReply: true})
static stump
thorny haven

yes

static stump
thorny haven

yes

thorny haven

well yes. That's about what I did

tame gazelle

you said "you cannot" ._.

thorny haven
thorny haven
static stump

@forest elm Bro !!!

uncut kelp

'Chu want boi

tame gazelle

that’s.. logic

mental scarab

Hey, I get this Error inside of my Command Handler:

TypeError: interaction.isCommand is not a function```
//Verwende und Antworte auf Slash-Commands

client.on('interactionCreate', async interaction => {
    if (!interaction.isCommand()) return;

    const command = client.commands.get(interaction.commandName);

    if (!command) return;

    try {
        await command.execute(interaction);
    } catch (error) {
        console.log(error)
        await interaction.channel.send({
            content: 'Tut mir leid! Während ich veruscht habe diesen Command auszuführen ist mir ein Fehler unterlaufen... Probiere es gerne noch einmal.',
            ephemeral: true
        });
    }
});
quartz hatch

אהלן

valid ledge

TypeError: MessageAttachment is not a constructor :

const attachment = new MessageAttachment(canvas.toBuffer(), `deck.jpg`);```
tame gazelle
valid ledge

thx

steel haven
mental inlet bumping again...

If you already have the row constructed it would be much easier to edit the JSON instead of rebuilding from JSON like that…

mental inlet

ohh okay

guess i'm dumb lol

mental scarab

Hey, why isnt this working:
I get a TypeError: Cannot read properties of undefined (reading 'Flags') Error in this Code:

if (!member.permissions.has(discordjs.Permissions.Flags.Ban_Members)) {
                interaction.reply('Du hast keine Rechte, diesen Benutzer zu bannen!')
                return
            }

I also tried FLAGS.BAN_MEMBERS

forest elm

PermissionFlagsBits.BanMembers

mental scarab

Thanks! I couldnt find that in the new Guide

south python

Is .setField not a function anymore?

addField*

thorny haven

.addFields([{}, {}])

south python

addField got removed?

thorny haven
south python

Ahh oke

empty urchin

(upload files in message)

thorny haven
empty urchin

attachment is this: ```ts
if (reaction.message.attachments.first()?.url.endsWith('.png')
|| reaction.message.attachments.first()?.url.endsWith('.jpg')
|| reaction.message.attachments.first()?.url.endsWith('.jpeg')
|| reaction.message.attachments.first()?.url.endsWith('.gif')
) attachment = reaction.message.attachments.first()?.url;
else if (reaction.message.attachments.first()?.url.endsWith('.mp4')
|| reaction.message.attachments.first()?.url.endsWith('.mp3')
|| reaction.message.attachments.first()?.url.endsWith('.mov')
) {
attachment = reaction.message.attachments.first()?.url;
asFile = true;
};


`urlData`, `url` is this: ```ts
urlData = reaction.message.embeds.find((object: any) => ['acticle', 'gifv', 'image', 'video'].includes(object.type));
if (urlData?.type === 'video') urlData.video?.url;
else url = urlData?.thumbnail?.url;

embeds are just 1-2 message embeds, shouldn't matter here;

const message: Message | undefined = await (channel as TextChannel).send({
    embeds: embeds,
    files: urlData?.type === 'video' || asFile ? [attachment || url || ''] : []
});

Long code short, I copy the uploaded files from a user (starboard)

so I assume that it times out because the file is just large and takes long to upload

( @thorny haven )

thorny haven

@empty urchin can you tell in which part of the code the problem occurs?

empty urchin

await (channel as TextChannel).send(..)

thorny haven

To begin with, try putting channel as TextChannel in a separate variable

const channel = channel as TextChannel

empty urchin

the issue is that it times out with large files and not the typing lol

small files or no files at all work

thorny haven

I don't know yet, maybe there is a limit.

@empty urchin Discord bots are able to send files with a size of <8mb or =8mb by default, if there are boosters on the server, then the size of the files being sent increas

From the 3rd level of boost, bots will be able to send files <=100mb on your server

empty urchin

well the limit in my server is 50mn atm, maybe there should be a more clear error that the file is too big instead of just letting the request timeout

thorny haven

In the first screenshot, your file weighs 69 mb

empty urchin

yeah I know

empty urchin
thorny haven

I'll give you a tip, you can use pm2 if you want your bot to reboot instead of shutting down 🙂

empty urchin

I use pm2

this error is just local testing

I would still just want to get rid of errors lol

thorny haven
empty urchin

yeah I noticed that, that's why I said that it would be helpful to get a clear error that tells you that the file is too large instead of just letting the request timeout

valid ledge
const newclient = new Client({
    allowedMentions: {
      parse: ["roles", "users"],
      repliedUser: false,
    },
    failIfNotExists: false,
    presence: {
      activity: {
        name: `Dm for Help & Support`, 
        type: "WATCHING", 
       
      },
      status: "online"
    },
    partials: ["CHANNEL", "MESSAGE", "REACTION", ""],
    intents: [
      GatewayIntentBits.Guilds,
      GatewayIntentBits.GuildMembers,
      GatewayIntentBits.DirectMessages,
      GatewayIntentBits.GuildMessages,
      GatewayIntentBits.MessageContent,
      GatewayIntentBits.DirectMessageReactions
    ]
});```  Strange the bot doesn't get a notification when someone dms him (newclient.on("messageCreate", async message => {console.log(message.content)) ...
thorny haven

Have you tried displaying message first?

valid ledge
thorny haven

This is understandable, but when a bot is written to the dm, does something come to you?

uncut kelp

Partials are wrong

As well as your activity type

forest elm

(the problem is you need the Channel partial)

valid ledge

thx all

mental scarab

Hey, why doesnt this Permission Check recognise, that I have Permissions and Administrator rights?


        //Get User from Interaction
        var user = interaction.options.getUser("user")
        //Bekomme Guild Object
        let guild = interaction.guild
        //Prüfe, ob der Benutzer die nötigen Rechte hat
        await guild.members.fetch(user.id).then(member => {
            (async() => {
                console.log(member)
            let user_perms = await member.permissions.has([discordjs.PermissionFlagsBits.BanMembers, discordjs.PermissionFlagsBits.Administrator], true)
            console.log(user_perms)
            if (user_perms == false) {
                interaction.reply('Du hast keine Rechte, diesen Benutzer zu bannen!')
                return;
            }
            //Check if Bot can Manage the User ( Ban the User )
            if (member.manageable == false) {
                interaction.reply('Der Bot hat keine Rechte, diesen Benutzer zu bannen!')
                return;
            }

            //Ban User
           guild.members.ban(user)
           

           //Reply to Slash Command
           interaction.reply("Der Benutzer " + user.username + " wurde gebannt!")
        })()
    })

user_perms is just "false"

every time

uncut kelp

There's no point checking if someone has both ban members and administrator, since the latter supersedes the former

Also I cannot reproduce that with your exact code

mental scarab

Hmm okay. I will do some debugging again

cosmic parrot

How to defer interaction without sending loading message and other messages?

median junco

i think you have to reply to a interaction in some way

jaunty comet

Based on what I know about the api

knotty plover

Yeah, Discord forces you to provide a good user experience

copper jetty

You only can defer message component interactions without sending messages

knotty plover

Users should know that the command was received

jaunty comet

Initial response is a no but responses after can use deferUpdate()

Like if you want to respond to someone hitting a button and need more than 3 seconds then deferUpdate() would work pretty sure

scarlet tangle

Will djs 14 make it easier to make slash commands? Also will the prefix commands will be the same +don't expect a response until like 6-8hrs

knotty plover

No real change to either of those other than permissions v2

scarlet tangle

Hmm I'll take a look at docs when v 14comes out

I don't even need to chnage any coded only in permission handler Soo it. Be esay update for me

scarlet tangle

some structure names was changed

and some methods removed/moved

i rewritten my bot to djs v14 alr

long narwhal
const i = GatewayIntentBits;
const p = Partials;

const intents = [
    i.GuildMessages,
    i.DirectMessages,
    i.GuildMembers,
    i.MessageContent,
    i.GuildScheduledEvents,
];

const partials = [
    p.Channel,
    p.GuildMember,
    p.Message,
    p.User,
];

Hey! So this is what I'm importing into my client, but I'm not receiving the messageCreate event. Can anyone help?

small light

it says i cant send an empty message ```js
let image = await create(song.name, song.thumbnail)
let attachment = image

  await interaction.followUp({
    attachment: [attachment],
  });```
valid ledge

How can i declare the new permission bitfield ? ( [BITFIELD_INVALID]: Invalid bitfield flag or number: VIEW_CHANNEL.)js await interaction.channel.permissionOverwrites.edit(interaction.member, { VIEW_CHANNEL: true, SEND_MESSAGES: false, SEND_TTS_MESSAGES: false });

nocturne kayak
median jetty
TypeError: Cannot read properties of undefined (reading 'custom_id')

I don't use custom_id i use customId

tame gazelle
median jetty
tame gazelle can you show the full error and the code please
TypeError: Cannot read properties of undefined (reading 'custom_id')
    at TextInputComponent.get customId [as customId] (C:\Users\utente\Desktop\IFireBot\node_modules\discord.js\src\structures\TextInputComponent.js:16:22)
    at Object.run (C:\Users\utente\Desktop\IFireBot\src\SlashCommands\Owner\eval.js:15:47)
    at Object.run (C:\Users\utente\Desktop\IFireBot\src\events\interaction\interactionCreate.js:9:31)
    at Client.<anonymous> (C:\Users\utente\Desktop\IFireBot\src\handler\events.js:19:54)
    at Client.emit (node:events:390:28)
    at InteractionCreateAction.handle (C:\Users\utente\Desktop\IFireBot\node_modules\discord.js\src\client\actions\InteractionCreate.js:81:12)
    at Object.module.exports [as INTERACTION_CREATE] (C:\Users\utente\Desktop\IFireBot\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (C:\Users\utente\Desktop\IFireBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:350:31)
    at WebSocketShard.onPacket (C:\Users\utente\Desktop\IFireBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:476:22)
    at WebSocketShard.onMessage (C:\Users\utente\Desktop\IFireBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:320:10)
undone yew

I made my own function (to make my job easier) but it gave such an error, how can I fix it?

I'm fixed

thx

knotty plover

yikes

small light
knotty plover yikes

hey so i get this error TypeError: Cannot read properties of undefined (reading 'path') when i run ```js
let image = await create(song.name, song.thumbnail)
let attachment = new Attachment (image)

  await interaction.followUp({
   files: [attachment],
  });```
tame gazelle
small light

create() is a fucntion i made w canvas

small light
knotty plover
small light
knotty plover

read the rules thanks

small light
forest mulch
median jetty
forest mulch code?
const code = new TextInputComponent().customId('code').setLabel('Code').setStyle('PARAGRAPH');
tall verge

I recommend you see the documentation

median jetty
tall verge
median jetty
tall verge

Are you using the code from v13?

median jetty

No

urban belfry
median jetty

ok

tall verge

TextInputComponent v13

TextInputBuilder 14

crystal valve
const member = interaction.user;
if (member.permissions.has([Permissions.FLAGS.ADMINISTRATOR])) {```
`TypeError: Cannot read properties of undefined (reading 'has')`
flat ice
crystal valve

ohh

hm TypeError: Cannot read properties of undefined (reading 'FLAGS') now

urban belfry

check the pinned guide for updating

crystal valve

alright

crystal valve
urban belfry

what does the guide tell you? idk i don't code

crystal valve

oh

ah i'm not supposed to use flags when using PermissionsBitField monbreyFacepalm

urban belfry

no?

urban belfry
crystal valve
urban belfry

FlagsBits, read what you said again

crystal valve
urban belfry

PermissionsBitField.Flags is PermissionFlagsBits

crystal valve

thank you for reiterating the fact

urban belfry

as it is undefined, fancy
you're not really supposed to create your own ActionRow instances, create ActionRowBuilders

undone yew

not working...

uncut kelp

Read the update guide, specifically enums

undone yew

GameType.Watching

yes

undone yew
uncut kelp

Not a discord.js issue, you just have to wait

You're doing that... every 5 seconds? Jeez, why?

undone yew
uncut kelp

I view that as API spam

Especially since setting presences are blocking in the gateway iirc

undone yew

status is loaded, but activity no found

scarlet tangle

so i had a question should i use fetch instead of cache since fetch returns the accurate value for what i look forward to but takes a lot of time so either way i wanna know is there any way i can make my fetching faster?

forest mulch
uncut kelp

That will have no effect

forest mulch

oh

uncut kelp
pine compass

is there any updates with the permissions of the slash commands w/ v14, i find it very restrictive to make slash commands permissions be tied to PermissionBits or smth, rather than a role

dawn phoenix

that is how discord decided to implement permissions going forward

roles can be set by the server staff

if you want to change that (server settings) as a bot dev you need oauth2 by someone with that permission (manage guild) to do it in their name

as a dev you are limited to default permissions with bits - which staff can change whenever they want

  • anyone with manage guild permission cannot be prevented from using any command anywhere (as long as it is deployed globally or to the specific guild, of course)
median jetty
if (interaction.type === InteractionType.Autocomplete) {}

Auto complete don't work

uncut kelp

Well, InteractionType.Autocomplete doesn't even exist, so yes, it won't work

forest mulch
urban belfry
uncut kelp
urban belfry

the changes in v14

uncut kelp

Will change it, thank you

median jetty
uncut kelp

That's not my call to make

uncut kelp

Use InteractionType.ApplicationCommandAutocomplete

median jetty
dawn phoenix

"contributor on the guide"? we take prs, knock yourself out
the v14 guide is however a deploy preview, meaning it is tied to a particular PR
so a comment/suggestion on that is better than opening your own

brave beacon

Oh there is lot's of preview Kappa, thanks :D

median jetty
uncut kelp

The what now

crystal valve

This isn't really v14 stuff, but I'm using v14:

my bot does not ping the role specified

interaction.channel.send({
content: `<@&${pingID}>`
})```
I have also tried putting the role ID directly into the content section; it does not work.

I have the role in the server, and the bot has admin.
median jetty
uncut kelp
crystal valve

alr, i'll check

yeah monbreyFacepalm

forest mulch

wdym by "valid options"

median jetty

It is possible that a person can select a string only from these options

cosmic parrot
cosmic parrot
steel haven
south python

How do i provide a custom hex color in the embed color?

west fjord

not been keeping up with the library for a while so sorry if this is a redundant question, have most of the isWhatver() typeguards been removed from structures?

west fjord

ah thanks! just what i needed

so this new way doesn't "apply" the typeguards or am i doing something wrong?

uncut kelp

The type of int is wrong

It should be AnyInteraction

west fjord

ohhhh never knew that existed

uncut kelp

It's a recent change. Are those types not inferred there already?

west fjord

if you mean this event file will always be an autocomplete, no

scarlet tangle

Heyy, a quick question, cause ts is showing that isModalSubmit method doesnt exists any more, so what is the other method to check if interaction is a modal?

// docs too

uncut kelp

Check the type of interaction

obtuse crater

Look above

dark minnow

Defer can be used with showModal?

outer bane

no

both are initial replies to an interaction

kindred moss

do you have to write your own type guard functions for TS now that they've been removed from DJS? checking the type property doesn't narrow down the actual type.

idle galleon

Type for what?

kindred moss

channels and interactions

marble barn

change Interaction to AnyInteraction

idle galleon

Likewise, Channel to AnyChannel

The former is the base class, the latter is a union, allowing ts to know which type correspond to which subclass

marble barn

Which is why I think there is a PR to rename them to Base* right now

kindred moss

ah, thanks. what about the remaining functions like isButton()? are they going to be removed too?

idle galleon

Yea

kindred moss

is ModalBuilder supposed to only work when using its functions instead of the constructor? or is it a bug?

// doesn't work
const modal = new ModalBuilder({
    customId: 'string',
    title: 'string',
    components: [new ActionRowBuilder<TextInputBuilder>({ components: [nameInput] }), new ActionRowBuilder<TextInputBuilder>({ components: [descriptionInput] })],
});

// works
const modal = new ModalBuilder()
    .setCustomId('string')
    .setTitle('string')
    .setComponents([new ActionRowBuilder<TextInputBuilder>({ components: [nameInput] }), new ActionRowBuilder<TextInputBuilder>({ components: [descriptionInput] })]);

I'm assuming that the first variant should work, since every other builder class behaves like this.

uncut kelp

@velvet jasper maybe? ^

Maybe ActionRowModalData is just missing title? Not too sure

knotty plover

where is the builder imported from?

kindred moss

discord.js

this is a type issue btw, the first variant works just fine when ignoring the TS error/forcing transpilation.

jade harness

hey I think I came across a bug: https://sourceb.in/r15atGFcs7
14.0.0-dev.1655770161-94f7ca9
My token is valid but for some reason I can't login

const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.MessageContent] });

client.on('ready', () => {
    console.log(`Logged in as ${client.user.tag}!`);
});

client.on('messageCreate', message => {
    console.log(message);
});

client.login('token');```
uncut kelp

Lol

Yikes

That is indeed a bug

jade harness

I'll open an issue I guess

uncut kelp

Please do

I think I found the problem though

const invalidToken = new Error(ErrorCodes.AuthenticationFailed);

This line is causing the issue

That error code doesn't exist

uncut kelp

Opened a pull request to correct the error code, so it's all good for now

jade harness

nice

uncut kelp

This is all that needs changing, lol
packages/discord.js/src/client/websocket/WebSocketManager.js:133

- const invalidToken = new Error(ErrorCodes.AuthenticationFailed);
+ const invalidToken = new Error(ErrorCodes.TokenInvalid);
jade harness

lol

latent lion

This error keeps happening when I start the bot.

This is where the error line is

uncut kelp

It's a bug. Just downgrade

Or do the diff above