#djs-help-v14

78874 messages · Page 42 of 79

dense jackal

they are talking about cv2 and not embeds

topaz locust

I think it's too much work for something “irrelevant” that only changes the aesthetics, but thanks for your help

west moss

Hello, does changing the bot's status every 15-30 seconds cause the bot to appear offline for a few seconds and then immediately appear online again? And does it keep repeating this?

bleak owl

why do you change the status so fast

west moss

to display things like the total number of guilds, the number of users and some short texts

bleak owl

there’s absolutely no reason you need to change the status that fast

change it once per hour or something

arctic spire

if i'm sending something that might have discord formatting in it, but i just want to show it raw, is there any method djs builds in that can allow me to escape what i need to, or do i need to write my own?

loud quartz

we have a bunch of functions for escaping markdown, yes

arctic spire

found it, { escapeMarkdown } = require('@discordjs/formatters');, ty

huh, can't find module, should have it from npm install discord.js, right?

loud quartz

discord.js exports it

just import it from it

arctic spire

so just { escapeMarkdown } = require('discord.js') instead?

nope message.channel.send(`Output:\n${escapeMarkdown(output)}`); ^ TypeError: escapeMarkdown is not a function

loud quartz
arctic spire

huh

lmme double check im using v14 ig

loud quartz

npm ls discord.js

arctic spire

ty

not sure how i've been on 13.6 thinking i was on 14...

loud quartz

yeah, that would do it

but

miiiiight be that 13 exports formatters as a whole (as in, not all separate functions)? don't remember

arctic spire

ima try the .util since i saw searching here that that was changed

works now, ty

white bridge
arctic spire

i thought of that, but if i did, i would need to figure out every place i needed to put the \

white bridge

Regex time lol

loud quartz

or just use what we already made for this

instead of reinventing the wheel

white bridge

Also completely valid

arctic spire

or, hear me out, i use the already made util for this purpose

wintry laurel

is there any way to get the name of a tag for a fourm channel/thread channel by the id? i want to get a threads appliedTags but i need the names not the ids

safe wigeon

Are modal components supported in d.js yet?

topaz bluff
loud quartz
wintry laurel
loud quartz

yeah

main scroll

hey can anyone help? i made some commands to show user profile badges with !userinfo but the only badges that show up are old ones like early supporter dev etc the new badges like nitro booster up, mission quest the bot cant detect pls help me out

loud quartz

nitro badges and some other badges are not available to bots as they are not contained within the public flags bitfield

nitro status can only be obtained via OAuth2, and other badges only via fetching user's profile which is not accessible to bots

teal obsidian

when you do roles.create() how do you specify the removal of permissions? like they cant send messages (for a muted role)
i have this now

        const muteRole = await message.guild.roles.create({
            name: "Muted",
            permissions: [
            ],
            color: Discord.Colors.Red,
            reason: "Muted role setup by bot."
        });
loud quartz

role has no concept of taking away permissions

role can either give permissions or not

if you need to deny a permission, you do it via permission overwrite on channels

in your case, you would need to go over every channel in the server and deny the send for that role in each of them

teal obsidian
lusty elk
proud arrow

Correct. There is a pr for their support tho, if you want to follow that

brittle dawn

can we give select menus a default selected value?

sharp ginkgoBOT
dense jackal

example for user select, but yes you can have default values for any type of select menus

brittle dawn

alr ty

i dont think it exists for string select menu

loud quartz

It naturally exists for string selects

mental silo

djs 13 nuked extending structures right?

I mean nothing really prevents me from simply modifying the prototype and adding properties

loud quartz

In a way that they would be internally used by the lib, yes

mental silo

Sorry elaborate, what do you mean

I'd just rather add my guild settings into my guild instead of using collections
My current approach is just adding properties to the Guild prototype

loud quartz

Which is a bad idea and primary reason structures were removed

rigid ridgeBOT
polar karma

The suggested approach is to use a function with the structure as one of the values you pass in, then return the data you want

wary coral
sharp ginkgoBOT
loud quartz

Yeah

Or any other way. What I do is i have my own class that doesn't extend Client but only has it as a property, and there i can keep whatever i want since it's my own class. I just pass that class to places from handlers

tardy sable

wondering how long itll take to support new modals or is djs waiting for the entire new modals update before releasing?

crimson gale

we don't give estimate release times, it will be released when it's ready

tardy sable
polar karma

d.js will always wait for discord to release and document the features, then it will eventually be added to the library. there is still no given timeline on any release beyond "after discord documents it"

red coral
const collector = msg.createMessageComponentCollector({
    filter: (int) => int.user.id === message.author.id,
    idle: 60 * 1000,
})

how do you have multple component types? Like cast the types to be that?

loud quartz

check the type in collect

radiant skiff

Hello!
When using the new components, my messages are always mentioning me, how can I disable this ?
Thanks!

red coral
loud quartz

well, can you?

red coral

i have no idea hence im asking.

sharp ginkgoBOT
loud quartz

so skip it and just check in collect

red coral

Ah I checked back and saw i did ask before,and i can do <ComponentType.Button | ComponentType.StringSelect>

modest surge

why slash commands not working in dms but in other server works

little pebble
modest surge

nah i dont have contexts

quick storm

is Bun not supported in discord.js with sharding enabled?
null is not an object (evaluating 'this.shard.ids')
works fine with Node

rose tangle

that's something bun will have to fix in their side then

djs doesn't specifically support other environments, but since it works on node it should work for them, otherwise it's their issue

ivory wasp

Every now again, my shard goes into the reconnecting state. Is this normal?

Fwiw nothing seems out of place... Everything works as normal. Just curious if that's normal behavior

loud quartz

discord periodically asks connections to reconnect

ivory wasp

Ah ok, good to know, thanks

acoustic fable

Error:
TypeError: interaction.user.displayAvatarUrl is not a function

Code:
.setFooter({ text: `Requested By: ${interaction.user.username}`, iconURL: interaction.user.displayAvatarUrl() })

sharp ginkgoBOT
bleak owl

displayAvatarURL

dense jackal

casing matters in programming

acoustic fable
bleak owl

correct

rose tangle

you typed Url, it's URL

it's still a function you need to call

spring monolith

is there a way to use showModal with raw JSON the same way you can send raw components? i'm trying to send a modal without using any builders (i think they're confusing and just like the raw text more)
e.g.

const modal = JSON.stringify({
    type: ComponentType.Section,
    data: {
        custom_id: "updateModal",
        title: "Modal",
        components: [
            {
                // valid labels/options snipped for length

            },
        ],
    },
});
// rest of code...
await interaction.showModal(modal); // "No overload matches this call."
dense jackal

via client.rest right?

idk how that works tho, but I heard thats a way to send raw api stuff using d.js

rose tangle

why are you stringifying it?

acoustic fable

it worked without error but not actually showing it

rose tangle

show your code

spring monolith
dense jackal
urban sequoia

Is there a way to make the text in an embed title not bold?

rose tangle
bleak owl
rose tangle

but currently djs will still error anyways when receiving the modal

so it's not really useful to send it

dense jackal

well just for visual purposes

spring monolith

roger on the api call, are the errors just something with discordjs right now or is that cuz of no builders?

rose tangle

which errors?

rose tangle

it's how djs currently works, it's "hardcoded" for text inputs

spring monolith

alr, thanks

safe wigeon

Will modal components be released in another v14 version or v15 when that’s ready?

rose tangle

v14, and it'll be in v15 as well of course

safe wigeon
sleek brook

anyone else's bot no longer connecting to discord? i.e. my ready event is no longer firing?

edgy coralBOT

Unable to fetch this user.

onyx hemlock

+cr 1326108023529148477

rose tangle
sharp ginkgoBOT
rose tangle

@teal obsidian please use #app-commands or the hide option for personal docs usage

teal obsidian

my bad pal

i just wanna make sure, im doing this correctly right?

                    category = await message.guild.channels.create({
                        name: "Jail System",
                        type: Discord.ChannelType.GuildCategory,
                    });

                    category.permissionOverwrites.set([
                        { id: message.guild.roles.everyone.id, deny: [Discord.PermissionFlagsBits.ViewChannel] },
                        { id: jailRole.id, allow: [Discord.PermissionFlagsBits.ViewChannel] },
                    ]);
rose tangle

you can pass the overwrites directly when creating the channel

teal obsidian

issue is that its not hiding the channel for everyone, and i cant figure out why

acoustic fable

Can someone help?

rose tangle

well you're not awaiting that .set(), maybe there's an error you're omitting

rose tangle
teal obsidian
hallow mesa
rose tangle
sharp ginkgoBOT
rose tangle

sounds like you have 26 commands

acoustic fable
rose tangle

if you really want to keep the same embed design, paginate

teal obsidian
acoustic fable
sleek brook
sharp ginkgoBOT

tag suggestion for @sleek brook:
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
teal obsidian
sleek brook
teal obsidian
sleek brook
export default class Client extends DiscordClient {
   // ...
  constructor(token: string, options: Options) {
    super(options);
    this.login(token);

    this.development = options.development;

    this.registerEvents();

    this.on("debug", console.log);
    this.on("error", console.error);
    this.on("warn", console.warn);

    this.on("ready", async () => {
        // ...
    });
  }
sleek brook

curl -v https://gateway.discord.gg returns a proper TLS handshake

halcyon bison

if absolutely nothing is being logged, I have to wonder if your custom class is somehow interfering
even without properly connecting to discord, you should at least get a log along the lines of

Provided token: **************************************
Preparing to connect to the gateway...
acoustic fable
teal obsidian
rose tangle
teal obsidian
sleek brook

I've been doing it with classes like this for years, never had issues like this

halcyon bison

that's great
even so, I'm just telling you that regardless of anything, the debug event should emit with some base logs

therefore something is interfering with djs base functionality

teal obsidian
sleek brook

It runs fine on my machine in it's docker container, but on my VPS nothing happens. I added some extra logs in there and they fire, but no event ever fires

halcyon bison

then it doesn't sound like a code issue nor something we can really help with
contact your host

rose tangle

also this is more of a design issue but constructors should only initialize internal state of the object, they shouldn't have side effects, including logging to the gateway

sleek brook

What will they be able to do? I mean the container perfectly connects to discord, curling returns a correct TLS handshake and I ran a quick script:

const WebSocket = require("ws");

const ws = new WebSocket("wss://gateway.discord.gg/?v=10&encoding=json");

ws.on("open", () => {
  console.log("WebSocket connected to Discord");
});

ws.on("message", (data) => {
  console.log("Message:", data.toString());
  process.exit(0);
});

ws.on("error", (err) => {
  console.error("WebSocket error:", err);
});

ws.on("close", (code, reason) => {
  console.log("WebSocket closed:", code, reason.toString());
});

This clearly connects to the gateway, so it's discord.js that's hanging for some reason

halcyon bison

What will they be able to do?
What will we be able to do?

sleek brook
rose tangle

if it works on your machine but not on your vps it's something on your vps, not on your code (which includes djs), since it's the same code and there isn't anything trying to detect whether it's on your vps or in your machine and doing different stuff

sleek brook
rose tangle

¯_(ツ)_/¯

I'd try logging and see where it stops

sleek brook
rose tangle

logging mock values to indicate where they are

if it doesn't work only on your vps there isn't much we can suggest

it's not like djs has special logic for when it detects it's in a vps or something

sleek brook

Ofcourse not, I'm just confused as to why it basically hangs silently, the process stays alive but no events are fired

rose tangle

you could add logs inside the copy of your library for debugging

or override methods to add logs given you already have a custom class

sleek brook

fair enough, I'll do some digging. Thanks anyways

Right so it hangs on Preparing to connect to the gateway...

sleek brook

Ok, so very stupid but turns out discord rate limited the VPS somehow, guess I'll have to look into why that happened

red coral

Yes that’s normally a cf ban. Anywhere from like hours to an entire 24 hours. Is it a shared ip? If not then you might have spammed the api too much

sleek brook

Looks like my provider uses unique IPs so I guess that’s indeed the culprit…

red coral

I believe cf bans you from making a lot of bad requests in a short amount of time. I believe… Jusr don’t do that or don’t have a host with a shared ip

sleek brook

Bad requests in what sense?

As in requests returning non successes?

teal obsidian

dw its working now lmfao you can ignore me

slim aurora
unique shoal

Barely readable as that is, looks like based on the error you forgot to set the IsComponentsV2 message flag

loud quartz
sharp ginkgoBOT
loud quartz
eternal drift

Since discord.js doesn't support the new modal features yet, is there a way d.js will let me sent raw JSON?

little pebble
sharp ginkgoBOT
eternal drift

ty

unique shoal

This doesnt mean you can correctly receive the interaction though

eternal drift

ah yea, I forgot about that part...

mossy path

Hey, does anyone know if it’s possible to create rounded embeds in Discord? And if so, how would I do it?

bleak owl

what’s a round embed?

are you referring to a container?

little pebble
mossy path
eternal drift

That's a lot of work lol

sharp ginkgoBOT

guide suggestion for @mossy path:
guide Popular Topics: Display Components - Container
read more

mossy path

Thank You

limpid pecan
slim aurora
limpid pecan

you leaked the IP address XD

slim aurora
limpid pecan

weSmart

desert bear

He's got too much aura to type full sentences

bleak owl
oak fossil

how do I get a list of all slash command options in a chatinputcommandinteraction as json? (so similar to the original discord response)?

oak fossil
chrome widget

Hi im new but want to know that is JavaScript same as node.js etc i have no knowledge just asking as i have watched few vids. of js beggining

dense frost

this is more of a discord api than discordjs question, but what exactly is the rate limit? is it 50/s per token or 50/s per token per channel ??
i keep finding info that contradicts each other

snow onyx

its dynamic

there is no fixed ratelimit in most cases

dense frost

i keep reading that there's is a 50/s limit, and that no auth header => applied to ip

ivory sable

Is there a way to have a table in a message? Or at least columns, I feel like I've seen it possible to have two columns in components, but I can't find it in the documentation now

red coral
red coral
ivory sable
sand heart

Hi, I’m working with Discord.js and I created a modal with user select and role select menus. But when I submit the modal, my InteractionCreate event doesn’t trigger at all. Instead, I get this error:

    at ModalSubmitFields.js:23:23
topaz bluff

Correct. You can't currently use select menus with DiscordJS because the interaction data would be malformed and won't trigger

sand heart

oh alright ty

fallen light

idk why my application is not running.

I started it two months ago and it went idle and i saw yesterday it was offline but the server was running and when i restarted the bot comes up but no response at all, there are no errors

wary coral
fallen light

any idea?

okay i found the issue

wary coral
fallen light any idea?

If you host it locally on your PC does it work? If it does then we can't help here as it is outside the scope of Discordjs nv what was your issue

fallen light

applications commands aren't reloaded

topaz bluff

You should be manually deploying commands when changes are made and have good logging to ensure they're deploying correctly

fallen light

no i have a handler for that but its stuck for some reason

see it reloads fine on my pc and i didnt make any changes since 2 months

topaz bluff

Correct. One of the reasons doing it manually has advantages. You limit the logic...you can add more logging for better debugging, and you add fewer things your client has to do to start up

Also, just helps against rate limiting

fallen light

i guess its a host issue i'll contact them

eternal drift

I have a button interaction that replies with an ephemeral message which has another button inside of it.
Once I click that button, it is possible to get that message and modify it from the new interaction data? Or do I have to hold a reference to that message from the original interaction instance

I'm trying to edit/delete it from the new interaction instance, but I keep getting errors like the message doesn't exist

halcyon bison

<ButtonInteraction>.message is the message the button is on
since it's ephemeral it can only be edited through the interaction webhook, so you'd need to use <Interaction>.update() if you haven't already responded to the interaction or <Interaction>.editReply() if you have

elfin shell

can i reply interaction using @discordjs/rest? for new modals experiment?

halcyon bison

sure, but the main issue is receiving the modal submit
djs isn't currently equipped to handle modal submits containing anything other than text inputs, so it'll error when receiving the interaction

sharp ginkgoBOT
toxic moat

is inline false by default

rose tangle

it's not present by default, and that behaves like inline: false

that's how discord designed it, and technically it can change

@amber bison please use #app-commands or the hide option for personal docs usage

toxic moat
rose tangle

no, technically it can, since we're not discord, we don't know what they'll do

but I doubt they'd change that

I'm trying to say that it being default to false and it being not present are different things

toxic moat

how can i do members.fetch('id") but first it looks in cache, if not found then fetches it

is that default maybe

rose tangle

yeah that's what all fetches do

unless you explicitly pass { force: true }

toxic moat
rose tangle

correct

toxic moat

what if i do force:true, cache: false

rose tangle

then it won't check in cache and won't save it either

toxic moat

thanks

are there rate limits for members.fetch("id") forcefully, also same way for channel role and guild fetching

rose tangle

there's ratelimits for every endpoint

rose tangle

there's no completely accurate list of ratelimits, they're mostly considered dynamic

but if you have the Guilds intent you won't need to fetch channels, roles or guilds

sharp ginkgoBOT

Ratelimits are dynamically assigned by the API based on current load and may change at any point.

  • The scale from okay to API-spam is sliding and depends heavily on the action you are taking
  • Rainbow roles, clock and counter channels, and DM'ing advertisements to all members are all examples of things that are not okay
toxic moat

but is it safe to always forcefully fetch every single time

rose tangle

why would you need that if they're cached anyways though

toxic moat
rose tangle

well if it's not in cache it'll fetch

toxic moat

but maybe it can be in cache but not latest data

rose tangle

that depends on your intents and what object

rose tangle
toxic moat

hmmm even role.members ?

roles.fetch forcefully wont update role.members, right

rose tangle

no, that's a special case

you'll need to fetch all members for the role members cache to be updated

toxic moat

but my biggest problem are members

rose tangle

any particular reason you need all members of a role? maybe there's another approach

toxic moat

on start i fetch everyone and i have all intents like guilds and guildmembers
and sometimes they arent in cache...

toxic moat

and server has 500k members

rose tangle

my question was about what you're doing though, not with how many people

rose tangle
toxic moat
toxic moat
rose tangle

how do you know it's like that?

toxic moat

thats all literally, so simple bot just to test is cache always working and its not

maybe because of too many members i have no idea

rose tangle

can you show your code where you do the get and the error, client constructor, and where you fetch the members?

toxic moat
const client = new SapphireClient({
  intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMembers,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.MessageContent
  ],
  partials: [Partials.User, Partials.GuildMember, Partials.Channel, Partials.Message],
  cronTasks: {
    defaultTimezone: container.config.guild.timezone
  }
});
private async fetchMainGuildMembers() {
  const mainGuild = this.container.client.guilds.cache.get(this.container.config.guild.id);

  if (!mainGuild) {
    this.container.logger.error('Main guild not found');

    process.exit(1);
  }

  await mainGuild.members.fetch();

  this.container.logger.info(
    `Fetched ${mainGuild.members.cache.size} members from the main guild`
  );
}

in clientReady.ts

ofc i actually execute that function dw

and as i said i have button interaction handler, on click ALL i do is members.cache.get("id") and reply with is user on server or not

rose tangle

would still be helpful to see it

toxic moat
rose tangle would still be helpful to see it
import { ApplyOptions } from '@sapphire/decorators';
import { InteractionHandler, InteractionHandlerTypes } from '@sapphire/framework';
import type { ButtonInteraction } from 'discord.js';

@ApplyOptions<InteractionHandler.Options>({
  interactionHandlerType: InteractionHandlerTypes.Button
})
export class BotInteractionHandler extends InteractionHandler {
  override parse(interaction: ButtonInteraction) {
    if (!interaction.inCachedGuild()) {
      return this.none();
    }

    if (interaction.customId.startsWith(`${this.name}-`)) {
      return this.some();
    }

    return this.none();
  }

  override run(interaction: ButtonInteraction<'cached'>) {
    const member = interaction.guild.members.cache.get(interaction.customId.split('-')[1]);

    return interaction.reply(member ? `Hello, ${member.toString()}!` : 'Member not found.');
  }
}

nothing really to see i aint doing anything wrong im sure my code is right it just doesnt work sometimes

robust flame

guys what is it

robust flame

i didnt change code

stable sun

A command file doesn’t default export a class

robust flame

how to fix it :/

rose tangle
rose tangle

that's not a djs error or issue

toxic moat
rose tangle

it's a js one

toxic moat

i think that it works fine with small amount of members like 5k but with 500k its a problem

robust flame
rose tangle
toxic moat

...

rose tangle
rose tangle

that issue is entirely unrelated to djs

it's with your own code to read command files

toxic moat

yeah but you dont understand, sapphire doesnt modify anything and I do not modify anything, i have default simple bot made just for testing is cache working fine, code i sent you looks perfectly fine and it is, 95% of members are fetched okay the rest is not

robust flame
rose tangle

your error suggests otherwise

robust flame

bruh

i changed TestCmd to BanCmd and it works ._.

rose tangle

¯_(ツ)_/¯

maybe it wasn't saved before

robust flame
rose tangle

then your code wouldn't have errored

anyways, the issue is solved

robust flame

ye

but the mongodb always needs to change my ip adress cuz my wifi router changing ip every day

rose tangle
eternal drift

Are InteractionResponses cached? I can't find where it might be

stable sun

What do you need it for?

eternal drift
stable sun What do you need it for?

I have a button inside an ephemeral interaction reply. I want to edit/delete that interaction message from the new interaction, but I have to reference the original instance of the interaction reply to do that
So I was wondering if d.js held it in cache and I wouldn't have to cache it myself

stable sun

ButtonInteraction provides what you need

interaction.update, interaction.deleteReply after a update call

rose tangle

interactions are very short lived (relative to the bot's lifetime), caching them would be a waste of resources for most use cases

eternal drift
stable sun interaction.update, interaction.deleteReply after a update call

No, I don't think I'm explaining it right:

  1. User presses button in a server message which creates a ButtonInteraction
  2. I reply to that ButtonInteraction with an ephemeral message - this reply message also has button inside of it
  3. User presses button inside of the ephemeral interaction reply
  • Replying to it will just create a new interaction reply message
  • I don't want this; I want to edit/delete the first initial reply message which holds the button

But I can't get a reference to the first interaction reply to update it without holding a reference to it

rose tangle

interaction.update also acknowledges the interaction

like a .reply

eternal drift

Never mind, that's not what I'm saying lol. I know what .reply is/does, but it's not calling the function on the correct interaction instance

rose tangle

you want to edit the server message in step 1? "User presses button in a server message"

eternal drift

Yes, but from a second interaction. Which means I have to cache the first interaction so I can call .edit on the first (cached) reply message

rose tangle

so the server message comes from the interaction? and why not use the message?

eternal drift

wat

I can't edit the message like that. ButtionInteraction holds a reference to the message, yes, but since it's ephemeral (or an interaction reply/both?), calling edit doesn't work and the API rejects the request

rose tangle

you just said "so I can call .edit on the first (cached) reply message" though

eternal drift

Well yea, because it's the cached InteractionReply, not Message

rose tangle

I see, I thought you meant a Message since you said you'd call it on the message

eternal drift

Yea, it's all good, I'm just bad at explaining lol, sorry

rose tangle

so from what I understand:

  1. Somehow, message A is created, which holds a button A ("User presses button in a server message").
  2. Button A, when pressed, creates an ephemeral message B, which holds button B ("I reply to that ButtonInteraction with an ephemeral message")
  3. Button B, when pressed, wants to edit/delete message A (" Iwant to edit/delete the first initial reply message which holds the button")
    correct?
eternal drift

No, message A spawns both message (InteractionReply) B and button B. Button B will edit message (InteractionReply) B

rose tangle

if B wants to edit itself, just call .update then?

.update will edit the message the button is on

eternal drift

...
Ok, let me try...

eternal drift
rose tangle

is it a components v2 message?

eternal drift

Yea. I can't even overwrite it as the legacy type?

rose tangle

no, you can't downgrade

once it's marked as such you need to use components entirely

if you just want text, use a text display component

eternal drift

Interesting, ok, good to know. I thought you just couldn't mix them

eternal drift
rose tangle

what do you mean by "update with a new message"

eternal drift

Just change the message. Change how it looks. New text, new components etc

rose tangle

I don't understand, can you show the code instead?

the one that errors

ValidationError suggests there's something wrong with the builders and their values you set, not with what you're actually doing

can you show the full error?

also you're meant to use interaction.editReply instead of the deferredReply.edit

though I think they do the same thing anyways

given that does work

yeah looks like it's just an alias

rose tangle

sounds like you have a section without an accessory

eternal drift

Yea, I remove the button. I can't edit/update the message like that?

rose tangle

you can't have a section without an accessory

it's a required field

you'll need to use a text display instead

eternal drift

I swear... I'm so dumb...
The second message was a copy/paste of the first, but when I removed the button, I forgot reduce it to just a label, so it was building a section without an accessory this whole time.......................................................

I appreciate you sticking around and helping, ty. I need a new brain

rose tangle

no worries, it's pretty much always the little things

last mango

hello

last mango

does d.js got this update or no?

rose tangle

no, it's still being worked on

last mango
snow onyx

no

last mango

okay..

safe wigeon

If I want someone's banner in full size, what size should I use? <user>.bannerURL({ size: ? })

copper dawn

Hi do you have a trial code for Embed ?

sharp ginkgoBOT

guide suggestion for @copper dawn:
guide Popular Topics: Embeds
read more

bleak owl

discord.js is a 3rd party library that interacts with the discord api

copper dawn
copper dawn
bleak owl

you're still using the discord api regardless of library or not

and your components are missing a type, as shown in the error

copper dawn
bleak owl

discord.js is a 3rd party library that interacts with the discord api. your error is a discord api error, but you are using discord.js to interact with the api

copper dawn
bleak owl

no

its a very simple error to fix

copper dawn
wary coral
copper dawn
copper dawn

Ok 😮‍💨

ivory plinth

This may also be because you did not specify the isComponentV2 flag, no?

bleak owl

that would depend if they are using components v2

ivory plinth

Btw, the current version of Discord.js isn't supporting selectors in modal or its already working with ?

bleak owl

it will be soon

loud quartz

No

dense jackal

-# not soon?! Gasp

oak fossil

Is there are a reason that every other time my bot that registers guild commands the commands disappear?

unique shoal

Probaby just need to reload your Discord app

Make sure youre only registering when you need to

pure ridge

can someone tell me how I can create a message .. or embed where an image banner is on top then comes the tex/description and then a dropdown/select menu and all of this inside a container?

this looks so clean but I don't know if I should share this here

sharp ginkgoBOT

guide suggestion for @pure ridge:
guide Popular Topics: Display Components
read more

pure ridge

oh wow .. that's awesome thank you

oak fossil

is there a way I could automatically detect changes and register if so? (I would need a way to fetch existing registered commands info)

safe wigeon

Does command replies' allowedMentions overwrite the client's allowedMentions?
E.g. if I set the client's to parse: ["users", "roles"] but the reply's to parse: ["users"], what happens?
-# I want this specific reply to only ping users, NOT roles.

red coral

If you put it in the reply it’ll take that, then the default in the client options

hushed scroll

hello

how can i set custom status for my app

sharp ginkgoBOT

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


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

topaz bluff
hushed scroll

i actually meant something like this

topaz bluff

That is an undocumented feature and is not supported by discord.js

hushed scroll

how does it work then

hushed scroll

still not

it only shows basic activity presence

little pebble
hushed scroll
little pebble Can you show your code
    client.user.setPresence({
      activities: [{
        name: `${servers} servers | ${users} users`,
        type: ActivityType.Streaming,
        url: 'https://twitch.tv/discord'
      }],
      status: 'online',
    });```

voila

little pebble
rose tangle

you're not following the example at all Thonk

hushed scroll

when i use custom :

const { Client, GatewayIntentBits, ActivityType } = require('discord.js');
new Client({
    intents: [GatewayIntentBits.Guilds],
    presence: {
        activities: [{
            type: ActivityType.Custom,
            name: "custom", // name is exposed through the API but not shown in the client for ActivityType.Custom
            state: ":lemon:"
        }]
    }
});```

it doesnt even show

crySparkle

rose tangle

and that's the client you're always using?

you're not creating a new one?

because if you create a new one and not doing anything with the one you have, that won't do anything

little pebble

How are you logging in with that client if you're not assigning it to a variable

hushed scroll

CAUGHT

oak fossil

Is there a guide for adding attachments to a non components v2 message?

sharp ginkgoBOT
topaz bluff

You mean just an AttachmentBuilder? You can create that and send it in the files: [] of a message

sharp ginkgoBOT

guide Popular Topics: Embeds - Attaching images
read more

oak fossil

thanks! I couldn't find the page and the attachmentbuilder constructor signature was confusing

hushed scroll
    client.user.setPresence({
    activities: [{
      type: ActivityType.Custom,
      state: `${servers} servers | ${users} users`
    }],
    status: 'online',
  });```

error 

TypeError [InvalidType]: Supplied activities[0].name is not a string.```

bleak owl

what happened to your previous code

hushed scroll

wasnt mine i copied it

hushed scroll
bleak owl

you need to provide both state and name iirc

hushed scroll

does this work ?

    client.user.setPresence({
      activities: [{
        type: ActivityType.Custom,
        name: `${servers} servers | ${users} users`
      }],
      activities: [{
        name: `${servers} servers | ${users} users`,
        type: ActivityType.Streaming,
        url: 'https://twitch.tv/discord'
      }],
      status: 'online',
    });```
bleak owl

did you try it?

also activities is an array

no need to pass it twice

hushed scroll

hmm

rose tangle

if you set a property twice you're overriding the last one

rose tangle
hushed scroll
rose tangle

well it's an array, technically you can pass as many as you want

but afaik discord only reads the first one

why do you want to set both anyways?

you've been shown already how to achieve what you wanted

hushed scroll

i want something liek that

    client.user.setPresence({
      activities: [{
        type: ActivityType.Custom,
        name: `${servers} servers | ${users} users`
      }],
      activities: [{
        name: `Use .help & .invite`,
        type: ActivityType.Streaming,
        url: 'https://twitch.tv/discord'
      }],
      status: 'online',
    });```
this is wrong but u get the idea
rose tangle

I don't quite get it

hushed scroll

like the custom status and the activity presence at the same time

rose tangle

how would that even look? (in discord)

hushed scroll
rose tangle

have you seen that somewhere?

I'm not too knowledgeable on statuses but I don't think that's possible

hushed scroll

nop any bot has either custom status or activity presence

but iv seen a bot switching between these two automatically

rose tangle

well you can make it switch, that's indeed possible

just send one, wait, and send the other

but I'm pretty sure both at the same time isn't possible

hushed scroll

probably but the "why" is always here

rose tangle

¯_(ツ)_/¯

you'll have to ask discord that

hushed scroll

@discord why

also how did u put an emojis inside a ``

rose tangle

just put the unicode emoji after the backticks

😭

works the same for codeblocks

hushed scroll

![kek](https://cdn.discordapp.com/emojis/1117578868140806164.webp?size=128 "kek")

:flag_ps:

rose tangle

custom emojis aren't unicode

anyways this is getting offtopic

hushed scroll

flag_ps isnt a custom

rose tangle
hushed scroll

sure

elfin shell

code to reply to new modals in discord.js interactions while the module is not updated. I saw that a lot of people were looking for it.

import { ButtonInteraction } from "@app/typings";
export const requiresDatabase = true;
import { token_beta } from "@app/config.json";
import { REST } from "@discordjs/rest";
const restBot = new REST({ version: "10" }).setToken(token_beta);
export const id = 'sheet_notes_delete'
export async function execute(interaction: ButtonInteraction) {
    restBot.post(`/interactions/${interaction.id}/${interaction.token}/callback`, {
        body: {
  "type": 9,
  "data": {
    "custom_id": "bug_modal",
    "title": "Title of modal",
    "components": [
      {
          "type": 10,
          "content": "Text Display Content",
      }
    ]
  }
}

    });
}
rose tangle

the issue isn't sending though, it's receiving

elfin shell

😔

versed current

Lads, is there a workaround for sending components V2 in Modals?

or will djs validate it before and therefore not allow sending anything with the new components?

proud arrow

So no workaround

golden zenith

For GuildMessageManager.fetch() https://discord.js.org/docs/packages/discord.js/14.22.1/GuildMessageManager:Class#fetch

Does it default to a max of 100 or something? Is there a limit? I am trying to fetch all messages in a "ticket" channel, but it seems to only fetch some of the latest messages (still a lot ), even if all the messages were sent within like the last 20 minutes or something. I just tried it and it only fetched 48 messages, while there were more

proud arrow

Max is 100 yes

golden zenith

Weird

proud arrow

Not at all

golden zenith

I just tried it, it only got 48, but there were maybe like 60 or smth

proud arrow

It defaults to 50 if limit is not set

toxic lake

Hi, i'm trying to use a ChannelSelectMenuBuilder but it doesn't display all the channels, whereas using StringSelectMenuBuilder everything is fine, is this a limitation?

proud arrow
golden zenith

Any docs for that?

proud arrow
toxic lake
shadow harness

Typescript error with command loading... SlashCommandBuilder#toJSON is throwing an error when I try to insert it into a list of RESTPostAPIChatInputApplicationCommandsJSONBody. Should this go in GH bug reports?

proud arrow
golden zenith
toxic lake
golden zenith
shadow harness
proud arrow Show the code and full error
import type { Collection, RESTPostAPIChatInputApplicationCommandsJSONBody } from "discord.js";
import type { Command } from "@/types";
import { base } from "@/globals";

export default async function <
    T extends Collection<any, Command> | RESTPostAPIChatInputApplicationCommandsJSONBody[]
>(list: T, filter?: string[]) {
    for (const path of new Bun.Glob("*.ts").scanSync(`${base}/commands`)) {
        const cmd = await import(`${base}/commands/${path}`);
        const command = (cmd?.default ?? {}) as Command;

        if ("data" in command && "execute" in command && !filter?.includes(command.data.name)) {
            if ("push" in list) {
                list.push(command.data.toJSON());
            } else {
                list.set(command.data.name, command);
            }
        } else {
            console.warn(`The command at ${path} is missing either "data" or "execute" properties!`);
        }
    }

    return list as T;
}
```I can pass either an empty array, or a Collection depending on what I need to do. Either loading for the app (Collection), or loading to push to Discord (array)
versed current
proud arrow

Seems to be types mismatch, make sure you are importing the type from discord.js, and not separately from discord-api-types

proud arrow
shadow harness
proud arrow
versed current
proud arrow
shadow harness
shadow harness

Actually reading the error this time, looks like it's just a type mismatch between @discordjs/builders.RESTPost... and discord-api-types.RESTPost.... Doesn't affect functionality whatsoever, works fine, just big spoopy red line 👻

proud arrow
shadow harness

Ok weird, types are different between d.js packages. Lemme check one sec

Yeah, /builders have different version than d.js

May have been missed by us

proud arrow
toxic lake
shadow harness
proud arrow
toxic lake
shadow harness
golden zenith
proud arrow

remember to delete lockfile too

shadow harness

I know what's wrong! Ain't got no gas in it! (my head)

proud arrow
toxic lake
proud arrow

No i mean searching the channels inside the select menu

toxic lake

sorry ! Nop, they are not displayed

proud arrow

They probably are not text channel then. They may look like it but it could be something like announcement channel

toxic lake
proud arrow
toxic lake
proud arrow

See my other point. It maybe due to that too.

toxic lake
proud arrow

Then I have no idea, sorry.

Also, can you show your code. And how you are looking for that channel in the menu?

Maybe that can clear something perhaps

toxic lake
proud arrow

At this point this is not d.js issue. You can try in ddevs

ivory plinth

I don't think discord even filters it

Based on their documentation they do not

"Options are automatically populated based on available channels in the server and can be filtered by channel types"

dim estuary

Am I doing something wrong? Im using Events.ClientReady to listen to ready events and the value of the enum is updated to clientReady

versed current
proud arrow You can already send it. Recieving will error though

Update. Can't send it with raw data. This error comes:

DiscordAPIError[50035]: Invalid Form Body
data.components[0].component[UNION_TYPE_CHOICES]: Value of field "type" must be one of (3, 4, 5, 6, 7, 8, 19).

-# What ever 19 is lol

Because it's a text input (which has type 10)

stable sun

Blame Discord

versed current

For not updating their docs? I will do that.

stable sun

Not updating their code

Unless they changed it to 19?

versed current

idk haha

stable sun

Try type 19 and see what error it gives you

versed current

but this error above originates from djs, not discord
give me a second

stable sun

d.js just formats the error

DiscordAPIError is otherwise an error directly from Discord API

versed current

okay 👍

bruh

DiscordAPIError[50035]: Invalid Form Body
data.components[0].component[STAFF_REQUIRED]: The Maze isn't meant for you.

I guess I'll go over to DDevs 😂

my bad, I tried to use a text display inside a label, but in modals its only allowed as a top-level component,

Now it works

mellow jolt

good job :)

versed current

_Now I'm waiting patiently for djs to get support for the interaction responses for that 👀 If I had the knowledge I would help, but that's too much for me 😅 _

elfin dragon

Hi, i'm sorry if this was answered again and again but I read through a few messages and I'm still wondering which is best.
I'm trying to log the ban/unban event (and later on, other events) and rn what I do is listen to the Events.GuildBan(Add|Remove) event then fetch the log for the executor. Would it be best to just listen to the AuditLog event create?

I don't know which is best and recommended and I struggle finding any information. What are the pros, what are the cons, etc. of one another?

tardy sable

but problem with audit logs are they dont always create new entries but stack upon each other if the executor is the same user

elfin dragon

Does every AuditLogCreate triggered gets the same informations as the event equivalent?

tardy sable

so they arent 100% accurate

tardy sable
elfin dragon
elfin dragon
tardy sable
tardy sable
elfin dragon

Thank you very much for the answers!

frozen sonnet

how can i add this line inside an embed?

elfin dragon
frozen sonnet how can i add this line inside an embed?

If you want the text only in an embed you can do this:

const embed = new EmbedBuilder().setTitle("your text");

await channel.send({ embeds: [embed] });

Otherwise you can check the EmbedBuilder data ig to custom the embed further

sharp ginkgoBOT
frozen sonnet
unique shoal

You pass an array of one of the types listed there

What exactly is it you want to do? That determines how you should use it

kind plume
frozen sonnet
wooden carbon
tardy sable

can you pass content in deferReply?
interaction.deferReply({ content: 'test' })

proud arrow

No, only flags, and only ephemeral flag at that

tardy sable

ty

steel trail
tardy sable
steel trail

So you wanted to edit without editing... that's not possible indeed

tardy sable
steel trail

Do you know what the word "defer" means?

dense jackal
tardy sable

yh ik just nvm then

fervent ocean

is there a way to center a button inside a section?

novel junco

Is there information on when the label component text input change is being released?

steel trail

We don't do ETAs

novel junco

Okay

sharp ginkgoBOT

guide Popular Topics: Display Components
read more

topaz bluff

Same way you would with anything else. Components V2 is just message data

rose tangle

well your text display has no content

how does it have no content? you just didn't set anything

topaz bluff

If you're using some other library...we can't gaurentee it will work. I don't know how discobase formats message data...or if it works with djs

rose tangle

also you misspelled separator in your imports but there's no issue with that since you're not using them

wide light
client.on('messageCreate', async (message) => {
  if (message.content === 'ping') {

    const section1 = new SectionBuilder()
      .addComponents(
        new TextDisplayBuilder().setContent(`__** — hello....**__`)
      )
      .setThumbnailAccessory(
        new ThumbnailBuilder({
          media: {
            url: 'https://media.discordapp.net/attachments/1260967890426003497/1270708616101494856/main_logo.gif'
          }
        })
      );


    const section2 = new SectionBuilder()
      .addComponents(new TextDisplayBuilder().setContent('اختر القناة:'))
      .setAccessory(
        new ChannelSelectMenuBuilder()
          .setCustomId('channel-select')
          .setPlaceholder('اختر القناة...')
      );


    const section3 = new SectionBuilder()
      .setAccessory(
        new RoleSelectMenuBuilder()
          .setCustomId('role-select')
          .setPlaceholder('role...')
      );


    const container = new ContainerBuilder().addComponents([
      section1,
      section2,
      section3,
    ]);

    await message.channel.send({
      flags: MessageFlags.IsComponentsV2,
      components: [container],
    });
  }
});```

this error :

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

TypeError: (intermediate value).addComponents is not a function
    at Client.<anonymous> (C:\Users\\Downloads\qwqw\indexv2.js:34:8)
    at Client.emit (node:events:508:28)
    at MessageCreateAction.handle (C:\Users\\Downloads\qwqw\node_modules\discord.js\src\client\actions\MessageCreate.js:32:14)
    at module.exports [as MESSAGE_CREATE] (C:\Users\\Downloads\qwqw\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\\Downloads\qwqw\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
    at WebSocketManager.<anonymous> (C:\Users\\Downloads\qwqw\node_modules\discord.js\src\client\websocket\WebSocketManager.js:236:12)
    at WebSocketManager.emit (C:\Users\\Downloads\qwqw\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:287:31)
    at WebSocketShard.<anonymous> (C:\Users\\Downloads\qwqw\node_modules\@discordjs\ws\dist\index.js:1190:51)
    at WebSocketShard.emit (C:\Users\\Downloads\qwqw\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:287:31)
    at WebSocketShard.onMessage (C:\Users\
\Downloads\qwqw\node_modules\@discordjs\ws\dist\index.js:1007:14) 
Emitted 'error' event on Client instance at:
    at emitUnhandledRejectionOrErr (node:events:391:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:92:21)

Node.js v24.7.0```'
halcyon bison

it's true, that doesn't exist
consider using <ContainerBuilder>.addSectionComponents() instead

sharp ginkgoBOT
topaz bluff

<SectionBuilder>.addComponents() does not exist

sharp ginkgoBOT
topaz bluff

You also can't have a Section without a TextDisplay component, so section3 is invalid

wide light
topaz bluff

no, im not going to do it for you...but i can link the guide

sharp ginkgoBOT

guide Popular Topics: Display Components
read more

storm snow

Is there any way to fetch user's serverTag like for example mine is r/BD ? From any events or data?

sharp ginkgoBOT
eternal harness

Hey there, I just joined the server. Is the modals update already out?

red coral

No

ivory valve

Hello, <MessageType>.interaction.commandName is deprecated, but when I replace by MessageInteractionMetadata I don't find commandName, it's not available anymore?

ivory valve

oh okay thanks

pearl roost

Why is the Voice Connections still zero? My code : ```js
async function getDetailedBotStats(client) {
const stats = {
guilds: client.guilds.cache.size,
users: client.users.cache.size,
channels: client.channels.cache.size,
commands: client.commands ? client.commands.size : 0,
emojis: client.emojis.cache.size,
wsPing: client.ws?.ping ?? null,
readyAt: client.readyAt,
cachedUsers: client.users.cache.filter((user) => !user.bot).size,
cachedBots: client.users.cache.filter((user) => user.bot).size,
};

try {
    stats.voiceConnections = client.voice?.connections?.size || 0;
} catch {
    stats.voiceConnections = 0;
}

return stats;

}

red coral

I don’t see where voice.connections exists

I have no idea how you’d get the connections size tbh amgelo was typing maybe they know

rose tangle

yeah it's an internal object

but they just want the size so

pearl roost
red coral

I mean that’s why chatgpt isn’t the best as it’s not trained on the latest stuff

red coral

Probs just .adapters.size

rose tangle

yeah, adapters is a map

red coral

Why was it renamed then from connections to adapters, isn’t connections a bit more intuitive

rose tangle

well they're adapters so it's more accurate

pearl roost

alright alright

I try to console adapters and it show Map(0) {}, why it says like that?

pearl roost
rose tangle
pearl roost

Oh I think it's because Riffy. I made the bot join the voice with Riffy not @discordjs/voice

Yeah it now count perfectly

drifting crown

im unable to register/update slash commands in my testing guild, it usually works fine but today it just won't load sometimes, no code changes (i've tried to run the code that was working fine last week too), is anyone else encountering this issue?

rose tangle

what happens when you run the deploy script

velvet thicket

i tried to skim everything, am i reading at modal components are still not fully implemented, and while you can manually trigger sending a modal with the new stuff, we cant receive the data properly yet?

oak fossil

Is this "file drop" a real component that actually exists?

stable sun

Ask ddevs tbh

rose tangle

it isn't

oak fossil

wow what a scam

why would they design that image with a mouse dragging the file 💀

rose tangle

maybe a future component? Thonk but yeah it's very missleading now that you mention it lol

topaz bluff

My thoughts is it was just a stylized "download" but ya is indeed misleading to a drag/droppable component

oak fossil

Whats the difference between "ID" and "CustomID" on comp v2 buttons? I remember working with the original components you just used customID to identify which button it was and there was no ID field

rose tangle

it doesn't make much sense for interactive components but it does for non interactive ones

those don't have a customId

and the purpose of the id is basically the same as the customId

oak fossil

so it's just if you'll never use the customID for interaction?

(i.e. I don't need to worry about it?)

rose tangle

treat it as a customId that every component can hold

since only interactive components have customIds

but with cv2 not every component is interactive

oak fossil

alright thank you

rose tangle

if you want you can ignore it, discord auto generates it for you

oak fossil

also, speaking of buttons, what type of SKU's are valid here? (this might just be a question of what type of purchases are currently valid on discord)

sharp ginkgoBOT

discord Overview: Monetizing Your Discord App - Types of SKUs
read more

polar karma

d.js does not have support for anything besides text inputs in modals yet

topaz bluff

And to add to this, unlike other "unsupported features" for DJS...this one you can't just bypass by sending the request yourself

Because DJS will be unable to receive the interactionCreate event for the modal data so you won't actually be able to use the modal

upbeat cedar

ok i got you thanks for your help

hearttred

halcyon zephyr

Is there any way to make an emoji appear full sized in a container with other text components there too? I tried putting the emoji in it's own text display component but it still shrinks to the size it would if it had text around it

loud quartz

No

The only case where emoji gets bigger is when it's alone (or with other emotes, up to a limit) in a message as a whole

halcyon zephyr

Understood, I guess best workaround is just to put a # behind it

thank you! Prayge

subtle swan

does anyone have a working command handler

topaz bluff

@subtle swan the deployment script from the guide 100% works...what is the console output you're getting after running it?

And are you deplying to a guild or globally?

topaz bluff

Ok...so that's not an issue of the script then

Can you paste your code?

sharp ginkgoBOT

To share long code snippets, use a service like gist, sourcebin, pastebin, or similar instead of posting them as large code blocks or files.

topaz bluff

Where's the imports?

subtle swan

at the top
const { REST, AuditLogEvent, Routes, Client, GatewayIntentBits, Collection, ActionRowBuilder, ButtonBuilder, Partials, ButtonStyle, EmbedBuilder, Events, ChannelType } = require('discord.js');
const { config } = require('dotenv');
const fs = require('fs');
const path = require('path');
const { messages, cooldown, prefix, ownerID, eventPrize, minLength } = require('./config.json');
config();
const settings = require('./config.json');
const GUILD_ID = '1268262061364740207'; // your guild id
const CLIENT_ID = '1280854361081249802'

const bot = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildBans
],
partials: [Partials.Channel],
partials: [Partials.GuildMember]
});

topaz bluff

Oh well ya. That script is designed to be run standalone, not part of your index.js

subtle swan

oh

topaz bluff

Deploying your commands on startup is bad practice, especially during development

subtle swan

oh

topaz bluff

That script is designed to be run manually whenever you make changes to your commands, because you rarely need to do so and it avoids the 24 hour rate limit if you hit it

subtle swan
topaz bluff

Slash commands only need to be registered once, and updated when the definition (description, options etc) is changed. As there is a daily limit on command creations, it's not necessary nor desirable to connect a whole client to the gateway or do this on every ready event. As such, a standalone script using the lighter REST manager is preferred.

This script is intended to be run separately, only when you need to make changes to your slash command definitions - you're free to modify parts such as the execute function as much as you like without redeployment.

topaz bluff
wide light
client.on('messageCreate', async message => {
    if (message.content.toLowerCase() !== '!components') return;
    const components = [
        new ContainerBuilder()
            .setAccentColor(0xFF0000)
            .addSectionComponents(
                new SectionBuilder()
                    .setThumbnailAccessory(
                        new ThumbnailBuilder()
                            .setURL("")
                    )
                    .addTextDisplayComponents(
                        new TextDisplayBuilder().setContent("Example components:"),
                    ),
            )
            .addActionRowComponents(
                new ActionRowBuilder()
                    .addComponents(
                        new StringSelectMenuBuilder()
                            .setCustomId("")
                            .setMaxValues(2)
                            .addOptions(
                                new StringSelectMenuOptionBuilder()
                                    .setLabel("Test selection")
                                    .setValue("")
                                    .setDescription("test")
                                    .setDefault(true)
                                    .setEmoji({
                                        name: "😜",
                                    }),
                                new StringSelectMenuOptionBuilder()
                                    .setLabel("qqwqw")
                                    .setValue(""),
                            ),
                    ),
            ),
        new ActionRowBuilder()
            .addComponents(
                new ButtonBuilder()
                    .setStyle(ButtonStyle.Secondary)
                    .setLabel("Button")
                    .setCustomId(""),
            ),
];
    await message.channel.send({ components });
});```
node:events:486
      throw er; 
      
DiscordAPIError[50035]: Invalid Form Body
components[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (1,).
    at handleErrors (C:\Users\\Downloads\bott\node_modules\@discordjs\rest\dist\index.js:762:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async SequentialHandler.runRequest (C:\Users\\Downloads\bott\node_modules\@discordjs\rest\dist\index.js:1163:23)
    at async SequentialHandler.queueRequest (C:\Users\\Downloads\bott\node_modules\@discordjs\rest\dist\index.js:994:14)        
    at async _REST.request (C:\Users\\Downloads\bott\node_modules\@discordjs\rest\dist\index.js:1307:22)
    at async TextChannel.send (C:\Users\\Downloads\bott\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:195:15)
    at async Client.<anonymous> (C:\Users\\Downloads\bott\bot.js:63:5)
Emitted 'error' event on Client instance at:
    at emitUnhandledRejectionOrErr (node:events:391:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:92:21) {
  requestBody: {
    files: [],
    json: {
      content: undefined,
      tts: false,
      nonce: undefined,
      enforce_nonce: false,
      embeds: undefined,
      components: [
        {
          type: 17,
          accent_color: 16711680,
          components: [ [Object], [Object] ]
        },
        { type: 1, components: [ [Object] ] }
      ],
      username: undefined,
      avatar_url: undefined,
      allowed_mentions: undefined,
      flags: undefined,
      message_reference: undefined,
      attachments: undefined,
      sticker_ids: undefined,
      thread_name: undefined,
      applied_tags: undefined,
      poll: undefined
    }
  },
  rawError: {
    message: 'Invalid Form Body',
    code: 50035,
    errors: {
      components: { '0': { _errors: [ [Object] ] } }
    }
  },```
tardy sable
wide light
tardy sable you have empty url in your thumbnailbuilder and empty values in your button and ...
    const components = [
        new ContainerBuilder()
            .setAccentColor(0xFF0000) // Optional: Set an accent color
            .addSectionComponents(
                new SectionBuilder()
                    .setThumbnailAccessory(
                        new ThumbnailBuilder()
                            .setURL("https://media.discordapp.net/attachments/1260967890426003497/1270708616101494856/main_logo.gif?ex=68c6aa1e&is=68c5589e&hm=72c85c5bddf0cd339873659dd77a7b37b1e4b1d08cce16931303787a0fe336d8&=&width=288&height=288")
                    )
                    .addTextDisplayComponents(
                        new TextDisplayBuilder().setContent("Example components:"),
                    ),
            )
            .addActionRowComponents(
                new ActionRowBuilder()
                    .addComponents(
                        new StringSelectMenuBuilder()
                            .setCustomId("99fca274f90a4070beb7086fdf335bfc")
                            .setMaxValues(2)
                            .addOptions(
                                new StringSelectMenuOptionBuilder()
                                    .setLabel("Test selection")
                                    .setValue("1")
                                    .setDescription("test")
                                    .setDefault(true)
                                    .setEmoji({
                                        name: "😜",
                                    }),
                                new StringSelectMenuOptionBuilder()
                                    .setLabel("qqwqw")
                                    .setValue("1"),
                            ),
                    ),
            ),
        new ActionRowBuilder()
            .addComponents(
                new ButtonBuilder()
                    .setStyle(ButtonStyle.Secondary)
                    .setLabel("Button")
                    .setCustomId("11"),
            ),
];```
this

this is the main one

proud arrow
wide light
sharp ginkgoBOT

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

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

Same thing, except the flag should be IsComponentV2

wide light
bleak owl

no

change .Ephemeral to IsComponentsV2

wide light
chrome widget

what does this mean and what can be done

rose tangle

and more importantly, what does it have to do with djs mmLol

that's an issue with your npm installation

and it also links an article you can check

chrome widget
rose tangle

but npm isn't made by djs

this channel is for djs help

chrome widget

alr

wet crypt

what are the intents I need to define so I can use slash commands in a group chat/dm? can use them fine in guilds and in the bots dms, but not outside of that

rose tangle

intents mandate what events and data from those events you receive

not how your bot can be used

you're most likely missing the appropriate contexts and integration types for those commands

sharp ginkgoBOT
wet crypt

thank you!!

marble mist

help

bleak owl
marble mist

okie!

weak flame

Hello. How to run a bot?

Where can I read an instruction?

sharp ginkgoBOT
proud arrow
weak flame

Yes, thank you very much. In Russia, Discord hasn't worked for over a year, now it's working, I've returned to my page, to my bots, but I've forgotten in a year how I created them, programmed them and entered them online. That's why I asked for a link to the guide to repeat and practice.

drifting crown
rose tangle

sounds like you've been ratelimited because of deploying too many times

are you running the script on every start? that's a common cause

drifting crown
rose tangle

well, deploying only when you change them

manually

that's why it's supposed to be on a separate script

so you run it manually

drifting crown

oh ok, i thought it wouldn't be much of a problem if i only loaded them in a guild, thanks

rose tangle

it's pretty much the amount of requests you do, not to where you're deploying

drifting crown

got it, still odd i never got this issue before tho

jolly ocean

im getting this error and idk how to solve it anyone know what does this mean

❌ Errore nel deploy: DiscordAPIError[10002]: Unknown Application
    at handleErrors (C:\Users\detto\Desktop\Foxnet Discord Bot\node_modules\@discordjs\rest\dist\index.js:762:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async SequentialHandler.runRequest (C:\Users\detto\Desktop\Foxnet Discord Bot\node_modules\@discordjs\rest\dist\index.js:1163:23)
    at async SequentialHandler.queueRequest (C:\Users\detto\Desktop\Foxnet Discord Bot\node_modules\@discordjs\rest\dist\index.js:994:14)
    at async _REST.request (C:\Users\detto\Desktop\Foxnet Discord Bot\node_modules\@discordjs\rest\dist\index.js:1307:22) {
  requestBody: { files: undefined, json: [ [Object] ] },
  rawError: { message: 'Unknown Application', code: 10002 },
  code: 10002,
  status: 404,
  method: 'PUT',
  url: 'https://discord.com/api/v10/applications/1416020164822175700/guilds/1412456143460237600/commands'
}
✅ Evento caricato: clientReady

🔄 Deploy di 0 comandi...
❌ Errore nel deploy dei comandi: DiscordAPIError[10002]: Unknown Application
    at handleErrors (C:\Users\detto\Desktop\Foxnet Discord Bot\node_modules\@discordjs\rest\dist\index.js:762:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async SequentialHandler.runRequest (C:\Users\detto\Desktop\Foxnet Discord Bot\node_modules\@discordjs\rest\dist\index.js:1163:23)
    at async SequentialHandler.queueRequest (C:\Users\detto\Desktop\Foxnet Discord Bot\node_modules\@discordjs\rest\dist\index.js:994:14)
    at async _REST.request (C:\Users\detto\Desktop\Foxnet Discord Bot\node_modules\@discordjs\rest\dist\index.js:1307:22) {
  requestBody: { files: undefined, json: [] },
  rawError: { message: 'Unknown Application', code: 10002 },
  code: 10002,
  status: 404,
  method: 'PUT',
  url: 'https://discord.com/api/v10/applications/1416020164822175700/guilds/1412456143460237600/commands'
}

golden laurel

Ids are strings

rose tangle
rose tangle
jolly ocean
rose tangle

I mean your log says you're also loading a clientReady event

a deploy script doesn't do that

and Jira already told you the issue

jolly ocean

im using yaml for store tokens and the rest of things

rose tangle

right, make sure it's a yaml string and not a number

like Jira said

and don't deploy on start to avoid future issues, like the one the guy above your question has

jolly ocean
import * as fs from "fs-extra";
import * as yaml from "js-yaml";
import * as path from "path";

export class Config {
    public data: { Token: string ,
         GuildId: string ,
            ClientId: string
        
        };

    private configDir = path.join(__dirname, "..", "Config");
    private configFile = path.join(this.configDir, "config.yaml");

    constructor() {
        if (!fs.existsSync(this.configDir)) {
            fs.mkdirSync(this.configDir);
        }

        if (!fs.existsSync(this.configFile)) {
            this.data = { 
                Token: "Token Here",
                GuildId: "Guild ID Here" ,
                ClientId: "Client ID Here",

            };
            const yamlStr = yaml.dump(this.data);
            fs.writeFileSync(this.configFile, yamlStr, "utf8");
        } else {
            const fileContent = fs.readFileSync(this.configFile, "utf8");
            this.data = yaml.load(fileContent) as { Token: string , GuildId: string , ClientId: string};
        }
    }
}
``` this is my config loader idk if the problem is how the yaml is made or its the config loader passing wrong types
rose tangle

well how does the file look like

specifically the application and guild ids

jolly ocean

GuildId: 1412456143460237486
ClientId: 1279825611526770688

i taked the token away

rose tangle

then you're saving them as numbers

not strings

wrap in "" or ''

jolly ocean

i feel rlly dumb , ty i resolved

jolly ocean

now it doesnt give errors anymore but the commands still arent on the server

wet hull

this.guilds.fetch / guild.roles.fetch

I had cache.get and fetch, but they both throw errors, what can I use that will work on every request with no limit?

const guild = this.guilds.fetch("XXXX");

const role = guild.roles.fetch("XXXX")

const guild = this.guilds.cache.get("XXXX");

const role = guild.roles.cache.get("XXXX")

all of these throw:
TypeError: Cannot read properties of undefined (reading 'fetch')

rose tangle
  • fetch returns a promise, you're not awaiting them
  • you need the Guilds intent for guilds and roles to be cached

you'd also need to provide context as to what "this.guilds" is

wet hull
const guild = await this.guilds.fetch("418801915162263574").catch(() => null);
if (!guild) return console.log("❌");

const role = await guild.roles.fetch("1416513979592999032").catch(() => null);
if (!role) return console.log("❌");

I have guilds intent

this.guilds is like client.guilds -its just when I created the client..

member.roles.add("1416513979592999032")

like this for example, will it work the same?

if I just add it, and its a valid ID ofc

rose tangle

yes, that works as well

rose tangle
sharp ginkgoBOT
wet hull

yes, thse usually worked so thats why I asked maybe new limit or som'

but as long as this role is constant and doesn't change, then I dont see a problem using straightup the ID

rose tangle

the only limit is for the message cache

unless you provide your own limits, ofc

rose tangle
molten bronze

hello

im new to javascript

dense jackal
molten bronze
dense jackal
molten bronze

ok thx

unique shoal

Worker threads are slightly more efficient as they have lower memory usage and dont need to rely on IPC for shard communication

If youre just starting sharding its unlikely you need to rely on process isolation

what stuff

only for when you actually need to communicate with other shards for some reason

no not usually

Unless its from the cache of a different guild on a different shard

unique shoal

sure

are yoiu at a guild count where you need to shard at all>

so youre already sharding?

Well no, using internal sharding is generally less scalable

It "works" but that doesnt make it the best option

Simple doesnt make it good

This will be less scalable if you intend to keep growing Im pretty sure

Im not a sharding expert though so Im not entirely certain

no, i dont know

weak flame

Here are my slash-commands: const fs = require('node:fs');
const path = require('node:path');
const { Client, Collection, Events, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json');

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

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

for (const folder of commandFolders) {
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));

for (const file of commandFiles) {
    const filePath = path.join(commandsPath, file);
    const command = require(filePath);
    if ('data' in command && 'execute' in command) {
        client.commands.set(command.data.name, command);
    } else {
        console.warn(`WARNING: The command at ${filePath} is missing a required "data" or "execute" property.`);
    }
}

}

// Обработка команд
client.on(Events.InteractionCreate, async (interaction) => {
if (!interaction.isCommand()) return;

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

if (!command) return;

try {
    await command.execute(interaction);
} catch (error) {
    console.error(error);
    await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}

});

// Логин бота
client.login(token);

  • please, look at them, do you think they are correct or not? How can I run them?

I use Java script for these commands, but I don't know they are correct or not and how to make them running.

Please, help me run slash commands in my bot.

rose tangle

are you just asking if it's correct?

or do you have an error?

grand scroll

throw new Error(`No compatible encryption modes. Available include: ${options.join(", ")}`); ^ Error: No compatible encryption modes. Available include: aead_aes256_gcm_rtpsize, aead_xchacha20_poly1305_rtpsize, xsalsa20_poly1305_lite_rtpsize
What is Error I'm Suddenly Getting Out Of An Completely Stable Running Bot

rose tangle

probably because of DAVE, but I don't know how that works, ask in #998942774994927646 so it doesn't get lost

loud quartz

Update your /voice

idle saddle
loud quartz

-S?

idle saddle
loud quartz

prism-media?

Where did you pull that from

idle saddle
loud quartz

From ai?

Please don't

idle saddle
grand scroll

Thanks It Fixed

halcyon vault

Hi! The Checkbox and boolean component will work in Modal? IN this latest version?

loud quartz

No

halcyon vault
rose tangle

that's not a thing in discord

that's an edited image

rose tangle

"Wanted Features for Modals"

loud quartz

Yes, discussion about wanted features

rose tangle

not "Current Features for Modals"

halcyon vault

So, will they implement this in future? Any idea?

loud quartz

No

rose tangle

ask discord

maybe they will, maybe they won't

the only thing they added recently was select menus and text displays for modals

halcyon vault
rose tangle

not really

doesn't mean it's high priority or anything though

halcyon vault

Ok, does the StringSelect work in discord js now? I mean did discord js updated to the modal?

rose tangle

not yet, that's still a WIP

halcyon vault
honest lavaBOT
rose tangle

you can follow that pr in the meantime

jaunty stream

yo

can i redirect to a page from a discord bot as a backend to a frontend website
because im just getting 404 not found from thjis code:

FRONTEND:

document.getElementById("connectBtn").addEventListener("click", () => {
  const clientId = "1239372532511932458"; // your Discord app client ID
  const redirectUri = encodeURIComponent("https://crsl.page.gd/api/auth/discord/redirect");
  const scope = encodeURIComponent("identify email");
  const responseType = "code";

  const oauthUrl = `https://discord.com/oauth2/authorize?client_id=${clientId}&redirect_uri=${redirectUri}&response_type=${responseType}&scope=${scope}`;

  window.location.href = oauthUrl;
});
bleak owl

discord.js does not support oauth2, sorry

jaunty stream

bruh what

rose tangle

I'm not sure what support you're expecting here since you're not using djs at all

jaunty stream
// ----------------- OAUTH CALLBACK -----------------
app.get("/api/auth/discord/redirect", async (req, res) => {
  const { code } = req.query;
  if (!code) return res.status(400).send("Missing code");

  try {
    const formData = new url.URLSearchParams({
      client_id: process.env.ClientID,
      client_secret: process.env.ClientSecret,
      grant_type: "authorization_code",
      code: code.toString(),
      redirect_uri: "https://crsl.page.gd/api/auth/discord/redirect",
    });

    const output = await axios.post(
      "https://discord.com/api/v10/oauth2/token",
      formData.toString(),
      { headers: { "Content-Type": "application/x-www-form-urlencoded" } }
    );

    const access = output.data.access_token;

    const userinfo = await axios.get("https://discord.com/api/v10/users/@me", {
      headers: { Authorization: `Bearer ${access}` },
    });

    const discordId = userinfo.data.id;
    const username = userinfo.data.global_name || userinfo.data.username;

    const existingUser = await ConnectedUser.findOne({ discordId });
    if (existingUser) {
      return res.redirect("https://crsl.page.gd/?error=already_connected");
    }

    const newUser = new ConnectedUser({ discordId, username });
    await newUser.save();
    console.log(`✅ Saved new user: ${username}`);

    try {
      const user = await bot.users.fetch(discordId);
      await user.send(":white_check_mark: Thanks for connecting your account!");
    } catch (err) {
      console.error("DM failed:", err.message);
    }

    // :red_circle: Here is where you redirect to your main page
    console.log("BACON EGG AND CHEES");
    res.redirect("https://crsl.page.gd/success.html");
  } catch (err) {
    console.error(err.response?.data || err);
    res.status(500).send("OAuth failed");
  }
});
rose tangle

well djs doesn't support the oauth workflow

bleak owl

my response is the same regardless

jaunty stream
bleak owl

djs doesn’t support oauth

jaunty stream
bleak owl

we cannot help you

jaunty stream
bleak owl

discord, not discord.js

this server is for discord.js

jaunty stream

does it really matter?

bleak owl

yes, it does

we are not discord

jaunty stream

why, I can't seem to get help anywhere else

bleak owl

because we can’t help with something we don’t support

loud quartz

Did you try ddevs server?

rose tangle

the only place where you're using djs is on

      const user = await bot.users.fetch(discordId);
      await user.send(":white_check_mark: Thanks for connecting your account!");

so unless that's where you need help and all the other code was sent for no reason, you're in the wrong place

jaunty stream
loud quartz
unique rivet

How do I put an actionRow inside an embed?

rose tangle

you can't

you can only put them inside containers, which aren't embeds but they look like them

sharp ginkgoBOT

guide suggestion for @unique rivet:
guide Popular Topics: Display Components
read more

rose tangle

yes, that's a container

if you're using a ContainerBuilder you can use the addActionRowComponents method to add an action row

sharp ginkgoBOT
unique rivet
unique rivet

What I want is that colored line

sharp ginkgoBOT
rose tangle

use that

polar karma

You should check the docs for the available methods

unique rivet
chrome widget

Why is my bot not updating
I added a command in a bot but I wanted to switch to another token (nw bot) so in the .env file i changed BOT_ID and TOKEN still not working

rose tangle

show your code and logs

chrome widget

register-commands.js

const { REST, Routes } = require('discord.js');
require('dotenv').config();

const commands = [
  {
    name: 'hi',
    description: 'You send Hi, I send Hi back',
  },
];

const rest = new REST({ version: '10' }).setToken(process.env.TOKEN);

(async () => {
  try {
    console.log('Refreshing application (/) commands...');
    await rest.put(
      Routes.applicationGuildCommands(process.env.BOT_ID, process.env.GUILD_ID),
      { body: commands }
    );
    console.log('Slash commands were registered (/)!');
  } catch (error) {
    console.error(`There was an error: ${error}`);
  }
});

index.js

require('dotenv').config();
const { Client, IntentsBitField } = require('discord.js');

const client = new Client({
  intents: [
    IntentsBitField.Flags.Guilds,
    IntentsBitField.Flags.GuildMessages,
    IntentsBitField.Flags.MessageContent,
    IntentsBitField.Flags.GuildMembers,
    IntentsBitField.Flags.GuildPresences,
  ],
});
client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}! The Bot is online on Discord.`);
});
client.on('interactionCreate', async (interaction) => {
  if (!interaction.isChatInputCommand()) return;

  if (interaction.commandName === 'hi') {
    await interaction.reply("Hi, I'm Dank Syndicate server's official bot. At your service. 🫡");
  }
});
client.login(process.env.TOKEN);

logs>

C:\Users---\Desktop\Discord Bot>nodemon
[nodemon] 3.1.10
[nodemon] to restart at any time, enter rs
[nodemon] watching path(s): .
[nodemon] watching extensions: js,mjs,cjs,json
[nodemon] starting node src/index.js
[dotenv@17.2.2] injecting env (3) from .env -- tip: 🛠️ run anywhere with dotenvx run -- yourcommand
Logged in as Dank Syndicate Beta#1185! The Bot is online on Discord.
(node:11984) DeprecationWarning: The ready event has been renamed to clientReady to distinguish it from the gateway READY event and will only emit under that name in v15. Please use clientReady instead.
(Use node --trace-deprecation ... to show where the warning was created)

in old bot the command was working properly

rose tangle

you're not deploying the command though

you're running your index.js which starts the bot

you need to run your register-commands.js instead

chrome widget

alr let me try

chrome widget
halcyon vault

Can Modal have a pre filled values? Instead of just placeholder?

stable sun

Or you mean pre-filled value in text input?

halcyon vault
halcyon vault
stable sun

Pretty sure you just call setValue

sharp ginkgoBOT
halcyon vault
hasty osprey

anyone got a link to component v2 page :3
from the guidfe

sharp ginkgoBOT

guide Popular Topics: Display Components
read more

manic moat

How to fetch channels by parent id ?

halcyon bison
manic moat How to fetch channels by parent id ?

on the assumption you have the Guilds intent, you can get the parent channel by id with <Client/Guild>.channels.cache.get(<parentId>)
on the assumption you were referring to a category specifically, you can then access <CategoryChannel>.children.cache
if you meant threads in a text channel, then you can use <TextChannel>.threads.fetch()

halcyon vault

Hi! Can we set any desc for the model textbuilder? Is there any method? Because i see it in discord dev guide

unique rivet

Which of these methods is best for me to add options? Or does it matter?

loud quartz

The 2nd is much more readable

halcyon bison
unique rivet
onyx torrent

To do, if you click on the Modal, is it an Interactioncreate or messagecreate if i want it to generate a new channel privately?

dense jackal
oblique seal

Are the new modal components already available in discord.js?

dense jackal
oblique seal

kk, thanks

radiant epoch

How to upload an emoji to app?

woeful geyser

Why is interaction.channel null in a DM text channel?

unique shoal

Because DM channel are uncached

unique shoal
radiant epoch
woeful geyser
trail pasture

hello, this may be a question thats been asked several times prob but does djs support the new modal update or not yet?

stable sun

Not yet

trail pasture
torn orchid

does djs support the profile set thing so you can change your banner, profile, and name, not username

sharp ginkgoBOT

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


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

polar karma

Dunno what you mean by name

hasty osprey

its not possible to recreate the embed header in comp v2 right?

like if i want the user's pfp to appear on the corner

frank slate

I'd like to add app-specific fields to Client (always launched via ShardingManager).

Should I use a class extending Client, use type augmentation or something else?

What's the recommended or best approach in your guys's opinion?

halcyon bison
hasty osprey
frank slate

I think you'd run into ratelimits really fast

halcyon bison

^hence why I called it unfeasible

hasty osprey

dangabit

frank slate
halcyon bison

it's really up to you
the only real recommendation is to check the docs to ensure you're not accidentally overwriting an existing property

frank slate

How would you do it if you had to? As for the overwriting thing I already checked

The fields are completely unrelated to anything the Client class already has

halcyon bison

asking me personally?
I probably just wouldn't attach these things to the client

frank slate

I thought it'd be a simple way to access my constants in my commands so I don't have to keep importing them each time, or even command cooldown timers

halcyon bison

again, totally up to you
I believe we recommend both extending the client or type augmentation in regards to the commonly defined <Client>.commands

sharp ginkgoBOT

We highly recommend you extend the Client structure properly instead of just attaching custom properties like .commands to the regular discord.js Client instance.

halcyon bison

er I suppose it just mentions casting instead of extending, but still totally your choice in design

frank slate

I tried extending it and I ran into issues with <Client>.shard or user being possibly null and stuff like that so I guess it's time for me to learn a bit more about typescript. Thanks for the help ^^

halcyon bison

I mean just those properties being possibly null is unrelated
I believe <Client>.shard is always possibly null given that there's no way for typescript to know whether you're sharding or not
<Client>.user is null when the client isn't ready
when accessing <Structure>.client in events (or the emitted param in the ready event) the client would be ready and <Client>.user would be typed appropriately