#djs-help-v14

78874 messages · Page 33 of 79

outer plume

Legitimately can’t do much about it if you’re 100% sure it’s not your code messing stuff up. Sometimes apis are slow.

toxic moat
outer plume

ye it happens with me too. Some times i’m .4 seconds over the 3s mark on a defer call. You can’t do much about that.

rose tangle

check these possibilities

toxic moat

So it’s okay to create error handler which will just ignore unknown interaction so it doesn’t spam console?

lofty topaz

Bro if i know how to put image I wasn't going to ask you

outer plume
rose tangle

you can log the interaction creation date and Date.now() to see which one it is, network or code

lofty topaz

I'm trying

rose tangle
toxic moat
rose tangle

do what part?

logging, getting the date?

toxic moat

In what case is it the code and when it’s network?

outer plume
rose tangle

if the current time and the interacion's creation difference is higher than 3s then that call will error, and you know it's your code

if it's not higher and it's within an acceptable margin then it's your network since your code is reaching the defer call in time

toxic moat

What is acceptable margin, 3s?

outer plume
rose tangle

I'd say 1.5s or more is acceptable

outer plume

It’s 3s from when the interaction started existing right? The snowflake?

rose tangle

yeah

or well when it reaches and is processed by discord technically

outer plume

that’s when the snowflake is generated i assume

inland remnant

woah sorry im a bit tired 🤦‍♂️ i meant to say it does create the thread, however everyone can see it, im assuming that in this case its more of a permissions issue rather than the code itself?

loud quartz

if you're creating a public thread, it's because you're creating a public thread, not because you have no perms to create a private one

wary coral
loud quartz

if you would try making private one without perms for that, you would simply get an error back

inland remnant
wary coral

yes, It would not start with the message

inland remnant

hmmm alright thanks

wary coral

here is the doc if it helps

sharp ginkgoBOT

method GuildTextThreadManager#create() discord.js@14.21.0
Creates a new thread in the channel.


// Create a new public thread
channel.threads
  .create({
    name: 'food-talk',
    autoArchiveDuration: ThreadAutoArchiveDuration.OneHour,
    reason: 'Needed a separate thread for food',
  })
  .then(threadChannel => console.log(threadChannel))
  .catch(console.error);

slate fiber

hey how can I check if an embed includes a word?

red coral

embeds[0].description.includes(…)

daring coral
slate fiber hey how can I check if an embed includes a word?

You would need the message content intent so this won't work for a public bot really
With that out of the way, you would need to get the Message somehow, assuming you have that, just get the embed(s) from the embed property and filter through the author, description, fields and footer properties
But before you do that, what is the use case

slate fiber

I'm making a system that adds you to a private thread when you send a command from a different bot

stuck sleet

Is it possible to make a decorative bot with the profile?

loud quartz

decorative? you cannot change other people profiles, nor do bots have access to any nitro features like customizing their own profiles

stuck sleet

aaa okey thank you

You can add decorations to the bot's profile XD

loud quartz

hm?

bot cannot do quests or buy decorations

native plank

Hi! Is there a way to fetch information about the number of boosts and who has boosted on a server?

dense jackal

the amount of boosts someone has given a server is not accessible through the api

native plank

Okay I see, thanks!

sharp ginkgoBOT
loud quartz

this also exists, no need to dig through the roles

faint sonnet

client.once not working

but client login working ?

stable sun
faint sonnet
stable sun

The event name changed to clientReady

faint sonnet

oh okey

stable sun
faint sonnet

thanks, its worked

spice wyvern

Hey, I have a weird bug... I received a message from discord saying my bots token got reset because it connected to Discord over 1000 times in a short period of time. However my logs suggest it never went into the client.once('ready'... block again. So I'm reluctant to believe it's an infinite crash loop. There weren't uncaught error logs either. I'm wondering if there's anything else that could've caused client.login calls without entering any other client functions?

halcyon bison

no part of discord.js or any submodules call <Client>.login() for you if that's what you're asking
hard to say about any other part of your bot without any info

spice wyvern

I can link the repo, its public

stable sun
spice wyvern
stable sun

Forcing the bot to make a new session rather than resuming the current one

spice wyvern

Bot losing internet for too long.. that would have to be a VPS issue?

stable sun

Yea

spice wyvern

Maybe? It's very hard to tell, my VPS says it's been up and my instance has been up for 26 days.

stable sun

The client.debug event prints out a lot of extra info, but it does let you know when this specifically happens

spice wyvern

Ok sounds good, I'll add that in too

golden smelt

how can i add an emoji on custom status ?

  client.user.setActivity({
    type: ActivityType.Custom,
    name: "custom",
    state: activities[0],
  });
halcyon bison

bots can't use the actual emoji field for custom statuses
the closest you can get is using unicode characters in the state

toxic moat

Why do I have this error empty reply thing?

halcyon bison

afaik that's entirely a client side issue
not something that can be caused or fixed in your code

toxic moat

so can i restart client to fix or what

I did, still happening 😭

oh shi that is vencord message logger

spice wyvern

@stable sun in my log it had this loop during the crash time that executes once an hour

Heap Used: 145 MB, RSS: 222 MB
Heap Used: 139 MB, RSS: 222 MB
Heap Used: 144 MB, RSS: 222 MB
Heap Used: 137 MB, RSS: 222 MB
Heap Used: 142 MB, RSS: 222 MB

this suggests my bot didnt crash, and the Discord.js websocket client tried to reconnect internally behind the scenes. This is just my theory, I added the logs you suggested and will see what happens for next time. But my bots been running smoothly for months so who knows. Thanks for your help.

lean sail

in the section of the guide that talks about sharding, it says you only need to at a certain number of servers. i have 2 questions.

  1. what happens if you shard and arent at this threshold? does it just do nothing or will shards actually spawn
  2. can a high amount of users require you to shard? such as if your bot is only in 10 servers, but each of them have hundreds of thousands of members
stable sun
lean sail
stable sun

That’s correct

cold ermine

Does internal sharding still count as sharding in the sense that it will allow the bot to join more than 2500 servers?

unique shoal

yes

stable sun

Internal sharding just puts the workload of multiple shards into one process

ivory plinth

Hi, if i'm not wrong <>.deferUpdate will allow my bot to respond within the 15 next minutes, will it throw an error if I don't ? (I'm mainly talking about Components interaction)

unique shoal

no

ivory plinth

good to know thanks you

pulsar aspen

So I got some code to do something when a user boosts a server, but it seems to also just happen when I change the role on someone if they have previously boosted the server?

I do not have partials enabled, but this is my code:

        if (oldMember.premiumSince === null && newMember.premiumSince !== null) {

            const guild = oldMember.guild;

            const boosterChannel = guild.channels.cache.find(
                (channel) => channel.name.toLowerCase().includes('boosters') && channel.type === ChannelType.GuildText
            ) as TextChannel | undefined;
            if (!boosterChannel) return;

            try {
                const message = await sendAsServer(
                    {
                        ...(await boostMessage(newMember))
                    },
                    boosterChannel
                );

                message?.react(BGNEmojis.GreenCheers);
            } catch {}
        }

This appears to trigger when I change a role on a user who has boosted, I reckon it has something to do with the user not being fully cached yet, how could I prevent that from happening?

sharp ginkgoBOT

tag suggestion for @pulsar aspen:
The Discord API does not provide a dedicated event for guild boosts, but you can check for it in the guildMemberUpdate event:

client.on("guildMemberUpdate", (oldMember, newMember) => {
    // Check if the member wasn't boosting before, but is now.
    if (!oldMember.premiumSince && newMember.premiumSince) {
        // Member started boosting.
    }
});
obtuse laurel

might be better to check for falsy value instead of null, like in this code ^^

pulsar aspen

Maybe, I will check that

wary coral

I do not think premiumSince will return to null when boost stops sorry, that is not relevant here

pulsar aspen

Maybe check the role? I don't know if there is a way to find the booster role in particular though if the guild has a different name for the booster role

obtuse laurel
pulsar aspen

So when checking it if (!oldMember.premiumSince && newMember.premiumSince !== null), this will trigger when the bot does not have the user cached already

obtuse laurel

you'd have to apply the same with the second check, like newMember.premiumSince instead of newMember.premiumSince !== null

pulsar aspen

If the user isn't cached it just immediately sees it as the user having boosted when any update happens on the member

!oldMember.premiumSince && newMember.premiumSince triggers if the member isn't cached beforehand, and I have no clue how I am going to solve it in that case.

wary coral
pulsar aspen Maybe

something like this

const boostRole = newMember.roles.cache.find(role => role.tags?.premiumSubscriberRole)
if(boostRole) {
 // Member is boosting
} else {
 // Member is not boosting
}
pulsar aspen

Maybe, still don't know how to fix the other issue though as I cannot check a non cached oldMember's roles to see if they have the booster role beforehand to fix the other issue...

obtuse laurel
pulsar aspen
obtuse laurel

what does your check look like now?

wary coral
pulsar aspen

All of the code:

        if (!oldMember.premiumSince && newMember.premiumSince) {
            client.logger.info(`Member ${newMember.user.tag} has boosted the server ${oldMember.guild.name}`);
            if (oldMember.guild.id !== minecraftBgnGuild) return;
            const guild = oldMember.guild;

            const boosterChannel = guild.channels.cache.find(
                (channel) => channel.name.toLowerCase().includes('boosters') && channel.type === ChannelType.GuildText
            ) as TextChannel | undefined;
            if (!boosterChannel) return;

            try {
                const message = await sendAsServer(
                    {
                        ...(await boostMessage(newMember))
                    },
                    boosterChannel
                );

                message?.react(BGNEmojis.GreenCheers);
            } catch {}
        }
obtuse laurel

where do you get oldMember and newMember from? a snippet of where it's defined

sharp ginkgoBOT
pulsar aspen

GuildMemberUpdate event, wrapped in a seperate class file:


class MemberBoosted extends GargoyleEvent {
    public override event: keyof ClientEvents = Events.GuildMemberUpdate;

    public override async execute(client: GargoyleClient, oldMember: GuildMember, newMember: GuildMember): Promise<void> {
        if (!oldMember.premiumSince && newMember.premiumSince) {
            client.logger.info(`Member ${newMember.user.tag} has boosted the server ${oldMember.guild.name}`);
            if (oldMember.guild.id !== minecraftBgnGuild) return;
            const guild = oldMember.guild;

            const boosterChannel = guild.channels.cache.find(
                (channel) => channel.name.toLowerCase().includes('boosters') && channel.type === ChannelType.GuildText
            ) as TextChannel | undefined;
            if (!boosterChannel) return;

            try {
                const message = await sendAsServer(
                    {
                        ...(await boostMessage(newMember))
                    },
                    boosterChannel
                );

                message?.react(BGNEmojis.GreenCheers);
            } catch {}
        }
    }
}

Ignore the other namings for the client and the event, as I needed some particular attributes to make extendability easy, but that is all there is, which is why I am so confused, I can also show you where it binds the execute funciton itself and the arguments granted to it from the event

client.on(event.event, (...args) => event.execute(client, ...args)) (simplified snippet from my register events method)

wary coral

Here is my current thought. What do you think?

const boostRole = newMember.roles.cache.find(role => role.tags?.premiumSubscriberRole)
const boostCheckInterval = 1500
if(boostRole && newMember.premiumSinceTimestamp && newMember.premiumSinceTimestamp >= Date.now() - boostCheckInterval) {
    // Member boosted in the last 1500 milliseconds
}
pulsar aspen

That may be a workaround

wary coral

I would recommend that you try to check oldMember before falling back on the timestamp

obtuse laurel

it's undefined if the member hasn't boosted, that's probably why it failed the null check

wary coral
obtuse laurel

not that sure though

wary coral

IDK would be nice if it was just an event

pulsar aspen

Would the boost message discord themselves send trigger a messageCreate event maybe?

Nah nvm that isn't a good idea

sharp ginkgoBOT
wary coral

but if you have the messages truned off it wont help

pulsar aspen

I guess this works as a work around for now;

        if (!oldMember.premiumSince && newMember.premiumSince) {
            if (oldMember.guild.id !== minecraftBgnGuild) return;

            const boosterRole = newMember.guild.roles.cache.find((role) => role.tags?.premiumSubscriberRole);
            if (!boosterRole) return;

            if (!newMember.roles.cache.has(boosterRole.id)) return;

            if (newMember.premiumSinceTimestamp && newMember.premiumSinceTimestamp < Date.now() - 15 * 1000) return;
wary coral

why get the role then check if the member has the role? And not just check if the member has a role with the premiumSubscriberRole tag

pulsar aspen

I guess that also works, it just won't look as pretty

Nevermind I am just stupid if (!newMember.roles.cache.find((role) => role.tags?.premiumSubscriberRole)) return;

wary coral

Wait you said that you dont have partials enabled right? If that is true you should get oldMember with each event. I think

pulsar aspen

Exactly, that is why I am so confused as to why premiumSince doesn't exist on a person who was already boosting

wary coral

weird I cant try it right now but I will try and reproduce later

pulsar aspen

Though I did just realize something, if partials are disabled the first guildMemberUpdate event doesn't seem to get triggered?

clear garnet

Correct, because the member wasn’t cached at that point

pulsar aspen

Yeah fair, so then checking if someone boosted if that specific member isn't cached is impossible

So I would have to enable partials, but then no oldMember to check

clear garnet

The guildMemberUpdate event relies on d.js’ cache for oldMember. That’s how it’s able to serve you the data from before the event emitted - Discord only provides the data for after the update happens

pulsar aspen

Fair, explains the current issue then, no clue how I am gonna check for a boost in that case

clear garnet

Enabling the partial tells d.js “give me this event, even if oldMember is not a fully populated GuildMember structure”

clear garnet
pulsar aspen
clear garnet

Okay, because a suggestion I give for apps in a small number of guilds is to fetch all members for the guild in your clientReady event listener. Then all members will be cached already making member-related events that rely on cache a lot more reliable

pulsar aspen

Yeah fair, that's unfortunately not an option for my use case

clear garnet

Not advisable for apps in hundreds or thousands of guilds though as you can imagine…

pulsar aspen

Could a webhook message be sent as a reply to another message?

rose tangle

nope

pulsar aspen

Yeah just saw, unfortunate.

pulsar aspen

Is there any way I could trigger a messageCreate event again for the same boost message? Or even just fake that event so I can debug it?
I cannot get more boosts for my testing purposes 😭

rose tangle

you could just listen to a fake event and emit that one

pulsar aspen

Unfortunately I do not have a copy of a boost message event, I will figure something out eventually hahaha

rose tangle

you can fetch the message and emit it

as mentioned, in a fake event, I wouldn't recommend doing it in djs' built-in ones

or well, you don't even need an event, you can call the handler function directly

gritty lily

I understand that a message with an embed or images when it updates the embed or image in anyway can trigger the Message Update Event.

However what I don’t understand currently is why messages from ages ago that have images or embedded links, in some cases way before the bot even joined are randomly triggering the event with no changes.

This might be more an API issue but just in case asking for help here.

steel trail

How did you determine there's no change?

vestal sun

do i need to fetch the guild or is it loaded automaticly
<member.>guild.preferredLocale

<member> is from guildMemberAdd event

gritty lily
steel trail How did you determine there's no change?

Well unless Discord is randomly updating the images posted like a refresh and then triggering the update event based on that then they’re messages from weeks if not months ago. When asking if people who it relates to edited these messages they reply that they have not.

The theme is however mostly messages with images.

No old message that has no media at all shows the same behaviour

obtuse laurel

might have something to do with link expiration for media

gritty lily

Could do, basically just thought I’d ask while I’m at work as I’m gonna try get to the bottom of it after

split thunder

Hi guys, how do I check in the message deleted event if someone else deleted a message?

wary coral
rose tangle

do consider there's no guarantees that first it'll emit the delete event and then create the audit log or viceversa

oak cosmos

if ur button collector is on the interactionCreate event, is there a way to make the button only collect then send back to the command file? like this

else if (interaction.isButton()) {
  // button collector logic
  // after it, the other logics are continued on the command.js file
}
```?
wary coral

I am not sure what you mean have you looked at the guide or docs?

sharp ginkgoBOT
rose tangle

do you want to send the button interaction to the command?

oak cosmos
rose tangle

just import your function and call it

that's a js question, not a djs one

how to import a function

oak cosmos

oh my bad

rose tangle

it sounds like a bad approach though, personally I'd make a common function for both

specially in js that'll let you pass anything with no issues

even if that won't actually work when executed

lofty topaz
sharp ginkgoBOT

guide Popular Topics: Display Components - Media Gallery
read more

lofty topaz

@rose tangle i will share for you my code

dense jackal

the guide provides an example so if you copy that and change the values of some methods you should be good tho

rose tangle

if you want to add it to a container, pass it to the add method

sharp ginkgoBOT
rose tangle

don't reply to my answer while ignoring it

dense jackal

I think your url in line 33 isnt complete, it ends with a “&” but normally there is another url query behind that too

lofty topaz
rose tangle

to which container? you have two

you already added it to one, but b3ssel mentioned a possible issue there

lofty topaz
rose tangle

just copy what you did with the first one

rose tangle
lofty topaz
rose tangle

did you check what b3ssel said?

rain forum

hi guys

if i want to send text in voice channel chat how can i do that

dense jackal
lofty topaz

I hate this

dense jackal

if you follow the guide and/or docs then there shouldn’t be any problem

it can be that the URL isn’t working

have you tried copying the URL you have in the code and pasting inside discord

lofty topaz
dense jackal
rose tangle

try making it work at least outside of the container first

like how you're doing it now

it should work, if it doesn't it suggests it's the link

lofty topaz

I deleted it

rose tangle

then now just call the addMediaGallery component in the container and set it up there

you already figured how to do it for text displays, separators and sections

it's the exact same thing

lofty topaz
dense jackal

and what will you learn from that? when you face another error you simply ask us again to modify code

we arent here for spoonfeeding

lofty topaz
sharp ginkgoBOT

guide Popular Topics: Display Components - Media Gallery
read more

rose tangle

you already added a text component, a section, a thumbnail and a separator

it's the exact same procedure for a media gallery

just with a different function

sharp ginkgoBOT
dense jackal

this and the guide is everything you need basically

rose tangle

.addMediaGalleryComponents((media) => ...)

lofty topaz

Yeah but Media gallery is so difficult i can't add it

I will try again

steel trail
rose tangle
lofty topaz
rose tangle

you don't, you don't want to send the gallery individually

you just add it to the container and then send the container

as mentioned, it's the exact same thing as with text displays, sections and separators

I'm unsure how you managed to add all of that and can't do the media gallery

sharp ginkgoBOT
rose tangle

@flint pier please use #app-commands or the hide option for personal docs usage

rose tangle

?

lofty topaz
rose tangle

yeah, in the gallery

you already did it when you sent the gallery outside

it's the exact same builder

you can quite literally copy and paste the methods you called

lofty topaz

Error 🙂

rose tangle

copy your own code

dense jackal
new ContainerBuilder()
  //…
  .addMediaGalleryComponents(
    mediaGallery => mediaGallery
      .setItems(
        mediaItem => mediaItem
          .setURL(“…”)
      )
  )

basic reading of both the docs and the guide we provided multiple times now

rose tangle

if you're copying and pasting code from other sources you won't get quite far in programming, you'll have to learn how to read docs and guides

I'm certain you copied all that other code from somewhere else if you're having these issues

learn how to write your own code instead of copying

dense jackal

and to add you haven’t shared any error with us, just a link to your code file and the words “doesn’t work help”

lofty topaz
function createStatusEmbed(status, checkTime) {
  return new ContainerBuilder()
    .setAccentColor(0x000000) // لون أسود
    .addTextDisplayComponents(
      textDisplay => textDisplay
        .setContent(`## 📊 |  ShareBot Status`),
    )
    .addSeparatorComponents(
      separator => separator,
    )
    .addSectionComponents(
      section => section
        .addTextDisplayComponents(
          textDisplay => textDisplay
            .setContent(`
- **ShareBot Assistant**
**Online :emoji_5:**`),
          textDisplay => textDisplay
            .setContent(`
- **ShareBot**
**${status}**`),
        )
        .addMediaGalleryComponents(
    mediaGallery => mediaGallery
      .setItems(
        mediaItem => mediaItem
          .setURL(`https://cdn.discordapp.com/attachments/1362042671799074877/1400165069224022068/IMG-20250402-WA0005.jpg?ex=688c4d96&is=688afc16&hm=ad4517a4620cd0b815ab5039b4067d898aea0002b7c73c781dca262e6f207180&`)
      )
  )
        .setButtonAccessory(
          button => button
            .setStyle(ButtonStyle.Link)
            .setURL('https://discord.com/oauth2/authorize?client_id=1348761924174745691&permissions=8&integration_type=0&scope=bot')
            .setEmoji({ name: 'ShareBot', id: '1369599144221605979' }),
        )
    )
    .addSeparatorComponents(
      separator => separator,
    )
    .addTextDisplayComponents(
      textDisplay => textDisplay
        .setContent(`-# ** *Last check: <t:${Math.floor(checkTime.getTime() / 1000)}:R>* **`),
    );
    
}

@rose tangle check it

Iam sorry to ping

topaz bluff

I wouldn't use a cdn.discord.com url in your code. Discord CDN links expire

Either store the image locally and share it as an attachment or post it to your own CDN

lofty topaz
topaz bluff

I'm on mobile so it's hard to tell but it looks like your .addMediaGalleryCompoments() call is nested in your .addSectionComponente()

dense jackal

it is yes

if you want a thumbnail in your section you should use this:

sharp ginkgoBOT
rose tangle

they already had yesterday a long issue about trying to add a thumbnail and a button accessory to the same section

they want to add a gallery now

dense jackal

😔 oh alr

tropic yoke

how can i send @silent embed on discord.js v14.14.1 ! i tried content: @silent but it doesn't the bot just ended up by sending @silent with embed

loud quartz

@silent isn't what makes a message silent

the flag does

the @silent is just a way for humans to set the flag

tropic yoke

after flag ?

sharp ginkgoBOT

dtypes v10: MessageFlags - SuppressNotifications
read more

tropic yoke

thnx

rose tangle

pass that to flags: in the message options

loud quartz

and just in case, update your d.js

dense jackal
tropic yoke
rose tangle

are you on TS or JS?

loud quartz

per semver, any v14 version is compatible with each other

tropic yoke

ts

loud quartz

if it would be breaking, it wouldn't be v14 but v15

rose tangle

then yeah you might need some changes

loud quartz

mh

rose tangle

type changes aren't considered breaking, only runtimes are (since djs is a js library)

loud quartz

(by us)

not by semver

tropic yoke

imma look

wait v15 released

loud quartz

no

it did not

where did you see that

dense jackal

v14.21.0 is the latest

tropic yoke

lemme update

rose tangle

tipaka was making an example that if there was a (runtime) breaking change then it would be applied in a next major release, not v14, the current version

dense jackal

best practice is to update asap when new stuff is released and modify your code accordingly

loud quartz

eh

lofty topaz
function createStatusEmbed(status, checkTime, MediaGalleryBuilder) {
  return new ContainerBuilder()
    .setAccentColor(0x000000) // لون أسود
    .addTextDisplayComponents(
      textDisplay => textDisplay
        .setContent(`## 📊 |  ShareBot Status`),
    )
    .addSeparatorComponents(
      separator => separator,
    )
    .addSectionComponents(
      section => section
        .addTextDisplayComponents(
          textDisplay => textDisplay
            .setContent(`
- **ShareBot Assistant**
**Online :emoji_5:**`),
          textDisplay => textDisplay
            .setContent(`
- **ShareBot**
**${status}**`),
        )
        .setButtonAccessory(
          button => button
            .setStyle(ButtonStyle.Link)
            .setURL('https://discord.com/oauth2/authorize?client_id=1348761924174745691&permissions=8&integration_type=0&scope=bot')
            .setEmoji({ name: 'ShareBot', id: '1369599144221605979' }),
        )
        .addMediaGalleryComponents(
          mediaGallery => mediaGallery
            .setItems(
              mediaItem => mediaItem
                .setURL(`https://cdn.discordapp.com/attachments/1362042671799074877/1400165069224022068/IMG-20250402-WA0005.jpg?ex=688c4d96&is=688afc16&hm=ad4517a4620cd0b815ab5039b4067d898aea0002b7c73c781dca262e6f207180&`)
            )
        )
    )
    .addSeparatorComponents(
      separator => separator,
    )
    .addTextDisplayComponents(
      textDisplay => textDisplay
        .setContent(`-# ** *Last check: <t:${Math.floor(checkTime.getTime() / 1000)}:R>* **`),
    );
}

Now?

rose tangle

you're still calling it in the section

not in the container

you can't add a media gallery to the section

you add it to the container

.addSectionComponents(...)
.addMediaGalleryComponents(...)
.addSeparatorComponents(...)

you're doing this which is incorrect

.addSectionComponents((section) => section.addMediaGalleryComponents(...))
.addSeparatorComponents(...)
tropic yoke

just updated to latest and mhmm

rose tangle

yeah command interaction doesn't have options, maybe you meant a chat input, which is the type for slash commands

lofty topaz
rose tangle

does that mean you understood?

lofty topaz
rose tangle

what part specifically?

lofty topaz
dense jackal

brackets mean a lot in javascript

lofty topaz
dense jackal

if misplaced it can have a whole different meaning

you aren't, otherwise you would not receive errors

Media Gallery is a component, Section is a component -- those should not be added inside of one another

.addSectionComponents( // <<< opening bracket, start of data for section components
  // everything that has relation to a section component goes here
) // <<< closing bracket, end of data for section components
.addMediaGalleryComponents( // <<< opening bracket, start of data for media gallery components
  // everything that has relation to a media gallery component goes here
) // <<< closing bracket, end of data for media gallery components
lofty topaz

Oh

I finally understood 😂😂

Sorry

rose tangle

brackets are also not the only thing different between the two snippets

dense jackal

🥳

lofty topaz
dense jackal

thats common when developing, if you assume its normal to have working code instantly I have to tell you something..

but please share the error, as I have no info how to solve it now

lofty topaz
dense frost

any idea why

new ButtonBuilder()
    ...
    .setEmoji({ name: "🔄" });

throws a

DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[2].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji

when sending it
why does this one emoji specifically doesn't get recognised
⏩, ⏪, ✋ and 🚮 work perfectly fine

i can't figure out how to send that damn emoji in a button

dense jackal

oh I thought .setItems() existed on the builder as well, my bad

only .addItems() exist, so change it to .addItems()

slate fiber

could anyone tell me why my code keeps sending this error?

dense jackal
dense frost
dense jackal
dense jackal

parameter is of type ComponentEmojiResolvable, which is APIMessageComponentEmoji or string

dense frost
lofty topaz
dense jackal
tidal ravine

How can you detect rate limit when creating roles

lofty topaz
dense jackal
lofty topaz
dense jackal
- setItems(
+ addItems(
dense frost

i guess discord just really doesn't like that one particular emoji ? really odd behaviour

dense jackal

okay then I have no idea sorry how some of the emojis don't work

lofty topaz
lofty topaz
hallow mesa

Sure. Reorder the components

dense jackal

the order of your code determines the order of the components displayed on discord

dense jackal
hallow mesa

Above the section, not inside it

dense jackal

the closing bracket of .addMediaGalleryComponents(...) must be on the line above the line where it says .addSectionComponents(

main mason

Is there another way to acknowledge button interactions without ButtonInteraction.reply()? I want to edit the original message that the button was a part of

sharp ginkgoBOT

method ButtonInteraction#update() discord.js@14.21.0
Updates the original message of the component on which the interaction was received on.


// Remove the components from the message
interaction.update({
  content: "A component interaction was received",
  components: []
})
  .then(console.log)
  .catch(console.error);

rose tangle

it also acknowledges

main mason

thanks!

inner cipher
Jul 31 12:00:25 node[92261]:             triggerUncaughtException(err, true /* fromPromise */);
Jul 31 12:00:25 node[92261]:             ^
Jul 31 12:00:25 node[92261]: ConnectTimeoutError: Connect Timeout Error (attempted address: discord.com:443, timeout: 10000ms)
Jul 31 12:00:25 node[92261]:     at onConnectTimeout (/opt//node_modules/undici/lib/core/connect.js:237:24)
Jul 31 12:00:25 node[92261]:     at Immediate._onImmediate (/opt//node_modules/undici/lib/core/connect.js:206:11)
Jul 31 12:00:25 node[92261]:     at process.processImmediate (node:internal/timers:476:21) {
Jul 31 12:00:25 node[92261]:   code: 'UND_ERR_CONNECT_TIMEOUT'
Jul 31 12:00:25 node[92261]: }```

id assume this is part of it ?
frail gate
 else if (interaction.isModalSubmit()) {
            const customId = interaction.customId.split("_")[0];
            const ticketCategory = interaction.customId.split("_").slice(1).join("_");
            const ticketOption = ticketCategories.find(v => v.data.value == ticketCategory);
            const activeTicketCategory = client.channels.cache.get(activeTicketCategoryId);
            const closedTicketCategory = client.channels.cache.get(closedTicketCategoryId);
            console.log(Object.fromEntries(interaction.fields.fields.map(v => [v.id, v.value])))
            if (!ticketOption) return await interaction.reply({ content: "❌ | Böyle bir destek kategori bulunamadı!", flags: [MessageFlags.Ephemeral] });
            if (!activeTicketCategory || activeTicketCategory.type !== ChannelType.GuildCategory) return await interaction.reply({ content: "❌ | Aktif destek talebi kategorisi bulunamadı, destek talebi açılamadı!" });
            if (!closedTicketCategory || closedTicketCategory.type !== ChannelType.GuildCategory) return await interaction.reply({ content: "❌ | Kapalı destek talebi kategorisi bulunamadı, destek talebi açılamadı!" });
            if (customId == "openTicket") {
                // client.ticketManager.createTicket({
                //     category: ticketCategory,
                //     ticketCreator: interaction.user.id,
                //     questions: 
                // })
            }
        

guys interaction.fields gives undefined. how can i solve?

unique shoal

How so? "gives undefined" is often confused with other errors

But if I had to guess it's because you've written interaction.fields.fields

lofty topaz
  .addSectionComponents(
      section => section
    
      
        .setButtonAccessory(
          button => button
            .setStyle(ButtonStyle.Link)
            .setURL('https://discord.com/oauth2/authorize?client_id=1348761924174745691&permissions=8&integration_type=0&scope=bot')
            .setEmoji({ name: 'ShareBot', id: '1369599144221605979' }),
        )
        .setButtonAccessory(
          button => button
            .setStyle(ButtonStyle.Link)
            .setURL('https://discord.com/oauth2/authorize?client_id=1348761924174745691&permissions=8&integration_type=0&scope=bot')
            .setEmoji({ name: 'loading', id: '1400602971028590713' })
            .setDisabled(true),
        ),
        );

Check this pls

@unique shoal sorry for ping

unique shoal
unique shoal
lofty topaz
unique shoal

Too bad

frail gate
unique shoal

Again, either of what. I don't know what you mean and you haven't explained the undefined thing.

lofty topaz
frail gate

thanks!

rose tangle

and you can't have a section with two accessories, you were already told

so if you call setButtonAccessory twice, the last one will override the other one

if you want a line of buttons, use an action row

sharp ginkgoBOT

guide Interactive Components: Buttons - Building buttons
read more

rose tangle

I don't understand

lofty topaz
rose tangle I don't understand
function createStatusEmbed(status, checkTime, MediaGalleryBuilder) {
  return new ContainerBuilder()
    .setAccentColor(0x000000) // لون أسود
    .addTextDisplayComponents(
      textDisplay => textDisplay
        .setContent(
`## 📊 |  ShareBot Status

- **ShareBot Assistant**
**Online :emoji_5:**
- **ShareBot**
**${status}**
`),
    )
    .addSeparatorComponents(
      separator => separator,
    )
    .addMediaGalleryComponents(
          mediaGallery => mediaGallery
            .addItems(
              mediaItem => mediaItem
                .setURL(`https://cdn.discordapp.com/attachments/1362042671799074877/1400165069224022068/IMG-20250402-WA0005.jpg?ex=688c4d96&is=688afc16&hm=ad4517a4620cd0b815ab5039b4067d898aea0002b7c73c781dca262e6f207180&`)
            )
        )
      
  .addSectionComponents(
      section => section
    
      .addTextDisplayComponents(
          textDisplay => textDisplay
            .setContent(`-# ** *Last check: <t:${Math.floor(checkTime.getTime() / 1000)}:R>* **`),
        )
        .setButtonAccessory(
          button => button
            .setStyle(ButtonStyle.Link)
            .setURL('https://discord.com/oauth2/authorize?client_id=1348761924174745691&permissions=8&integration_type=0&scope=bot')
            .setEmoji({ name: 'ShareBot', id: '1369599144221605979' }),
        ),
        );
}
rose tangle

yeah that shouldn't cause issues

or well, not at first glance

lofty topaz
rose tangle
rose tangle

they're different

lofty topaz
lofty topaz
rose tangle

yeah, and I explained the issue and what you need to do

lofty topaz

Container is very complicated

😑

rose tangle

you just need to figure what each component needs

media galleries need at least one item, sections need one accessory and 1-5 text displays

lofty topaz
rose tangle

no, that won't solve it

lofty topaz
dense jackal
unique shoal

Yeah this doesnt strike me as a lack of JS knowledge honestly, there are lots of little details you need to know about how each component type works

However, Amgelo has very patiently explained those details, so now there's not much else we can do

dense jackal

oh imo everything seems pretty clear with just the docs and guide if you have a basic understanding of js, but that might be just me then shrug

toxic moat
const collector = selectMessage.createMessageComponentCollector({
  filter: i =>
    i.customId === 'selectCustomVC' && i.user.id === interaction.user.id,
  time: Time.Minute,
  max: 1
});

collector.on('collect', async selectInteraction => {
  if (!selectInteraction.isStringSelectMenu()) {
    return;
  }

  await selectInteraction.deferUpdate();

  const selectedCustomVCId = selectInteraction.values[0];
  const selectedCustomVC = sortedCustomVCDocs.find(
    vc => vc.id === selectedCustomVCId
  );

  if (!selectedCustomVC) {
    return selectInteraction.editReply({
      embeds: [],
      components: []
    });
  }

  await selectInteraction.editReply({
    embeds: [],
    components: []
  });
});

Is this correct way to do it, defer then editReply?

unique shoal

If you need time to perform an action that will take more than 3 seconds, yes

Otherwise you could just update directly

rigid hinge

hello how is it called when you have commands like this
/balance add
/balance view
/balance reset

rose tangle

subcommands

sharp ginkgoBOT

guide Slash Commands: Advanced command creation - Subcommands
read more

toxic moat

if i do const modalInteraction = await interaction.awaitModalSubmit({})
how can i try catch it but i need to know if error in catch is like timeout (it didnt collect anything)

unique shoal

Thats like the only reason it can throw iirc

Assuming you pass a time

tardy sable

is there a way to change the ui to be more compact?

like how it would look on mobile

unique shoal

No

rotund turret

Do slash command stringOptions allow for multi select when providing choices? or is that only for selectMenus

stable sun

Only select menus

rotund turret

aight

toxic moat

is there something like instanceof,
so I can log actual error that's not related to collector and edit message saying that select menu is expired yk IF IT's expired

unique shoal

No, we dont used typed errors like that

They dont really exist in JS/TS

ivory plinth

Hi, ContainerComponent is up to 50 components but how does it work ? like they have weight like you can have a row of five buttons but a selector will take 5 places

topaz bluff
ivory plinth

wait that means you can have 20 selectors in a container

that sounds terrible SCwhat

frail gate

guys how to reset the selection on select menu?

stable sun
frail gate
stable sun

That’s the only way to programmatically do it

Other way is to restart the discord app

frail gate

okey, thanks!

tardy sable

why it says TypeError: role.setColors is not a function

role = interaction.guild.roles.cache.get(roleId);
await role.setColors({ primaryColor: rolecolor });

stable sun

Role.setColors doesn’t exist in v14

stable sun

That’s the main/dev version

tardy sable

ill have to wait for release then?

stable sun

I mean, you can use the dev version. Just have to mind the breaking changes it has

Or hope that feature gets back ported

tardy sable

ill just wait then

slate fiber

hey how much customization are you able to set for your bot's rich presence?

sharp ginkgoBOT

method ClientUser#setPresence() discord.js@14.21.0
Sets the full presence of the client user.


// Set the client user's presence
client.user.setPresence({ activities: [{ name: 'with discord.js' }], status: 'idle' });

unique shoal

You can check the properties here

tardy sable

This an UI issue right, no way to make it looks like its on pc?

unique shoal

There's basically nothing you can do about Discord rendering assuming you wrote the code properly

If each one of those is a Section with TextDisplay and ButtonAccessory, you've done all you can

tardy sable

I guess best i can do is complain on the dev server?

unique shoal

Yeah

thorn lava

how?

stable sun
thorn lava
stable sun

Could be slow internet

You only get 3 seconds upon receiving the event to reply or defer

thorn lava
stable sun

Might be possible that ur running multiple instances of the bot, but you usually see a reply/defer alongside the error in console

thorn lava

No idea, there's only one running

stable sun

You checked task manager?

thorn lava
stable sun

Try killing the bot and then run the command to see if you get the same result

thorn lava

I killed the process and the bot shut down

rose tangle

you could contact your host about why your network is so slow

thorn lava
rose tangle

maybe you had the two instances running back then?

thorn lava

If I tried to run two copies of the bot, I would get an error. Because I don't use sharding

rose tangle

can you format your code correctly and then share it? the indentation looks wrong in that image

thorn lava
rose tangle can you format your code correctly and then share it? the indentation looks wron...
client.on("ready", async() => {
        log("Бот запущен", "info");

        if (!state_core_load) {
            log("/&core&/ Ядро было отключено", "warn");

            client.user.setPresence({
                status: "dnd"
            });
        };
    
        const commands = [
            new SlashCommandBuilder()
            .setName("test")
            .setDescription("Проверка отклика бота")
            .toJSON()
        ];

        const rest = new REST({ version: "10" }).setToken(config.token);
        try {
            await rest.put(
                Routes.applicationCommands(client.user.id),
                { body: commands }
            );

            log("Команда /ping зарегистрирована", "info");
        } catch (err) {
            log("Ошибка регистрации команды /ping: " + err.stack, "error");
        }

        client.on("interactionCreate", async interaction => {
            if (!interaction.isChatInputCommand()) return;
            if (interaction.commandName === "test") {
                try {
                    await interaction.deferReply();  // чтобы Discord не считал интеракцию просроченной
                    const latency = Date.now() - interaction.createdTimestamp;

                    console.log(interaction);
                    await interaction.editReply(`Pong! Задержка: ${latency}мс`);
                } catch (err) {
                    console.error("Ошибка при ответе на interaction:", err);
                }
            }
        });
    });
rose tangle

yeah that should work

kinda unusual to have the interaction listener inside the ready event but it shouldn't cause issues

lusty current

yo, weird question

is there a way to get djs working on react?

rose tangle

why?

do you want to execute a bot in a browser?

lusty current

wellll, react server

rose tangle

can you be more specific on how that works?

thorn lava
lusty current

blue_joobi_idk i dont really know, thats why im asking if that possible?

lusty current
rose tangle

you don't know how the environment you're trying to setup works?

thorn lava
lusty current

well i do.. still trying to get used to react

  1. Djs
  2. React
  3. backend api
rose tangle

I'm not really sure what's supposed to be your environment where you want to setup djs though

lusty current

backend is based off of py so djs wont work

rose tangle

react isn't a runtime, it's a library

lusty current

is there a version of djs that has a py lib? (i bet not)

rose tangle

yeah, djs is only for js

if you want to use py, use dpy

lusty current

dpy dosent have components v2 (or i dont think so)

rose tangle

no idea ¯_(ツ)_/¯

if you have a node env you can run djs there

otherwise nope, can't run it in a browser

bots shouldn't really run there either way

they're stateful, persistent applications

not something more ephemeral like a browser tab

you'd also need to share your credentials to the client

thorn lava
rose tangle

in general it's just not possible/worth it to run a bot in a browser

lusty current

not if u try 😭

rose tangle

try to make it worth it?

lunar tangle

lol

rose tangle

we still don't know what you actually want to build and where it'd be ran, that'd be a start

lusty current

i think its possible, itll just be limited

rose tangle

limited to what?

lusty current

what it can do

rose tangle

to what, not what you meant

lunar tangle

dogeHaHa

thorn lava

dogeHaHa

rose tangle
lusty current
rose tangle
rose tangle
rose tangle
lusty current the client.. (browser)

but like, what would it be limited to, what would be the actual limitations you mean

if you can share what you want to build it'd be useful, maybe we can give some alternatives

lusty current
lunar tangle
rose tangle please take general comments outside this chat

Ok, This bro wants to integrate discord.js into React library but it can't be done because it's not designed for frontend, and his backend is in python, so he decided to ask for discord.js if it can be integrated because python libraries don't keep Discord API functions up to date.

lusty current
lusty current

brower hosted bot hmmm

rose tangle

though with djs it's just plain impossible for now

it uses a lot of node apis

lunar tangle
rose tangle yeah, we know all that already

I assume that we will have to make an API for the bot to interact with the backend, otherwise it's just not realizable. Unless of course this bro has time to write his own library using discord gateway api and rest api from discord xD

rose tangle

which are independent of the library you use

lusty current
rose tangle

at most an actual application would be one that lets you input your code and token and start a bot in the browser, no idea why you wouldn't just install node though

lunar tangle
lusty current
rose tangle

you can come back later once you have a more solid idea about what you want to build, if it's still in a browser env you'll know it's not possible with djs but maybe we can give alternatives

lusty current

yeah ill think about it, thanks for the ideas

lunar tangle

@lusty current

Use to hata for the python

steel trail

Keep this channel on topic of help for djs please

lunar tangle
steel trail

And they've been told before. So yes, it is off-topic now

lunar tangle
steel trail
thorn lava
steel trail

Please don't reply to unrelated messages. Is your network connection that bad that it takes more than 3s? Can you log the interaction, interaction.createdTimestamp and Date.now() in your interactionCreate event first thing?

outer plume
thorn lava

Please do what Qjuh suggested above. We need to see two timestamps. Interaction.createdTimestamp and the current timestamp for Date.now()

thorn lava
steel trail

Okay, so you do send the deferReply pretty fast (and judging by the screenshot in the background of your first one it even works as you want it to, no error). The complete run taking 5s indicates a very bad network connection between you and discord though. Where do you host that bot code?

thorn lava

It is very strange that there is such a delay, because the ping to discord is 139ms.

steel trail

How did you measure that?

If you mean your latency variable: for that to be accurate your local clock would have to be in perfect sync with discord's clock

thorn lava
steel trail

Well, the other option is that your PC itself is really slow or there's something else running on that node process clogging the event loop

thorn lava

If you know a program like btop. Here the computer is clearly not loaded to the point of being so slow

steel trail

That doesn't say anything about your node process though. Since NodeJS is single-threaded if there's something else clogging the event loop then your await calls might have to wait for longer than the actual network request

thorn lava
steel trail

Sounds like common asynchronous speed

spark jay

searching through the discord, i am under the impression that global slash command registration is instant but i just did it (bot is in 27 servers) and i pressed ctrl + r and the commands are not here, if i set a guild ID tho, its instant

snow onyx

Global command registration is, indeed, instant.
You either lack perms to see them or your registration failed.

spark jay

oh

im ratelimited 😭

rigid hinge

hello where is the description used in case of subcommands?

south sigil

Hey, maybe this has changed, but in StringSelectMenuBuilder I can't use .setMaxValues(4) .setMinValues(1), so I can't select more than one option.

snow onyx
south sigil

-# Discord not uploaded my image

rigid hinge

why is it even required in the api then smh

snow onyx

because subcommands are not required?

every command needs a description, sub command or not

just like every option needs a description

outer plume

anyway. Question.
What is setId for on a TextInputBuilder? It's not the customId, I know that. But then what is it for?

loud quartz

For you to identify specific components

outer plume

was setId not there before ComponentsV2 came out?

outer plume

no wonder. alr thanku

lean sail

what are the character limits for containers?

wary coral
tardy sable

what am i doing wrong

container.addSectionComponents(new SectionBuilder().addTextDisplayComponents(new TextDisplayBuilder().setContent(text))).addActionRowComponents(row);

I cant add an action row to a section?

topaz bluff
sharp ginkgoBOT
tardy sable
topaz bluff

Well you can. But the buttons will have to be under the text, rather than on the right side

tardy sable

how would i do that. i did button accessory at first and it put it on the right side

sharp ginkgoBOT
tardy sable

found it

lean sail

would i need a gateway connection for a user installable only bot?

tardy sable

I cant add a button accessory to component without a text display?

obtuse laurel
topaz bluff
tardy sable
stable sun

Not all members are cached

You'd have to await guild.members.fetch(); to fetch all members beforehand

tidal ravine

can a discord bot have a server tag

stable sun

No

polar karma

members are not sent on ready, they're sent and cached when relevant events are received

meager laurel
tidal ravine
sly merlin
south sigil

know anyone the big int of Manage Permissions i not find it in PermissionFlagsBits

snow onyx
south sigil

ah wow ok sorry my bad

golden smelt

i have a problem with calculating the total users

With Sharding

Before Shharding:

lofty topaz
sharp ginkgoBOT
topaz bluff

You should check the docs to make sure the function you're using actually exists

rose tangle

and please don't ping for support, there are more people to help than just us, and your problem doesn't require any context for you to require our specific help

the error is already self explanatory, you should learn how to read errors and find fixes, your fix would be to search the actual methods in a SectionBuilder

I'm not sure how you've come up with this problem though, you already created a section correctly before

just copy your own code from before

topaz bluff

Copilot moment probably

stable sun
last mountain

anyone know how to get a slash command in an embed like this

stable sun

Can you count up unavailable guilds?

golden smelt
sharp ginkgoBOT

documentation suggestion for @last mountain:
discord API Reference - Message Formatting
read more

stable sun
sand atlas
sharp ginkgoBOT
tight dagger

anyone know when a bot get to show commands like this?

steel trail

When it's verified and discord has enough usage statistics of public commands of it. Then it's automatically added to the profile

tight dagger
slate fiber

hey, can I use message.content.includes in a switch statement? for example

swtich (message.content.includes()) {
  case "string1":
  case "string2":
}```
clear garnet

That is not how JavaScript switch statements work, irrespective of if it's with <Message>.content or any other string

slate fiber

yeah that's what I figured

probably could use an object and for (let key in object)

followed by an if statement

rose tangle

I'm not sure what object iteration has to do with checking whether message content includes something

reef jewel

Can someone help please, i tried to create a bot with basic commands(restart,stop,mute) and it's show me The application did not respond when i use slash command.
my index.js

const { Client, GatewayIntentBits } = require('discord.js'); // Updated for v14+
const fs = require('fs');
const path = require('path');
const config = require('./config.json');
const registerCommands = require('./register-commands.js');

// Initialize the bot client with necessary intents
const client = new Client({
  intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.GuildVoiceStates
  ]
});

// Initialize client.commands as a Map
client.commands = new Map();

// Register commands once the bot is ready
client.once('ready', () => {
  console.log('Bot is online!');
  registerCommands(client); // Register the commands
});

// Command handling with timeout
const { promisify } = require('util');
const timeout = promisify(setTimeout);

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

  if (!message.content.startsWith(config.prefix)) return;

  const args = message.content.slice(config.prefix.length).trim().split(/ +/);
  const commandName = args.shift().toLowerCase();

  try {
    const command = client.commands.get(commandName);
    if (command) {
      await Promise.race([
        command.execute(message, args, client),
        timeout(5000).then(() => { message.reply('Команда не отвечает.'); }) // Timeout after 5 seconds
      ]);
    } else {
      message.reply('Команда не найдена.');
    }
  } catch (error) {
    console.error(`Error executing the ${commandName} command:`, error);
    message.reply('Произошла ошибка при выполнении команды.');
  }
});

// Log actions to the chat and log file
function logAction(user1, action, user2, channel) {
  const logMessage = `${new Date().toLocaleString()} - ${user1.tag} ${action} ${user2.tag} из канала ${channel.name}`;

  try {
    // Log the message in the file
    fs.appendFileSync(config.voiceLogFile, logMessage + '\n');

    // Log the message to the specified log channel in Discord
    client.channels.cache.get(config.logChannel).send(logMessage);

    // Optional: Log to console for debugging purposes
    console.log(logMessage);
  } catch (error) {
    console.error('Error logging action:', error);
    client.channels.cache.get(config.logChannel).send('Произошла ошибка при логировании действия.');
  }
}

// Voice state update (logging and actions)
client.on('voiceStateUpdate', (oldState, newState) => {
  try {
    if (oldState.channel && !newState.channel) {
      // User disconnected from a voice channel
      logAction(newState.member, 'вышел из', oldState.channel);
    } else if (!oldState.channel && newState.channel) {
      // User joined a voice channel
      logAction(newState.member, 'вошел в', newState.channel);
    }
  } catch (error) {
    console.error('Error during voice state update:', error);
  }
});

// Bot login using token
client.login(config.token);
red coral

You’re using the messageCreate event to try and respond to slash commands? You need an interactionCreate for slash commands

reef jewel

i see.. thanks ❤️

red coral

You also don’t seem to ever load any commands either

reef jewel

it's my first time and i use chatgpt for help.. so i'm pretty new.

i have js files with commands in different folder

that my structure for now

red coral

You should follow the guide imo, ai can for sure help but it’ll also get lost eventually

reef jewel

i see, i will try then the guide ❤️ appreciate the help

shut musk

How would you go about handling HTTPError: Service Unavailable
I see no viable option to be honest so im curious if anyone does

loud quartz

that's one kind of error you just can't do anything about

if cf/discord are unavailable, you can't tell them to stop being such

catch it, log it, drop it

crystal cargo

Error: Expected token to be set for this request, but none was present
"discord.js": "^14.21.0",

          await channel.send({ embeds: [embed] }).catch(e => {
              console.error(`err: ${e}`)
          });
loud quartz

that's what's written in package.json

what's actually installed?

npm ls discord.js to check

wintry laurel

is it possiable to change a response from ephemeral to not

snow onyx

no

wintry laurel

ok ty

south sigil

work sections without and TextDisplay?

unique shoal

Those are words that sort of form a question but if I think what you're trying to ask is "Can Sections work without a TextDisplay" the answer is no

slate fiber

could anyone tell me why this is returning undefined

const thread = message.channel.threads.cache.get(
                wordle[i].threadId
              );```
the variable it's reading is a valid thread id
stable sun

The thread isn’t cached

slate fiber

I'm trying to cache it, how do I do that correctly?
using the id

stable sun

Fetch it

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

rose tangle

all channels are always cached with the Guilds intent, except threads and dms

slate fiber

got it ty

😭

TypeError: Cannot read properties of undefined (reading 'add')```
```javascript
thread.members.add(message.interactionMetadata.user.id);```
rose tangle

that suggests thread is not actually a thread channel

if it's the result of .fetch(), did you await it?

like the example suggests, it's a Promise

slate fiber

that's a good idea

wait what exactly do I await

rose tangle

the fetch()

as a rule of thumb, every djs .fetch() returns a Promise

because it'll do an api call if it's not in cache

in contrast, cache gets are in-memory, it returns directly, no need for an await

slate fiber

okay that worked, but it didn't actually add me to the thread

rose tangle

show your code

slate fiber
for (let i = 0; i < wordle.length; i++) {
              console.log(i);
              console.log(wordle[i])
              console.log(wordle[i].threadId)
              if (wordle[i].number != shareContent.substring(7, 11)) continue;
              const thread = await message.channel.threads.fetch(
                wordle[i].threadId
              );
              console.log(thread);
              thread.members.add(message.interactionMetadata.user.id);
              console.log(
                `Added ${message.interactionMetadata.user.username} to thread`
              );
              break outer1;
            }```

the logs are for debugging

rose tangle

well, you aren't awaiting that .add

slate fiber

I'm pretty new to async sorry

rose tangle

no worries

in essence, all methods that do api calls return Promises, which need to be awaited or .then()'ed, otherwise it'll just proceed to the next line regardless of the actual result of the method call

slate fiber
await thread.members.add(message.interactionMetadata.user.id);``` still didn't add me
sharp ginkgoBOT
rose tangle
slate fiber

yes

rose tangle

that suggests it did work correctly then... are you sure you're checking the correct thread?

if it didn't then it would've thrown

or maybe you have a try catch that ignores errors instead of logging?

though then it shouldn't have logged that line, nvm, it sounds you're just checking the wrong thread

slate fiber

okay it worked correctly, the autoarchive duration had already passed though so it didn't ping me when it added me

thanks for the help ❤️

neat nimbus

How make so the option on the role select menus update
since i going from ping role menu to staff roles but the embed has the old selected options in it from old menu

deft flower

Anyone help me please how to make like this interface message with like / messages send

sharp ginkgoBOT

guide Popular Topics: Display Components
Opting into using this system by passing the IsComponentsV2 comes with a set of caveats:
read more

stable sun

@deft flower

languid summit

idk why but messsage by my bot doesn't renderes like other bot, the embed by bot comes but the invite embed doesn't render:
https://sourceb.in/mAm6VJH47h

leaden wing

how can i prevent cache reset? I need to fetch all of my members but they get reset every hour. I don't wanna fetch them at every 20 min.

stable sun
leaden wing
outer plume
leaden wing

i tried to change the default sweepers but it didn't work

sweepers: {
      ...Options.DefaultSweeperSettings,
      users: {
        interval: 3_600,
        filter: (user) => !user.id,
      },
    },
tardy sable

does anyone know if a member flag always stays? for example for the member flag didrejoin, i tried it on a very old member that rejoined years ago but they didnt have that flag

not sure if member flag didrejoin is maybe new so thats why?

crimson gale
outer plume
outer plume
languid summit
crimson gale

if you value "good looking" over "abusing parsers and looking like a scammer/spammer" you may want to re-evaluate your priorities

leaden wing
neat nimbus
outer plume
neat nimbus How make so the option on the role select menus update since i going from ping r...

if you want the role select menu to only show some roles, not all, I'm afraid that's not possible. If you want that behaviour, rather use a string menu, and add options to it. the labels could be the role names and the values could be the role IDs. You won't get a Role object from this, but roles are cached (if you have the correct intents) so you can just get them from cache using the selected role IDs

neat nimbus

i select the roles for ping but when next menu come which is staff roles i cant select the same roles

outer plume

Try this. when you call interaction.update, for the select menu components, use the setDefaultRoles() method and don't pass anything in it. If this doesn't work, we'll try to figure something else out

sharp ginkgoBOT
neat nimbus

this what i have

outer plume

yes, I read the code above

neat nimbus

.setDefaultRoles(true) ?

outer plume

no, just .setDefaultRoles()

neat nimbus

Nope didnt remove selected roles from old menu

outer plume

can u show code pls

neat nimbus
       case "add": {
            let uuid = bot.utils.MakeID(25);
            con.query(`INSERT INTO tickets (guildId, channelId, uuid) VALUES (?, ?, ?)`, [interaction.guild.id, interaction.channel.id, uuid], function (e) {
                interaction.update({
                    content: 'Select a channel:',
                    components: [
                        new bot.discord.ActionRowBuilder().addComponents(
                            new bot.discord.ChannelSelectMenuBuilder()
                                .setCustomId(`Tickets-AddChannel-${uuid}`)
                                .setPlaceholder('Select a channel')
                                .setMinValues(0)
                                .setMaxValues(1)
                        )
                    ],
                    ephemeral: true
                });
            });
            break;
        }```
So after Channel is selected it goes to the staff roles menu then to ping roles menu
outer plume

lemmi try too. someone else might help you out in the time I get back thumbsup

neat nimbus

ok if want i can dm you the snipet of the code

outer plume

hmmm. i dunno actually. i've seen a bot or two do it so it's definitely possible.

{
  type: 6,
  custom_id: 'select',
  placeholder: 'Select a role...',
  max_values: 3,
  default_values: []
}

even though default values is empty, it's using them.

neat nimbus

yeah thats why i am confused

outer plume

And yeah, clicking that X and clearing the selection doesn't make it work either
it only works when I go to a different channel and come back

neat nimbus

yeah i wait till djs people can see whats wrong

deft flower
signal patrol

What wrong in this?

    const username = interaction.options.getUser('username');
    const type = interaction.options.getString('type');
    const expiredDate = interaction.options.getString('expiration');
    const reason = interaction.options.getString('reason')

It was causing error of undefined.

    .addUserOption((option) =>
      option
        .setName('username')
        .setDescription('Staff User')
        .setRequired(true)
    )
    .addStringOption((option) =>
      option
        .setName('type')
        .setDescription('Type of Infraction')
        .setRequired(true)
        .setChoices(
            { name: 'Warning', value: 'warning' },
            { name: 'Strike', value: 'strike' },
            { name: 'Demotion', value: 'demote' },
            { name: 'Termination', value: 'terminate' }
        )
    )
    .addStringOption((option) =>
      option
        .setName('reason')
        .setDescription('Reason of Infraction')
        .setRequired(true)
    )
    .addStringOption((option) =>
      option
        .setName('expiration')
        .setDescription('Optional - Date of Expiration. Ex: 2m, 2d, 2w, 2y.')
    ),
wary coral
signal patrol
wary coral Could you paste the full error with stacktrace? Which value particularly is unde...
node:events:496
      throw er; // Unhandled 'error' event
      ^

TypeError: Cannot read properties of undefined (reading 'getString')
    at Object.run (D:\OrderNova1\src\commands\General\promotion.js:43:38)
    at Client.<anonymous> (D:\OrderNova1\node_modules\commandkit\dist\index.js:643:67)
    at Client.emit (node:events:518:28)
    at InteractionCreateAction.handle (D:\OrderNova1\node_modules\discord.js\src\client\actions\InteractionCreate.js:101:12)
    at module.exports [as INTERACTION_CREATE] (D:\OrderNova1\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (D:\OrderNova1\node_modules\discord.js\src\client\websocket\WebSocketManager.js:351:31)
    at WebSocketManager.<anonymous> (D:\OrderNova1\node_modules\discord.js\src\client\websocket\WebSocketManager.js:235:12)
    at WebSocketManager.emit (D:\OrderNova1\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:287:31)
    at WebSocketShard.<anonymous> (D:\OrderNova1\node_modules\@discordjs\ws\dist\index.js:1190:51)
    at WebSocketShard.emit (D:\OrderNova1\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:287:31)
Emitted 'error' event on Client instance at:
    at emitUnhandledRejectionOrErr (node:events:401:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:92:21)

Node.js v22.14.0
[nodemon] app crashed - waiting for file changes before starting...
wary coral

Use console log to see what the interaction object returns. As of now it looks like the option property does not exist

sharp ginkgoBOT

The order of function parameters must match between definition and function call.

function execute(client, interaction) { ... };
execute(interaction, client);
  • mismatch! you pass an interaction where the client is expected
  • mismatch! you pass the client where an interaction is expected
wary coral

check the fuction as it sound like a parameters mismatch

signal patrol
wary coral check the fuction as it sound like a parameters mismatch

tried

node:events:496
      throw er; // Unhandled 'error' event
      ^

TypeError: Cannot read properties of undefined (reading 'options')
    at Object.run (D:\OrderNova1\src\commands\General\promotion.js:42:29)
    at Client.<anonymous> (D:\OrderNova1\node_modules\commandkit\dist\index.js:643:67)
    at Client.emit (node:events:518:28)
    at InteractionCreateAction.handle (D:\OrderNova1\node_modules\discord.js\src\client\actions\InteractionCreate.js:101:12)
    at module.exports [as INTERACTION_CREATE] (D:\OrderNova1\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (D:\OrderNova1\node_modules\discord.js\src\client\websocket\WebSocketManager.js:351:31)
    at WebSocketManager.<anonymous> (D:\OrderNova1\node_modules\discord.js\src\client\websocket\WebSocketManager.js:235:12)
    at WebSocketManager.emit (D:\OrderNova1\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:287:31)
    at WebSocketShard.<anonymous> (D:\OrderNova1\node_modules\@discordjs\ws\dist\index.js:1190:51)
    at WebSocketShard.emit (D:\OrderNova1\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:287:31)
Emitted 'error' event on Client instance at:
    at emitUnhandledRejectionOrErr (node:events:401:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:92:21)

Node.js v22.14.0
[nodemon] app crashed - waiting for file changes before starting...

probably not it cause it unable to get interaction's properties.

wary coral

Your interaction is undefined meaning it is not passed at the call of the function

please share your command handler

signal patrol

thats problem, its a package.

wary coral

If your are using a package for your command handler this is not d.js problem

sharp ginkgoBOT
signal patrol
sharp ginkgoBOT
polar karma
cinder osprey

Hey
Is a bot able to read the « about me » section of a user?

outer plume

nop. Discord doesn't expose that information to bots.

frail gate

guys Channel#setParent is removed?

wary coral
tardy sable

how would i check when a member joins if they joined by an invite?

polar karma

You can't reliably know that

rose tangle

doesn't every member join through an invite? Thonk

dense jackal

discovery

tardy sable
rose tangle

ah, true

polar karma

I figured they meant an invite tracker

tardy sable

yh that

sharp ginkgoBOT

Discord does not provide the invite that a member used to join through the bot API.

  • Tracking the uses of invites through the inviteCreate and guildMemberAdd events is unreliable and we recommend against it.
  • Discord has not shared any plans to make the members tab available for bots.
tardy sable

is there a way to get how much boosts a member spent, or should i check in guildmember update event (newMember.guild.premiumSubscriptionCount - oldMember.guild.premiumSubscriptionCount)

polar karma

There's no update if they boost multiple times. Your best bet is to have the boost system message enabled and listen for that

tardy sable

mmh alright thanks. the guild.premiumSubscriptionCount isnt adjusted immediately on a boost?

polar karma

Should be, but it doesn't tell you who boosted

Discord does not encourage (and in some cases doesn't even allow) incentive behavior like you've been asking about

tardy sable

i have it inside a guildmemberupdate event

polar karma

A) there's no GMU emitted for second and more boosts
B) there's no guarantee which order you get events in

solemn arch

Is there any way I could ExportToJSON some data then bring it into a embed?

main mason

if I have an InteractionResponse object that I then pass to a child function via a parameter, will that child function still be able to run InteractionResponse.reply() on that parameter?

sullen wadi

What would cause shard death?

jade portal

How to handle GIFs and animated images ?? @napi-rs/canvas doest fully support managing gifs!

wary coral
solemn arch
orchid radish
solemn arch

Then I can access it with /buyer-view and delete it /buyer-delete.

orchid radish
rose tangle

ah, I think I misunderstood, you don't want the embed as json

solemn arch
rose tangle

well just build the embed from the data then

no? why would it be

Embed is the class for embeds received from the api

EmbedBuilder lets you build embeds so you can send them to the api

bitter nova
halcyon zephyr

can I set allowedMentions in deferReply or editReply? Or does it not matter because an edited message wouldn't ping either way?

bitter nova

i think you can, but the latter applies

rose tangle

or not in the foreseeable future

bitter nova

ye ik, but its an understandable connection to make

rose tangle

I think they specifically meant the Embed class though, given they were talking about using the builder with no issues

bitter nova

002_think possible

frosty epoch

is it possibel to defere reply and then show a modal? otherwise what could be a solution?

dense jackal

only solution is to show to modal within the 3 seconds after the interaction was created

spark jay

how can i only register user-install commands? i already have global application commands but only issue is user-installed commands idk how to register those

dense jackal
spark jay
dense jackal

you set its context and integration type

spark jay

but not user i have my bot authorized but i cant run the commands

btw for registering commands i use a for-loop to go by every guild ID to register since it wasnt working before

sharp ginkgoBOT
spark jay

i think i got it now

outer plume
toxic moat

can I use specific djs version/PR something to have access to gradient color roles

i found this in package.json of some old bot as djs version https://github.com/discordjs/discord.js/tarball/cbd7f2b9aa44a9240947ed716d0e72257ac499f7

so i was wondering if something like that is possible for gradient color roles

spark jay

i was doing it and it wasnt registering anything, but for a specific guild id it did so it was a lil bit of a workaround idk it still doesnt work btw :/

rose tangle

but you shouldn't register a command to every guild as a workaround

polar karma
spark jay
fair palm

Is there id value as number or bigint instead of string?

rose tangle
spark jay

either alt + f4 and restart from taskbar or ctrl + r

rose tangle

console.log the result of the rest call

slate fiber

could anyone tell me why the second if statement isn't running?

for (let i = 0; i < triggers.length; i++) {
      if (triggers[i][0].test(message.content)) message.reply(triggers[i][1]);
    }
if (triggers[3][0].test(message.content)) {```
```javascript
let triggers = [
      [/^ping/gi, "pong"],
      [/i+ *l+(o+v+e+|u+v+) *(y+o+)*u/gi, "i love you too"],
      [/\bi *l *y/gi, "ily2"],
      [/\bpa+ti+\b/gi, "mrow"],
  ],```

don't mind the regex hell

unique shoal

Because it doesnt match the message content?

slate fiber
unique shoal

Dunno what else to tell you, this doesnt seem djs related

slate fiber

wait you're right
super sorry

unique shoal

all good

verbal plinth

Is there any further information?

snow onyx
tidal ravine

any idea why this is giving me NaN? It was working previously

const totalMembers = client.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0);
loud quartz

look into what you're adding

tidal ravine

ah i see ok i think i was adding undefined lol

thanks

loud quartz

you think? or did you actually check

tidal ravine
loud quartz

i'd instead actually check why is memberCount not a number

since you're just hastily patching something that shouldn't happen in the first place

unique shoal

Unavailable guilds?

tidal ravine
radiant jewel

Can I do an ephemeral deferReply, with possible errors after, and finally reply non-ephemerally?

loud quartz

you cannot change ephemerality state after deffering

your editReply will ignore what you pass and follow what you set for the defer

radiant jewel

Ah, I thought followUp would allow changing it.

loud quartz

you can followUp freely though after you provide reply for the defer

it does

unique shoal

Not "changing" it

loud quartz

but if you followup without actually ever editing the defer, it gets treated as editing the defer

unique shoal

Its entirely separate, it wont change it if its responding to the defer

radiant jewel

Hmm, I posted a followUp after no errors occurred (so no editReply), but it is ephemeral.

loud quartz

did you set it as such?

unique shoal

Is it a new followUp, or was it after the defer

loud quartz

did you ever editReply the defer?

radiant jewel

No, the command is successful, so I don't do editReply, but the final followUp is still ephemeral

unique shoal

That does not answer the question

loud quartz

so your final followup has no business being a follwup

because you never told the user the interaction was successful

unique shoal

deferReply -> followUp will edit the deferral, and since ephemeral state cant be changed, will not be able to change it

loud quartz

you deferred the interacion, telling user tha tyou need more time to actually respond

and then never respond

radiant jewel
loud quartz

editReply first

then followup

radiant jewel

Okay, I think I was close to that, I just did deleteReply instead

Alright, that seems to work. Though, the followUp doesn't have the usual blue clicky thingy

loud quartz

because followup isn't a response to a command

it's a followup to the previous response

and it's indicated as such

radiant jewel

Fair. So no way to make it a nice, clean command when I need defer?

loud quartz

you using a command and me replying to your command doesn't make me use the command as well

no, there isn't

this is best you get

also, note that if you dismiss the ephemeral, the followup points to nothing

and it does so always for everyone else (since they never see the ephemeral)

radiant jewel

Yeah, I noticed. Well, that's unfortunate. But I'm sure it'll be improved in the future.

loud quartz

hm? there's nothing to improve here

it's been like that for years

if you don't want to use followups, just send a message to the channel

note that this means that your app will require its bot account to be in the server and have permissions to do so

radiant jewel

Yeah, it can totally send messages (it's my bot and is only in 1 server.)
It's just unfortunate that it's not possible to deferReply and have the blue command clicky thing, that's what I meant by "it could be improved"

loud quartz

you cannot suddenly appear a message out of nowhere

nor can you suddenly disappear it from existence

that's what you'd want with editing ephemeral state of a message

radiant jewel

I mean, that would be sweet, hm?

loud quartz

no, it would be quite bad

radiant jewel

I mean, I know what you mean (user thinks it's private)

User thinks his input is private (ephemeral) and then the bot decides to make it public, isn't that what you mean by bad?

I guess it depends on the command/content

loud quartz

that too, but also a myriad of other issues in both directions

anyway, this is getting offtopic

radiant jewel

👍 Thanks for your help, appreciate it!

versed current

Is there an integrated way of turning a djs User into an APIUser ?
Because toJSON() only returns an object without functions but still the djs named properties...

clear garnet

No

@discordjs/structures will allow that though

versed current

I guess I have to do that manually.

ocean portal

как заставить бота подавлять уведомления для своих собственных встраиваний?

pulsar heath

Hi, I have a text display component in a container, and I'm wondering how I can fetch the content from it, similarly to how we would use interaction.message.embeds for regular embeds

Please ignore if it sounds like a stupid question, I've only started using Components v2 in the past few weeks :)

rose tangle

interaction.message.components is the array of components you sent

which includes containers

though they aren't builders anymore, they're just data, so they don't have setX methods

pulsar heath

Okay, I was just trying to pull the data from them anyways

neat nimbus
steel trail
neat nimbus

shows the new placeholder yeah but has the old values still selected

steel trail

That sounds like a discord bug then, I'd report that on the discord-api-docs repository, see ddevs server in #useful-servers

languid summit

should i set sharding to be auto or manually set, what's better

daring coral

How many guilds is your bot in?

languid summit
dark adder

i have a bot keep saying
❌ Error registering slash commands: DiscordAPIError[50001]: Missing Access
at handleErrors (D:\Projects\last-town\node_modules@discordjs\rest\dist\index.js:748:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (D:\Projects\last-town\node_modules@discordjs\rest\dist\index.js:1149:23)
at async SequentialHandler.queueRequest (D:\Projects\last-town\node_modules@discordjs\rest\dist\index.js:980:14)
at async _REST.request (D:\Projects\last-town\node_modules@discordjs\rest\dist\index.js:1293:22)
at async Client.<anonymous> (D:\Projects\last-town\index.js:60:9) {
requestBody: { files: undefined, json: [ [Object], [Object] ] },
rawError: { message: 'Missing Access', code: 50001 },
code: 50001,
status: 403,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1401493380156096512/guilds/1197141507409444894/commands'
}

how to solve it?

snow onyx

sounds like your bot is not on that server or is missing the applications.commands scope somehow

are both IDs correct and does the token match that client?

dark adder
snow onyx

then that error wouldn't appear kek

dark adder
loud quartz

if all the files would be the exact same, then this wouldn't happen

either the files aren't the same, or you're running something else

versed current
steel trail What's the use case here?

I'm building a user-websocket for my bot and dashboard and want to respond with APIUser[]
However, I just realized that I maybe don't even need that much info.
The primary use case of my WS is getting something called MentionUser - a stripped down version of a User, with just the username, global_name, avatar, and id.
The other WS endpoint (for getting whole users) isn't used currently, since I have a REST API Route on the dashboard where I can pass anything to either search a member, or fetch it directly with the ID (with caching).

dense jackal
rapid elk

Good morning, I'm trying to use captcha canvas, but I get an error message that I can't install it. Anyone else having this problem?

sullen wadi

What would cause a shard to die for seemingly no reason? Common issues?

stable sun

Lost internet connection for too long

Too many guilds on that shard

You can add debug event logs to see if it’s ended by d.js

sharp ginkgoBOT

Please add the following code to your code base outside of any other event listeners and provide the full log output relevant to your issue.

client
    .on("debug", console.log)
    .on("warn", console.log)
  • Note: if you initialize your Client as bot or other identifiers you need to use these instead of client
  • If the output is too long to post consider using a bin instead: gist | sourceb.in | hastebin
frosty epoch

when using fetch (for channel and users) it automatically first check if it's cached before fetching for both?

stable sun

Also can’t forget unhandled promise rejection

sullen wadi

hmm. It always seems to happen during the same loop

[02:55 UTC] [S4] user (server) - Attempting to create BFV Weapons canvas.
[02:58 UTC] [SHARDING] Shard 2: death
[02:58 UTC] [SHARDING] Shard 4: reconnecting
[02:58 UTC] [S4] user (server) - Successfully posted Battlefield V Weapons image for user "user".
  • A function on shard 4 is being run. This should have sent "Successfully posted..." basically instantly after, but something fucks up.
  • Shard 2 dies and shard 4 reconnects three minutes after
  • Also three minutes after, the success message that should have happened right after the first log happens.

Looks like network issues to me, right?

I'll add the debug and warn to see if there's anything there

upbeat cedar

hi, how can I get a list of who is subscribed to an event, the condition is that there can be more than 1000 people at the event

    const guildEvent = await interaction.guild.scheduledEvents.fetch('1401518571984654446').catch(() => null);

if (guildEvent) {
  const subscribedUsers = await guildEvent.fetchSubscribers({ limit: 1000 }).catch(() => []);
  console.log(guildEvent)
  console.log(subscribedUsers);
  console.log(subscribedUsers.some(u => u.id === interaction.user.id));

}```

thanks to those who will help

obtuse laurel
obtuse laurel
low spear

how does rhythm put buttons in embeds?

red coral
dense jackal
low spear

then what

dense jackal
sharp ginkgoBOT

guide Popular Topics: Display Components
read more

red coral
low spear

oh thats insane cheers

cinder shale

im trying to usee a custom rest proxy like

import { REST } from '@discordjs/rest';
import { proxyRequests } from '@discordjs/proxy';
import express from 'express';
import { TOKEN } from 'core/config';
import { Log } from 'utils/log';

const app = express();
const port = 3000;

const rest = new REST().setToken(TOKEN);

app.use((req, res, next) => {
  Log(`Received: ${req.method} ${req.url}`);
  next();
});

app.use('/', proxyRequests(rest));

app.listen(port, () => {
  Log(`Rest listening on port ${port}`);
});```
and inside client rest
```ts
  rest: {
    api: 'http://localhost:3000/api',
  },```
but im getting the error
```Decompression error: ZlibError
[2025-08-03 12:00:34] Uncaught Exception: Error: ZlibError fetching "http://localhost:3000/api/v10/gateway/bot". For more information, pass `verbose: true` in the second argument to fetch()```
how should I fix/avoid it??
(sorry if its obvious, im kinda new to this api stuff)
bitter nova

have u tried passing verbose: true in the second argument to fetch()

solemn arch

Is there a way my bot could watch peoples display names and if they violate what word I don’t want in names can it then change that persons display name?

dense jackal
solemn arch
dense jackal
solemn arch Where?

I think you can access this through the api, but you have to find out yourself using the d.js and discord docs as I am not to sure
-# Image is from server settings > safety setup > AutoMod

main mason

Can you run .createMessageComponentCollector() on an InteractionResponse to a ButtonInteraction?

e.g.

const captchaMessage = await interaction.reply(captchaDisplayOpts);

where interaction is a ButtonInteraction

and then

const collector = captchaMessage.createMessageComponentCollector({ ... });

because every time I print captchaMessage.id it's always different from the ID i manually copy from the sent message

basically, I want to spawn an ephemeral message with action rows, when a user presses a button

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
stable sun

Then create the collector on that message

main mason
stable sun

It tells you how to extract the message

main mason

but it's returning an InteractionResponse, which doesn't have the resource attribute

should I just run interaction.fetchReply() to fetch the message?

stable sun

Use <InteractionCallbackResponse>.resource.message to get the message

Oh, it’s a type issue

main mason

yeah, it's only returning a message if i I run interaction.fetchReply() after I send the reply

stable sun

Use satisfies instead of typing it

rose tangle

you'd need to type it as InteractionReplyOptions & { withResponse: true }