#djs-help-v14

78874 messages · Page 38 of 79

loud quartz

why does it make any difference whatsoever?

queen vale

Because users are stupid and cant work out to press the message icon - Apparently theres also a bug on ios that the message icon isnt working

loud quartz

and none of that is anyhow fixable by you or us

queen vale

I was wondering if all the commands dont work in dms if the button still shows

topaz bluff
grim sinew

Appreciate it thanks so much for the help

Hey sorry I looked at the docs but I still can't seem to understand how to actually make the collector last, I understand how to make it work for a while when the bot is on but not to make it last and keep on collecting even when I turn the bot off

waxen comet

there is a function to check someone's server tag?

sharp ginkgoBOT
dense jackal

@waxen comet ^

waxen comet

tysm @dense jackal

dense jackal
dense jackal
grim sinew
dense jackal

yes, button presses, menu selecting and modal submitting are all interactions that will emit the interactionCreate event

along with the slash commands and context menu commands (right click on message/user > Apps)

grim sinew
dense jackal

yes

client.on(“interactionCreate”, (interaction) => {
  if (!interaction.isButton()) return; // Block all non-button interactions
  if (interaction.customId === “myButton”) {
    // Do stuff whenever the button with custom id “myButton” is pressed
  }
});
dense jackal

nice

grim sinew
loud quartz

exists where

grim sinew
loud quartz

ok, but exists where

grim sinew
loud quartz

no

there's no button search

grim sinew

Alright thank you for your help

cosmic burrow

when i try to run ping command, it shows "The Application Did not respond" here is my index.js

const path = require('node:path');
const { Client, Collection, GatewayIntentBits, MessageFlags } = require('discord.js');
const { token } = require('./config.json');

const client = new Client({ intents: [GatewayIntentBits.Guilds] });

client.commands = new Collection();
const foldersPath = path.join(__dirname, 'commands');
const commandFolders = fs.readdirSync(foldersPath);

for (const folder of commandFolders) {
    const commandsPath = path.join(foldersPath, folder);
    const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
    for (const file of commandFiles) {
        const filePath = path.join(commandsPath, file);
        const command = require(filePath);
        if ('data' in command && 'execute' in command) {
            client.commands.set(command.data.name, command);
        } else {
            console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
        }
    }
}

const eventsPath = path.join(__dirname, 'events');
const eventFiles = fs.readdirSync(eventsPath).filter(file => file.endsWith('.js'));

for (const file of eventFiles) {
    const filePath = path.join(eventsPath, file);
    const event = require(filePath);
    if (event.once) {
        client.once(event.name, (...args) => event.execute(...args));
    } else {
        client.on(event.name, (...args) => event.execute(...args));
    }
}

client.login(token);```

can you help me pls?

polar karma

do you have an interactionCreate listener

cosmic burrow
rose tangle

can you show it?

cosmic burrow
rose tangle

we know that since you've shown it

tawny roost

Is it possible to add an empty embed field?

loud quartz

one way or another, yeah

cosmic burrow
rose tangle we know that since you've shown it

here in the interactionCreate file:


module.exports = {
    name: Events.InteractionCreate,
    async execute(interaction) {
        if (!interaction.isChatInputCommand()) return;

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

        if (!command) {
            console.error(`No command matching ${interaction.commandName} was found.`);
            return;
        }

        try {
            await command.execute(interaction);
        } catch (error) {
            console.error(error);
            if (interaction.replied || interaction.deferred) {
                await interaction.followUp({ content: 'There was an error while executing this command!', flags: MessageFlags.Ephemeral });
            } else {
                await interaction.reply({ content: 'There was an error while executing this command!', flags: MessageFlags.Ephemeral });
            }
        }
    },
};```
rose tangle

and what happens in your console when you run the command

cosmic burrow

"There was an error while executing this command!" error

rose tangle
weak karma

hey is it possible to use the discord api to update user's profile avatar / banner?

sharp ginkgoBOT

method ClientUser#setAvatar() discord.js@14.22.0
Sets the avatar of the logged in client.


// Set avatar
client.user.setAvatar('./avatar.png')
  .then(user => console.log(`New avatar set!`))
  .catch(console.error);

method ClientUser#setBanner() discord.js@14.22.0
Sets the banner of the logged in client.


// Set banner
client.user.setBanner('./banner.png')
  .then(user => console.log(`New banner set!`))
  .catch(console.error);

glossy field

the 14.22.0 release i can for example see how mush users uses my server tag?

polar karma

assuming the user has to be on the guild to use the tag, you could filter the guild.members.cache by the tag data and check the size (if they don't have to remain on the guild to continue using the tag, then there's no way to check, but tbh that makes no sense. i have no further knowledge of tags though)

weak karma
polar karma

no, you can't edit another user. that would be atrocious

weak karma
polar karma

because it has far-reaching implications and would be ripe for abuse. user data is global data, why not change the username to a slur or something else malicious, put them at risk for being actioned? same for the avatar. you might not do this, but another app may, or your app could even be compromised and do that to users who authorized your app to be able to change that data

weak karma
rose tangle

"current user"

if you want to edit another user maybe you can do so through oauth with that endpoint, just guessing though

polar karma

that'd be a question for ddevs

loud quartz
halcyon vault

Is there any way to make a Discord button always reply ephemeral at creation time (like .setEphemeral(true)), instead of deciding inside the interaction handler?

-# Ping me when you reply!

halcyon vault

Ohh. you mean, there is no way?

rose tangle

yeah sorry, meant it isn't possible

halcyon vault

Then, any ideas to override on button set time even?

rose tangle

you could add something in your customId that marks your button as ephemeral and then make your replies ephemeral if they have it

but imo it's much more convoluted than just replying ephemerally normally

weak karma
halcyon vault

-# Anyway, Thanks for helping me out!

tidal ravine

Any way for a webhook to like publish announcements automatically in an announcements channel?

loud quartz

webhook is not a member in a server to be able to have permissions to do so

proper gorge

Hello, does anyone know why everything works on the local server, but on the VDS the application does not respond? It worked before..

rose tangle

make sure there's no error while starting the bot, and also that you have the correct token

red coral

Anyone know what the DiscordjsErrorCodes or similar is for the cannot dm this user

Found it i think, RESTJSONErrorCodes.CannotSendMessagesToThisUser

waxen walrus

Say I make a container with a text display with id 1, and retrieve access to the container's message somewhere else, how could I get get the content of the text display with id 1? (At least I assume that's what that ID is for?)

rose tangle

you'd iterate through the components array of the container

and yes, that's the purpose of the id

waxen walrus

Oh actually that leads me to a different question, is it possible to do it somehow if it's ephemeral? cause last time I did something along those lines I encountered not being able to access the "message" class of the ephemeral response

rose tangle

you can access it normally, you just can't use it as a regular message (eg fetch, delete, etc)

rigid crest

i want a filed image to media builder for V2but it wont be a valid URL so if i do

await interaction.reply({ files: [attachment] });``` will it attach like a Embed setImage? from attachment if i use "://attachment" thingie
waxen walrus

I see I see, thanks

I have another question actually 😓, say I have a container with a button that summons a modal, from the modal submit interaction, would it be possible to retrieve the message that the button was attached to?

Or would I have to just save a reference in memory

waxen walrus

on the modal interaction?

stable sun

Yes

waxen walrus

does it just propagate somehow from wherever the modal response got sent?

steep laurel

S

stable sun

Discord provides the message

waxen walrus

alright

thanks

iron void

What things can I add in SectionBuilder? Can I add a menu or something similar?

halcyon bison

no, sections can only have text displays and buttons/thumbnails as accessories

proper gorge

what function so that only administrators can see these buttons? approve suggestions and reject suggestion

sharp ginkgoBOT
subtle falcon

What is the max length of a Text Display ?

hallow mesa
unique mountain

how do you "embed" commands in a message (generally).

I apologise if that's difficult to understand but i'm referring to when I see a command within a bot reponse like

/help

that i can click on and have it run that command, clickable commands in bot messages

unique mountain
unique mountain

so if i were to embed that slash command in the message, could i embed it with options already filled out

hallow mesa

You can't per-fill options
Edit: I guess other than subcommands

cosmic burrow

how do i host a bot 24/7 for free, not just like expensive ones like Google Cloud

bitter leaf

hello i wanna ask if there any idea about sync the data 1 by 1 ?

like after changing roles of someone by any member
then refresh cache of the bot automatic

optimized plan

i want plan guild roles, members roles, members nickname

caching

hallow mesa

Better in what way?

radiant epoch
timid onyx

How long do I have to wait for global commands to be deployed?

wary coral
oak valley

would it be possible to get the bot owner directly from discord.js?

not as in hardcoding it

oak valley

ah ty

lean sail

why is this showing N/A members on roles where there are

proper gorge

how to make slash commands show only in specified channel and not in all channels? what function

stable sun

You can fetch all members from the guild beforehand

lean sail

ah ok

stable sun
proper gorge
uneven crater
kindred bolt

how can i showoff my bot commands like that

rose tangle

it's only for verified bots and you don't get to choose them, it's automatic

kindred bolt
rose tangle

and you don't get to choose them, it's automatic

long dome

i have a command that takes two inputs - two players, for comparison, and since it can be search by last name, there can be multiple results for each of the inputs. what i have right now is, if theres multiple options for either player 1 (p1) or player 2 (p2), the user gets a button menu to select their desired option from, but i cant figure out what to do if theres multiple options for both p1 and p2. any guidence on where to go with this?

rose tangle

players from an outside game or discord users?

if the latter you can simply use two user options

honest girder

how to map over a member's roles in order? when I do just member.roles.cache.map it's not ordered by priority

bleak owl

you’re in the wrong server, sorry

clear garnet
sharp ginkgoBOT

method Collection#sort() discord.js@14.22.1
The sort method sorts the items of a collection in place and returns it. The sort is not necessarily stable in Node 10 or older. The default sort order is according to string Unicode code points.


collection.sort((userA, userB) => userA.createdTimestamp - userB.createdTimestamp);

long dome

tryna make a util bot for sports

rose tangle

ah, well you could make it an autocomplete string option

maybe force the user to select one choice by replying with an error if they don't

long dome

mmmm wouldnt that be problematic bc im tryna handle a database of around 6000 hockey players

velvet sorrel

How can I know the current server tag using discord.js? I just found how to know an user primary guild tag.

unique shoal
unique shoal
proper gorge

how to find /test if this command is not in my scripts?

unique shoal

What do you mean?

proper gorge

/test

unique shoal

Yes

proper gorge

this cmd is not in my scripts

unique shoal

You can fetch either guild or global commands to find it

Or just use our deployment script which overwrites commands

cosmic burrow

everytime i run the /ping command in my bot, it shows this:

interactionCreate code:


module.exports = {
    name: Events.InteractionCreate,
    async execute(interaction) {
        if (!interaction.isChatInputCommand()) return;

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

        if (!command) {
            console.error(`No command matching ${interaction.commandName} was found.`);
            return;
        }

        try {
            await command.execute(interaction);
        } catch (error) {
            console.error(error);
            if (interaction.replied || interaction.deferred) {
                await interaction.followUp({ content: 'There was an error while executing this command!', flags: MessageFlags.Ephemeral });
            } else {
                await interaction.reply({ content: 'There was an error while executing this command!', flags: MessageFlags.Ephemeral });
            }
        }
    },
};```
halcyon bison

have you checked the console for the error you're logging?

unique shoal

Well thats your own error message, which it will send no matter why it throws

cosmic burrow
unique shoal

?

cosmic burrow

i just fixed it by adding
const { MessageFlags } = require('discord.js');
nvm it fixed

unique shoal

That... uhh okay well as long as its fixed

cosmic burrow

also, how do i host a discord bot 24/7 for free, because the others are expensive

unique shoal

leave your pc running

There are no good free hosts

cosmic burrow

ok

unique shoal

You can find good ones for under $5/month

cosmic burrow

k

proper gorge
unique shoal

Then it isnt in your scripts

But it once was, and has been deployed

So you need to delete it, or overwrite it

sharp ginkgoBOT

guide Slash Commands: Deleting commands - Deleting specific commands
read more

proper gorge
unique shoal

no lol

unless you really fucked up hard

rose tangle

commands stay deployed regardless of what your files are

discord has no way to know what's on your pc

like monbrey said, you deployed it once and it's still there, you're either not deleting commands that aren't in your files anymore (you're not using rest.put()) or you're deploying globally and it's deployed on the guild (or viceversa)

cosmic burrow

everytime i run /gif command it shows: "The application did not respond" error

code:


module.exports = {
    data: new SlashCommandBuilder()
        .setName('gif')
        .setDescription('Sends a random gif!')
        .addStringOption(option =>
            option.setName('category')
                .setDescription('The gif category')
                .setRequired(true)
                .addChoices(
                    { name: 'Funny', value: 'gif_funny' },
                    { name: 'Meme', value: 'gif_meme' },
                    { name: 'Movie', value: 'gif_movie' },
                )),
    async execute(interaction) {
        const category = interaction.options.getString('category');
        // category must be one of 'gif_funny', 'gif_meme', or 'gif_movie'
    },
};```
rose tangle

that seems expected?

you aren't replying

cosmic burrow
rose tangle

then what's the issue?

rose tangle
cosmic burrow
rose tangle

and what did I say?

cosmic burrow
rose tangle

yes, I understand that, and I've answered to you

you aren't replying

cosmic burrow

because i was out

rose tangle

I'm not sure what you're expecting it to show

I meant that you aren't replying to the interaction

if you don't reply, it will say you didn't reply (respond)

simple as that

cosmic burrow

yeah

rose tangle

if you know that then what's the issue

reply to your interaction so it won't say you didn't reply

cosmic burrow

do i need to put "await interaction.reply"?

rose tangle

yeah but not just that

you need an actual reply

your entire execute code only gets an option, nothing else

it doesn't reply with anything

cosmic burrow

Ok

grim sinew

Hey so I am trying to use the message collector (promise based one) but I keep on getting the issue ```bash
response.resource.message.channel.awaitMessages({ max: 1, time: 30_000, errors: ["time"] }).then((collected) => {
^

TypeError: Cannot read properties of undefined (reading 'message')


This is my code ```js
    await interaction.reply({ content: "Hello", withReply: true }).then((response) => {
      response.resource.message.channel.awaitMessages({ max: 1, time: 30_000, errors: ["time"] }).then((collected) => {
        console.log(interaction);
      }).catch((collected) => {
        interaction.followUp("No one replied");
      });
    });
``` I can't seem to find out what could be causing it as I'm just trialing code from the guide
proud arrow

Not withReply

grim sinew
proud arrow

Sure

topaz bluff
grim sinew

Okay i've used almost the exact same code in the dms (it sends a dm to a user then tries to collect message from it)

    await interaction.user.send({ content: "What is the reason for this message?" }).then((response) => {
      response.resource.message.channel.awaitMessages({ max: 1, time: 30_000, errors: ["time"] }).then((collected) => {
        console.log(collected);
      }).catch((collected) => {
        console.log("Looks like no one replied this time.");
      });
    });

But now I seem to the get the issue ```bash
node:events:496
throw er; // Unhandled 'error' event
^

TypeError: Cannot read properties of undefined (reading 'message')```

clear garnet

You're forgetting that the whole response pattern is for using the withResponse option in an interaction

Sending a DM to a user is not an interaction

grim sinew
clear garnet

send() resolves with the message itself, not a response

So remove all of that response.resource stuff

sharp ginkgoBOT

method DMChannel#send() discord.js@14.22.1
Sends a message to this channel.


// Send a basic message
channel.send('hello!')
  .then(message => console.log(`Sent message: ${message.content}`))
  .catch(console.error);

grim sinew

Okay thank you very much

sharp ginkgoBOT

method DMChannel#awaitMessages() discord.js@14.22.1
Similar to createMessageCollector but in promise form. Resolves with a collection of messages that pass the specified filter.


// Await !vote messages
const filter = m => m.content.startsWith('!vote');
// Errors: ['time'] treats ending because of the time limit as an error
channel.awaitMessages({ filter, max: 4, time: 60_000, errors: ['time'] })
  .then(collected => console.log(collected.size))
  .catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));

grim sinew
sharp ginkgoBOT

To receive direct message events on "messageCreate" with your bot, you will need:

grim sinew

Alright got it thank you very much appreciate it

grim sinew
rose tangle

awaitMessages returns a collection of the collected messages

grim sinew
unique shoal

property?

Its just the return value

grim sinew

oh wait nvm I didn't see taht in the log my mistake thank you very much

grim sinew

is there a way to make the thread message like ephemeral? So that the only included users will se it

sharp ginkgoBOT

guide Slash Commands: Command response methods - Ephemeral responses
read more

torn orchid

(node:36460) Warning: Supplying "ephemeral" for interaction response options is deprecated. Utilize flags instead.
why does it keep saying that

crimson gale

because it's true!

sharp ginkgoBOT

The ephemeral option when replying to an interaction will be removed in v15

- {..., ephemeral: true}
+ {..., flags: MessageFlags.Ephemeral}
``` Read [here](<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_OR>) on how to specify multiple flags
torn orchid
minor marten

I mean it's just an enum for better readability

crimson gale

and less typos

ivory valve
proud arrow
ivory valve

oops

vestal sun

you would need to return a boolean and use the function as an if condition for the last line
so something like this:

export async function <functionName>(args) {
  ...first line
  if (!guildSearch.logging) return false
  ...rest of the code 
  .catch(){
  ...
  await interaction.channel.send({embeds:[embed]})
  return false
  }
return true
}

...
const result = await <functionName>
if(result) {
  await <channel>.send()
}
tough cedar
grim sinew

Can you have permissions for buttons?

crimson gale

you'd have to do the check from the button submission event and send a custom (maybe ephemeral) message as response

there is no permission native to who can use a button, if you can see it you can click it
-# unless it's disabled / you are timed out / the thread is archived

grim sinew
sharp ginkgoBOT
grim sinew

Alright thank you, is there anyway I can loop over all members in the guild

dense jackal
cinder shale

Does discord js has a builder for PrimaryEntryPoint commands?

halcyon vault

Can component texts present in inline?

but if it is true, i guess we cant keep the button on align?

polar karma

They don't have an inline option

halcyon vault

👍

slender elk
Error starting application process: CombinedError (2)
  Received one or more errors

  1 ExpectedValidationError > s.instance(V)
  |   Expected
  | 
  |   Expected:
  |   | [Function: ButtonBuilder]
  | 
  |   Received:
  |   | undefined

  2 ExpectedValidationError > s.instance(V)
  |   Expected
  | 
  |   Expected:
  |   | [Function: ThumbnailBuilder]
  | 
  |   Received:
  |   | undefined

    at _UnionValidator.handle (/Users/devyxi/Desktop/Coding/Adminium/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1965:23)
    at _UnionValidator.parse (/Users/devyxi/Desktop/Coding/Adminium/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:972:90)
    at SectionBuilder.toJSON (/Users/devyxi/Desktop/Coding/Adminium/node_modules/@discordjs/builders/dist/index.js:2169:37)
    at /Users/devyxi/Desktop/Coding/Adminium/node_modules/@discordjs/builders/dist/index.js:1870:64
    at Array.map (<anonymous>)
    at ContainerBuilder.toJSON (/Users/devyxi/Desktop/Coding/Adminium/node_modules/@discordjs/builders/dist/index.js:1870:35)
    at /Users/devyxi/Desktop/Coding/Adminium/node_modules/discord.js/src/structures/MessagePayload.js:151:46
    at Array.map (<anonymous>)
    at MessagePayload.resolveBody (/Users/devyxi/Desktop/Coding/Adminium/node_modules/discord.js/src/structures/MessagePayload.js:150:49)
    at DMChannel.send (/Users/devyxi/Desktop/Coding/Adminium/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:191:61)```

what's the problem cause Im currently using components v2

topaz bluff
slender elk
manic leaf
topaz bluff

The API is already updated for those changes... If you mean when will DJS have those changes? When it's ready, there's still months before it's mandatory anyways, so they're likely waiting

formal sail

where's the docs for components v2, i can't for the life of me figure out how to use separators

sharp ginkgoBOT

method MessageManager#fetchPins() discord.js@14.22.1
Fetches the pinned messages of this channel and returns a collection of them. The returned Collection does not contain any reaction data of the messages. Those need to be fetched separately.


// Get pinned messages
channel.messages.fetchPins()
  .then(messages => console.log(`Received ${messages.items.length} messages`))
  .catch(console.error);

steel trail

Already there and released

unique mountain
steel trail

</command subcommand:id>

unique mountain

my confusion is the name lookup part

steel trail

Subcommands are options of the base command

unique mountain

hm oki

sharp ginkgoBOT

guide Popular Topics: Display Components
read more

steel trail

If you want a guide, not just docs

formal sail

thank yiou

glossy field

in v15 the code style and formats will be changed like from v13 to v14?

rose tangle

there are breaking changes, yeah, that's the point of major releases

mostly builders v2 and removal of deprecated elements

(for now, there could be more in the future)

steel trail

But there is no v15 yet, so the question is hard to answer apart from a vague "yes"

glossy field

ok

copper trail

js discordbot2 % node delete-commands.js DiscordAPIError[50035]: Invalid Form Body application_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake. command_id[NUMBER_TYPE_COERCE]: Value "commandId" is not snowflake. at handleErrors (/Users//discordbot2/node_modules/@discordjs/rest/dist/index.js:762:13) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async SequentialHandler.runRequest (/Users//discordbot2/node_modules/@discordjs/rest/dist/index.js:1163:23) at async SequentialHandler.queueRequest (/Users//discordbot2/node_modules/@discordjs/rest/dist/index.js:994:14) at async _REST.request (/Users//discordbot2/node_modules/@discordjs/rest/dist/index.js:1307:22) { requestBody: { files: undefined, json: undefined }, rawError: { message: 'Invalid Form Body', code: 50035, errors: { application_id: [Object], command_id: [Object] } }, code: 50035, status: 400, method: 'DELETE', url: 'https://discord.com/api/v10/applications/undefined/commands/commandId' } DiscordAPIError[50035]: Invalid Form Body application_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake. command_id[NUMBER_TYPE_COERCE]: Value "commandId" is not snowflake. at handleErrors (/Users//discordbot2/node_modules/@discordjs/rest/dist/index.js:762:13) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async SequentialHandler.runRequest (/Users//discordbot2/node_modules/@discordjs/rest/dist/index.js:1163:23) at async SequentialHandler.queueRequest (/Users//discordbot2/node_modules/@discordjs/rest/dist/index.js:994:14) at async _REST.request (/Users//discordbot2/node_modules/@discordjs/rest/dist/index.js:1307:22) { requestBody: { files: undefined, json: undefined }, rawError: { message: 'Invalid Form Body', code: 50035, errors: { application_id: [Object], command_id: [Object] } }, code: 50035, status: 400, method: 'DELETE', url: 'https://discord.com/api/v10/applications/undefined/guilds/1375115092773044224/commands/commandId'
Hi,
I keep running into this problem when i try to delete commands, tried researching and looked and used the code from discord.js

clear garnet

Whatever you're passing for the application ID in your request is not valid. Likewise with your command ID

copper trail
clear garnet

That'd be your problem then

Put one into your config.json

copper trail

💀 im dumb af

copper trail
clear garnet

Your application/client ID should not be the same as your guild ID

They should most definitely be different, because they are different things

copper trail
clear garnet

The developer page does not have guild IDs listed anywhere in it as far as I know

rigid crest

question, im looking to privatise a couple commands to a private server but keep the rest global, i looked up and it says "you have to delete form global then register to guild" but i only know how to removall all commands by a empty array, how do i tell it what to keep as global and what to delte then turn to guild?

sharp ginkgoBOT
clear garnet

Delete the specific commands by their ID instead of doing a bulk-delete

rigid crest

ok, then how do i target it to be guild only?

clear garnet

Deploy them again to that specific guild

sharp ginkgoBOT

guide Creating Your Bot: Registering slash commands - Guild commands
read more

rigid crest

do i add a in the command data if its guild

clear garnet
copper trail
rigid crest

ok, but, would it deploy all at guild this is where im ripping hair out, i want to have "application panel" for example as a guild one whiles having all the existing non senstive to the development still global,, but then again, would i beable to direct a "/guild-commands" folder in the guild deploy ig? as it will still be commands

its just i have a command disabler which does check user ID to my ID but at the same time it just would look out of place for a maint command on global

clear garnet

would it deploy all at guild
If you're asking if it deploys to all guilds your app is in, no, it deploys to the guild whose ID you provide when deploying. If that's not what you're asking, I'm afraid I'm not quite understanding your concern

would i beable to direct a "/guild-commands" folder in the guild deploy ig? as it will still be commands
That is entirely up to you regarding how you handle deployment and storage of your command data & logic. d.js does not try to shoehorn you into any specific way of deploying commands and how you organize them

unique mountain
    container.addSectionComponents(
        new SectionBuilder().addTextDisplayComponents(
            new TextDisplayBuilder().setContent(
                `# ${nickname ?? user.displayName}\n${user.username}`,
            ),
            new TextDisplayBuilder().setContent(`ID: ${user.id}`),
        ),
    );

Are you unable to put two textDisplay's beside each other, mimicing inline fields, I guess

bleak owl

no

unique mountain

so you are able to?

red coral
bleak owl
unique mountain

ah thank you

red coral
clear garnet

The message is a partial

red coral

Oh i forgot to mention i have these as well

        if (reaction.partial) {
            try {
                await reaction.fetch();
            } catch {
                return;
            }
        }
        if (reaction.message.partial) {
            try {
                await reaction.message.fetch();
            } catch {
                return;
            }
        }
clear garnet

That's not gonna actually patch the properties inside reaction.message as far as I know. Would need to actually take the return value of fetch() and use that

red coral

cool thanks

dense jackal

why do we have multiple methods to add components to a container, and not a generic .addComponents() method? just curious

unique mountain

how do i access userPremiumType or premiumType, I see it's relating to APIUser so I wonder if i'll have to do some direct API fetching here?

novel mauve

it's only accessible over oauth2 with the identify scope afaik

stable sun
dense jackal

wasn’t that the case with the ActionRowBuilder then 🤔

halcyon bison

yes, which is why ActionRowBuilder is being changed in builders v2
or at the very least, it's getting addXComponents methods
I do notice addComponents still seems to exist

dense jackal

cool, good to know

steel trail
kindred moon
steel trail

ActionRowBuilder has no generic in v2, correct

It was a wrong assumption in the first place based on that there was only one component type that doesn't take the whole row

true lynx

whats a user friendly way to let a user friendly compare a number?
for example, what i've done is taking a string like "<5" and parsing it and then checking if the stat value is lower than 5
now i need a user friendly way to do this with dates
i came up with "<[25y 7mon 6d]" but its gotta be a little hard to implement
is there a better way to ask the user for a date? and then potentially an operation?

dense jackal

sadly discord hasnt got any sort of calendar component yet

true lynx
dense jackal

you can’t have options in options?

or are you talking about subcommands and subcommand groups

true lynx
dense jackal

oh but you can change your current string option to be replaced with 3 integer options right?

true lynx
dense jackal

slash command can have up to 25 options so you should have plenty of space left

true lynx

slash commands are so damn limiting man

bleak owl

not at all

true lynx
dense jackal

there is absolute zero difference in this and a prefix command regarding speed and clutter

torn sphinx

bro i have tried everything i possibly could.... but i cant add a file display component to my message. Im using a discord cdn url to upload the file with the message and i have a name set for the attatchment. wtf is the url i need to use for the file component so it uses the file i uploaded???????
i tried things like: attachment://[original-dicsord-cdn-uel], attachment://[last-path-argument-of-cdn-url], and attachment://[attachment-custom-name]
i assume web urls differ from relative path urls as shown fromhttps://discordjs.guide/popular-topics/display-components.html#file

im genuinly confused please help....

wary coral

attachment:// is only if you are uploading something via the files property. If you're just using a CDN link, then you don't need to prefix it with attachment

torn sphinx

is it because the file name has spaces? i would rather to keep the spaces

CombinedPropertyError (1)

  Received one or more errors


  input.url

  | ExpectedConstraintError > s.string().url()

  |   Invalid protocol for file URL. Must be attachment:

  | 

  |   Expected: expected to match a URL

  | 

  |   Received:

  |   | 'attachment://Y3@T [144 BPM - C# Minor] - Vaisonic.mp3'


    at _ObjectValidator.handleIgnoreStrategy (file:///app/node_modules/.deno/@sapphire+shapeshift@4.0.0/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:2119:72)

    at _ObjectValidator.handleStrategy (file:///app/node_modules/.deno/@sapphire+shapeshift@4.0.0/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1983:47)

    at _ObjectValidator.handle (file:///app/node_modules/.deno/@sapphire+shapeshift@4.0.0/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:2089:17)

    at _ObjectValidator.parse (file:///app/node_modules/.deno/@sapphire+shapeshift@4.0.0/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:972:90)

    at FileBuilder.setURL (file:///app/node_modules/.deno/@discordjs+builders@1.11.3/node_modules/@discordjs/builders/dist/index.js:1585:36)

    at file:///app/src/lib/utility/createPostMessageContainer.ts:68:39

    at resolveBuilder (file:///app/node_modules/.deno/@discordjs+builders@1.11.3/node_modules/@discordjs/builders/dist/index.js:2224:12)

    at file:///app/node_modules/.deno/@discordjs+builders@1.11.3/node_modules/@discordjs/builders/dist/index.js:1795:75

    at Array.map (<anonymous>)

    at ContainerBuilder.addFileComponents (file:///app/node_modules/.deno/@discordjs+builders@1.11.3/node_modules/@discordjs/builders/dist/index.js:1795:56)
urban fjord

With Containers, is it possible to send an (image) attachment in the same reply as the Container? I am hitting a bit of a wall trying to, but perhaps I am misunderstanding the implementation of Containers.

halcyon bison
torn sphinx
halcyon bison
wary coral
halcyon bison

then nevermind on the encoding, doesn't sound like they'd accept % either

torn sphinx
halcyon bison

no, you'll need to rethink the filename format

torn sphinx
wary coral

I am unsure, I can't test it right now

torn sphinx

ill try url encode it

torn sphinx

so i got it to work with no - and stuff, url encoding seems to not work. Also: Not only do i have to potentially rethink how my bot names files, but after ALL this time, i find out apparently audio files dont have previews in display components!!!! Which is A REQUIRMENT for my bot btw... what do i do? do i just revert back to normal messages without components v2 (which i only find out about today and i really like them)?

rose tangle

yes, there's no current solution

a file component doesn't support previews, it's just for arbitrary files

and url encoding doesn't work since, as mentioned, % isn't an alphanumeric character or an underscore/dash/dot

torn sphinx
rose tangle

nope

torn sphinx

bruhhhhhhhhhhhhh

rose tangle

at most you could send the audio file in another non cv2 message

tardy sable

in message.mentions.members, if you mention yourself it wont be in there right?

loud quartz

why wouldn't it be there

torn sphinx
loud quartz

if the message actually mentions <whoever>, that <whoever> is in that Collection

tardy sable
loud quartz

the message will have yellow highlight

tardy sable

fair

lofty topaz
loud quartz

you already did

lofty topaz
loud quartz

containers don't have thumbnails

this is nothing that required pinging me specifically for help

lofty topaz

Thanks

modest owl

Not sure why this doesn't work help please. uses Components v2

bleak owl

please be specific as to what isn't working.

modest owl
bleak owl

does the event fire at all?

modest owl
bleak owl does the event fire at all?

Yes I have this line of code in index.js

for (const file of eventFiles) {
    const event = require(`./events/${file}`);
    if (event.once) {
        client.once(event.name, (...args) => event.execute(...args));
    } else {
        client.on(event.name, (...args) => event.execute(...args));
    }
}```
bleak owl

that's just your event handling. this doesn't exactly mean that the event is being executed

is this line of code logging in your console when a new user joins the server?

bleak owl

right below async execute(...) put console.log('test')

bleak owl

you can simiulate an event by emitting it like so
client.emit('guildMemberAdd', member)

modest owl
  name: Events.GuildMemberAdd,
  async execute(member) {
    console.log('test')
    try {
      // Check if we've already processed this member
      if (processedMembers.has(member.id)) {
        console.log(`Member ${member.id} already processed, skipping`);
        return;``` Like this right?
bleak owl

yes

modest owl
bleak owl

if the "test" doesn't log, then the event isn't running

do you have the GuildMembers intent?

modest owl
bleak owl

please do not use language like that

modest owl
bleak owl

did you enable the GuildMembers intent in the dev portal?

modest owl
bleak owl

oh great

lean sail

is there a utility function that takes in a hex code and can return a number that we can provide to accent color for container?

unique shoal

No but Javascript does have parseInt

lean sail
unique shoal

With a base of 16, yes

parseInt("FFCCAA", 16)

I think that should work

lean sail

thanks

unique shoal

You can also use hex number notation without conversion, 0xFFCCAA

lean sail

ah ok

sharp ginkgoBOT
rose tangle

pretty sure you meant that?

unique shoal

oh there you go

lean sail

also why am i getting this error?

data.components[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (1,).

unique shoal

"HexColorString" is a ColorResolvable though

unique shoal
rose tangle

if you mean just the hex code without the #, looks like it also accepts that

it's not reflected in typings

lean sail

so how would i pass in a string then? like a clean hex

rose tangle

just pass it

unless you use ts then you'll need to type assert

steel yacht

Hi,
How to edit a followUp ?
Thanks

polar karma

editReply

stable sun
steel yacht

If editReply edits the followUp, does that mean if there was a reply before the followUp then the reply can no longer be edited ?

stable sun

No. None of that is related to each other

You can still use editReply normally to edit the original reply

steel yacht

How do I choose which I'm editing, given than editReply isn't a method of Message but Interaction ?

stable sun

followUp returns a Message

steel yacht

Yes

stable sun

You use that in editReply to edit the follow up

If you want to edit the original message, you don’t specify the message in editReply

steel yacht

editReply doesn't take a Message parameter, only string | MessagePayload | InteractionEditReplyOptions

stable sun

Yes it does

InteractionEditReplyOptions.message

steel yacht

Ohh

Nice, thanks

I wonder why not just mapping Message.edit(content) to Interaction.editReply({ message, ...content }) though

rose tangle

because then you wouldn't be able to edit them after 15m

drifting zealot

Would anyone know as to why this is only being limited to 1k? ```js
const guild = await client.guilds.fetch(interaction.guild.id);
const bans = await guild.bans.fetch();

bleak owl

that is discord’s limit

drifting zealot

Oh

Is there any way to make it show over 1k though?

bleak owl

it’s per call afaik, but i’m not 100% sure on that

drifting zealot

Alr

rose tangle

it's paginated

shadow harness

How the hell do you handle interactions after 15m without putting your entire codebase in client.on wraps?

clear garnet

What's the issue you're having?

rose tangle

you can't handle an interaction after 15m Thonk

foggy dawn

quick question... is there a way to change server traits and banner via the discord api?? and if so is it in djs yet?

nvm ill just check myself

rose tangle

server traits are undocumented

sharp ginkgoBOT

method Guild#setBanner() discord.js@14.22.1
Sets a new guild banner.


guild.setBanner('./banner.png')
 .then(updated => console.log('Updated the guild banner'))
 .catch(console.error);

rose tangle

for the latter

last time I checked discord was deciding whether to keep traits in the first place

foggy dawn

yeah, i doubt bots will ever be able to change traits

but how about banner colors, like you canc haneg the banner color and use banner images if ur lvl 2

theyve been out for long enough, i hope they added a way for bots to select the color.. but its one of thoose features where they may take awhile to add it or never add it

is there a way to change if the server is private or not via bot

how about guild tags..

sharp ginkgoBOT
foggy dawn

😭

image format????? gif??????

wait no im dumb

bots cant change guild tags ether... what a prison.... i still wanna read user pronouns, badges, and discriptions via normal bots

rose tangle

why?

grim sinew

Hey how would I get the role provided from this I know it's interaction.options? But what comes after options?

rose tangle

getRole

sharp ginkgoBOT
grim sinew
rose tangle getRole

Alright, I've tried get role but for some reason it still tends to return null, when I try to log it

rose tangle

you misspelled administrator in your option name (addRoleOption)

change it and deploy your commands

grim sinew
rose tangle

no worries

grim sinew
rose tangle no worries

Sorry to bother you again, but for threads is their anyway to add roles instead of members within threads?

halcyon vault
CombinedError (2)
  Received one or more errors

  1 ExpectedValidationError > s.instance(V)
  |   Expected
  |
  |   Expected:
  |   | [Function: ButtonBuilder]
  |
  |   Received:
  |   | undefined

  2 ExpectedValidationError > s.instance(V)
  |   Expected
  |
  |   Expected:
  |   | [Function: ThumbnailBuilder]
  |
  |   Received:
  |   | undefined

But, you know, even in the discord js template, they given as ButtonBuilder.

loud quartz

and you didn't give it anything

grim sinew
stable sun

Or just role.toString() if you happen to have it

grim sinew

Thank you

grizzled rune

if a message component collector ends due cause it's time has expired then what would be the value for endReason

clear garnet

time

grizzled rune

oik

bitter socket

Why am I getting a type error here?
Is this the correct type for the interaction object, when receiving the interaction over http?
import type { APIInteraction } from "discord-api-types/v10";

dense jackal

are you using d.js library?

bitter socket

only "discord-api-types" which is also from djs

dense jackal

can you check if a simple if (interaction.type !== 5) break; will fix it

switch statements and typeguards are sometimes not working properly idk

bitter socket

Oh yes I just noticed the previous cases don't have a break
thank you!

dense jackal

ahh that might be the issue

overlooked that too actually lol

iron void

I’m already using it

dense jackal

shouldn’t pop up if the old event name isn’t anywhere in your project

proud arrow
proud arrow

Doesn't mean you can share your code, and if your events are handled by commandkit, check with them how they are doing it and if they have update their code to remove deprecated events

iron void

Oh ok

kindred dragon

Does anyone know what's wrong about this embed?
Specifically the author.
As soon as I add that, I get a "encountered one or more errors" error when the bot tries to send the embed, without any clear info on what's wrong...

//send a warning message both to all channels the filter deleted messages in and the log (if it exists)
let warnemb = new Discord.EmbedBuilder()
.setAuthor({name: `⚠️ A user triggered the scam prevention filter`, url: `msg.url`})
.setTitle(`⚠️ Do NOT click any links from recent messages!`)
.setDescription(`A user has triggered the scam prevention filter. Recently posted links may be dangerous.`)
.setColor(`#f55742`)
.setFooter({text: 'A.C.I. Security can make mistakes. Moderators have been informed.'})
little pebble
kindred dragon

Sure, one second!

oh god i think i just saw it

yeah i used 'msg.url' instead of msg.url

harsh arch

Seems like you wanted to do ${msg.url} and just forgot to hahah

kindred dragon

yeah haha

rigid crest

can custom emojis show in modal question titles? like "Who is this? pepe "

proud arrow

I don't think so, no.

grave willow

My bot isn't responding to DM.

I have

        GatewayIntentBits.MessageContent,
        GatewayIntentBits.DirectMessages,

Am I missing something else?

toxic moat
proud arrow
sharp ginkgoBOT

To receive direct message events on "messageCreate" with your bot, you will need:

dense jackal

@grave willow ^^

crimson thistle

this may sound insanely stupid, but i've seen specifically a discord bot named Dyno that has basically the same "message commands" as the slash commands (for example, you can use the ban slash command or the message ?ban)
is there some way i can kinda replicate the system on my own bot? i'm just trying to experiment with it and to see what i can do with it

lusty bramble

Team, whats the "Set a channel status", can someone give me a quick help ❤️

dense jackal

thats about it actually

crimson thistle
sharp ginkgoBOT

tag suggestion for @lusty bramble:

discord.js does not support features until they are officially documented.
While there might be a way for these features to work, it can change at any time without any notice

silent mirage
wary coral
silent mirage

yay let me remove logger and i will send

TypeError: guild.channels.create is not a function
    at Object.guildCreate (/home/shawnhamby/Documents/Projects/FrostSentinel/src/bot/events/guildCreate.ts:34:43)
    at FrostSentinelClient.<anonymous> (/home/shawnhamby/Documents/Projects/FrostSentinel/src/bot/handlers/eventHandler.ts:39:54)
    at FrostSentinelClient.emit (node:events:518:28)
    at module.exports [as GUILD_CREATE] (/home/shawnhamby/Documents/Projects/FrostSentinel/node_modules/discord.js/src/client/websocket/handlers/GUILD_CREATE.js:30:14)
    at WebSocketManager.handlePacket (/home/shawnhamby/Documents/Projects/FrostSentinel/node_modules/discord.js/src/client/websocket/WebSocketManager.js:351:31)
    at WebSocketManager.<anonymous> (/home/shawnhamby/Documents/Projects/FrostSentinel/node_modules/discord.js/src/client/websocket/WebSocketManager.js:235:12)
    at WebSocketManager.emit (/home/shawnhamby/Documents/Projects/FrostSentinel/node_modules/@vladfrangu/async_event_emitter/src/index.ts:513:28)
    at WebSocketShard.<anonymous> (/home/shawnhamby/Documents/Projects/FrostSentinel/node_modules/@discordjs/ws/src/strategies/sharding/SimpleShardingStrategy.ts:32:47)
    at WebSocketShard.emit (/home/shawnhamby/Documents/Projects/FrostSentinel/node_modules/@vladfrangu/async_event_emitter/src/index.ts:513:28)
    at WebSocketShard.onMessage (/home/shawnhamby/Documents/Projects/FrostSentinel/node_modules/@discordjs/ws/src/ws/WebSocketShard.ts:640:10)
wary coral

The file you linked is guildCreate.ts?

silent mirage

yup

wary coral

if you log guild on line 32 what does that print

silent mirage

its a blank line no code

wary coral

I mean using console.log(guild) what is printed out to console. as I believe guild is being passed undefined

could you also provide the code where guildCreate is used

silent mirage

u think i see my issue it calling client in guild

let me try one thing

wary coral
stoic portal

Hey everyone! My current discord.js version is ^14.14.1, and I’m considering updating to the latest one. Could anyone help me out by pointing out any major changes or breaking updates I should be aware of?? There have been quite a few releases..

silent mirage

yup that was issue

bleak owl

it’s on the GuildChannelManager class

which cache returns

wary coral

cache is a collection on the channel manager?

bleak owl

look at the docs

worthy drift

🥴

silent mirage

i can also agree with mafia i read the docs i was doing it right that is why i needed help

wary coral
stoic portal
bleak owl

im very sorry, i confused myself

wary coral
wary coral
stoic portal

Thanks Mafia! I really appreciate 👍

wary coral

You can update right to the latest. you may just need to add some typegaurd stuff

unique mountain

when mentioning an amount of users in a server and that mention appears as "unknown-user", is there a definitive fix for that, or is it soely dependant on which users are cached for the person viewing the message?

stoic portal
wary coral
unique mountain
wary coral
wary coral
unique mountain

let's say it was a leaderboard command that mentions the top 100 message users in a larger server, can I force resolve those mentions for those that view my bots message

unique mountain
wary coral

also if it an embed. the mentions are not parsed in the embed

unique mountain

it's cv2

wary coral

than it should, could you share the send/reply function where the message is sent

wary coral

I meant in the code

unique mountain

(for me)

unique mountain
wary coral I meant in the code
    await interaction.guild.members.fetch();

    const memberNames =
        role.members.size === 0
            ? "N/A"
            : role.members.size > 10
                ? `${role.members
                        .map((member) => `<@!${member.user.id}>`)
                        .slice(0, 10)
                        .join(", ")} ...`
                : role.members.map((member) => `<@!${member.user.id}>`).join(", ");

(previous to this we were just using member.user)

wary coral

I am looking for ineration.reply. as a side note <@!USER_ID> format is deprecated I would recommend using member.toString()

solemn vortex

hello, is there any way for me to "acknowledge" an interaction, without replying to it? basically i want nothing to show up after executing the command, not even a confirmation message or anything

without showing The application did not respond

only way i thought of doing this is to send a dummy reply and then delete it

blissful zephyr

Hello! I want to ask if it is possible to add a select menu to the modal window.

wary coral
solemn vortex

yes, the feedback is there, just not in the reply

wary coral
blissful zephyr
orchid radish
solemn vortex

basically im doing a github issues style task management bot that is super specific for my use case. when you add a new issue, a new thread for that issue is generated and a big message containing a list of all issues

so pretty much the feedback is the thread being created and the list updating, sending a message just to say "created successfully" would be distracting

wary coral

Yeah but that would be the correct response. Create an ephemeral message that says that the issue was created and potentially a button linking to the message where it's tracked or thread

solemn vortex

that would also be a good idea

dense jackal
sharp ginkgoBOT
dense jackal

sent the wrong one hold on

sharp ginkgoBOT

method ButtonInteraction#deferUpdate() discord.js@14.22.1
Defers an update to the message to which the component was attached.


// Defer updating and reset the component's loading state
interaction.deferUpdate()
  .then(console.log)
  .catch(console.error);

rose tangle

that still shows an error but after a while, wouldn't recommend using it for that since it's not what discord intended and they were already answered with a better idea

unique mountain
    const parts: string[] = command.split(" ");
    const topCommand: ApplicationCommand | undefined = commands.find(
        (c) => c.name === parts[0],
    );
    if (!topCommand) return `No command found with name "${command}"`;

    const { command: deepCommand, id } = getDeepCommand(topCommand, parts);

    const description: string =
        "description" in deepCommand && deepCommand.description
            ? deepCommand.description
            : (topCommand.description ?? "No description");

    return {
        components: [
            new ContainerBuilder()
                .setAccentColor(0x0494e4)
                .addTextDisplayComponents(
                    new TextDisplayBuilder().setContent(
                        `</${parts.join(" ")}:${id}> — ${description}`,
                    ),
                ),
        ],
        flags: MessageFlags.IsComponentsV2,
    };
};

I'm having no luck with this

sand atlas

I foudt it

sharp ginkgoBOT
wary coral

in raw text it looks like this </name subcommand_group subcommand:COMMAND_ID> The Id is the same for all subcommands and subcommand groups

unique mountain

I'm sure it references the parent ID, so for commands, it's own id, for subcommands, the command ID (same twice) for grouped commands, the subcommand group id

sharp ginkgoBOT

discord API Reference - Message Formatting
read more

wary coral

it is true

Subcommands and subcommand groups can also be mentioned by using respectively </NAME SUBCOMMAND:ID> and </NAME SUBCOMMAND_GROUP SUBCOMMAND:ID>.

unique mountain

yeah

dense jackal

afaik subcommands and subcommand groups do not have a separate id

dense jackal

then why saying Mafia said something that isn’t true?

</name subcommandgroup subcommand:0> this is a valid format

unique mountain

can you use emojis in autocomplete similar to select menu emotes?

nvm u can't

lean sail

can you not have a button + thumbnail in a section? its only displaying the thumbnail

halcyon bison

you cannot, you can only have 1 accessory

lean sail
halcyon bison

2 sections

lean sail

ohhh

tardy sable

in message.cleanContent sometimes threads dont get formatted to their thread name. am i doing something wrong or is it a bug?

radiant epoch
lean sail ohhh

I mean... if you have read the text inside the screenshot you sent... you could've gotten your answer lol

tardy sable
verbal plinth

Is it possible to get all servers where the bot is in a voice channel? I don't want to go through every guild to do this.

bleak owl

mind if i ask for what purpose?

verbal plinth

Sometimes some shards have a higher ping, and I'm trying to figure out why. To do that, I want to look at a few things, including this.

halcyon bison

afaik there isn't a way to get all servers where the bot is in a voice channel across all shards in one go
that collection of adapters is going to be specific to the current shard
furthermore if you're looking to get guilds where the bot's voice state shows them connected despite having destroyed the connection from your end, there wouldn't be an adapter

empty canopy

does discord.js support reading server tags yet

bleak owl

it does!

empty canopy

oh yay

sharp ginkgoBOT
radiant epoch
unique shoal

Yes, if you have the oauth scope to be able to do so

and token

clear garnet

Can you elaborate on what you mean by "do" in regards to attachments?

pearl roost

how do i make the embed field look like this? like the bracket a and bracket b, because when i try it out, it become bracket a, bracket b, and then bracket c

pearl roost

I try this but the Field 4 just don't want to get up```js
interaction.reply({
embeds: [
new EmbedBuilder()
.setTitle('Fields')
.setColor('Random')
.addFields(
{ name: 'Field 1', value: 'Value 1', inline: true },
{ name: 'Field 2', value: 'Value 2', inline: true },
{ name: 'Field 3', value: 'Value 3', inline: false },
{ name: 'Field 4', value: 'Value 4' }
)
]
})

no matter i set inline true or false on field 4, its just still there

dense jackal

and then the \n character for a new line is used

so its

{ name: “Bracket A”, value: “NikooLoy vs TBA\nBelum dimulai\n\nAjax kenzz va Babyshark\nBelum dimulai\n\n…” }
stable sun

Yea, the way you want to do it is simply not possible with embeds

toxic moat

how do i pass in files/images when sending msgs to a webhook?

sharp ginkgoBOT

documentation suggestion for @toxic moat:
method Webhook#send() discord.js@14.22.1
Sends a message with this webhook.


// Send a basic message
webhook.send('hello!')
  .then(message => console.log(`Sent message: ${message.content}`))
  .catch(console.error);

dense jackal
toxic moat
dense jackal

read the docs, its all explained there

stable sun

files? : readonly ( | BufferResolvable | Stream | JSONEncodable<APIAttachment> | Attachment | AttachmentBuilder | AttachmentPayload )[]

Supposed to be inherited from MessageCreateOptions

I’ve never seen anyone use MessagePayload directly tbh. It’s usually used internally

stable sun

Yea, no one uses MessagePayload

Always MessageCreateOptions

dense jackal

yeah but they asked for a webhook, so I looked up Webhook#send()

and this is what is present on the docs

stable sun

WebhookMessageCreateOptions mostly extends MessageCreateOptions

It does omit some options, but files is not omitted

dense jackal

files do not exist on WebhookMessageCreateOptions

sharp ginkgoBOT
snow onyx

that one extends MessageCreateOptions

which does have files

dense jackal

oh wait I see now

stable sun
dense jackal

but why isn't it listed on that page then?

snow onyx

on what page

dense jackal

WebhookMessageCreateOptions|

if it extends it should be listed on there too right?

snow onyx
dense jackal

yes but it doesn't appear on the properties list

stable sun

It’s inherited

snow onyx

yes because its not typed that way

dense jackal

I thought that would automatically add it to the properties list

snow onyx

send takes string | MessagePayload | WebhookMessageCreateOptions
What each type extends is listed on their own interface docs

dense jackal

yeah and I thought the docs would taking everything it extends to be present on the list of properties

so the user itself doesn't need to click on different pages if stuff is extended from something else

stable sun

Pretty easy to assume that extended props show when in reality it’s just overridden methods

TextChannel.send isn’t real. A separate class adds on the send method

dense jackal

yes, TextChannel extends BaseGuildTextChannel

and .send() comes from class BaseGuildTextChannel, but it also appears on the list of methods on the TextChannel page

stable sun

Have you checked the implementation?

dense jackal

this page gives me the assumption that this is everything I can work with

why would it be needed to click on MessageCreateOptions to see if it is present there, maybe that is extended from some other class, which might be extended from another class

do I then really have to click that extends X class page three times just to see what I actually have for properties?

stable sun
dense jackal

just saying that the d.js docs maintainers might need to think about showing every possible property or method on each interface or class -- omitted stuff gets removed from the properties list, so why not extended stuff being added to the list?

yes I can check it on my TS intellisense too, but that shouldn't be needed

cosmic burrow

Hello, i tried to run the command /create-flight it says "The application did not respond", i have await Interaction.reply already.

create-flight.js code:


module.exports = {
  data: new SlashCommandBuilder()
      .setName('create-flight')
      .setDescription('Creates a flight!')
      .addStringOption(option =>
          option
              .setName('flight_number')
              .setDescription('Flight Number example: NE-XXXX')
              .setRequired(true))
      .addStringOption(option =>
          option
              .setName('departure')
              .setDescription('Departure Airport example: JFK or KJFK')
              .setRequired(true))
      .addStringOption(option =>
          option
              .setName('arrival')
              .setDescription('Arrival Aiport example: LAX or KLAX')
              .setRequired(true))
      .addStringOption(option =>
          option
              .setName('aircraft')
              .setDescription('Any Aircraft example: Airbus A320')
              .setRequired(true))
        ,async execute(interaction) {
          const flightnumber = interaction.options.getString('flight_number')
          const Departure = interaction.options.getString('departure')
          const Arrival = interaction.options.getString('arrival')
          const Aircraft = interaction.options.getString('aircraft')

          const exampleEmbed = new EmbedBuilder()
              .setColor('8x808080')
              .settitle('fuck flight ever')
              .setDescription('yeah')
              .setTimestamp()
            await interaction.editReply({ embeds: [exampleEmbed] });
        }
    }
steel trail

Where do you have .reply()? Not in that codeblock

And unless you get an error in your console that code isn't even executed

Do you have an interactionCreate event handler?

cosmic burrow

code:


module.exports = {
    name: Events.InteractionCreate,
    async execute(interaction) {
        if (!interaction.isChatInputCommand()) return;

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

        if (!command) {
            console.error(`No command matching ${interaction.commandName} was found.`);
            return;
        }

        try {
            await command.execute(interaction);
        } catch (error) {
            console.error(error);
            if (interaction.replied || interaction.deferred) {
                await interaction.followUp({ content: 'There was an error while executing this command!', flags: MessageFlags.Ephemeral });
            } else {
                await interaction.reply({ content: 'There was an error while executing this command!', flags: MessageFlags.Ephemeral });
            }
        }
    },
};```
steel trail

And is that event handler getting called at all?

sharp ginkgoBOT

If you aren't getting any errors, try to place console.log checkpoints throughout your code to find out where execution stops.

  • Once you do, log relevant values and if-conditions
  • More sophisticated debugging methods are breakpoints and runtime inspections: learn more
cosmic burrow
snow onyx

Either its not executed or you are getting an error.
You are not replying properly to that command, since you are directly trying to use editReply() without having deferred or replied before

cosmic burrow
sharp ginkgoBOT

Responding to interactions:

  • #reply immediately respond with a message
  • #update immediately update the original message (buttons, select menus)
  • #showModal immediately show a modal (cannot be deferred)
  • #deferReply/Update respond later (up to 15 minutes)
  • #followUp post an additional message

The initial response has to happen within 3s of receiving the interaction!

steel trail

You need to do either of 1, 3 or 4

In your case probably 1 or 4

cosmic burrow
wintry cargo

hey uhhh got a problem and I come here just to know if it is a problem with discordjs rest or with api or something else. sry I'm a little lost since it is a problem about a request on a bot I try to host online and I only get this when he is hosted online not and not when he's hosted on my computer.

throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^
DiscordAPIError[10062]: Unknown interaction
at handleErrors (/workspace/node_modules/.pnpm/@discordjs+rest@2.6.0/node_modules/@discordjs/rest/dist/index.js:762:13)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async BurstHandler.runRequest (/workspace/node_modules/.pnpm/@discordjs+rest@2.6.0/node_modules/@discordjs/rest/dist/index.js:866:23)
at async _REST.request (/workspace/node_modules/.pnpm/@discordjs+rest@2.6.0/node_modules/@discordjs/rest/dist/index.js:1307:22)
    at async ChatInputCommandInteraction.reply (/workspace/node_modules/.pnpm/discord.js@14.22.1/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:200:22) {```

and it was working fine not long ago and I didn't touch anything since but now I get this for every interaction I do

I get a 404 on the post

and rawError: { message: 'Unknown interaction', code: 10062 },

loud quartz

Are you running multiple of the same bot at once

wintry cargo

hmmmm

feeling dumb rn because I think that's it I didn't configure the hosting to avoid it

I didn't think of this problem since last time I tried running another instance I had a different error : 'Interaction has already been acknowledged.'
But yeah I think that's it thank you a lot I'd be stuck much longer without asking

cosmic burrow

all the commands are working except, /create-flight.js

i do have

await interaction.editReply({ embeds: [exampleEmbed] });

verbal plinth
snow onyx
verbal plinth
loud quartz

we don't have clusters

verbal plinth

I have clusters, and each cluster has two shards.

loud quartz

and that doesn't really answer the question

steel trail
cosmic burrow

module.exports = {
  data: new SlashCommandBuilder()
      .setName('create-flight')
      .setDescription('Creates a flight!')
      .addStringOption(option =>
          option
              .setName('flight_number')
              .setDescription('Flight Number example: NE-XXXX')
              .setRequired(true))
      .addStringOption(option =>
          option
              .setName('departure')
              .setDescription('Departure Airport example: JFK or KJFK')
              .setRequired(true))
      .addStringOption(option =>
          option
              .setName('arrival')
              .setDescription('Arrival Aiport example: LAX or KLAX')
              .setRequired(true))
      .addStringOption(option =>
          option
              .setName('aircraft')
              .setDescription('Any Aircraft example: Airbus A320')
              .setRequired(true))
        ,async execute(interaction) {
          const flightnumber = interaction.options.getString('flight_number')
          const Departure = interaction.options.getString('departure')
          const Arrival = interaction.options.getString('arrival')
          const Aircraft = interaction.options.getString('aircraft')

          const exampleEmbed = new EmbedBuilder()
              .setColor('8x808080')
              .settitle('fuck flight ever')
              .setDescription('yeah')
              .setTimestamp()
            await interaction.reply({ embeds: [exampleEmbed] });
        }
    }```

i have added await interaction.reply({ embeds: [exampleEmbed] })
verbal plinth

I know, just trying something different

cosmic burrow

yeah

steel trail

What "yeah"? Did you do that? Do you know where execution stops?

steel trail

But you'd rather keep it for yourself instead of telling those trying to help you?

cosmic burrow

yes, because i have a console.log

steel trail

Good luck fixing it yourself then

cosmic burrow

yeah, i have await interaction.repy

run the command and it didn't work

snow onyx

Show your console output.

cosmic burrow

PS C:\Users\timpu\OneDrive\Desktop\NovaEagle Discord Bot> node deploy-commands.js
Started refreshing 4 application (/) commands.
Successfully reloaded 4 application (/) commands.
PS C:\Users\timpu\OneDrive\Desktop\NovaEagle Discord Bot>

i reloaded the commands, tried to run the command, it did not worked because of this stupid error "the application did not respond"

snow onyx

Just so we are on the same page... you are actually starting the bot, are you?

What you have shown is just registering the command(s), but that ain't running the bot

snow onyx

Show the output of running the bot & using the command then

cosmic burrow

Ready! Logged in as NovaEagle Air Bot#7331

rose tangle

you said you placed logs

(and didn't show where which would be useful as well)

cosmic burrow

after i run the bot, and i run the command it says "There was an error while executing this command!"

rose tangle

are you a native english speaker?

cosmic burrow
rose tangle

what's your native language?

cosmic burrow
snow onyx

If that is all that was logged, add more debug logs to figure out where it stops.
My guess is that your command handler or event handler is broken.

cosmic burrow

k

tranquil pivot

how can i use interaction.options.getUser() if the interaction is autocomplete? my command is structured like this:
/name <user> <string>
and when autocompleting the string i want to get the id of the user. is this possible?

sharp ginkgoBOT

guide suggestion for @tranquil pivot:
guide Slash Commands: Autocomplete - Accessing other values
However, the .getUser(), .getMember(), .getRole(), .getChannel(), .getMentionable() and .getAttachment() methods are not available to autocomplete interactions. Discord does not send the respective full objects for these methods until the slash command is completed. For these, you can get the...
read more

tranquil pivot

so #get().value will return the id entered in the command right

rose tangle

the id of the selected user, yes

woeful lark

HI, I have a question, what is the limit for placing TextDisplay in ContainerBuilder? How many can I place at most?

polar karma

iirc you can have up to 40 components in a container, the api docs should list the limits

woeful lark

oh okay, thanks

steel trail

40 components in total. Since a container is also a component the max is 39 textdisplays in it. But if all you have in it are textdisplays then one textdisplay does the same job

old shell

my code used to work fine until it started running into this error Error processing file: image1.jpeg Error: Expected token to be set for this request, but none was present am i being rate limited?

topaz bluff

What version of DJS are you using?

old shell

nope it still breaks (it also sends this at the end Uncaught RangeError RangeError: Shard 0 not found

loud quartz

at the end of what

steel trail

That sounds like you destroyed your client somewhere

old shell

oh found the issue if (){ client.destroy(); }

granite lion

any examples of what is a invite with a type of friend/2?

bleak owl

a what?

vast bloom

do i need to do anything about any of this? was getting errors earlier for missing libraries (and have since installed @snazzah/davey)

sharp ginkgoBOT
bleak owl
granite lion

ive seen group dms invites but never friend invites

brisk pond

I'm literally so confused right now. I'm following the discord.js guide setting up the ping, server, and user slash commands but I'm repeatedly getting an error from the bot saying that the bot didn't respond in time. I searched in this chat for the same problem but it didn't help at all. I made sure the bot was running with node . and I tried putting console.logs all over index.js but it's not showing up at all when I try the commands

cosmic burrow

i put global commands and my commands are duplicated 2 commands:
/ping
/ping

sharp ginkgoBOT

tag suggestion for @cosmic burrow:
If you have duplicate commands on your server, you registered both global and guild commands.

You can remove the duplicates by resetting either the global or guild commands

  • Resetting global commands: rest.put(Routes.applicationCommands(clientId), { body: [] })
  • Resetting guild commands: rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: [] })
halcyon bison
brisk pond
halcyon bison
brisk pond
halcyon bison
brisk pond

ahhh ok i gotchu thank you. I removed it but I'm getting another error when I try to do /ping but imma see if I can try to fix it on my own

pallid flax

Hey everyone, what's the recommended way to serve HTTPS certificates when setting up an activity?

unique shoal

Doesn't sound very djs related

pallid flax

Looking now and it seems I've been mislead. I was running into a SSL Handshake Failed while trying to load my activity but I think the error is somewhere else.

topaz bluff
cinder shale

was MessageFlags.IsComponentsV2 removed? if yes, whats the replacement

bleak owl

not at all

why would it be removed?

cinder shale
bleak owl why would it be removed?

idk, but im getting this error Property 'IsComponentsV2' does not exist on type 'typeof MessageFlags'. when i try to use MessageFlags.IsComponentsV2

bleak owl

oh boy, let me refer this to the devs

what version of d.js are you on?

cinder shale
export declare enum MessageFlags {
    /**
     * This message has been published to subscribed channels (via Channel Following)
     */
    Crossposted = 1,
    /**
     * This message originated from a message in another channel (via Channel Following)
     */
    IsCrosspost = 2,
    /**
     * Do not include any embeds when serializing this message
     */
    SuppressEmbeds = 4,
    /**
     * The source message for this crosspost has been deleted (via Channel Following)
     */
    SourceMessageDeleted = 8,
    /**
     * This message came from the urgent message system
     */
    Urgent = 16,
    /**
     * This message has an associated thread, which shares its id
     */
    HasThread = 32,
    /**
     * This message is only visible to the user who invoked the Interaction
     */
    Ephemeral = 64,
    /**
     * This message is an Interaction Response and the bot is "thinking"
     */
    Loading = 128,
    /**
     * This message failed to mention some roles and add their members to the thread
     */
    FailedToMentionSomeRolesInThread = 256,
    /**
     * @unstable This message flag is currently not documented by Discord but has a known value which we will try to keep up to date.
     */
    ShouldShowLinkNotDiscordWarning = 1024,
    /**
     * This message will not trigger push and desktop notifications
     */
    SuppressNotifications = 4096,
    /**
     * This message is a voice message
     */
    IsVoiceMessage = 8192,
    /**
     * This message has a snapshot (via Message Forwarding)
     */
    HasSnapshot = 16384
}``` looks like its rreally gone lmao
bleak owl

it's there for me. try reinstalling d.js

cinder shale

will do

cinder shale
bleak owl

oh okay great

woeful lark

I'm having problems with my bot's cache, it's not getting the right users, or it didn't go to the cache, what can I do? I used client.users.cache.size and it only returns 2, even though there are 38 users using it.

can someone help me?]

wary coral

you can fetch the member/user

but I am not sure what you issue is. In regards to the "not getting the right users"

If you could share the affected code and what your trying to acomplish

dense jackal
unique shoal

You cant bulk fetch users

dense jackal

oh

unique shoal

What would the scope even be

dense jackal

I thought you could under 100

unique shoal

no

woeful lark

the first one I'm using:

client.guilds.cache.reduce((a, b) => a + b.memberCount, 0)

other:

client.users.cache.size
sharp ginkgoBOT

Getting your bot's member count

  • client.users.cache.size is unreliable because it will only return cached users
  • The preferred method is using collection.reduce() on client.guilds.cache
client.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0)
unique shoal

This doesn't explain why you're concerned about the users not being in cache

And I mean, technically those numbers could be correct if its just you and your bot in 19 guilds mmLol

woeful lark

I have a server with 19 members and another with 6 and it is in others... but even so it only pulls 2 users

unique shoal

And why is that a problem?

Do you do any cache overrides in your constructor?

woeful lark
unique shoal

no it shouldnt "pull" anything

woeful lark
unique shoal

The user cache is populated over time when people interact with your bot

This shows everything except the options you passed

woeful lark
unique shoal

yeah okay, that looks fine

woeful lark

It must be that problem you told me about, about how as users use the bot, it collects

but sorry, and thanks for the help

unique shoal

no worries

river sequoia

Why am I getting this error?

Error executing command "leaderboard":  TypeError: leaderboardStore.init is not a function
    at Object.execute (C:\Users\hollowed\OneDrive\Desktop\the-organization\src\commands\Community\leaderboard.js:87:22)
    at Object.execute (C:\Users\hollowed\OneDrive\Desktop\the-organization\src\events\handlers\interactionCreate.js:168:31)
    at Client.<anonymous> (C:\Users\hollowed\OneDrive\Desktop\the-organization\src\functions\handlers\handelEvents.js:83:62)
    at Client.emit (node:events:520:35)
    at InteractionCreateAction.handle (C:\Users\hollowed\OneDrive\Desktop\the-organization\node_modules\discord.js\src\client\actions\InteractionCreate.js:101:12)     
    at module.exports [as INTERACTION_CREATE] (C:\Users\hollowed\OneDrive\Desktop\the-organization\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (C:\Users\hollowed\OneDrive\Desktop\the-organization\node_modules\discord.js\src\client\websocket\WebSocketManager.js:351:31)     
    at WebSocketManager.<anonymous> (C:\Users\hollowed\OneDrive\Desktop\the-organization\node_modules\discord.js\src\client\websocket\WebSocketManager.js:235:12)      
    at WebSocketManager.emit (C:\Users\hollowed\OneDrive\Desktop\the-organization\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:287:31)
    at WebSocketShard.<anonymous> (C:\Users\hollowed\OneDrive\Desktop\the-organization\node_modules\@discordjs\ws\dist\index.js:1190:51)
[01:14:29] ✚ ADD │ errors\2025-08-25T23-14-29.190Z.txt File created
wary coral
river sequoia

Alright, thank you.

glossy field

what progress djs v15 now?

bleak owl

there is no v15 yet

discord.js v14 covers 99% of the discord api at this time

v15 will come when there’s a need for it

robust flame

TypeError: Cannot read properties of undefined (reading 'highest')

const bot = interaction.guild?.members.fetch(`${this.client.user?.id}`) as unknown as GuildMember;
..........................
if (member.roles.highest.position >= bot.roles.highest.position) {

??

little pebble
robust flame
little pebble
robust flame

'bot' is possibly 'undefined' is was typescript compile error xd

robust flame
coarse storm
const container = new ContainerBuilder()
.setAccentColor(0x0080FF)
.addTextDisplayComponents(
  new TextDisplayBuilder()
  .setContent("abcd")
)
return interaction.update({ components: [container], ephemeral: true });

Using this to update an existing container, but recieving the following error:

DiscordAPIError[50035]: Invalid Form Body
data.components[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (1,).
    at handleErrors (/home/container/node_modules/@discordjs/rest/dist/index.js:748:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async BurstHandler.runRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:852:23)
    at async _REST.request (/home/container/node_modules/@discordjs/rest/dist/index.js:1293:22)
    at async ButtonInteraction.update (/home/container/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:361:22)
snow onyx

You need to add the MessageFlags.IsComponentsV2 flag

coarse storm
snow onyx

I believe so, yes

waxen walrus

I don't add that flag when editing/updating and it still works

snow onyx

I mean, you are getting the error about it, so probably :P

waxen walrus

Is there some convenient way of re-sending components (e.g. a container) with just one thing modified? Something like destructuring the interaction.message.components into discordjs classes and then change one text display or so?

neat nimbus

If you notice that the role selection menu or channel selection menu is not updating or is showing old selections when moving between steps (like from "Give Roles" to "Take Roles" or when selecting channels),

sharp basin

how do i make an embed like this

crimson thistle
sharp ginkgoBOT

guide suggestion for @sharp basin:
guide Popular Topics: Display Components - Container
read more

urban sequoia

is there any way to put some text below the image besides the footer? im learning the hierarchy for the embed but i cant seem to get some text below the image

i dont think that the order in the code matters

snow onyx

No, there is not

It should be possible with Components V2, but then you don't have specific fields/footers

urban sequoia

so the only way is using the footer

snow onyx

In Embeds, yes

urban sequoia
snow onyx

You are not supposed to, it replaces them

sharp ginkgoBOT

guide Popular Topics: Display Components
read more

urban sequoia

but the guide covers only a little bit no? or is that the whole thing

bleak owl

take a look and you’ll see what it covers

wary coral
urban sequoia
polar karma

one accessory per section

formal ore

how yall handle buttons?

bleak owl

something i do is similar to handling slash commands like shown in the d.js guide, but instead of setting slash command data, i set the custom id and run the file that way

candid glen
formal ore

i mean just buttons,i also used smt like sladh command and found that messy creating new folder / file for each folder so i added an button function in the same as command file is and i use swich case to handle each button but it seems to be buggy talking about replying and some command gets cross executed

loud quartz
meager agate
steel trail

Because you have two buttons with empty strings as labels and customId

meager agate
crimson gale

yeah, don't do that

loud quartz

which are probably getting stripped

hangul filler (U+3164)

meager agate

i tested it by replacing them with numbers and it gave the same error

candid glen
meager agate
loud quartz
meager agate

yes

steel trail

Show full error with stacktrace

loud quartz
meager agate
meager agate
steel trail
steel trail
meager agate
formal ore

use emoji instead?

midnight folio

hey, i dont think this has anything to do with discord.js but im still gonna ask cause i dont know where to ask, if i want to reuse a button isnt it best practice to make the button into a function in a separate file and call that function in the command files that use the same button?

outer plume
outer plume
midnight folio
outer plume
midnight folio

i dont know if this is the most efficient way but its something so i dont make the same button over and over

outer plume

yes I got that the first time you said it…
and it’s efficient. If you’re using the button more than once, that is

meager agate
steel trail
sharp ginkgoBOT
steel trail

Your message.components[0] is an instance of 👆 , not raw API data. Call toJSON() on it to get the API data

wooden carbon

member : CacheTypeReducer<Cached, GuildMember, APIInteractionGuildMember>
I would like to access APIInteractionGuildMember's roles structure

How do i narrow member down to APIInteractionGuildMember

red coral

roles is a GuildMemberRolesManager when it come from a cached guild. So inCachedGuild is what you want. If you want the raw roles array of strings then it’s when it’s not from a cached guild

wooden carbon

alright

https://discord.js.org/docs/packages/discord.js/14.22.1/GuildMemberRoleManager:Class#holds
can i pass raw snowflakes

nvm i can't

meager agate
loud quartz

but the literally first thing in the javascript specification is to try and convert the given parameter to string

uneven crater

-# TypeScript hates implicit coersion because Weird and Unfortunate Things™ can happen.

sharp ginkgoBOT

method GuildSoundboardSoundManager#create() discord.js@14.22.1
Creates a new guild soundboard sound.


// Create a new soundboard sound from a file on your computer
guild.soundboardSounds.create({ file: './sound.mp3', name: 'sound' })
  .then(sound => console.log(`Created new soundboard sound with name ${sound.name}!`))
  .catch(console.error);

modern owl

does the file here support base64?

rose tangle

make it a buffer and pass that

modern owl

how can I convert base64 to buffer?

sharp ginkgoBOT
modern owl

I was able to pass base64 until now, but today I saw an error and realized it's interpreting the base64 I'm sending as a file location, trying to find the file in the working directory, and giving an error because the base64 is too long

modern owl
rose tangle

djs always resolved strings as file paths

it will but you have to pass the encoding

modern owl

oh im dumb I was already taking it as a buffer before converting to base64

thanks

proper gorge

how to make a normal space?

and why aren't the stickers showing?

dense jackal
sharp ginkgoBOT
dense jackal
proper gorge

2 with space

dense jackal
cinder shale

How do I get the hash of a guild tag badge via djs?

tardy sable
sharp ginkgoBOT
cinder shale

thank you!

iron needle

Is it possible to make a button without any content, as in this image? (These currently use a "blank" emoji, but I'd rather not use this method.)

unique shoal

Could try a non-breaking space

iron needle

Good idea, thank you!

iron needle
unique shoal

yeah idk then sorry

dense jackal
iron needle

Yup but that's fine. Is it possible to use application emojis in buttons? By just pasting the ID?

spark ledge
iron needle

Oh wait, my bad, I used setEmoji instead of label. \u200B does in fact work

bleak owl

i just tried the blank unicode character and it worked fine for me.

iron needle

I don't know about those non-breaking spaces, but I'll do it with this character. Thank you very much!

bleak owl
iron needle

Yeah I know, I was doing it wrong. Thanks!

unique shoal

Oh thats the one I meant, zero-width space

My bad

sharp ginkgoBOT
formal sail

hm

sharp ginkgoBOT
unique shoal
tardy sable

how would i set allowedmentions off in my message reply but only set reply to user mention on

loud quartz

set it to don't parse anything, and set replied user to true

tardy sable

thanks

brisk pond

any idea why my channel name is returning undefined? I made sure that I had the correct channel ID. I think it might have something to do with the cache but I'm not sure how to check that.

wary coral

also it looks like your tring to get the channel befor the bot is logged in

brisk pond

i have it after my client.login, it just for some reason shows that first idk why. How would I fetch the channel?

sharp ginkgoBOT

method ChannelManager#fetch() discord.js@14.22.1
Obtains a channel from Discord, or the channel cache if it's already available.


// Fetch a channel by its id
client.channels.fetch('222109930545610754')
  .then(channel => console.log(channel.name))
  .catch(console.error);

brisk pond

ahhh i gotchu thank you

uneven crater
brisk pond
uneven crater
client.once(Events.Ready, () => {
  console.log("connected to discord"); // Will run after the bot is ready to do stuff
});

await client.login(token);
console.log("I run after login"); // Will run after the bot has connected to the websocket - but NOT necessarily after the bot is *ready*.
brisk pond

ahhh ok i gotchu thank you. I think this might be the problem then because fetching returns null

unique shoal

fetching shouldnt be able to return null

brisk pond

:0 ok so maybe this is something else then idk what but imma try to figure it out

wary coral
uneven crater
brisk pond
robust flame
brisk pond
robust flame
brisk pond
unique shoal

clientchannels isnt a thing

robust flame

replace interaction to member

uneven crater

And you probably do not want once:true.

robust flame

why timeout is 10 seconds((

robust flame
brisk pond
unique shoal

I mean... I also dont know where client is defined here so