#djs-help-v14

78874 messages · Page 34 of 79

rose tangle

or satisfies yeah

stable sun

Or that

Either way, the withResponse: true pair is a crucial part of the type

main mason

now i'm getting this error

Property 'customId' does not exist on type 'APIButtonComponent | ButtonComponent'.

does captchaMessage have to be Message<true>?

if so, how can I type response.resource.message to be Message<true>

rose tangle

you're supossed to get the customId from the interaction, not the button component

sharp ginkgoBOT
main mason

oh... oopsies 😅

lean sail

how come the output isn't formatted properly? how can i format it?

sharp ginkgoBOT
glossy silo

i cant get my cmd to show up in message>apps, is anything else needed?

// commands/quote.js
module.exports = {
    data: new ContextMenuCommandBuilder()
        .setName('quote')
        .setType(ApplicationCommandType.Message)
        .setContexts(InteractionContextType.Guild),
        
    async execute(interaction) {
        await interaction.deferReply();
        // ...
    }
}
  • running the guild-specific deploy code from the guide
    fwiw slash cmds register fine, just the context menu ones wont show up
minor marten

Have you tried refreshing discord?

glossy silo

yeah

minor marten

All I can say is that you would need to provide your deploy script, as context menu commands deploy together with slash.

glossy silo
const { REST, Routes } = require('discord.js');
const fs = require('node:fs');
const path = require('node:path');
require('dotenv').config()

const commands = [];

const commandsPath = path.join(__dirname, 'commands');
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) {
        commands.push(command.data.toJSON());
        console.log(`Successfully loaded command: ${command.data.name}`);
    } else {
        console.log(`Cmd at ${filePath} is missing a required "data" or "execute" property.`);
    }
}

const rest = new REST().setToken(process.env.DISCORD_TOKEN);

(async () => {
    try {
        console.log(`Started refreshing ${commands.length} application (/) commands.`);
        const data = await rest.put(
            Routes.applicationGuildCommands(process.env.CLIENT_ID, process.env.GUILD_ID),
            { body: commands },
        );

        console.log(`Successfully reloaded ${data.length} application (/) commands.`);
    } catch (error) {
        console.error(error);
    }
})();

ive verified GUILD_ID is correct and that slash cmds do update

cunning hinge

are the context menus inside the commands folder?

glossy silo

yes, commands/quote.js is my ctx menu

i see it being parsed by the deploy script, just nothing on discord's dropdown menu

cunning hinge

hmmm

rigid hinge

hello, how can i add some number choices of a option of slash command in discord.js which you can pick from but also allow user to input their own number?

cunning hinge
new SlashCommandBuilder()
    .setName("command")
    .setDescription("does command stuff")
    .addIntegerOption((option) =>
      option.setName("command-option").setDescription("number").setRequired(false)
    )

that adds an integer option

rigid hinge
cunning hinge

you can do option.setChoices but i think that forces you to pick one of them, hmm

one, more convoluted method would be to use an autocomplete interaction

sharp ginkgoBOT

guide suggestion for @rigid hinge:
guide Slash Commands: Autocomplete
read more

quick storm

is there no way to disable channel caching or sweep them?

cunning hinge

why would you want to disable channel caching?

quick storm
unique shoal

you might be surprised how often discord.js relies on a channel being in the cache to operate

cunning hinge

Yeah, even if you dont use any channel data, you will still want to keep it around.

unique shoal

Which is why its not one that we support sweeping of

quick storm

oh i see, thanks

sullen wadi

Update on shard death:
Most times a shard dies, it's caused while doing:

  const [backgroundImage, backgroundGrid, backgroundLogo, avatar, platformIcon, rankImage, bestClassImage] =
    await Promise.all([
      loadImage(...),
      loadImage(...),
      loadImage(...),
      loadImage(...).catch(() => loadImage(...)),
      loadImage(...),
      loadImage(...).catch(() => loadImage(...)),
      loadImage(...).catch(() => loadImage(...)),
    ]);

loadImage is from @napi-rs/canvas.
The shard that dies does not seem to have any connection to the shard running this code. Sometimes it's the same shard, sometimes a different one.
There doesn't seem to be any spikes in memory or network usage.
No sus logs from the client's warn or debug logs. The shard that died's client had Heartbeat acknowledged, latency of 107ms a few seconds before dying.

I am kinda lost as to what to look into.

gritty oak

Can anyone tell me if my codig9 is correct?
<button>"CONTINUE"</button>
identify button="CONTINUE"="automatic click"
function ="click automatic(1)"

clear garnet

Are you aware of what this channel caters towards?

cunning hinge
cunning hinge

please elaborate

gritty oak

as?

Who?

cunning hinge

that does not look like typescript or javascript

cunning hinge
gritty oak

Okay, but how do I make it work?

unique shoal

why are you asking here

cunning hinge

this channel is for discord.js and discord.js only. that is clearly not discord.js nor is it even js or ts

unique shoal

#1081585952654360687 if you really need standard JS help, though what youve asked gives nowhere near enough context for what "make it work" means

cunning hinge
gritty oak

make the program click automatically

sullen wadi

you're in the wrong place

keen widget

is client ready?

sullen wadi
keen widget
sullen wadi

Positive

keen widget

client.on('ready'...

cuz u said shard ready

sullen wadi

The client is receiving interactions, and said interaction runs the code that is seemingly what kills the shard

keen widget

okay

at what point does it crash? like the line. and is there an error?

sullen wadi

It's the Promise.all() that causes it. Debug logs before it run, but nothing after

keen widget

hm I see

sullen wadi

No other errors caught or logged anywhere, just shard death

keen widget
unique shoal
cunning hinge
unique shoal

Doubt it, they're functionally the same really

sullen wadi

Test

cunning hinge

if that doesn't work try loading them all separately and log between each one to see if there is a single perpetrator (or if all of them are the problem)

cunning hinge
sullen wadi
cunning hinge
sullen wadi
cunning hinge

and it never dies if that code in particular isn't ran?

sullen wadi

No, I've only seen a shard die in connection to that code

cunning hinge

hmm

what is the code behind loadImage?

sullen wadi
cunning hinge

isn't canvas rust-based?

sullen wadi

Yes

cunning hinge

oh noes, i have no idea how to read rust

it looks like it checks to see if the file exists and then returning a promise that resolves on image load, doesn't seem like it would break a shard though

sullen wadi

I'll add some more schizophrenic logging, like a .then() on every loadImage() call

cunning hinge

alr

loud quartz

cough digging into canvas, be it for what it does or why it doesn't, isn't really discord.js relatead

cunning hinge
sullen wadi

Since there are no errors visible, I can only assume it's something with canvas overloading something. Sigh

true lynx

what im i missing in my string select menu?:

halcyon bison
solemn arch

My Ephemeral isn't working. Here is the code for the ticket system.

const { SlashCommandBuilder, EmbedBuilder, ButtonBuilder, ActionRowBuilder, PermissionsBitField, ChannelType, ButtonStyle, MessageFlags } = require('discord.js');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('ticket-setup')
        .setDescription('The ticket setup command.')
        .addChannelOption(option => option.setName('channel').setDescription('The channel to put the ticket system in.').setRequired(true).addChannelTypes(ChannelType.GuildText)),
    async execute (interaction, client) {
        if (!interaction.member.permissions.has(PermissionsBitField.Flags.Administrator)) {
            return await interaction.reply({ content: 'You do not have the permissions to do that.', Flags: MessageFlags.Ephemeral });
        }

        const { options, guild } = interaction;
        const channel = options.getChannel('channel');

        const embed = new EmbedBuilder()
            .setTitle('Ticket System')
            .setDescription('Click the "Create Ticket" button to open a private channel to speak with the Staff Team.')
            .setColor('Aqua')

        const row = new ActionRowBuilder().addComponents(
            new ButtonBuilder()
                .setCustomId('button')
                .setLabel('Create Ticket')
                .setEmoji('🎫')
                .setStyle(ButtonStyle.Secondary)
        )

        await channel.send({ embeds: [embed], components: [row] })
        await interaction.reply({ content: 'Ticket system successfuly setup!', Flags: MessageFlags.Ephemeral })
    }
}```

I believe I set it up to be Ephemeral correctly but maybe I am wrong.

clear garnet

Flags: MessageFlags.Ephemeral
flags, not Flags

sharp ginkgoBOT
lofty topaz

Hello, are you there API to monitor the quests?

unique shoal

no

lofty topaz
rotund turret

is there any way to add like .setTimestamp() to components v2 like there is in embeds or nah

unique shoal

no

Can do whatever you like with text displays and markdown though

potent sky

Does anyone have the documentation to role gradients yet?

topaz bluff

It's not supported by Discord JS yet

potent sky
sharp ginkgoBOT
topaz bluff

Here's the docs if you want to use a raw API request...while you wait for DJS to support it

solemn arch

How could I DM a user with my bot? I am trying to make it so when the ticket is closed the user who opened it gets a DM with the transcript attached.

sharp ginkgoBOT

method User#send() discord.js@14.21.0
Sends a message to this user.


// Send a direct message
user.send('Hello!')
  .then(message => console.log(`Sent message: ${message.content} to ${user.tag}`))
  .catch(console.error);

solemn arch

Thanks Mark!

topaz bluff
solemn arch Thanks Mark!

Make sure you catch for errors as it will throw an error if their DMs are closed (and there's no way to check without attempting to send the message)

placid rampart

Hey, I'm having an issue where my bot can't join the voice channel using DisTube and gives me this error after 30 seconds:

(node:5864) Warning: Supplying "ephemeral" for interaction response options is deprecated. Utilize flags instead.
[DisTube Debug] [QueueManager] Creating queue for guild: 677387067583627264
[DisTube Debug] [QueueManager] Joining voice channel: 804740919751999489
DisTube Play Error: DisTubeError [VOICE_CONNECT_FAILED]: Cannot connect to the voice channel after 30 seconds
at DisTubeVoice.join (C:\Users\Administrator\Documents\Bc\node_modules\distube\dist\index.js:678:13)
...
errorCode: 'VOICE_CONNECT_FAILED'

I'm using discord.js v14 and DisTube latest version. Any ideas?

polar karma

We do not offer support for projects that violate the TOS

potent sky
polar karma

Yes, it's always been a violation

topaz bluff
lunar jewel
rose tangle

are you sure that's the erroring code?

rose tangle

the error says you're calling setName somewhere

but it's not in that snippet

lunar jewel

oh shoot sorry had to bathe the kiddo
line 83 is guildCountId.setName(`Total guilds : ${guildCount}`);

it's just weird because it is only sometimes

topaz bluff

guildCountId is sometimes undefined

lunar jewel

but it shouldn't be...it's the same channel id everytime. Could this be happening since I have it inside a scheduled cron job?

rose tangle

do you have sweepers?

is the cronjob started after the bot has logged in?

do you have the Guilds intent?

also, this won't solve your issue but:

sharp ginkgoBOT

Don't use the find method to query a Collection by key (mostly the associated id)

- someCollection.find(structure => structure.id === "348607796335607817")
+ someCollection.get("348607796335607817")
lunar jewel

I just noticed it didn't paste everything in the sourcebin. Let me update it. It worked in the ready event. The cron job is in the index.js file. https://sourceb.in/btdL5uWL2A

lunar jewel
rose tangle

you're not doing that method, find and get are different

get is an O(1) map get, find is a O(n) map search

lunar jewel

oh I read it backwards 🤦‍♂️ I'm tired so that isn't helping lmao

clear garnet
lunar jewel

but anyway
1.) what are sweepers?
2.) it's in the index.js
3.) yes

clear garnet

Otherwise there's the possibility it triggers before the client is ready

lunar jewel

now it's doing the setName error on another line in the same code 😑 let me see what's going on and I'll update this message

EDIT: I forgot to put the channel ID in the array for channels 🤦‍♂️

ionic dome

I want to ask whether gradient role can be done in DJS?

rose tangle

not yet, it'll be on next release

ionic dome

okay, thanks for the information

vestal zenith

how can i get all historical messages in a channel?

weak ledge

hi guys, is there a way to use socks5 proxy in discord.js?

unique shoal

@discordjs/proxy exists

zinc quartz

Ive been reading the message history and see i shouldnt register on every startup, but how should i then? Also i came here because i probably restarted too many times and now the commands are not registering anymore even after a night

But how should i fix the not registering now

snow onyx

but how should i then
Manually, once you actually change something

But how should i fix the not registering now
You don't, you keep waiting until the ratelimit is lifted.

zinc quartz
snow onyx

Yes

sharp ginkgoBOT

guide Creating Your Bot: Registering slash commands
read more

zinc quartz

After updating and testing in a dev bot

zinc quartz
snow onyx

No, it will just keep limiting you.
If you catch the rejection you should be able to see how much time is left.

zinc quartz

Kk thanks

pulsar aspen

I couldn't seem to find the max amount of characters anywhere in both the official discord documentation nor the discord js documentation.

What is the limit on Text Display Components, and is that a per text display component limit or is it a limit based on the total text?

snow onyx

I think its 4000 characters combined in the message

weak ledge
sullen wadi
zinc quartz

Nothing pops up

zinc quartz

Its like theres no error message

wary parrot

I feel as though I'm going crazy at the fact this was working in an earlier version of DJS, and porting over to the newer version, permission checks for the client are basically being ignored whilst my userPermission side of operations works 100%. May I have some form of assistance to just at least steer in the direction of what may be causing the issue? I feel it is literally right in front of my face, and I'm not seeing it after looking at this for ages. fc_timm1ezSob

The bits boxed in are what I am primarily focusing on in the code that I believe are the sources of the issue- but it is drivin' me crazy. LMAOO

snow onyx

just to make sure I understand, in that if body you add permissions to that clientPermissions array that the bot doesn't have?

wary parrot

Yeah! The bot is primarily creating the array for storing permissions it doesn't have* for a later message that gets pushed through a translation tool I'm using for the project. CB_nod

snow onyx

ah okay, then yeah, looks good to me?
also you can make that if statement way shorter by just using interaction.guild.members.me.permissions.has()

wary parrot

That's what I was thinking too yeah; For some reason when it happens to jus' not have the permissions; it just outright skips the whole section of code- and jus' ignores the client side is what is confusin' for me. bok_nod

snow onyx

does it have admin though?

.has() skips the perm check by default if it has admin

wary parrot

In the testing environment I got it in atm, it doesn't I beliiiieve- but I'll triple check rq. bok_nod

Yeah, it doesn't have administrator and still jus' skips. CB_nod

snow onyx

Otherwise just add some good ol debug logs and log some relevant values like guild.members.me.permissions.toArray()

wary parrot

I'll give that a shot again, somethin' is being real weird about it all. I've tried doin' that earlier and once it hits the forEach() method, it just basically just goes completely silent. 😭 LMAOO

Even with a good 'ol log of just that line in general, to even just throwing a good 'ol Hello World into it. lmfao_I_cannort

zinc quartz

@snow onyx (pinging you cus u know what i was saying earlier) i added a single registration console commands and i did one command and it worked, then i did another and it didnt work anymore

snow onyx

how do you know "it didn't work anymore"

wary parrot
snow onyx

did you make sure it even arrives here and slashCommand.clientPermissions contains something?

zinc quartz
wary parrot
snow onyx

I guess try a for..of loop instead?

for (let permission of slashCommand.clientPermissions) {
...
}
wary parrot

I'll give this an approach and see if I might've just literally foobarred this somehow and I might not just not see it personally since I been looking at this for hours. lmfao_I_cannort

worthy drift

If im not wrong, a section needs both text and image.

. addMediaGalleryComponents()

wary parrot
snow onyx ```js for (let permission of slashCommand.clientPermissions) { ... } ```

Yeah no for whatever reason, the clientPerm... side of things is like foobarred like insane. Even with switching out the the forEach() to the for (let...); It just doesn't read the GuildMember permissions for the Client; Yet for some reason despite the code quite literally being identical to the userPermissions side of operations, the userP works just fine. LMAOO

I just genuinely am beginning to have zero clue on what is possibly causing this just from glancing into this section, or if really it may be outside if everything seems fine even then. But I still appreciate it. tz_timm1ezLove

clever hazel

Is there a way to do fields in new components? Basically a table?

outer plume
fluid plinth

How can I get option values from the initial command? I need to get them during the point where I'm responding to an action row interaction and I can't see anything to get the initial command...

daring coral

Depends how you're collecting the interaction

fluid plinth
daring coral
fluid plinth via interactionCreate

If it's a slash command and its response contains components, you're better off handling the component interactions within the command logic
I'm assuming that's what you're doing here, not a permanent message with components, because you mentioned an 'initial command'

Using either awaitMessageComponent or an InteractionCollector

fluid plinth

also what's the type for collectionFilter again? (typescript)

daring coral
fluid plinth

i know, but it wants a type

daring coral

Oh wait hold up I get what you mean now

In theory you shouldn't need one if you're returning a valid type it can infer

fluid plinth

yeah just last time i copied the code exactly typescript went flare up

but this time ive just written inline and it seems to work?

daring coral

If you do that it will be fine, because the type is already specified in the parameter

The type is CollectionFilter btw, didn't know it had an actual typealias

sharp ginkgoBOT
fluid plinth

thanks

unique mountain

@zinc quartz hey, let's talk here

zinc quartz

This fix is pretty okay now i just register them 1 by 1 and then from now on only reg a new one / edited one

unique mountain
snow onyx

why does it remove all commands first thonk

unique mountain
snow onyx

you dont need to, put already takes care of all lthat

unique mountain

and for just a testing guild i found it’s generally fine to do, not globally of course

snow onyx

put takes a list of commands and replaces existing commands with the new ones

zinc quartz
unique mountain
snow onyx

then it will be gone with put

Doing a single put with all of your commands does the same as your two requests now do

unique mountain

hm that’s interesting, i’ll have to give that a go since i’ve never had it work that way for me in the past

as in, ‘/test’ would remain after deploying my new commands with the file containing ‘/test’ logic deleted

fair scarab

bulk overwrite will overwrite all commands with the payload you send so that shouldn't happen if test isn't in that payload

low spear

how do I get the value of a sectioncomponent textdisplay? such as when I'm using a button and want to read information from the container

unique shoal

Thats why they allow you to set an id on components, so you can find them again

manic leaf

guys, where can I find a list of all the api endpoints for discord bots? for example v9

I've been reading the api docs but couldn't find a comprehensive list

unique shoal

Not sure what to tell you

The docs are pretty much it unless someone decided to put them all on one page

Besides, raw API is not discord.js related

crimson gale
manic leaf
unique shoal

So you did find the channel is what youre saying mmLol

Or even other servers like Discord API / Discord Developers

manic leaf
daring coral
unique shoal

Wait what? I thoiught you were already reading the api docs

daring coral
manic leaf

wish you the best 🙏

red trellis

how can I fetch all the channels and threads in a server including the archived ones?

also forum post threads

unique shoal

Channels are fetched by default, threadss from the forum thread manager

sharp ginkgoBOT

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


// Fetch a thread by its id
channel.threads.fetch('831955138126104859')
  .then(channel => console.log(channel.name))
  .catch(console.error);

sullen wadi
mellow sierra

Is it possible to get information about what tag the user has set?

topaz bluff
sharp ginkgoBOT
daring coral
neon sphinx

for UserSelectMenuBuilder() is it possible to exclude the current user who trigger the interaction to be in the select menu

dense jackal

no, you cannot modify user selects/channel selects/role selects to decide what can be selected and what not

neon sphinx

=\ wish there was a way

dense jackal
neon sphinx

was hoping to filter it without the workaround of checking values after user selects

sleek brook

Are there any breaking changes from 14.14 to 14.21?

outer plume

minor versions will never introduce breaking changes

sleek brook

Cool thanks

rose tangle

consider only runtime breaking changes are considered for that

breaking changes on typings don't bump major, they're still on minor or patch bumps

outer plume

oh Thonk is that because it only affects a small number of people using the library?

rose tangle

iirc because djs is technically a js library, not a ts one

outer plume

hm. makes sense

rose tangle

as in, it mostly targets js

and also because most typings changes are inherently major (in the context of this library)

they'd need to bump it quite frequently lol

outer plume

dogeHaHa

radiant epoch

does components v2 can work with flags: mf.ephemeral?

red coral

Sure

radiant epoch
if (!interaction.guild?.members.me?.permissions.has(PermissionFlagsBits.ManageEvents)) {
            await interaction.reply({
                components: [
                    new TextDisplayBuilder().setContent(
                        [
                            `# ${getEmoji("danger")}`,
                            `It seems like I don't have permission to manage events to create giveaways...`,
                        ].join("\n"),
                    ),
                ],
                flags: MessageFlags.Ephemeral,
            });
        }

I am trying something like this but

hallow mesa

Yes, just include both flags

red coral

flags: [ ephemeral, cv2 ]

radiant epoch

wait, it accepts array? yeah it is "flag(s)"

hallow mesa

Yeah it can

typealias BitFieldResolvable
Data that can be resolved to give a bitfield. This can be:

  • A bit number (this can be a number literal or a value taken from Flags)
  • A string bit number
  • An instance of BitField
  • An Array of BitFieldResolvable
red coral

Can you also do like | or >> or something?

hallow mesa

ephemeral | cv2 would also work. "Bitwise OR"

radiant epoch

thanks

sleek brook

Can we make a footer like this on a container with components v2?

dense jackal

if you use a custom emoji for the avatar then yes

sleek brook
dense jackal

that makes it still possible

hallow mesa

Yes. They're saying you could make a temporary emoji for the avatar. Components V2 don't have icons like that. Closest is thumbnails in sections but they're much larger

red coral

You can’t no, best thing you can do is to use -#
-# footer

I feel like making an emoji on demand is a bit much

sleek brook
dense jackal

not that hard to code tbh, its just a wacky workaround

hallow mesa

Yeah I wouldn't recommend it, but it's an option, technically

sleek brook
red coral

Put that rust tag to use an make some canvas addon in rust

dense jackal

the guy working on discord for cv2 said once they will look into so called “user icons” to be used just like custom emojis work: emojis used in text that display the users avatar (or a server icon)

sleek brook
red coral

Nope

dense jackal

but as of now thats non existent so you cannot replicate the embed footer 1 to 1

sleek brook

Too bad

I would assume also no way to add a timestamp to the footer?

hallow mesa

You can put a formatted date in small text and it looks similar
-# <t:1754332920:f>

sleek brook

This is probably as close as I can get

lofty topaz

Wow nice idea

candid anchor

How to use the componentsv2 string select menu?

sleek brook
rose tangle
sharp ginkgoBOT

guide Interactive Components: Select menus
read more

queen vale
2025-08-04T17:31:45.547553354Z This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
2025-08-04T17:31:45.547611492Z DiscordAPIError[10062]: Unknown interaction
2025-08-04T17:31:45.547615881Z     at handleErrors (/build/node_modules/@discordjs/rest/dist/index.js:748:13)
2025-08-04T17:31:45.547619437Z     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2025-08-04T17:31:45.547623264Z     at async BurstHandler.runRequest (/build/node_modules/@discordjs/rest/dist/index.js:852:23)
2025-08-04T17:31:45.547626731Z     at async _REST.request (/build/node_modules/@discordjs/rest/dist/index.js:1293:22)
2025-08-04T17:31:45.547650955Z     at async ButtonInteraction.reply (/build/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:200:22)

Anyone seen this error before and have ideas how to fix it? I have no idea where its happening and cannot reproduce it - just see it sent in my logs randomly

sharp ginkgoBOT

Common causes of DiscordAPIError[10062]: Unknown interaction:

  • Initial response took more than 3 seconds ➞ defer the response *.
  • Wrong interaction object inside a collector.
  • Two processes handling the same command (the first consumes the interaction, so it won't be valid for the other instance)
    * Note: you cannot defer modal or autocomplete value responses
crystal cargo

how to do this in v14
restRequestTimeout: 30_000
for client Object

rest: { timeout: 30_000 },
thx

it's fine to put large numbers like 1 or 2 min?

rose tangle

no rest request should take that long

that'd indicate a network issue

the default is already a more than reasonable value

candid grove

I have DirectMessages and MessageContent intent selected for my bot, and approved for it on the dashboard, but the event MessageCreate is not returning any data as if it isnt firing when I message my bot directly. Is this something intended? Like I can get it to reply to commands and slash commands in DM Groups and direct dm with it. but not reply to chats sent to it?

clear garnet

If this is for a user-installable app, the way you reply is through the interaction, not standard messages

candid grove

Oh...

loud quartz

your app has a bot account that you can add to servers

candid grove

It is for that yes. I am trying to let people talk to the AI running on the bot in direct message. So is both user installable and guild installable.

loud quartz

it's not possible for that bot account to be added everywhere where you can add the app itself - like user installs

candid grove

So it cannot fire an event for MessageCreate in the dm? What is fired when I message the bot directly?

loud quartz

me user-installing your app does not allow you to listen to every message i receive, that's a huge privacy issue

loud quartz

they simply come from a channel with different type

(and require you to have the separate intent, as well as a partial enabled)

clear garnet
candid grove

I think I have all the intents I need?

clear garnet

If it's missing the bot scope, you're restricted to just interactions

candid grove

I have it installed in mutual servers and as a user installed app... I am not sure why it is not firing the MessageCreate event for a dm to it, but works for servers.

sharp ginkgoBOT

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

candid grove

Ah I was missing the partials. Did not know that was needed now. have not worked on this bot in a long time.

lapis imp

Hello! Does anyone know why is the message not ephemeral? The message is deferred and I get the log.
This code is in my SlashCommand event:

const { Ephemeral } = Discord.MessageFlags;

if (interaction.isCommand()) {
    if (command.onlyEph === true) {
        console.log("Interaction is only ephemeral");
        await interaction.deferReply({ flags: Ephemeral });
    } else if (command.onlyEph === false) {
        await interaction.deferReply({ flags: undefined });
    };
};
toxic moat

why is there no EmbedBuilder.from in djs v15 (dev)

unique shoal

Because you don't need it

toxic moat

lol i literally need to update embed..

unique shoal

It uses builders v2 which supports passing to constructors

toxic moat

new EmbedBuilder(interaction.message.embeds[0])

Argument of type 'Embed' is not assignable to parameter of type 'Partial<APIEmbed>'.
  Types of property 'title' are incompatible.
    Type 'string | null' is not assignable to type 'string | undefined'.
      Type 'null' is not assignable to type 'string | undefined'
unique shoal

Pass embed.data

toxic moat
unique shoal

That should still exist but you can just write hex literals

0xAABBCC

toxic moat

it wants only number, color: number

unique shoal
toxic moat

can I install discordjs/rest dev version to have access to gradient color roles then? 😭 without modifying discord.js

halcyon bison
unique shoal
unique shoal

I don't know what else that could mean

toxic moat

i need to create a role but with new gradient color roles, that isnt available on latest stable djs version

unique shoal

I don't think you need the dev version of rest to make a call to that endpoint

Yeah but you asked about /rest

toxic moat

yes, which version do i need for that

unique shoal

Any

It makes API calls

Just pass the right params

frozen ginkgo

if i pass withResponse: true when interaction.replying to a slash comamnd, would response.resource or response.resource.message ever be null, or can i safely expect them both to exist in this context?

stable sun
lapis imp
halcyon bison
sudden grove

how can i get my bot that uses discord.js to send a message (as if its in a DM/GC) but not reply to the interaction

halcyon bison
sudden grove how can i get my bot that uses discord.js to send a message (as if its in a DM/G...
  1. interactions need responses, so if you don't respond to the interaction, you'll get a "Application did not respond" error in the client
  2. as if it's in a DM/GC?
    as in it's not actually in that DM/GC due to it being a user app?
    if that's the case, it can't since it's not actually in the DM/GC
    if this is a DM with the bot or a guild channel, you can just use <Channel>.send(), but you would still need to respond to the interaction aside from that
sudden grove
halcyon bison
rose tangle

you can followUp which creates a separate message

and you can make it ephemeral if you want

it'd work regardless of whether the bot is actually in the guild or not, but if it isn't you can only followUp 5 times (for that interaction)

sudden grove
sudden grove
halcyon bison

if that's the case, it can't since it's not actually in the DM/GC

sudden grove

but i used the command in a DM/GC

stable sun
halcyon bison
rose tangle

user apps are limited to only what you can do with the interaction

otherwise that'd be a security nightmare

tidal ravine

hey guys so my bot pings roles in a bunch of servers and i'm getting complaints from some server owners that users with the roles don't actually recieve the discord push notification for the message anyone have any ideas?

they have the role for the ping but they just don't recieve the notification. The message is still highlighted yellow and stuff

My bot sends messages with multiple role mentions in each, and I saw some user mentioning how they don't recieve notifications for the first role mentioned. Has anyone heard of similar issues?

unique shoal

Not specifically no, if you've set it to parse mentions correctly, and its not in an embed or something, its just push notification behaviour

tidal ravine

i store roles in a database and then send them using <@&[roleid]> and im just super confused why some ppl aren't getting notifications

seems like a discord thing then which is annoying. I notice in larger servers role pings aren't super reliable so I don't rlly know what to do abt this

hallow mesa

If it works in some servers but not in others, and you're not messing with allowedMentions, then I'd assume it's just some server owners not setting up roles/permissions correctly

tidal ravine
unique shoal

push notifications aren't a super reliable mechanism, can even be impacted by app settings or battery saving settings on personal devices

tidal ravine
loud crater
let i = 0;
  setInterval(() => {
      client.user.setPresence({
          activities: [activities[i]],
          status: 'online'
      });
      i = (i + 1) % activities.length;
  }, 5000); 

this wont work..

my activities table is this

const activities = [
  { type: 'LISTENING', name: 'to Jibriel.' },
  { type: 'LISTENING', name: 'to Faisal.' },
  { type: 'WATCHING', name: 'for chammaks.' },
  { type: 'WATCHING', name: 'the falcons fly.' },
  { type: 'LISTENING', name: 'to Hussain Al Jassmi.' },
];
rose tangle
  • I wouldn't recommend changing presence every 5s
  • activity types are numbers, not strings
unique shoal

Not only wouldnt I recommend it, you cant ever 5s

loud crater

okay thank you, where can i find the activity types? documentation?

sharp ginkgoBOT
loud crater

So i literally just change it to a number, or is it an enum?

rose tangle

imo even 30s would be a much more reasonable approach, not that anyone will be taking a look every 5s either way

I shared the doc to the enum, which is ActivityType

loud crater
slender elk

Bro, Im so confused on how to get buttons on a seperate row with no text with comp v2

snow onyx

you just add an action row with a button to the container I believe?

slender elk
snow onyx

code?

slender elk

and used:

  const sectionButton = new SectionBuilder()
      .setButtonAccessory(nowPlayingButtonRow)
      .setButtonAccessory(optionsRow);

  container.addSectionComponents(sectionButton);```
dense jackal

so you did not try to use an action row

slender elk
sharp ginkgoBOT

guide Popular Topics: Display Components
read more

dense jackal

Sections are not the only component available

slender elk

but those 2 rows are using action rows

sharp ginkgoBOT
slender elk
hallow horizon

Not sure if this is related to the library or not, but probably the best place to ask I know of...

I've updated a command to be used in DM's, allowed DM's to the bot, and updated the commands list, but I still can't see the command in DM's

snow onyx

are we talking about actual slash commands or prefix commands, cuz your screenshot is not an slash command

dense jackal
sharp ginkgoBOT
dense jackal

afaik you need both of these in your command builder and set them to DM as well

or maybe you just need to reload your discord client using CTRL + R

hallow horizon

I'll take a look over this, thanks

The issue I am having is the command isn't even showing in DM's

It shows in my server, Just not in DM's

I have message Intents, I've set the messageCreate event to listen for specific commands in dms, I've updated the reg-commands file for global applications...

snow onyx

message Intents, I've set the messageCreate event to listen for specific commands in dms
these aren't relevant for slash commands

hallow horizon

Thanks

toxic moat

dotenv@17.2.1] injecting env (0) from .env -- tip: 📡 observe env with Radar:
C:\Users\dmitr\Desktop\Новая папка\testdcjs\node_modules\discord.js\src\client\Client.js:542
      throw new DiscordjsTypeError(ErrorCodes.ClientMissingIntents);
      ^

TypeError [ClientMissingIntents]: Valid intents must be provided for the Client.
    at Client._validateOptions (C:\Users\dmitr\Desktop\Новая папка\testdcjs\node_modules\discord.js\src\client\Client.js:542:13)
    at new Client (C:\Users\dmitr\Desktop\Новая папка\testdcjs\node_modules\discord.js\src\client\Client.js:81:10)
    at Object.<anonymous> (C:\Users\dmitr\Desktop\Новая папка\testdcjs\index.js:6:16)
    at Module._compile (node:internal/modules/cjs/loader:1730:14)
    at Object..js (node:internal/modules/cjs/loader:1895:10)
    at Module.load (node:internal/modules/cjs/loader:1465:32)
    at Function._load (node:internal/modules/cjs/loader:1282:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5) {
  code: 'ClientMissingIntents'
}

Node.js v22.17.0

snow onyx
sharp ginkgoBOT
short granite

I have a problem. I want to send a message to a user on the server, but after a while, the bot says "Bot Quarantined."
Your bot has been flagged by our anti-spam system for abusive behavior. While your bot is quarantined, it is unable to join any more guilds or send any direct messages to users it has not previously messaged. If you believe this to be an error, click here and select "Appeal an action taken on an app/bot" as the Report Type to submit an appeal.

How can I fix this?

For example,
I sent a message with 30 * 1000 timestamps per timeout.

snow onyx

do what it says?

short granite
snow onyx do what it says?

Bot Quarantined
Your bot has been flagged by our anti-spam system for abusive behavior. While your bot is quarantined, it is unable to join any more guilds, or send any direct messages to users it has not messaged before. If you believe this to be in error, click here and select "Appeal an action taken on an app/bot" as the Report Type to submit an appeal.

snow onyx

okay?

What kind of answer do you expect now

short granite
toxic moat

setTimeout()

dapper horizon

hello, everytime i use my bot it tells me i exceeded my current quota (i use openai api key). are there free credits when you make a new account?

polar karma

this is not support for openai

dapper horizon
frozen quartz

Hi ! how long do I have to wait before being able to use a custom emoji of my application

rose tangle

it's instantaneous

frozen quartz

😕

rose tangle

is that a problem?

frozen quartz

Yep, when i put :
.setDescription(<:dot: 1402278991393718273>

I have this issue (without space)

rose tangle

is the space in your code?

ah, nvm just saw your edit

sounds like the id or name is wrong then, the panel has a copy button you can use

frozen quartz

Yup sorry i cant white :dot:withID

Yep i copied but idk :/

proud arrow

Make sure application is same where the emoji is uploaded

vagrant blade

when is Presence.user null?
didn't see this anywhere on the docs so i'm not sure. and if there's some way i can easily figure out when other fields can be null, i'd love to know, because so far i've been either guessing or searching this server.

stable sun

It does say User | null in the docs and typings

sharp ginkgoBOT
vagrant blade
vagrant blade
stable sun

Prob just check the source code tbh

vagrant blade

i was about to say that, i guess i could just read the source code, but was hoping to avoid haha

stable sun

If that doesn’t answer your question, then dive into ddocs

vagrant blade

well, thanks again for the quick response

stuck sleet

How to add two graphics where the selection in red

sharp ginkgoBOT
agile nest
stuck sleet

thank you

tough lodge

hello how to disable all components on components v2, I do this but it's didn't work

msg.components.forEach((row) => {
    row.components.forEach((component) => {
        component.data.disabled = true;
    })
})
await msg.edit({ components: msg.components }).catch(() => {});
wary coral
polar karma

disabling is not the same as removing

sharp ginkgoBOT

Structures from the API cannot be edited directly. To do so, you can create a new structure (a builder) using the .from() method

const newEmbed = EmbedBuilder.from(embed).setTitle("title")
const newRow = ActionRowBuilder.from(row).addComponents(component)
polar karma

that said, the above applies. you need to use the existing data, pass it to the correct builder, and then disable it. then you pass the updated data to edit()

rose tangle

also not every component is a row, which you should know already given you mention you're using components v2

wary coral
sleek brook

Can you not remove buttons from a container by editing it with a new container without the button components?

wary coral
sleek brook
wary coral
sleek brook
wary coral

You want to use editreply. But also just know that it's only good for 15 minutes from the initial interaction

sleek brook
wary coral

And edit reply is not removing the container as you expect? Could you share your code?

outer plume

Editing the reply by passing in a new set of components should replace the previous ones. Does that not work for you?

sleek brook
sleek brook
outer plume Editing the reply by passing in a new set of components should replace the previ...

No. I think it expects a similar container? As I get this error

topaz-dev  | Unhandled Rejection: CombinedError (2)
topaz-dev  |   Received one or more errors
topaz-dev  | 
topaz-dev  |   1 ExpectedValidationError > s.instance(V)
topaz-dev  |   |   Expected
topaz-dev  |   | 
topaz-dev  |   |   Expected:
topaz-dev  |   |   | [Function: ButtonBuilder]
topaz-dev  |   | 
topaz-dev  |   |   Received:
topaz-dev  |   |   | undefined
topaz-dev  | 
topaz-dev  |   2 ExpectedValidationError > s.instance(V)
topaz-dev  |   |   Expected
topaz-dev  |   | 
topaz-dev  |   |   Expected:
topaz-dev  |   |   | [Function: ThumbnailBuilder]
topaz-dev  |   | 
topaz-dev  |   |   Received:
topaz-dev  |   |   | undefined
wary coral
outer plume
sleek brook
wary coral We can't help you further if you don't share your code

This is all I'm doing:

    cmd.interaction.editReply({
        components: [this.getContainer(cmd, profile, false)],
    });

    private createQuestSection(quest: AnyQuest, withButtons: boolean = true): SectionBuilder {
        const section = new SectionBuilder()
        .addTextDisplayComponents(new TextDisplayBuilder().setContent(`**${quest.title}**`))
        .addTextDisplayComponents(new TextDisplayBuilder().setContent(quest.description))
        .addTextDisplayComponents(new TextDisplayBuilder().setContent(`-# Rewards: ${this.formatRewards(quest)}`))
        if (withButtons) section.setButtonAccessory(
            new ButtonBuilder()
            .setCustomId(`claim-${quest.id}`)
            .setLabel("Claim")
            .setStyle(ButtonStyle.Success)
            .setDisabled(!quest.completed)
        );

        return section;
    }

    private createEmptySection(i: number, withButton: boolean = true): SectionBuilder {
        const section = new SectionBuilder().addTextDisplayComponents(new TextDisplayBuilder().setContent("**No active quest**"));
        if (withButton) section.setButtonAccessory(
            new ButtonBuilder()
            .setCustomId(`find-${i}`)
            .setLabel("Find a Quest")
            .setStyle(ButtonStyle.Primary)
        );
        
        return section  
    }
outer plume

lemmi check past messages in this chat tho

sleek brook
outer plume

.

outer plume
sleek brook
outer plume

that could work, ye

woven cipher

guys how can i make my bot fetch logs correctly

sharp ginkgoBOT

method Guild#fetchAuditLogs() discord.js@14.21.0
Fetches audit logs for this guild.


// Output audit log entries
guild.fetchAuditLogs()
  .then(audit => console.log(audit.entries.first()))
  .catch(console.error);

wary coral
queen vale

const blacklist = async (interaction: ChatInputCommandInteraction) => {
  const subcommandName = interaction.options.getSubcommand();

  switch (subcommandName) {
    case "view":
      await viewBlacklist(interaction);
      break;
    default:
      break;
  }
};

Whats the correct type for a command group interaction?

sharp ginkgoBOT
queen vale

Property 'getSubcommand' does not exist on type 'CommandInteraction<CacheType>'.

clear garnet

That error says CommandInteraction, but your code says ChatInputCommandInteraction

rose tangle

and the method is in the options, not in the interaction

queen vale

apologies - the command seems to fall under isCommand so using CommandInteraction which then errors, rather not typecast if I don't need to

The command is blacklist view - There are no other params or inputs

clear garnet

Use isChatInputCommand() instead

queen vale

its not isChatInputCommand - it doesnt trigger it

rose tangle

it doesn't trigger the error?

queen vale

it doesnt trigger any code checking under the if for isChatInputCommand

rose tangle

then it's not a chat input command interaction

queen vale
  if (interaction.isCommand()) return handleCommandInteraction(interaction);
  if (interaction.isButton()) return handleButtonInteraction(interaction);
  if (interaction.isChatInputCommand()) return handleChatInputCommand(interaction);
  if (interaction.isModalSubmit()) return handleModalSubmit(interaction);

Unless all commands are isCommand too?

rose tangle

yes

queen vale

that would be the issue then 😉

rose tangle

XCommandInteractions are also CommandInteractions

CommandInteraction is the base class

there shouldn't be any situation where you need to work with that, you should only work with its "implementations"

chat input, context menus, entry point

queen vale

so if its a slash command but not a ChatInputCommand - what is it?

clear garnet

A slash command is a chat input command

isCommand() covers message and user context menu commands as well as chat input/slash commands and entry point commands. isChatInputCommand() is for chat input/slash commands specifically, which is what have subcommands and all that other jazz

queen vale

got it

queen vale

Remind me - is there an easy way to display all text channels in a StringSelectMenuBuilder in ComponentsV2

bleak owl

you can just use a ChannelSelectMenuBuilder, and filtering GuildText channels with .addChannelTypes(ChannelType.GuildText)

queen vale

Perfect thanks!

Is there a way to not submit the input until a button is pressed? (So making a modal but with componentsv2)

rose tangle

input?

like a text input in a modal?

or a select menu?

queen vale

select menu in a container

solemn arch

Would anyone be able to point me in the right direction to start with ComponentsV2?

sharp ginkgoBOT

guide suggestion for @solemn arch:
guide Popular Topics: Display Components
read more

rose tangle
queen vale

Why would I need to make it disabled?

rose tangle

you don't need to, it was an idea

"disable or something", something being whatever fits your needs

queen vale

got it thanks

orchid radish

how big of a file can a bot upload?

loud quartz

Same as regular user or server member

hallow horizon

Hi peeps, My bot is setup as Public, and I have a command for users to use in DM's, For me it works flawlessly, but everyone else who has tried, it gets either "Your message could not be delivered as you dont share a server", or "Failed to respond in time" or "Unknown application" error...

Everyone whose tried it 100% shares a server, and I am unsure why they get the other errors, although it works flawlessly for me?

I also don't have it limited anywhere to just respond to me either

loud quartz

The first one is not the same kind of error as the other 2

hallow horizon

I know - But I also don't get any logs output - When I add logs to try and troubleshoot

So I resolved the "You don't share a server" issue... The server they were trying to DM from, had Direct messages turned off, they joined my server, and was able to interact throguh DM's - However when they try to do the command, they got "This interaction failed"

But if I do the command, It works.

Could this be something to do with it being an "app"?

topaz bluff

Do you happen to have the bot installed as a User Installed Application?

hallow horizon

No - Guild installed

Strange thing, the second time they tried it, I added this logging:

console.error('[trade.js] Caught error in main try/catch:', {
            error: mainError,
            stack: mainError?.stack,
            user: interaction.user?.tag,
            userId: interaction.user?.id,
            guildId: interaction.guildId,
            channelId: interaction.channelId,
            isDM,
            commandName: interaction.commandName,
            options: interaction.options?.data
        });

And now they can use the command with no errors or output?

I'm so confused...

First time from joining - Interaction failed
Second time from joining (Adding above code) - Works, no errors...

tardy sable

is interaction withresponse same usage as fetchreply?

hallow mesa
tardy sable
hallow mesa

You should use withResponse since the other is deprecated

tardy sable

alright thanks

queen vale

How do I clear a select dropdown if validation fails?

radiant portal

Is it just me or is the "Manage Members" permission just gone? I don't see any permission in the role settings to allow changing roles for users, my bot randomly started crashing because it now lacks that permission

hallow mesa
radiant portal

So it changed then? Because my bot did have the role and since a week it has been crashing now

hallow mesa

No it's always been that. Have there been any changes to role hierarchy?

hallow mesa
radiant portal
hallow mesa

It's definitely that permission. The fact that it's combined is actually a pain point imo

radiant portal
hallow mesa

🤷

queen vale

How do I edit the message with the componentsV2 items in - I select something in the select menu and want to edit the message

await interaction.message.edit({ components: [container] }); does not seem to work

stable sun

You should be using update on the select menu interaction

queen vale

thanks

ionic dome

Hello, please help me remove the 'started a thread' notification when the bot creates a thread, so the layout looks cleaner

// Find the original message from the interaction
      const originalMessage = interaction.message;
      let targetThread = null;

      // Check if there is already a thread for this message
      if (originalMessage && originalMessage.hasThread) {
        targetThread = originalMessage.thread;
      } else if (originalMessage) {
        // Create a new thread if it doesn't exist yet
        try {
          targetThread = await originalMessage.channel.threads.create({
            name: `💬 Confession Reply`,
            autoArchiveDuration: 1440, // 24 jam
            reason: 'Thread untuk discussion confession',
            startMessage: originalMessage
          });```
toxic moat

can i add role without fetching a member

queen vale
acoustic night
queen vale
rancid folio

Anyone have a clue why this isn't actually editing the message or progressing past it? No errors are being thrown at all. Basically nothing happens after the third log.

    console.log("Updating ID:", discussMsg.id);
    console.log(embed.toJSON());
    console.log(discussMsg)

    await discussMsg.edit({ embeds: [embed] });
    console.log(`✅ Updated discuss embed in <#${announcementsChannelId}>`);
    return true;
unique shoal

So the third log does happen?

Could be a rate limit

rancid folio
unique shoal So the third log does happen?

Yup. But nothing happens after that. I have tried a try/catch and other things, and nothing has worked... the code just magically stops.

I don't know if it's a rate limit either, considering this is only happening on command once in a while, and not frequently enough to trigger any ratelimits I am personally aware of. And, again, no errors are being thrown, such as the ratelimit error which I have a handler for that pings me.

sweet flax

Someone said they used components to make this, does anyone know what type of components that this uses?? I had no idea you could do this 😭

sharp ginkgoBOT

guide Popular Topics: Display Components
read more

sweet flax

holy what this is amazing tysm

rancid folio
rancid folio Yup. But nothing happens after that. I have tried a try/catch and other things, ...

I've figured this has to do with something on Discord's end. It seems my edit requests get hung up in the ether for ages before Discord actually responds to them. I logged rest stuff for rateLimited, request, and response and the requests were properly sending, but Discord was never sending back a response.

I'm going to assume this is a Discord-side issue for now and revisit tomorrow to see if it's still having problems.

wary coral
sweet flax

Ok quick question, is there a way to make it so when I make a new Button or component that can run a callback (i.e. Buttons, SelectMenus, etc), they are stored in a collection and the time the message / interaction was sent so then I can check if that specific button from that message / interaction has overlapped an allotted time, we no longer allow the function to run?

This idea just came to me because I was thinking of a way to solve the solution when clicking on a button after restarting the bot can cause the bot to either be out of sync or the function can't get internal saved information since it restarted

rose tangle

well it's not something related to the discord api but more of a programming question, so the answer is usually yeah, you can do most stuff you can dream of with programming

you're not constrained to what the discord api offers, that's entirely backend logic

that's some form of persistence though, so you'll need to store that data in a db or something

trail raven

Does the messageUpdate event also trigger when like an reaction is added?

stable sun
sharp ginkgoBOT
toxic moat

Is client.guilds.fetch gonna fetch latest guild members too? Or how does that work

rose tangle

you need to explicitly fetch members for that

sweet flax

uh im having an issue with ContainerBuilder with sections, it just physically won't allow me to send a interaction reply with this setup

        const container = new ContainerBuilder()
        .addTextDisplayComponents(
            textDisplay => textDisplay.setContent('# An Error Occured!'),
        )
        .addSeparatorComponents( separator => separator.setSpacing(SeparatorSpacingSize.Large), )
        .addSectionComponents(
            section => section
                .addTextDisplayComponents(
                    textDisplay => textDisplay.setContent('Dude please work'),
                )
        );
        
        await interaction.reply({
            components: [container],
            flags: MessageFlags.IsComponentsV2,
        });

It's giving me these errors:

halcyon bison
sharp ginkgoBOT
sweet flax
sweet flax

Ok is it possible to disable the formatting in the textDisplayComponents?
Unless you are stuck with formatting no matter what

unique shoal

What formatting? It's text

Format it however you like, what am I missing lol

sleek brook
sweet flax

oh thats cool to know

ocean portal

am i able to make multiple events, commands and handlers in single file? just like cogs

crystal tiger

the User class doesn't have the primary guild upon fetching the user?

snow onyx

that is correct?

If you are talking about all this tag stuff, that will be in the next release.

crystal tiger

isn't there any dev builds that i could use?

snow onyx

You can install discord.js@dev, yes

crystal tiger

ty

i installed it but the bot doesn't start for some reasons

frosty epoch

once reply is deferred, you can actually editreply more than once?

thought u had to use followup

snow onyx

editReply edits the reply, so sure? xD

followUp is just for sending a new reply

queen vale
stable sun Can you show code?

Sorry for the delay

import { AnySelectMenuInteraction, ChannelType, MessageFlags, PermissionsBitField, User } from "discord.js";
import { getConfig, updateConfig } from "../utils";
import { fetchChannel } from "../../utils/fetchChannel";
import { client } from "../../index";
import { getConfigMessage } from "./getConfigMessage";

export const updateConfigHandler = async (interaction: AnySelectMenuInteraction) => {
  if (!interaction.guild || !interaction.inCachedGuild()) return;
  const { customId } = interaction;
  const currentConfig = await getConfig(interaction.guildId);
  const value = interaction.values[0];

  if (interaction.isChannelSelectMenu()) {
    const channel = await fetchChannel(interaction.guild, value);
    const container = await getConfigMessage(interaction.guild);

    const hasPerms = channel
      ?.permissionsFor(client.user as User)
      ?.has([PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ViewChannel]);

    if (!hasPerms || !channel || channel.type !== ChannelType.GuildText) {
      await interaction.update({ components: [container] });
      await interaction.followUp({
        content: "I do not have permission to send messages in this channel.",
        flags: [MessageFlags.Ephemeral],
      });
      return;
    }
  }

  const camelCaseName = customId.replace(/_([a-z])/g, (g) => g[1].toUpperCase());

  // @ts-expect-error Type mismatch, but we know it's correct
  currentConfig[camelCaseName] = interaction.values[0];

  await updateConfig(interaction.guild.id, JSON.stringify(currentConfig));

  const container = await getConfigMessage(interaction.guild);

  await interaction.update({ components: [container] });
};
crystal tiger

any way to get these 2 flags? (quest and orb)

crimson gale

no

outer plume
snow onyx

(altho that goes against SOLID)
Good thing you don't need to follow SOLID

outer plume

Well, yes. But u should Pray

snow onyx

meh

halcyon edge

I want to ask whether gradient role can be done in DJS?

outer plume
snow onyx

Not "may", it will be added in the next version

outer plume

Ah ok

dense kiln

Is there an event for when a poll vote is received

sharp ginkgoBOT
dense kiln

Thanks

neat nimbus

what discord Discord API or Discord Developers

steel trail
mental silo

If I edit a message to @mention a user (edit due to deferReply)
Will the ping be silenced
As editing a ping into a message obviously does not ping

Some users reported the bot doesn't mention them and I have an assumption its that

mental silo

That's a huge design flaw and incredibly stupid omg

Considering Discord practically forces you to deferReply if you're doing any validation via a db, I can't initially ping a user before running my checks

hallow mesa

Use a followup message

dense jackal

as long as its within the 3 seconds

mental silo
hallow mesa

In addition to edited messages not pinging, the deferred message is probably already marked as read so it wouldn't show up as an unread ping either

mental silo
dense jackal

any additional .followUp() create a new message, just not the first one after defer

mental silo

Huh

So the first followUp is practically the same as a normal edit

kindred moon

if you deferReply yes

mental silo

Oh mah gawd

kindred moon

you could just editReply and then followUp if thats the thing you want out of it

mental silo

And if I editReply() first?
Or do I really have to do a random followUp edit to send my actual followUp

mental silo
hallow mesa

Or just don't defer and reply -> followUp. First one can be ephemeral if you want to reduce clutter

"Searching..."
"Found @ user"
Or whatever you're trying to do

mental silo

Yeah discord also silently added the ability to delete empheral messages shortly after releasing them so I could just delete it

Gotta love those useless 3 API calls

dense jackal

I thought that always was possible, deleting ephemeral replies

mental silo

I think it just returned a message not found

Makes sense, as the message doesn't really exist on discords end

neat nimbus
crimson gale
tidal ravine

anyone have a like website to design these like message component embed things bc they look pretty cool

bleak owl
onyx lagoon

how can i change the permssion for an channel Thread so that only specific users/roles can see and write something in their?

hallow mesa

Not really a thing on a thread-by-thread basis, other than changing send permissions for the parent channel or adding/removing members from private threads. Or locking it I suppose

onyx lagoon

oh okay thanks

tidal ravine
obtuse radish

I’ve been trying to create a ticket and ad mod bot w cgpt

I also tried to use components v2 to no success (cgpt doesn’t know about those I believe)

Does anyone think they could help me convert it into components (and other bug fixes)?

bleak owl

im sorry, no

we help with discord.js issues and questions, not really do it for you

especially if you didn't even make the code yourself

rare glade

Hello, I'm running into a little wave here when trying to implement ComponentsV2 utilizing djs.

For context, I do have my own ContainerBuilder class, however, that is not the issue as all it does is unify the way components are added. In addition, I did in fact try the native ContainerBuilder with the same result.

I receive the following error:

Error: Expected a string primitive
    at _StringValidator.handle (file:///C:/Users/User/Documents/GitHub/SU/node_modules/@sapphire/shapeshift/dist/esm/index.mjs:2607:70)
    at _StringValidator.parse (file:///C:/Users/User/Documents/GitHub/SU/node_modules/@sapphire/shapeshift/dist/esm/index.mjs:964:90)
    at TextDisplayBuilder.toJSON (file:///C:/Users/User/Documents/GitHub/SU/node_modules/@discordjs/builders/dist/index.mjs:1635:33)
    at file:///C:/Users/User/Documents/GitHub/SU/node_modules/@discordjs/builders/dist/index.mjs:1797:64
    at Array.map (<anonymous>)
    at ContainerBuilder.toJSON (file:///C:/Users/User/Documents/GitHub/SU/node_modules/@discordjs/builders/dist/index.mjs:1797:35)
    at C:\Users\User\Documents\GitHub\SU\node_modules\discord.js\src\structures\MessagePayload.js:151:46
    at Array.map (<anonymous>)
    at MessagePayload.resolveBody (C:\Users\User\Documents\GitHub\SU\node_modules\discord.js\src\structures\MessagePayload.js:150:49)
    at MessageContextMenuCommandInteraction.reply (C:\Users\User\Documents\GitHub\SU\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:198:56)

heres the code line in reference:

const container = new ContainerBuilder().addTextDisplayComponents(
  new TextDisplayBuilder().setContent(
    ["**Message Report**", "-# Does this message violate the server rules? Tell us how!"].join("\n"),
  ),
);

this is crafted right before its sent off to Interaction#reply with no alteration, heres that line:

interaction.reply({
  components: [container],
  flags: MessageFlags.IsComponentsV2,
});

Edit: It's worth noting, at error start I was running v14.14 and as part of debugging, I did cleanly install latest; same problem.
Edit 2: I'd like to mention, without using the Container component, the message will post just fine; it's only when utilizing the container that the issue occurs.

any help is appreciated, thanks y'all :)

stable sun
rare glade

but thank you for taking the time to reply anyway, much appreciated

crystal cargo

for allowedMentions, what is the difference between parse and users

halcyon bison
rare glade
steel trail
crystal cargo
rare glade

and heres that import for you

steel trail
rare glade

thats from my altered ContainerBuilder class but the context is the same

halcyon bison
rare glade Correct me if I'm wrong but `/builders` should be refreshed with the clean insta...

that's not what I'm asking about
if you were using v14.14 but were already writing code with components v2, I'd guess you had @discordjs/builders installed separately and were importing the builders directly from there rather than from discord.js

  1. we recommend not installing /builders separately
  2. importing directly from /builders rather than djs also happens to result in djs not recognizing the class as the same builder, so it uses the wrong object as the builder data resulting in your error
crystal cargo
steel trail

Yes

crystal cargo

Ok thx

rare glade
rare glade

i see

then I must be getting the version wrong, it was prob 14.15

snow onyx

14.19.0

^-^

rare glade

well either way its latest now

halcyon bison

either way, your issue is caused by importing the builders from @discordjs/builders rather than discord.js

rare glade

alright, I appreciate that brother thanks for your help

trail raven

What does bulkDelete(number, filterOld) the filterOld do? Does it filter out messages that are over 14 days and only delete the ones UNDER 14 days?

halcyon bison

yes that's correct

trail raven

Ok thank you

The docs dont tell you that 😂

rare glade

Duck, I do not mean to insult your intelligence in any way however, I'm baffled that was the issue. Again, I'd like to apologize and say thank you for taking the time to reach out. I don't entirely understand why /builders is installed alongside djs when it has this type of behavior but either way, thanks for the help.

stable sun

This’ll prob change in the future tho

rare glade

Yeah, I've gathered they aren't too concerned about it anymore if it has buggy behavior like that. Certainty a head scratcher...

tacit pulsar

is the char limit of a container also 6k?

trail raven

Quick question but does message.interactionMetadata exist on every interaction even if its like way back and already answered or just on pending interactions that are currently being processed?

snow onyx
trail raven

Ok then my question is: Can I somehow check if a message is a currently active interaction?!

halcyon bison
tacit pulsar

ty, my worst enemy

trail raven

like one that was defered and is currently "thinking" and does not have sent a response

dense jackal

there is <ChatInputCommandInteraction>.replied

but idk if that boolean will be true when deferred

as you also have <ChatInputCommandInteraction>.deferred

snow onyx

thats why #deferred is also a thing dogeHaHa

trail raven

Yeah but deferred isnt avalible on message.interactionMetadata

dense jackal

yeah so that means you could do

if (interaction.deferred && !interaction.replied)
{
  // whenever its in “bot is thinking” state
}
dense jackal
trail raven

...I think you dont unterstand...or you are using a deprecated version. Like message.interaction is deprecated. and message.interactionMetadata should be used

snow onyx
trail raven
snow onyx

you just need to set a different accent color

sharp ginkgoBOT
snow onyx

or, if you want to remove it, use #clearAccentColor()

tropic yoke

thx lemme give a try

snow onyx

what is there

Im really not sure what you are referencing in this screenshot

tropic yoke

like the bg that orange thing

snow onyx

where is that orange 😭

tropic yoke

on the right crySparkle

check this

cinder shale

The ping markdown

snow onyx

LOL THE PING?! kekw

deft nimbus

^ You can be pinged within containers

cinder shale

skullcry2

sharp ginkgoBOT

tag suggestion for @tropic yoke:
You can control which entities receive notifications via the allowedMentions option. You can:

{ ..., allowedMentions: { parse: ["users", "roles"] } }
tropic yoke

ThonkcrySparkle

snow onyx

I thought we were talking about the container accent color since that was yellow too ._.

tropic yoke

i was stupid sry

tropic yoke
dense jackal

seems like thats not helping

tropic yoke

the thing is it's not a message.reply im sending that msg with channenl id

snow onyx

that doesnt matter, the message posted above is not just about reply

show what you have configured

tropic yoke

working fine now just used this

await channel.send({
    components: [container],
    flags: MessageFlags.IsComponentsV2 | MessageFlags.SuppressNotifications,
    allowedMentions: { parse: [] },
});```
soft lance

Why is this happening?

snow onyx

you haven't deferred/replied before using editReply

dense jackal
soft lance
dense jackal

then show us? the images you provided only shows an .editReply()

soft lance
mighty wyvern

how can i solve this warning

sharp ginkgoBOT

tag suggestion for @mighty wyvern:

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

- {..., fetchReply: true}
+ {..., withResponse: true}

```This returns an [InteractionCallbackResponse](https://discord.js.org/docs/packages/discord.js/14.17.3/InteractionCallbackResponse:Class)
Use `<InteractionCallbackResponse>.resource.message` to get the message
mighty wyvern

thanks

snow onyx
dense jackal

line 11

snow onyx

not what the error is about

the error complains about 106 which is a different handler

dense jackal

oh yh

@soft lance whats on uddelleenliity.ts line 106

soft lance

this is uudelleenliity.ts

dense jackal

line 106 has break; so no

soft lance

its on 105:29 actually since I edited the code

dense jackal

all I can think of is that buttonpart has interaction as param, and you only use interaction.editReply() in that section

and no interaction.reply() or interaction.deferReply()

soft lance
dense jackal

then use interaction.update() instead

soft lance

Okay

soft lance

Is it possible to open a menu from a componentsv2 button?

rose tangle

what menu?

and buttons behave exactly the same

soft lance

modal i mean

rose tangle

the only thing cv2 did was add display components and ids

no behavior changes

you can still do what you were able to do before and can't do what you weren't able to

vestal sun
const dmChannel = await <member>.user.createDM()
const sentMessage = await dmChannel.send({ components: [container], flags: [MessageFlags.IsComponentsV2] })
const collector = sentMessage.createMessageComponentCollector({
    componentType: ComponentType.Button,
    time: 60_000 * 5, // 5 minutes
    max: 1,
})```

this collector would **end ** after either 5min or one interaction correct ? or does it always end after 5min and i need to use the <collector>.on("collect", <function>) for a direct use of the interaction ?
steel trail

The former

But you do need to use the collect event. You might want to use awaitMessageComponent(...) instead

vestal sun

ok ty

true granite

||guys I was programming a bot for discord in discord js that sends the notification on a discord channel every time someone in a streamer list goes live like notifyMe does. As a bee I used tiktok-live-conncector but it doesn’t go.

polar karma

we don't offer support for other packages. if it's an issue with their package, i suggest you contact them via their npm page/repo, or you could show code and issue in #1081585952654360687 . if it's an error coming from d.js, then post your code and error here

steel yacht

Hi,
I just saw a bot pass a clickable element in an embed that fills the user's message input with a slash command on click.
How to do that, and does it support prefililng parameters as well ?
Thanks

crimson gale

looks like an embed, is a container display component

sharp ginkgoBOT

guide Popular Topics: Display Components
read more

dense jackal

I think they are talking about </command_name:command_id>

dense jackal

if so: can be done using the syntax I said above -- and it does not allow you to put in prefilled options (at least I couldn't make it work for me lol)

steel yacht

That's it, thanks

fierce wing

Is there a nice way to update an existing client object (that's initially not "ready") with the <true> generic to mark the nullable fields as nonnullable?

as in new Client<true>()

loud quartz

What are you trying to do

Or where

fierce wing

Just wanting to be able to access values like Client.user without it possibly being null, and afaik, creating a new client with <true> does that

loud quartz

No, creating a new client does not take a generic, and neither does it ever log in, so you have a different Client instance that has no data

Are you trying to access that in some code/function of yours, or just in an event listener

fierce wing

The source has this

class Client<Ready extends boolean = boolean> extends BaseClient
loud quartz

Okay, but that's not how that works

You setting true there will not log the client in

fierce wing

I know that. I'm wondering how to update that value after it logs in

loud quartz

In events it should already be marked as ready

If you're taking Client somewhere in your function parameters instead of Client<true>, you can either change that, or use the typeguard

sharp ginkgoBOT
fierce wing

I've seen that. Just don't want to have to check that value before every single time I access a nullable value

loud quartz

It's a typeguard

Are you using typescript?

fierce wing
loud quartz

If you return / throw / whatever if it's not ready, the type will be narrowed already afterwards

That's how typeguards work

tardy sable

does deleting a sticker or emoji also delete their image urls, or are they kept in cache for some time?

urban swallow
            const name1 = member1.nickname ?? member1.user.username;
            const name2 = member2.nickname ?? member2.user.username;

what would be command for my actual name? so not destiezk.dev which is my username, but destiezk

daring coral

Or use displayName which uses globalName if available but falls back to username if it isn't for whatever reason

globalName can be null so I suggest that

loud quartz

Unless you're asking about discord itself

In which case - they are impossible to delete and stay up permanently

You can't send new ones with that id, but the emote will continue existing in existing messages

wind cypress

my bot just died for no reason, it doesnt respond to any command, and theres no error on the terminal

daring coral
wind cypress
daring coral
wind cypress
icy surge

after trying to switch fetchReply with withResponse I get this error Cannot read properties of undefined (reading 'first')

polar karma

because the promise resolves into a different object, it's not a message

sharp ginkgoBOT

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

- {..., fetchReply: true}
+ {..., withResponse: true}

```This returns an [InteractionCallbackResponse](https://discord.js.org/docs/packages/discord.js/14.17.3/InteractionCallbackResponse:Class)
Use `<InteractionCallbackResponse>.resource.message` to get the message
daring coral
icy surge
polar karma

memes, apparently mmLol

sharp ginkgoBOT
icy surge

okay so how do I use this to get the image link now?

rose tangle

the tag explains how to get the message, then use it like you were using it before

rose tangle

the callback resource, the docs explain what each property is

icy surge

if thats the callbackresource why is there also InteractionCallbackResource do I need to use that instead?

rose tangle

resource: InteractionCallbackResource | null means there's a property called resource, which is of type InteractionCallbackResource or null

rose tangle

won't be null for this case though

rose tangle
wind cypress nothing

so you restarted and it still isn't answering? doesn't sound like a network issue but a code issue

daring coral
wind cypress

theres no errors, that what is throwing me off. i have no idea what's wrong. not even /ping works

icy surge
rose tangle

the property is in the response

it's not a static property on InteractionCallbackResponse

the tag has an example

daring coral

this is why you use TS

rose tangle
wind cypress
sharp ginkgoBOT

tag suggestion for @wind cypress:
To share long code snippets, use a service like gist, sourcebin, pastebin, or similar instead of posting them as large code blocks or files.

still needle

after a user adds my bot to a guild, is there any way to get information about the guild my bot was just added to? i feel like discord used to expose a guild_id in the callback url params, but can't seem to find any info on this now

i need to keep track of what guild a user added the bot to in a database so that I can authorize any commands received from guild id xyz

rose tangle

the guildCreate event emits the Guild object

but what do you mean by "so that I can authorize any commands received from guild id"

daring coral

Yeah that last part doesn't really make sense

I'm assuming you're talking about adding guilds to guild scoped commands but idrk why you would want that

wind cypress
rose tangle

and your interactionCreate listener?

icy surge
rose tangle

it's an instance of that already

type casting doesn't exist in javascript anyways, so you can't make something an instance of another thing

still needle

my fault! i have an external userbase and am building a discord bot that my users can add to their own servers. in my database, i need a way to connect each user to whatever guild they add the bot to so that when the bot receives a command from some guild:

  1. I'll be able to authorize that guild by checking if it exists with some user in my db
  2. i'll be able to use the guild id to fetch external data about the user associated with that guild id (the functionality of the bot depends on which user it was added to)

in other words, if the invite link gets exposed, anyone can just add that bot to their server - I want to prevent the bot from being functional in any server that wasn't added my one of my users

icy surge

I figured it out

rose tangle

you could just fetch the guild on guildCreate, if it doesn't exist in your db, leave it

still needle

so my plan here was to expose the invite link in my product's dashboard with a callback url. then after a user adds the bot to a guild, they're redirected to my product with a guild_id that I can verify and save

still needle
rose tangle

I'll be able to authorize that guild by checking if it exists with some user in my db
I meant, don't do this check when you receive a command, just do it when you join the guild

since the bot isn't going to be functional anyways you can leave directly

still needle

hmm, I maybe I worded that confusingly. my issue is with actually linking my external user with the guild id (see red text in image).

i assume that, typically, authorization would be done with some kinda /authorize command where the user would input an API key or secret (where the bot would then fetch the user from the api key and link the guild with this user).

but i'm trying to avoid this by just linking the guild with a user right after a user adds a bot to a guild (since the user is already signed in on my product dashboard, I know I can trust them)

the guildCreate event wouldn't have any information on my user, so I wouldn't be able to link the guild with the user

rose tangle

if the user is the guild owner, you get that info as well in the Guild, if not then maybe you could wait a bit (since event order isn't guaranteed) and then check audit logs (but your bot would need permission to read them), and those would show who invited the bot

in both approaches you'd get both the guild and user id, then you should be able to associate both with an account you stored

if you go for the second approach you can specify the default permissions in the invite, if it somehow doesn't have them you could leave and maybe send an info message to a channel where you have permission to send messages

shut musk

How likely is it that a channel ID can match a user ID?

steel trail

0%

Snowflakes are unique

loud quartz

*unique within their scope

there are no 2 users with same ID

but there are servers and channels with the same ID

timid onyx

deploy-commands.js stuck on 'Refreshing 48 application commands', client id, guild id, token are all set properly, same deploy-commands.js in guide

timid onyx
rose tangle

maybe you're ratelimited? do you run it on start or very frequently?

halcyon zephyr
module.exports = async (interaction) => {
    const topUsers = await getTopCatCoinUsers(leaderboardLimit);

    const leaderboardContainer = new ContainerBuilder();

    for (let i = 0; i < topUsers.length; i++) {
        const user = topUsers[i];
        const member = interaction.guild.members.cache.get(user.userId);
        const memberIconUrl = member?.displayAvatarURL() ?? defaultAvatarUrl;

        leaderboardContainer
            .addSectionComponents(
                section => section
                    .addTextDisplayComponents(
                        textDisplay => textDisplay.setContent(`${i + 1}. <@${user.userId}> (${user.userId})\n  - **Cat Coins: ** ${user.coins} ${catCoinEmoji}`)
                    )
                    .setThumbnailAccessory(
                        thumbnail => thumbnail.setURL(memberIconUrl)
                    )
            )
            .addSeparatorComponents(smallSeparator);
    }
};

Quick question, since there is a 40 component limit, wouldn't this be valid if I am trying to display the top 10 users? I'm trying this with a 10 person leaderboard but it's saying my components can't exceed 40, as far as I can tell each iteration should add 4 components, so in total it'd be 40?

rose tangle

the container also counts

halcyon zephyr

ah makes sense, thank you Prayge

timid onyx
rose tangle

you can see it by logging on rateLimited

rest.on('rateLimited', console.log)

by default the manager will wait until the ratelimit expires then re-send the request, and only then the promise will resolve

you can use the rejectOnRatelimit option to make it reject instead, you can also log it if you want since it accepts a callback

sharp ginkgoBOT

propertysignature RESTOptions#rejectOnRateLimit discord.js@14.21.0
Determines how rate limiting and pre-emptive throttling should be handled. When an array of strings, each element is treated as a prefix for the request route (e.g. /channels to match any route starting with /channels such as /channels/:id/messages) for which to throw RateLimitErrors. All other request routes will be queued normally
Default value: null

rose tangle

passed to the REST constructor

timid onyx
rose tangle you can use the rejectOnRatelimit option to make it reject instead, you can also...

DB file exists: false
📦 Loaded 48 commands.
🔄 Refreshing application (/) commands...
{
global: false,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1369038912684691456/guilds/1356734866628153495/commands',
route: '/applications/:id/guilds/:id/commands',
majorParameter: 'global',
hash: '3e32a240d3716487d7d8f6dae6c54f6b',
limit: 2,
timeToReset: 59808,
retryAfter: 59808,
sublimitTimeout: 0,
scope: 'user'
}

rose tangle

yeah you're ratelimited

from that log it sounds like you're doing it on every start, don't

timid onyx
rose tangle

just wait then

timid onyx

59808 is millisecond?

meaning like a aminute-ish

rose tangle

yeah, about 1m

timid onyx

actually 3 minutes it's been

unique shoal

What on earth are you doing to hit this limit that badly

rose tangle

maybe it goes up if you still make requests

timid onyx
timid onyx
rose tangle

I mean 1m should be enough, but you shouldn't time it precisely, just wait for a bit, a minute goes by without noticing

timid onyx
unique shoal

Discord says the retry-after is in seconds, so thats at least 10 minutes

timid onyx

59000 seconds?

16 goddamn hours?!

deft ermine

nah it shud be on MS not seconds

unique shoal

Its a weird rate limit response

timid onyx
unique shoal

It says your limit is 2, which cant be right for a whole day

deft ermine

the thing is why r u running that many deploys to trigger a rate limit

rose tangle

iirc there's a daily limit but that's for amount of commands, not for amount of requests

just work on some other stuff, you can try again tomorrow

if you're not deploying on start that shouldn't be an issue

timid onyx

it's not on start

rose tangle

then work on something else for now

there's really not much you can do when hitting a ratelimit except wait

timid onyx

thing is i've finished all of my stuff and it's 2.30 am

i'm just gonna wait 20ish minutes cause i need the bot started now

unique shoal

Okay yeah confirmed we emit in ms

Youre not individually deploying them to multiple guilds or something are you?

timid onyx

no just one guild

Okay fuck is discord doing
It's been 5 minutes and it's just gone down to 59811

Limit's still at 2

unique shoal

The limit wont change

unique shoal

We dont know we arent Discord

Kinda seems like something is spamming way more requests than you think

timid onyx

{"message": "401: Unauthorized", "code": 0}

unique shoal

So whatever was going on was bad enough to get the token revoked

timid onyx

So I have to make a new token?

unique shoal

yes

timid onyx
timid onyx

@unique shoal Went down to 45164.

unique shoal

okay, theres still nothing we can do

deft ermine

Hey guys, I'm getting a 37-1 hour rate limit from defer reply commands. The commands that don't use a reply or use a PATCH request will go through, while messages that needs to be edited via interaction is completely rate limited, basically locking out most of the commands that the bot has.

[SHARD 2] REST Debug: [REST 3d2712a9e4fe17cc9d3fed4a8e672e5f:1376145557487226912/aW50ZXJhY3Rpb246MTQwMzE3ODc5MzE4Njc1NDY5MTpaQXlnY21lWEgwSUJMdWU5S3dzcDBqdDRnQVRpdWFNeElUN0dDZFVtSHBRTExTYlYzSWZhejh6Ukxwd0JOd0xvQ3hrVURLN0FlZk5saVZoOHRyS0VEaFNiZEsyRE1sSGNkOXhBM1hmbzJDVFRaZEtsaXpnSnhLa0tzRmNyd1k2cg] Encountered unexpected 429 rate limit
  Global         : false
  Method         : PATCH
  URL            : https://discord.com/api/v10/webhooks/1376145557487226912/aW50ZXJhY3Rpb246MTQwMzE3ODc5MzE4Njc1NDY5MTpaQXlnY21lWEgwSUJMdWU5S3dzcDBqdDRnQVRpdWFNeElUN0dDZFVtSHBRTExTYlYzSWZhejh6Ukxwd0JOd0xvQ3hrVURLN0FlZk5saVZoOHRyS0VEaFNiZEsyRE1sSGNkOXhBM1hmbzJDVFRaZEtsaXpnSnhLa0tzRmNyd1k2cg/messages/%40original
  Bucket         : /webhooks/:id/:token/messages/%40original
  Major parameter: 1376145557487226912/aW50ZXJhY3Rpb246MTQwMzE3ODc5MzE4Njc1NDY5MTpaQXlnY21lWEgwSUJMdWU5S3dzcDBqdDRnQVRpdWFNeElUN0dDZFVtSHBRTExTYlYzSWZhejh6Ukxwd0JOd0xvQ3hrVURLN0FlZk5saVZoOHRyS0VEaFNiZEsyRE1sSGNkOXhBM1hmbzJDVFRaZEtsaXpnSnhLa0tzRmNyd1k2cg
  Hash           : 3d2712a9e4fe17cc9d3fed4a8e672e5f
  Limit          : Infinity
  Retry After    : 1111050ms
  Sublimit       : 1111050ms
  Scope          : user

(This is not an actual discord webhook rather a webhook from interaction route i assume )

Is there a way to resolve this other than to remove DeferReply () as we think thats causing the issue as u would also need to edit the reply... the bot is also in over 43k servers that might be one of the reason for the heavy traffic.

unique shoal

This doesnt quite look like discord.js rate limit output, you might be better off asking Discord Developers. Seems unusual

deft ermine
unique shoal

There's not much we can do either way, discord.js just responds to what Discord provides

deft ermine

Right, so in order for these rate limits not to trigger we just gotta remove the editReply() part right

unique shoal

I can't really answer that, but no, I wouldnt think a single edit on a single defer per interaction should ever be causing this

deft ermine
unique shoal

This is really outside what we can support with, I suggest you try Discord Developers server

deft ermine

the commands that don't use a deferreply, or a patch request goes through instantly

rose tangle

ddevs would be a better place to ask, but afaik each interaction has its own ratelimits, it'd sound like you're using editReply too much for a given interaction

or its not a command and its an actual webhook

in which case it'd sound more likely to get a ratelimit

pallid ridge

can i not defer then show a model

a bit confused because i havent made any changes to my bot recently but it suddenly stopped working, were there breaking changes to the api?

answered my own question Showing a modal must be the first response to an interaction. You cannot defer() or deferUpdate() then show a modal later.

weird how i didn't have this issue before

unique shoal

Nope, that's always been the case

warm sundial

for database is sqlite3 decent enough?
before i made python bots, but since a week or so im using discord.js V14 with the componentsV2 stuff

but before i used aiosqlite

dont know if that matters that much

unique shoal

Its fine

warm sundial

As in, they both good enough or does it like not really matter

unique shoal

It's the same thing really

A wrapper for sqlite, which is the actual database

daring coral
lusty bramble
warm sundial
warm sundial
lusty bramble
pliant forge

how can i use applications? like these

sharp ginkgoBOT

guide Other Interactions: Context Menus - Registering context menu commands
read more

tardy sable

whats difference channel.position and channel.rawPosition ?

crimson gale

former: calculated, tries to emulate the order of channels you see in the left pane
latter: a mess (as returned from the api)

certain channel types are forced to be ordered after others if in categories, multiple channels can have the same position, even if in the same category
categories have their own order and their children start from 0 again, etc. etc.

tardy sable

tried normal position and the rawPosition but both have same issue

waxen dock

I keep getting this error

(process:14784): Pango-WARNING **: 14:09:33.428: couldn't load font "Headliner No. 45 Not-Rotated 50px", falling back to "Sans Not-Rotated 50px", expect ugly output.```
steel trail
tepid zodiac

flags: MessageFlags.IsComponentsV2

this no longer works?

unique shoal

It does