#djs-help-v14

78874 messages · Page 63 of 79

radiant epoch

Why does client.user.application one also have banner when you want to set/update the app?

Apps can’t really have banner but bots, so this kinda confusing and the banner is not updated on the Discord developer portal page at all (I don’t remember)

formal carbon
/**
     * Parse a string
     * @param content {string} - The content to parse
     * @param member {GuildMember} - The member to parse the content for
     * @returns {Promise<string>}
     * @description Parse a string
     * @example
     * await this.client.util.parse(content, member);
     */

    public async parse(content: string, member: GuildMember): Promise<string> {
        try {
            console.log('Member object:', {
                id: member.id,
                user: member.user,
                displayName: member.displayName,
                nickname: member.nickname,
                guild: member.guild?.id,
                roles: member.roles.cache.map(r => r.id),
                joinedTimestamp: member.joinedTimestamp,
                userTag: member.user.tag,
                member: member
            });
            const guild = member.guild;
            const mention = `<@${member.user.id}>`;
        
            const memberCount = await this.safeMemberCount(guild);
        
            const joinedTimestamp = member.joinedTimestamp ?? Date.now();
        
            return content
                .replaceAll(/\\n/g, "\n")
                .replaceAll(/{server:name}/g, guild.name)
                .replaceAll(/{server:member:count}/g, String(memberCount))
                .replaceAll(/{member:name}/g, member.displayName)
                .replaceAll(/{member:mention}/g, mention)
                .replaceAll(/{member:id}/g, member.user.id)
                .replaceAll(/{member:created_at}/g, `<t:${Math.floor(member.user.createdTimestamp / 1000)}:R>`)
                .replaceAll(/{member:joined_at}/g, `<t:${Math.floor(joinedTimestamp / 1000)}:R>`)
                .replaceAll(/{member:tag}/g, member.user.tag);
        } catch (e) {
            console.error(`Error in parse for member ${member.user.id} in guild ${member.guild.id}:`, e as Error);
            await this.client.logError.send({ 
                content: `Error in parse for member ${member.user.id} in guild ${member.guild.id}: ${e instanceof Error ? e.message : 'Unknown error'} \nStack: ${e instanceof Error ? e.stack || 'No stack trace available' : 'No stack trace available'}\nError: ${JSON.stringify(e, Object.getOwnPropertyNames(e))}` 
            });
            return content;
        }
    }
formal carbon

in this memberCount is not available either the guild is

steel trail
formal carbon

You're doing weird stuff in your code. That isn't djs that does that, why does your member have a .member property

And why is .guild an id

Show the original place where you define that before passing it down your line of functions

Pretty sure your typings simply are wrong, since this is not a GuildMember

sharp ginkgoBOT

discord Component Reference - Container
A Container is a top-level layout component. Containers offer the ability to visually encapsulate a collection of components and have an optional customizable accent color bar. Containers are currently only available in messages.

subtle girder

what prism-media does?
seeking means finding right?

naive hull

can someone help me?

subtle girder
naive hull

I have this container:

    
      .addTextDisplayComponents(
        new TextDisplayBuilder().setContent("## Official Rules :emoji_7:")
      )

      .addSeparatorComponents(new SeparatorBuilder().setSpacing(SeparatorSpacingSize.Small).setDivider(true))```
How do i add a photo in it?
sharp ginkgoBOT
naive hull

A,ty

steel trail

Or - if you want it as thumbnail - you'll use a section with accessory

naive hull

addMediaGalleryComponents(...components: RestOrArray<APIMediaGalleryComponent | MediaGalleryBuilder | ((builder: MediaGalleryBuilder) => MediaGalleryBuilder)>) : this .Is it this?

I am new to js,so i don t understand a very big part of it

steel trail

That's the signature of the method, yes... you use it the same way you use the other addX methods you already have

sharp ginkgoBOT

guide Display Components
While you might be familiar with embeds in Discord, there are more ways to style and format your apps messages using display components, a comprehensive set of layout and content elements. To use the display components, you need to pass the IsComponentsV2 message flag (in docs: MessageFlags) when sending a message. You only need to use this flag when sending a message using the display components system, not when deferring interaction responses.

steel trail

If you need a detailed guide

naive hull

Im so dumb

rigid crest

THis helped alot, im back to see ing normal numbers for 8k servers tyvm

formal carbon
steel trail You're doing weird stuff in your code. That isn't djs that does that, why does y...
| {
1|shards  |   member: GuildMember {
1|shards  |     guild: Guild {
1|shards  |       id: '1203645499597652028',
1|shards  |       name: 'PRASHANT GAMER',
1|shards  |       icon: 'a_99a45802cfc48555efdf24ea41c65fd4',
1|shards  |       features: [Array],
1|shards  |       commands: [GuildApplicationCommandManager],
1|shards  |       members: [GuildMemberManager],
1|shards  |       channels: [GuildChannelManager],
1|shards  |       bans: [GuildBanManager],
1|shards  |       roles: [RoleManager],
1|shards  |       presences: PresenceManager {},
1|shards  |       voiceStates: [VoiceStateManager],
1|shards  |       stageInstances: [StageInstanceManager],
1|shards  |       invites: [GuildInviteManager],
1|shards  |       scheduledEvents: [GuildScheduledEventManager],
1|shards  |       autoModerationRules: [AutoModerationRuleManager],
1|shards  |       soundboardSounds: [GuildSoundboardSoundManager],
1|shards  |       available: true,
1|shards  |       shardId: 0,
1|shards  |       splash: null,
1|shards  |       banner: 'a_8023873cb2cf7781e1e920d09215b264',
1|shards  |       description: null,
1|shards  |       verificationLevel: 2,
1|shards  |       vanityURLCode: 'prashantgamer',
1|shards  |       nsfwLevel: 0,
1|shards  |       premiumSubscriptionCount: 21,
1|shards  |       discoverySplash: null,
1|shards  |       memberCount: 4447,
1|shards  |       large: true,
1|shards  |       premiumProgressBarEnabled: true,
1|shards  |       applicationId: null,
1|shards  |       afkTimeout: 300,
1|shards  |       afkChannelId: null,
1|shards  |       systemChannelId: '1444619460639199373',
1|shards  |       premiumTier: 3,
1|shards  |       widgetEnabled: null,
1|shards  |       widgetChannelId: null,
1|shards  |       explicitContentFilter: 2,
1|shards  |       mfaLevel: 0,
1|shards  |       joinedTimestamp: 1764484335925,
1|shards  |       defaultMessageNotifications: 1,
1|shards  |       systemChannelFlags: [SystemChannelFlagsBitField],
1|shards  |       maximumMembers: 25000000,
1|shards  |       maximumPresences: null,
1|shards  |       maxVideoChannelUsers: 25,
1|shards  |       maxStageVideoChannelUsers: 510,
1|shards  |       approximateMemberCount: null,
1|shards  |       approximatePresenceCount: null,
1|shards  |       vanityURLUses: null,
1|shards  |       rulesChannelId: '1373405469913387111',
1|shards  |       publicUpdatesChannelId: '1203800328336703550',
1|shards  |       preferredLocale: 'en-US',
1|shards  |       safetyAlertsChannelId: '1203645502315434003',
1|shards  |       ownerId: '618097307841200164',
1|shards  |       emojis: [GuildEmojiManager],
1|shards  |       stickers: [GuildStickerManager],
1|shards  |       incidentsData: null
1|shards  |     },
1|shards  |     premiumSinceTimestamp: null,
1|shards  |     nickname: null,
1|shards  |     pending: false,
1|shards  |     communicationDisabledUntilTimestamp: null,
1|shards  |     user: User {
1|shards  |       id: '1372572559966605333',
1|shards  |       bot: false,
1|shards  |       system: false,
1|shards  |       flags: [UserFlagsBitField],
1|shards  |       username: 'romayxfire',
1|shards  |       globalName: 'ROMAY X FIRE',
1|shards  |       discriminator: '0',
1|shards  |       avatar: null,
1|shards  |       banner: null,
1|shards  |       accentColor: null,
1|shards  |       avatarDecoration: null,
1|shards  |       avatarDecorationData: null,
1|shards  |       collectibles: null,
1|shards  |       primaryGuild: null
1|shards  |     },
1|shards  |     avatar: null,
1|shards  |     banner: null,
1|shards  |     joinedTimestamp: 1765721896735,
1|shards  |     flags: GuildMemberFlagsBitField { bitfield: 8 },
1|shards  |     avatarDecorationData: null
1|shards  |   }
1|shards  | }

i did console.log({ member}) and this is what i got

steel trail

No idea why you added the {} but that log is fine and won't throw the error you had before (and I assume it didn't?)

formal carbon
 member: GuildMember {

1|shards  |     guild: Guild {
1|shards  |       id: '1345287311813775421',
1|shards  |       name: 'Omegle 18+',
1|shards  |       icon: '0ecb221326d94afeb0e9d81d29f5470b',
1|shards  |       features: [Array],
1|shards  |       commands: [GuildApplicationCommandManager],
1|shards  |       members: [GuildMemberManager],
1|shards  |       channels: [GuildChannelManager],
1|shards  |       bans: [GuildBanManager],
1|shards  |       roles: [RoleManager],
1|shards  |       presences: PresenceManager {},
1|shards  |       voiceStates: [VoiceStateManager],
1|shards  |       stageInstances: [StageInstanceManager],
1|shards  |       invites: [GuildInviteManager],
1|shards  |       scheduledEvents: [GuildScheduledEventManager],
1|shards  |       autoModerationRules: [AutoModerationRuleManager],
1|shards  |       soundboardSounds: [GuildSoundboardSoundManager],
1|shards  |       splash: 'c346397a6ec734c4c9a62e542861cbcd',
1|shards  |       banner: 'def324a4704cb43303bd793e3793ba3c',
1|shards  |       description: "Camming sessions happening on every 500 members, Active Ask2dm channels, Introductions, VC's and alot more, Feel free to join!",
1|shards  |       verificationLevel: 1,
1|shards  |       vanityURLCode: 'omegle',
1|shards  |       nsfwLevel: 0,
1|shards  |       premiumSubscriptionCount: 24,
1|shards  |       available: false,
1|shards  |       discoverySplash: '4a63f9fae580ae7dd64c109fb77e639c',
1|shards  |       premiumProgressBarEnabled: true,
1|shards  |       applicationId: null,
1|shards  |       afkTimeout: 300,
1|shards  |       afkChannelId: null,
1|shards  |       systemChannelId: '1437812807104987267',
1|shards  |       premiumTier: 3,
1|shards  |       widgetEnabled: false,
1|shards  |       widgetChannelId: null,
1|shards  |       explicitContentFilter: 2,
1|shards  |       mfaLevel: 1,
1|shards  |       defaultMessageNotifications: 1,
1|shards  |       systemChannelFlags: [SystemChannelFlagsBitField],
1|shards  |       maximumMembers: 25000000,
1|shards  |       maximumPresences: null,
1|shards  |       maxVideoChannelUsers: 25,
1|shards  |       maxStageVideoChannelUsers: 600,
1|shards  |       approximateMemberCount: 7146,
1|shards  |       approximatePresenceCount: 1341,
1|shards  |       vanityURLUses: null,
1|shards  |       rulesChannelId: '1430105126588125304',
1|shards  |       publicUpdatesChannelId: '1430105275272007771',
1|shards  |       preferredLocale: 'en-US',
1|shards  |       safetyAlertsChannelId: '1430105275272007771',
1|shards  |       ownerId: '1137675561473417216',
1|shards  |       emojis: [GuildEmojiManager],
1|shards  |       stickers: [GuildStickerManager],
1|shards  |       incidentsData: [Object],
1|shards  |       shardId: 2
1|shards  |     },
1|shards  |     premiumSinceTimestamp: null,
1|shards  |     nickname: null,
1|shards  |     pending: true,
1|shards  |     communicationDisabledUntilTimestamp: null,
1|shards  |     user: User {
1|shards  |       id: '955841725883105351',
1|shards  |       bot: false,
1|shards  |       system: false,
1|shards  |       flags: [UserFlagsBitField],
1|shards  |       username: 'isma03865',
1|shards  |       globalName: 'isma',
1|shards  |       discriminator: '0',
1|shards  |       avatar: 'ae1e05e7ff38e8b49e3f870482aec8ca',
1|shards  |       banner: null,
1|shards  |       accentColor: null,
1|shards  |       avatarDecoration: null,
1|shards  |       avatarDecorationData: null,
1|shards  |       collectibles: null,
1|shards  |       primaryGuild: null
1|shards  |     },
1|shards  |     avatar: null,
1|shards  |     banner: null,
1|shards  |     joinedTimestamp: 1765722745276,
1|shards  |     flags: GuildMemberFlagsBitField { bitfield: 0 },
1|shards  |     avatarDecorationData: null
1|shards  |   }
1|shards  | }```

in this i don't have memberCount cause guild is available :false

isn't there is any way too fix this ?

steel trail

You won't receive a guildMemberAdd event from an unavailable guild though. And memberCount won't suddenly get unset. So this - again a boils down to:

  1. show the original event this is called from or
  2. show the log of member in a case where the error is thrown

So you do a force fetch of the guild there (and discard the result). That's part of your problem I'd say. You really never should have to fetch a guild in guild-related events, this only causes more issues

Also what does that Queue do?

formal carbon

1 event 3 jobs with bullmq

but even if i removed fetch from the code right ?

public async safeMemberCount(guild: Guild): Promise<number> {
  if (typeof guild.memberCount === 'number') {
    return guild.memberCount;
  }

  if (typeof guild.approximateMemberCount === 'number') {
    return guild.approximateMemberCount;
  }

  return 0;
}

like this it will still return 0; sometimes

steel trail

So you pass member and client as payloads to a bullmq queue? They won't be instances anymore then, they'd be JSONified, right? That causes your issues

steel trail
formal carbon
steel trail

And does that cause 0? Where did you log this (in which of your functions)?

steel trail

I don't see you logging guild in there. I would need to see a log of guild from inside that function for a case where it returned 0

The typeof that should always be number if you passed it from a guildMemberAdd like you showed earlier.

This is leading nowhere. Show a log of a case where that happened. Until then I can't help you

memberCount should never be not there in a guildMemberAdd event either

I get the feeling you're trying to fix an issue you brought upon yourself by trying to fix something else that doesn't happen

torn orchid

does anyone know why my clientReady.js isn't doing Watching test! ?

const { ActivityType } = require("discord.js");

module.exports = {
    name: "clientReady", 
    once: true,
    async execute(client) {
        client.user.setActivity({
            name: "test!",
            type: ActivityType.Watching
        });
    },
};
topaz bluff

Where are you registering this file?

torn orchid
topaz bluff

Discord.js does not do anything like that automatically. It's up to you to actually load that file

Are you loading files from the src/events folder in any part of your code?

torn orchid

Nope

sharp ginkgoBOT

guide Event Handling
Node.js uses an event-driven architecture, making it possible to execute code when a specific event occurs. The discord.js library takes full advantage of this. You can visit the Client documentation to see the full list of events. This page assumes you've followed the guide up to this point, and created your index.js and individual slash commands according to those pages. At this point, your index.js file has listeners for two events: ClientReady and InteractionCreate.

torn orchid
topaz bluff

On more recent versions of djs, yes

But using the Enum is also even better

sharp ginkgoBOT
topaz bluff

Oops not that one

sharp ginkgoBOT
topaz bluff

This one

torn orchid

Okay

torn orchid
sharp ginkgoBOT

guide Registering Commands
For fully functional slash commands, you need three important pieces of code:...

restive aurora
torn orchid

yeah, i got it

restive aurora

Ok :3

versed ivy

Is there any event that gets triggered when a member uses the guild tag? guildMemberUpdate doesn’t seem to work for this?

tribal hatch

Can webhooks send v2 Components?

shell girder
tardy sable

does this error mean i can only bulk delete between 1 and 100 messages? i thought you could bulk delete more than 100 messages?

DiscordAPIError[50035]: Invalid Form Body
messages[BASE_TYPE_BAD_LENGTH]: Must be between 2 and 100 in length.
at async TextChannel.bulkDelete (/home/container/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:333:7)
await interaction.channel.bulkDelete(messages, true)
bleak owl

nope, only 100 messages at a time

and only from the past 2 weeks

although you can delete a single message at any time

tardy sable

oh okay. can i do multiple bulkdelete calls then or am i going to get rate limited?

bleak owl

you could, but you will probably get rate limited if done too often

north vale

After selecting an option from a select menu inside a modal, I assumed that once the modal is submitted I could use the selected option’s value for my logic. Am I right? If I’m handling the modal submit interaction, where can I access the selected option(s)?

tardy sable
sharp ginkgoBOT
ruby bane

does discord list the rate limits anywhere? feels like some mention including the including the X-RateLimit-Limit header, and some dont, even though some of them do include it w/o mentioning it

tardy sable

idk all i hear is that its dynamic so theres no point in specifying the exact rate limits since its different for everyone

north vale
tardy sable

just check the docs

ruby bane

the docs are the best resource for anything djs dev related

verbal plinth

When I try to send a container via a webhook, I get this error: “components[0][UNION_TYPE_CHOICES]: Value of field ‘type’ must be one of (1,).”

const message = new TextDisplayBuilder().setContent(`## ${title} - ${publisher}`)
const container = new ContainerBuilder()
    .addTextDisplayComponents(message)

const webhookUrl = getConfig().questWebhookURL
if (!webhookUrl) {
    console.warn('Webhook-URL missing')
} else {
    const webhook = new WebhookClient({ url: webhookUrl })

    console.log(container.toJSON())

    try {
        await webhook.send({
            withComponents: true,
            components: [container],
        })
    } catch (e) {
        console.warn('Webhook senden fehlgeschlagen:', e?.message || e)
    }
}

But console.log has all kinds of types.
Logs:

{
  type: 17,
  components: [
    {
      type: 10,
      content: '## test - 85'
    }
  ]
}

bleak owl

you need to send the MessageFlags.IsComponentsV2 flag

verbal plinth

Oh, thank you

gray jasper

Its giving me invalid token even tho my token is valid, someone knows this fix?

tardy sable
gray jasper

NEVERMIND GUYSS

ruby bane

well something happen to their profile so gg

topaz bluff
wary coral
ruby bane

theyre gone

wary coral

Lol

restive aurora

Guys, I don't have a specific project, but It's just for curiosity. How can I make a bot appear online on a phone?

Like this

steel trail

It's not documented by discord nor do we support it

restive aurora
steel trail

My answer remains

restive aurora

And ik that you need to modify the discord.js file

restive aurora
shadow shoal

Im gonna crash out im still waiting for the merge request for my language 💔

bleak owl
shadow shoal

nono the discord presence icrawl made

bleak owl

this is the channel for discord.js v14. if you would like to have general conversations about that, please ask in #archive-offtopic

safe wigeon
restive aurora Like this

Dunno if you found the answer to it. If you add this to your client (same place where you put your intents), it should show the online on mobile icon instead ```js
ws: {
properties: {
$browser: "Discord iOS"
}
}

tardy sable

its against tos i think so i wouldnt recommend

unique shoal

Not really against ToS, but discord.js complies with the dev guidelines to report to the ws as the library in use - this overrides that

wraith cedar

How to set bot's svr avatar and banner ?

sharp ginkgoBOT
wraith cedar
Eval (async () => {
  const guild = client.guilds.cache.get("1408835793258025154");
  if (!guild) return "Guild not found";

  await guild.members.me.edit({
    avatar: "https://cdn.discordapp.com/attachments/1414885422324252722/1442183224209051648/IMG_5141.gif",
    reason: "Update server avatar"
  });

  return "✅ Server avatar updated";
})();```

It says updated but it didn't

topaz bluff

I wouldn't use a cdn.discordapp.com address

Because it looks like that is a private image...I can't open it (thus the API can't either)

(or I mistyped it)

fallow finch
sharp ginkgoBOT
wraith cedar
snow onyx
wraith cedar

Input:

(async () => {
 const guild = client.guilds.cache.get("1408835793258025154");
 if (!guild) return "Guild not found";

 await guild.members.editMe({
 avatar: "https://cdn.discordapp.com/attachments/141...

Output:

'✅ Server avatar updated'

But it did not update

wraith cedar
stable sun

What’s ur d.js version? npm ls discord.js

wraith cedar
fallow finch

Also make sure the url is valid

wraith cedar

It is

fallow finch

If you open it up on a browser do you get the image?

topaz bluff

Incognito browser ideally as well

topaz bluff

Have you also restarted your discord client? (Ctrl+R) Could he a caching issue

wraith cedar
fallow finch

Try a different image

stable sun

Could just be looking in the wrong guild

flint pier
Timeout duration was set to 1.
(Use `node --trace-warnings ...` to show where the warning was created) ```

What is this?
crimson gale

setting a timeout for over 30 years seems a bit excessive

restive aurora
steel trail
restive aurora
steel trail
restive aurora
steel trail
wraith cedar

member.user.tag is depriciated?

polar karma

yes

wraith cedar

.replace(/{user.tag}/g, member.user.tag) should i use member.user.username now

tardy sable
polar karma

-# except for bot users

sharp ginkgoBOT

property User#tag discord.js@14.25.1
The tag of this user This user's username, or their legacy tag (e.g. hydrabolt#0001) if they're using the legacy username system

steel trail

It's not deprecated. It depends on what you want it to do

civic jungle

how to check if bot has this permissions for a specific guild

export const PERMS_REQUIRED = [
PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ManageMessages,
PermissionsBitField.Flags.EmbedLinks,
] as const;

steel trail

The guild as whole or a specific channel on the guild?

civic jungle

lets say channel

steel trail

Because channels have overwrites, so it may differ per channel

sharp ginkgoBOT
civic jungle

can you explain to me what is a bitfield?

rose tangle

it's a special kind of number that "stores" multiple booleans by making each digit a boolean value

it's not really a djs concept, it's used commonly in programming, there are resources online you can check

djs has the XBitField objects that wrap them, to help you manipulate and get data

steel trail

But for working with it in djs all you need to know is "a set of flags"

civic jungle

alright

btw, how much I can rely on ChatGPT?

instead of asking here newbie questions

rose tangle

we recommend checking the guide for most stuff

we don't really mind answering newbie questions, as long as they're newbie to djs and not js itself

though you can also google or search in this channel for most stuff either way

ruby bane

the docs and guide are more up to date than any ai model is going to be, if theres clarification needed, thats what this server is for

civic jungle

ok, thx

unique edge

if u can dm me

polar karma

this is not related to d.js, please don't post questions like that here. ask their support

unique edge

K

amber dome

Hey, how does one set the channel status like this in Discord.js? Is it even possibe?

rose tangle

it's an undocumented feature

so it's not supported

you can achieve it with raw api requests but it's not guaranteed to be stable

amber dome

Ah okay, I found something like this online too but was skeptical, thanks for letting me know :D

nimble obsidian

does channel.threads.fetch() fetch all channels? or is it used to only fetch a single channel by ID? cause rn it's returning anything for me if I just run it without options

tardy sable
nimble obsidian
sand minnow

The first picture is my bot's profile, I want mine to look like the one of mee6 in the second one. The showcase of slash commands is what I mean

is that through the bot code or in the developer portal?

nimble obsidian
tardy sable

i think most popular commands show up there once your bot is getting used

nimble obsidian
sand minnow
nimble obsidian
tardy sable

question for ddevs server not djs

sand minnow
tardy sable

probably not no

sand minnow

alright thx

olive torrent

Its possible to get the content of message that contains a mention to the bot without the required message intents?

topaz bluff

Yes. The content of the message will be included in any messages that mention the bot

civic jungle

how can I check if message is sent by the bot?

tardy sable
sharp ginkgoBOT
civic jungle

nice thx

TS18047: bot.user is possibly null

tardy sable

is that a error message? show your code

civic jungle

yes

function checkElegibilityForCheck(message: Message) {
  if (message.channel.type !== ChannelType.GuildText) return false;
  if (message.author.id === bot.user.id) return false;
  if (message.author.bot) return false; // check if message is from the bot
  return true;
}
tardy sable
civic jungle
const bot = new Client({
  shards: maxShards,
  intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.MessageContent,
    GatewayIntentBits.GuildMembers,
    GatewayIntentBits.GuildMessageReactions,
    GatewayIntentBits.DirectMessages,
  ],
  partials: [Partials.Channel, Partials.Message, Partials.Reaction],
});
tardy sable

in that case your message.author.bot check is sufficient enough

civic jungle

wdym, he will ignore own messages?

tardy sable

the client user is a bot too. it will get ignored with that check

proud arrow

In places where not available, pass it around as function params

civic jungle

I should pass bot instance to a function?

oh wait, message.client is a reference to a bot client?

proud arrow
proud arrow

Most of d.js structures have client property. You can check the docs to verify

civic jungle

awesome, that solved, thx

civic jungle

how can i prevent null for guildId?

tardy sable

theres normally always a guildId unless youre working in dms

polar karma

use an if statement to guard that it's present

civic jungle

ok

magic hemlock

@bleak owl

bleak owl
magic hemlock
brisk dome

hey anyone know if its possible to access the Members panel -> Join method through api/djs yet? I know it wasn't a while ago, but i havent tested yet. Figured id ask before going on a wild goose hunt

dense jackal
brisk dome

😔 yeah i took a glance at djs docs
thank u

wary coral
leaden wadi

I know you can add emojies in buttons and stuff, but is there a way to add custom emojies in dropdown menues?

ruby bane

theres an emoji property when setting options

sharp ginkgoBOT
leaden wadi

ty

hybrid fable

is there a kind of input for a modal for dates / hours?

snow onyx

nope

hybrid fable

ty will just make select with hours i guess

topaz bluff
tawny roost

allowedMentions: { repliedUser: false }

Does this make it so that when the bot explicitly mentions someone in a message, it would not send the notification?

azure forge

Does timestamp in footer section of embed message work just fine?

topaz bluff
topaz bluff
azure forge
tawny roost
snow onyx

yes

sharp ginkgoBOT
tawny roost

Thanks 🙏

versed ivy

how can I get information about a server tag?

sharp ginkgoBOT
versed ivy
polar karma

it's not available on the guild object

versed ivy
polar karma

ask discord ¯_(ツ)_/¯

versed ivy
polar karma

it's not on members to begin with mmLol

cobalt solstice

hello, i've seen that component builders for container have an id you can set, can it be used to replace a component in a later date?

unique shoal

Not in any automatic way, but you can use it to identify things yes

cobalt solstice

ah k, is there any way to replace, for example, a specific textdisplaycomponent text with another?

versed ivy
cobalt solstice

with an embed you can just invoke the set method again but with containers it just adds a new component 😅

hybrid fable

hmm, I am looking to have a select component in a modal where you either can select 1 element or not select any
I did it like this

    const regionInput = new StringSelectMenuBuilder()
      .setCustomId(ModalCustomIds.inputs.region)
      .setMaxValues(1)
      .addOptions(
        new StringSelectMenuOptionBuilder()
          .setLabel("EU")
          .setValue("EU"),
        new StringSelectMenuOptionBuilder()
          .setLabel("NA")
          .setValue("NA"),
      );

but it tells me, that the region field is a required field
is the maxValues enforcing the required or am I looking at a potential caching issue?

tardy sable
hybrid fable
tardy sable
sharp ginkgoBOT
hybrid fable

oh my, is it true by default? SilvervaleFacePalm

that didnt even cross my mind because I just assumed you have to enforce it with true

tardy sable

yes by default its true

hollow relic

yo, how can do that?

unique shoal

It's an action row of buttons in a container

hollow relic
sharp ginkgoBOT

guide Display Components
While you might be familiar with embeds in Discord, there are more ways to style and format your apps messages using display components, a comprehensive set of layout and content elements. To use the display components, you need to pass the IsComponentsV2 message flag (in docs: MessageFlags) when sending a message. You only need to use this flag when sending a message using the display components system, not when deferring interaction responses.

unique shoal

Container

Not embed

rose tangle

like monbrey said, it's a container, not an embed

you're building an embed

if you're using an ai it's likely outdated

rose tangle
hollow relic

ok, thx

hybrid fable

is there a way to fail a modal interaction such that the user does not lose the data in the modal?
I need a date to be submitted, and if the date is not in the correct format, I need to stop processing

I would like the user to not have to fill out the modal again

right now I tried throwing an error but that didn't work

sharp ginkgoBOT
rose tangle

you'd need to re-send the modal with the values filled already

hybrid fable

oh thats clever
and also obnoxious

thanks, I think that should work out great!

rose tangle

you could alternatively add three select menus where they can input the year, month and day

not the best ux but at least it's somewhat validated already

hopefully discord will add a proper date pick component in the future

hybrid fable

oh thats a lot more comfortable, but yea still horrible UX

I kinda gave up on this modal when I saw the hassling with the date so I will just throw in the ISO string and see if people ever use it correclty or not, probably the latter

hybrid fable
steel trail

Sure

tardy sable
sharp ginkgoBOT
steel trail

Set default

hybrid fable
hybrid fable
rose tangle

yeah you'd need another interaction

can't send a modal after a modal

what I do is show the preview and errors, and have an edit button and a submit button which can't be used until there's no errors

hybrid fable

can I respond to an interaction with a new interaction, or was your suggestion I "save" the modal data until a new interaction comes in and I try to restore the data from there?

rose tangle

the latter, yeah

well if you program it

that's not a thing in djs if that's what you mean

hybrid fable

from my understanding, which is limited of course, modals are not that interactive that I could create a preview in there wellThink

tiny blade

can discord rest api create a invite link of a server?

rose tangle

ah no, a preview embed

you submit and the preview updates

hybrid fable

oh I see, and I can probably send the preview as an ephermal message too

sharp ginkgoBOT

documentation suggestion for @tiny blade:
method GuildInviteManager#create() discord.js@14.25.1
Create an invite to the guild from the provided channel.


// Create an invite to a selected channel
guild.invites.create('599942732013764608')
  .then(console.log)
  .catch(console.error);

hybrid fable

clever awwNotes

rose tangle

yeah

tiny blade

omg 15 second cooldown, pain

rose tangle

but I figured you wanted the how, not just yes/no

tiny blade
rose tangle
hybrid fable

was intended to be a little cool side feature but I am 2 modals, 5 handlers and 2 embeds deep, so I guess I will have to tone it down a bit lmao

tiny blade

any of you do have knowledge about edge functions? i need a quick - fix

rose tangle
hybrid fable

in a slash command handler, where I respond with a modal, I do it like this:

my bot is currently showing "bot is thinking..." like as if I deferred a reply and never responded

am I doing something wrong?
everything works as expected, but I see the bot "thinking" forever

tardy sable
wary coral

Sounds like it the interaction is being deferred. You cant defer then show a modal. Are you catching errors for this function?

hybrid fable
cobalt solstice

Hello, i just converted textinputbuilder which sliced with labelbuilder, anyone knows if in LabelBuilder the description is required too?

cobalt solstice

k then i get an issue related to something else i guess... ill check and come back if i cant fix

thanks

wary coral

also the modal guide is now upto date

tardy sable

oh okay

sharp ginkgoBOT

guide Modals
Modals are pop-up forms that allow you to prompt users for additional input. This form-like interaction response blocks the user from interacting with Discord until the modal is submitted or dismissed. In this section, we will cover how to create, show, and receive modals using discord.js! This page is a follow-up to the interactions (slash commands) page. Reading that page first will help you understand the concepts introduced in this page.

cobalt solstice
steel trail
cobalt solstice
steel trail
smoky grail

does the reload command work on Windows 11?

cobalt solstice

yeah i just checked again and found out, ill check if that was the issue lmao

steel trail
smoky grail

the reload command is part of the discord.js guide

cobalt solstice
wary coral
smoky grail

Because of this message on the reloading commands part of the disord.js guide that i linked. ESM does not support require and clearing import cache. You can use hot-esm to import files without cache. Windows support is experimental per this issue.

wary coral
smoky grail

okay

hybrid fable

can discordjs create events? (The discord thing where you put in a date and location and people can click interested at the top left of the server)

I was searching "events" in the docs and you can probably guess how that went 💦

sharp ginkgoBOT
hybrid fable

thanks PogU

rugged vale

is there any particular reason the guide says "legacy" in the url? I want to make sure im using the newest documentation so I don't accidentally make an outdated bot. https://discordjs.guide/legacy

wary coral
rugged vale

so I can use it and assume im working with the most current info? Thank you!

wary coral

correct

rugged vale

thanks a ton!

uncut mango

Is there a more reliable way to check for boosters?

guildMemberUpdate listener works good but it seems to miss them every now and again

sharp ginkgoBOT

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.
    }
});
rose tangle

like the tag says it's only for new boosters, furthermore you'd need the member cached or the member partial

uncut mango
rose tangle

do you have all members cached or do you have the member partial, like I mentioned?

rose tangle

by checking your code?

check if you fetch all members on start or have the partial on your client constructor

uncut mango
polar karma

there's the boost message, if the guild has it enabled

uncut mango

there's also nothing to fetch the members on startup

uncut mango
rose tangle

you have the update event for unboosting

rose tangle
uncut mango

alr i'll either fetch them on startup, which shouldn't be a big performance issue since its only 1 server

or look into partials

rose tangle

I'd just enable the partial

sharp ginkgoBOT

guide Partials
One example leveraging partials is the handling of reactions on uncached messages, which is explained on this page. Prior you had to either handle the undocumented raw event or fetch the respective messages on startup. The first approach was prone to errors and unexpected internal behavior. The second was not fully fail-proof either, as the messages could still be uncached if cache size was exceeded in busy channels.

uncut mango

@rose tangle do i need to fetch any members from the partials? or is just seeing if the premiumSince property is there enough

polar karma

a partial structure is only guaranteed to have the id present, any other data is not guaranteed to be present. fetching the structure will give you the new structure data, there is no way to retrieve the old state from the api

uncut mango
polar karma

the idea is to fetch all members at once on startup (<guild>.members.fetch()) and have them cached, thus having the old data present in cache to compare to the new data in the event

partials only enable you to receive events where the structure is uncached, and the functionality is limited

uncut mango

maybe a more reliable method would be checking to see if the premiumSubscriptionCount changed and then going through premiumSubscriberRole

rose tangle

which you currently don't

rose tangle
uncut mango
uncut mango
rose tangle

though you'd still need all members cached for the role to figure who actually boosted

unless you don't want that

uncut mango

if i just wanted the count i'd use premiumSubscriptionCount and be on with it

rose tangle
uncut mango
rose tangle can you show what you did and show what you mean?
async function guildMemberUpdate(
  oldMember: GuildMember | PartialGuildMember,
  newMember: GuildMember | PartialGuildMember
) {
  if (!newMember.guild || newMember.user.bot) return;

  const configGuild = config.customRoleConfig.boosterGuilds.find(
    (g) => g.id === newMember.guild.id
  );
  if (!configGuild) return;

  if (oldMember.premiumSince === null && newMember.premiumSince) {
    // handle booster
  }
}
tardy sable
uncut mango

but if i hover over newMember.guild it says "Guild" instead of "Guild | undefined" which seems wrong if its supposed to be a partial but idrk

uncut mango
rose tangle
  • newMember isn't partial, you always have the new data
  • partial data has a | null, not | undefined
  • in the event you do have the guild id, and you do have the Guild cached, so Guild is not partial data, so it's not Guild | null
uncut mango

is partial data is null how can you differenciate between premiumSince just being null because there's no premium since data or because its partial data (this would only happen in the case of new boosters not boosts expiring but)

im sorry if im not making any sense but its a bit confusing

if newMember is always complete ill remove the check for guild then

async function guildMemberUpdate(
  oldMember: GuildMember | PartialGuildMember,
  newMember: GuildMember
) {
  if (newMember.user.bot) return;

  const configGuild = config.customRoleConfig.boosterGuilds.find(
    (g) => g.id === newMember.guild.id
  );
  if (!configGuild) return;

  if (!oldMember.premiumSince && newMember.premiumSince) {
  }
}
rose tangle

the Guild is always complete, if you wanted to check whether it's a partial then you do member.partial

I think I understand what you mean though, but for some reason premiumSince isn't marked as a nulled key on the partial member

though maybe because it's already | null

in that case then it sounds like it doesn't solve the issue sadly, you'd need all members cached

or use the message event

uncut mango
rose tangle

yep

uncut mango
rose tangle

maybe audit logs could work but that's another intent and more permissions

uncut mango

i assume new joiners are cached by the bot while its logged in?

rose tangle

if you have the GuildMembers intent

uncut mango

alright well ill go with the code with partials as it is right now and add fetching the guild members on startup

rose tangle

you can remove the partials since you'd have all data anyways

a partial member wouldn't be emitted

uncut mango
rose tangle

Thonk weird from my experience they happen at the same time

uncut mango

🤷‍♂️ they got the premium subscriber role

it is odd

old arrow

Going through the documentation and in the reloading part of it, I thought of something that would convenience me as well, having multiple commands in the same file. How would I do that, exactly?

uncut mango
old arrow

Honestly, fair enough
I'm just really picky with organization, that's what prompted me to ask lol

Guess I'll go with another thing, perhaps further organisation with more folders. Doesn't seem to exactly like the extra layer with folders though.

rose tangle

also djs doesn't handle command files at all

that's why the guide takes you through building such a system yourself

old arrow
trail spindle

I'm looking to start implementing a music feature for my djs bot, what package(s) is the best choice? I randomly had issues with distube and ffmpeg exiting when trying to queue up songs, and wanted to get perspective from other people.

bleak owl

if you're trying to get audio from youtube, that is against tos, which we will not help you with

trail spindle

It was specifically spotify / soundcloud I was working with

bleak owl

spotify doesn't allow playback from their api

trail spindle

Saddest news I've heard thus far. What platforms do work without going against tos ?

bleak owl

check soundcloud's tos, but none of this is related to discord.js, sorry

trail spindle

copy

shell girder

Hello, question: Is it possible to know when a user's last nitro boost was?

molten summit

is there any person i could pay for them to help find the issue in my code

shell girder

crySparkleI understand, thank you.

crude mist

so .js has you put components and modals back into the main index file. so whats the point of putting them in seperate files if you're just gonna have to put the rest of the command back

stable sun

Wdym "put the command back"?

crude mist

back to the main file

stable sun

I mean, I just require/file the command file

Is that what ur referring to?

I do put my modals and components in the same file as the commands

crude mist

When I learned about components you have to put them back into the index file cuz discord.js doesnt have the memory to support that in a different file

stable sun

That’s absurd

Are you running off of a raspberry pi or some ancient computer?

crude mist
crude mist
stable sun

If you setup your handler correctly, you can have components and such in separate file too

crude mist

obviously I didnt make this code but yeah

stable sun

It really depends on how you want it to work (where component code goes whether in its own file or group by command)

Ultimately, it’ll be a similar setup to how the command handler, but you have different checks and branches for different components

crude mist

well if I had known that I would've stuck to js instead of python

uncut mango
crude mist

A few tips

  • you can move the modal definitions outside the run function which means it won't be redefined every time it's run, also applies to required role id
  • ephemeral: true is deprecated, use flags: MessageFlags.Ephemeral
  • if this is just one server you can set which roles are allowed to use them in app integrations
stable sun

Yikes, gl my friend

crude mist

I've already learned everything about discord.py Im moving to .js since its faster and has more up to date information

stable sun

But yea, you can make handlers for other components/interactions

Or for any event really

D.js is more barebones than d.py tbh, unless you use a d.js framework like sapphire

crude mist

This was as far as I got before I got lost what to do next

stable sun

Should start with the command handler first

crude mist

can you run slash commands in the index file?

I assume so

I'd rather learn how to get the interaction of the commands working before I go to the chaos that is linking folders and files to the main index

stable sun

Yea

Pretty sure the guide starts you off like that anyways

Huh, it doesn’t

crude mist

yeah thats what put me off with .js at first how it wants you to run them in different files

stable sun

It’s pretty simple anyways

client.on(Events.InteractionCreate, interaction => {
  if (interaction.isChatInputCommand()) {
  switch (interaction.commandName) {
      case "ping": {
        await interaction.reply("pong");
      }
    }
  }
});```

Listens for slash commands /ping and replies "pong"

crude mist

oh yeah that is pretty simple

i'll play around with it. thnaks

tiny condor

If you put everything on your main file you won't be able to add features, debug features or modify them easily when your file gets larger

crude mist
tiny condor

Good for you, it isn't good practice though you should learn to organize your code

crude mist

I added all my commands and events to the same file and when it got too big and unmanageable I moved them to different files

tiny condor

DJS guide is a great way to start learning this, so I suggest following the guide as it shows

stable sun

The guide started off w/ the handler tho

tiny condor

Yeah as in if he follows it

crude mist

well thanks for the help chewinky

You were the only help

old arrow

Hey, I'm able to get components working and the buttons function. I want to be able to use the same interaction after the message is updated, since it is paging through posts. I tried looking through the docs, but I am still confused.


        const nextPost = new ButtonBuilder().setCustomId('nextPost').setLabel('Next Post').setStyle(ButtonStyle.Primary);
        const prevPost = new ButtonBuilder().setCustomId('prevPost').setLabel('Previous Post').setStyle(ButtonStyle.Secondary);

        const row = new ActionRowBuilder().addComponents(prevPost, nextPost);

        const message = await interaction.reply({
            content: 'Test',
            components: [row],
            withResponse: true,
        });

        const collectorFilter = (i) => i.user.id == interaction.user.id;

        try {
            const confirmation = await message.resource.message.awaitMessageComponent({ filter: collectorFilter, time: 60_000 });

            if (confirmation.customId == 'prevPost') {
                await confirmation.update({ content: 'Previous Post', components: [row] });
            }
            else if (confirmation.customId == 'nextPost') {
                await confirmation.update({ content: 'Next Post', components: [row] });
            }
        }
        catch {
            await interaction.editReply({ content: 'Confirmation not received within 1 minute.', components: [] });
        }
halcyon bison
old arrow
stable sun
stable sun

Yea

Guess I just called myself old

tacit pulsar
Collection(5) [Map] {
  'roles' => {
    type: 6,
    id: 2,
    customId: 'roles',
    values: [ '1446047082535456892', '1446047082057302077' ],
    roles: Collection(2) [Map] {
      '1446047082535456892' => [Role],
      '1446047082057302077' => [Role]
    }
  },
  'duration' => { type: 4, id: 4, customId: 'duration', value: '5' },
  'winners' => { type: 4, id: 6, customId: 'winners', value: '1' },
  'title' => { type: 4, id: 8, customId: 'title', value: 'hello' },
  'description' => { type: 4, id: 10, customId: 'description', value: '' }
}

why does the interaction fields of a roleselectmenu have the "values" property but everything else has the "value" property 😭

spent 20 mins racking my brain lmao

velvet cipher

Because a role select can hold multiple values whereas the other fields can only have one value

tiny blade

what is the scope called for send you direct message permissions

crisp roost

hi, is there a maximum amount of components i can have in a modal?

topaz bluff

5

crisp roost

damn alr

tiny blade
topaz bluff 5

samtino what is the scope called for send you direct message permissions

topaz bluff

Bots don't need a scope to DM

tiny blade
topaz bluff

I believe so, yes. Just bring a user app should be enough

crimson gale

by being user-installable

user-installable apps can send dms to people that have installed it without sharing a server

tiny blade
crimson gale

that's what i just answered

if you don't understand a detail of that, please elaborate on what you need more info on instead of just pinging me

help me to understand how i can help you

tiny blade
crimson gale

"others don't"? yes they do

if they are user installable

and after you selected that you want it installed on your account

tiny blade
steel trail

That's not a user-app. That's just oauth2

crimson gale

that's an oauth2 flow, not, yeah

tiny blade

im confused, then how to make a user-app?

topaz bluff

Go to Installation. Toggle on User Install

steel trail

In dev portal>your bot

tiny blade

both are on, only one should be ?

steel trail

Depends if you want only user install or be able to install to guild too

tiny blade

ye both i want, and its already on

steel trail

Do you want/need full OAuth2 flow too? Or why/where is that screenshot of oauth2 flow coming from?

tiny blade

well, there is just a login button in my website, user click and login, simple.

same in appeal.gg website but its showing that permission also, mine isn't

steel trail

If you want login that sounds like you don't make a bot but an OAuth2 app. I'm genuinely confused what you're trying to make or what your actual question is

tiny blade

nvm, i found the solution
thanks anyways

tawny roost

Is there a way to get the message the user is replying to? I remember i could do that with <Message>.replied (or something similar) seems like that was removed though (?)

sharp ginkgoBOT
halcyon bison

or just <Message>.reference.messageId if you only need the id

tiny condor

The intents limit is only for the amount of servers right, not members?

halcyon bison

by intents limit, do you mean verification being required for privileged intents?
iirc you can verify your bot at any time now, just that verification is required to go past 100 servers

tawny roost
tiny condor

I just cba to move it to a team, it's for a single server but about 20k members

golden smelt

why the "#" dosn't work properly in embed

topaz bluff

doesnt work in embeds

golden smelt

hmmm, thank you

tiny condor
hybrid fable
rose tangle you submit and the preview updates

How would i extract the data from that preview?

I was thinking from the "edit" button interaction below the preview I was gonna get the message and then the embed from there

But now my best approach would be to use regex to extract the previously submitted modal data from the embed

Is there a good way to do this that I am missing?
For context, this is about having a modal to create an embed and edit the embed in a preview message before sending the real one

tardy sable
hybrid fable
tardy sable from my understanding you have some kind of embed editor that also shows the emb...

I have a slash command that triggers a modal where input a description and a date

Those two are then put into an embed

I would like to let the user preview the embed before really sending it off.
So iam sending a message with the embed as kind of a preview with an edit button below

And when hitting the edit button, I would like to go back to the modal but with the description and date filled out

So everything is in discord

tardy sable
hybrid fable
loud quartz

You can't really attach something hidden

But if the edit button is on the message with the embed, and it's the one triggering the modal, then you already have everything you need

hybrid fable

alright thanks, wanted to make sure there isnt somethng I am missing that makes it cleaner

hybrid fable

hmm, I am sending an embed preview in an ephermal message with a submit button below

once the submit button is pressed, I post the embed from the ephermal message to a "real" channel for everyone to see

I would then like to delete the ephermal preview message to prevent resubmission

I did a message.delete() but I am getting an "Unknown Message" error

can you not delete an ephermal message from the "bots" perspective?

I get the message like this in the button interaction handler:

    const message = interaction.message;
    const embed = message.embeds[0];

The embed is the correct one, so the message is the right one and definitely not undefined

rose tangle

you still need to reply to the submit interaction

why not update the message to one without buttons, saying it succeeded

hybrid fable
topaz bluff

you should also use interaction.deleteReply() as i dont think you can reference an ephemeral message for message.delete()
(unless im confused)

rose tangle
hybrid fable
topaz bluff you should also use `interaction.deleteReply()` as i dont think you can referenc...

I tried that, but since the interaction is for the button below the message, this interaction I have in the button handler does not have a reply yet so I got the "cannot delete when there is no reply" error

the emphermal message was created by a modal interaction at an earlier step, here I am inside the button handler

the interaction still gives me the message, but it won't let me delete it

hybrid fable
rose tangle

what I mean is, user presses submit, it sends the message, and the one that used to have the submit button is edited to not have any buttons and just say it succeeded

hybrid fable

looks like this for some context, so with the button I basically want to delete the ephermal message its part of:

hybrid fable

but if I can't delete it, I am not sure it will let me edit it, I will give it a try

rose tangle

you can't use message.edit, you'd use interaction.update

you can't do much with messages from ephemeral interactions

covert shore

does anyone know why presenceUpdate doesn't fire when an activity's properties changes (i.e. end timestamp)

rose tangle

if you really want you can delete it with deferUpdate and then deleteReply, but I think it'd be better to let the user know what happened, and not just dissapear the message

hybrid fable
rose tangle

you can edit it out to the success message then

tardy sable
hybrid fable
covert shore
hybrid fable
rose tangle you can't use message.edit, you'd use interaction.update

hmm turns out this button handler does a lot of things and has to wait for API's, so I am kinda worried I will get a timeout on the interaction before I am finished

so, usually I would do an interaction.deferReply to get enough time

however, if I do that, then I can't do interaction.update to update the message anymore

is there something I am missing or is this an unsolveable situation I am creating with those requirements?

rose tangle

you can also deferUpdate

hybrid fable
rose tangle

though I'm not sure if the user is restricted to not use any components from that message until the defer is resolved, I don't think so, so you could initially edit out the action row and then editReply

loud quartz

Defer doesn't block buttons, no

hybrid fable
loud quartz

It's why the "trick" of "not having to respond" works with deferUpdate

hybrid fable

I think I am getting the hang of interactions now thanks for the help

covert shore
covert shore yea a song (I'm using premid for YT Music Presence)

So basically I'm trying to get the if a song is playing or paused. It works when I skip or go to the previous song because it updates the state, description and large image. But when you pause a song, I think it gets rid of the end time to display the duration you've been paused for instead. Then I was just sending it through my Websocket so that it updates on a website.

loud quartz

That should work the exactly same way

It's genuinely the same way the app you use as a human to look at the presence knows it changed as well

covert shore

I can show code

loud quartz

Sure

covert shore

do I post a snippet directly in chat or do I upload it somewhere?

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.

covert shore
covert shore

I think for now I'll just implement a workaround. How often am I allowed to get a user's presence without hitting a rate-limit?

tardy sable

you arent hitting any ratelimits by getting the data from client events

loud quartz

they said "get user presence", not receive

tardy sable

thought with the context it had to do with the client event. if not, rate limit depends then on getting the member, if you have the member cached you wont hit a ratelimit fast 🤷

loud quartz

but having them in cache defeats entire reason they are trying to even do this workaround

covert shore

I'm trying to see how often I can run guild.users.fetch(...).presence

loud quartz

users don't have presence

and fetching a member does not come with their presence

covert shore

wait no I meant guild.members

loud quartz

for the precise reason presence is behind a privileged intent

covert shore
loud quartz

that doesn't change the fact that it's behind and intent

tardy sable
loud quartz

that only changes that you are free to enable it, it doesn't change how API works for you

loud quartz

if they would just be taken from cache

loud quartz

presence is tied to gateway

you can't just HTTP GET member's presence

tardy sable
loud quartz
covert shore
loud quartz
tardy sable
loud quartz

and you have partials enabled

covert shore

now I'm kinda confused because I can fetch the member and get their presence so does this just not work?

like I'm getting all of this so it's just like 😵

for reference: this is my implementation

stable sun
covert shore
stone marsh

Is it possible to upload or attach files inside a Modal in Discord.js?
If yes, from which Discord.js version is this supported, and can you share a simple code example?

sharp ginkgoBOT

guide File upload
File upload components allow you to prompt the user to upload a file from their system. Discord does not send the file data itself in the resulting interaction. You will have to download it from Discords CDN to process and validate it. Do not execute arbitrary code people upload via your app!

topaz bluff

need 14.24.0 at least...but you should use @latest

tiny condor

Wait, is it possible to display an image in a modal?

topaz bluff

no i dont believe so

only accept file uploads

wary coral

ya no it is not

sharp ginkgoBOT

guide Modals
Modals are pop-up forms that allow you to prompt users for additional input. This form-like interaction response blocks the user from interacting with Discord until the modal is submitted or dismissed. In this section, we will cover how to create, show, and receive modals using discord.js! This page is a follow-up to the interactions (slash commands) page. Reading that page first will help you understand the concepts introduced in this page.

topaz bluff

advaith pls fix

covert shore
silent mirage

Not sure if this us allowed id there away i can search any guild by id using it for a website for my bot

Without bot being in server

covert shore

no

wary coral
sharp ginkgoBOT

discord Guild Resource - Get Guild Preview GET guilds/{guild.id}/preview
Returns the guild preview object for the given id. If the user is not in the guild, then the guild must be discoverable.

main mason

when someone else invokes a slash command that's responded to via an interaction.reply() that's not ephemeral (i.e. the message is viewable by anyone), is it possible for another bot that can access that message to check who initially invoked that slash command.

sharp ginkgoBOT
ruby bane

(more specifically MessageInteractionMetadata.user)

main mason

tysm!

ruby bane

salute

sharp ginkgoBOT
tiny blade

embeds with components like buttons sent from api though a website, that interactions logic lives in website function or discord bot?

how common bots does it?

sharp ginkgoBOT

guide Display Components
While you might be familiar with embeds in Discord, there are more ways to style and format your apps messages using display components, a comprehensive set of layout and content elements. To use the display components, you need to pass the IsComponentsV2 message flag (in docs: MessageFlags) when sending a message. You only need to use this flag when sending a message using the display components system, not when deferring interaction responses.

tiny blade

@steel trail can you please elaborate in easy words?

website function or in discord code

for example the ticket bots, we can send ticket panel from website, do their interactions are handled in bot code?

velvet cipher

Both. The website probably has an API endpoint that then internally sends a request/message to the bot to create a ticket in a server.

tiny blade

which one is common/better way?

i guess bot?

velvet cipher

You need both

If you want your website to interact with your bot, you need some kind of internal communication between them. Either your bot exposes API endpoints directly, or you have internal endpoints between your bot and your website's back-end.

tiny blade

ye i know i need both, like for sending embed process to a channel, its api job, after that for button etc, it comes to bot.

i know both can do that but i'm asking which is better

velvet cipher

I really don't understand what you're asking. I'm not giving you two options, I'm saying this is the only way to connect a website and a bot.

tiny blade

no? we can do store all logic of buttons interaction in bot?

velvet cipher

Okay I have no idea what your question is, sorry

tiny blade

no problem, thanks anyways

velvet cipher

Either through a HTTP API or some kind of message queue

steel trail
brazen quarry

Hi, so as much as I understand, Client#user is only null when the client isn't in Ready state. Now, I want to use client.user in a bunch of event handlers like mainly interactionCreate, guildDelete, voiceStateUpdate. Is the client guaranteed to always be ready when these events fire or more generally, how to know which events might trigger with a not ready client and which will certainly only trigger with a ready client?

polar karma

you should only receive events after the client is ready

fallow finch

And most of these events have a way of giving you ClientUser without passing client in the event handler, invite.client guild.client etc

brazen quarry

hm, that's a good idea actually... some of this code is really old and possibly uninformed

steel trail

The only events that could emit before client is ready are shardX events like shardReady

brazen quarry

Another question, maybe this is a bigger topic, we will see... the bot handles slash commands and basically nothing else. How do I ensure that interaction.guild is never null?

polar karma

specify guild context only when deploying and use the inCachedGuild typeguard if using ts

sharp ginkgoBOT
brazen quarry

Yes, I have seen this. The followup question would be, when could an interaction come from an uncached guild? Is that something I need to realistically prepare for?

steel trail

If there is no bot user in that guild (app invited without bot scope) or you don't login with Guilds intent

brazen quarry

Thank you. That's not something I'm supporting right now so it's probably safe to just assert otherwise.

steel trail

Don't assert. Use the inCachedGuild() method to check and not do what you're supposed to do if it's false

brazen quarry

well that's an assertion

that one change (along with a corresponding update to a custom type) eliminated at least 20 errors xD

brazen quarry

Okay, another similar one 😅 when can the channel property of a chatinputcommand (now with cached guild) be null?

fallow finch

Don't think it should be null, if you hover over the ChatInputCommandInteraction object does it show <"cached">

brazen quarry

seems like this is an inherited property

steel trail

what is interaction typed as?

brazen quarry

inb4 latest discord.js (14.25.1)

steel trail

ah, that's right... I think it could be null for some edge cases, like a command being used in a thread in a channel the bot user can't see...

brazen quarry

ouch

whatever, I have an idea, I will narrow this particular field in my functions

and assert in the handler

Now probably everything that is still missing will be related to voice. Thank you for the assistance ^^

loud quartz

wrong server

verbal plinth

Before sending a container, I log container.components.length, which returns 23. Nevertheless, when sending, I get components[COMPONENT_MAX_TOTAL_COMPONENTS_EXCEEDED]: Total number of components cannot exceed 40. Am I looking at the wrong number, or why am I getting this error?

proud arrow

It's total component in a message, a button component in a section will also count towards that

  • tex display in section

So they can stack which can be easily missed

velvet creek

what is the usage of setId in ButtonBuilder?

tardy sable
velvet creek
tardy sable

yh you can set any string in it iirc

sharp ginkgoBOT
tardy sable

nvm only supports number

velvet creek
tardy sable

yes you will receive the id with interaction

velvet creek
        const actionRow = new ActionRowBuilder().addComponents(reason);
        modal.addComponents(actionRow);

        await interaction.showModal(modal);

it says that modal.addComponents() is depreciated... what should we use then?

bleak owl

the deprecation warning should be telling you the alternative

sharp ginkgoBOT
ember hare

Hello there! I am trying to assign a "visitor" role to people joining my server. But for some reason members do not recieve the role when joining. Can you help me pinpoint what I am doing wrong? It should be straightforward..

const event: Event<Events.GuildMemberAdd> = {
    name: Events.GuildMemberAdd,
    execute: async (member) => {
        try {
            await member.roles.add(config.visitorRole);
        } catch (error) {
            console.error(`Failed to assign visitor role to ${member.user.tag}:`, error);
        }
    },
};

export default event;

I have confirmed this code runs on the GuildMemberAdd event, my bot has permission to give roles to users and the GuildMembers intent is present but new people joining do not receive any role. Am I missing additional intents?

bleak owl

do you have the GuildMembers intent in your client and enabled in the dev portal?

signal jewel

do you have correct intent

ember hare
export const AuroraClient = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.MessageContent, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMembers] });

the intent is also enabled in the dashboard on the web

bleak owl

any errors?

ember hare

I don't see any :*(

sharp ginkgoBOT

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

  • Once you do, log relevant values and if-conditions
  • More sophisticated debugging methods are breakpoints and runtime inspections: learn more
tardy sable

place the console log and see if youre receiving the event

ember hare

yeah but I already have a trycatch with a console.error in the code above guys

bleak owl

the try catch won't do anything if the code isn't even executing

tardy sable

try catch wont do anything if you arent receiving the event. place console log at the very top to see if youre even receiving the event

signal jewel

what is config.visitorRole?

bleak owl

thats irrelevant

ember hare

its a roleID coming from a config object

tardy sable

it would throw error if that id isnt correct

ember hare

something strange is going on, the event fires, the role does not get added, the trycatch does not error

the handler is properly firing

I can pass a role ID into member.roles.add() right?

signal jewel

yes

ember hare

I have confirmed the role ID exists and matches my config

tardy sable
ember hare

yes exactly it logged my user ID and username

tardy sable

place another console log right after adding role

ember hare

adding the console log fixed it

could it have been a race condition?

I have never seen adding a console log change logic

tardy sable

are you sure you didnt change anything else?

ember hare

I swear I didn't lol I will show you git commits

anyways, I am sorry for wasting your time

tardy sable

no i dont have to see it but you wont know what fixed it now

ember hare

thank you so much for helping me out

do intents maybe take some time to propagate?

rose tangle

no, that's not how intents work

the code was probably not properly saved imo

safe wigeon

If I have a static string option, and below a dynamic string option (autocomplete option), is there a way to tell what was chosen for the static one?
Example:
Option 1 (normal string option): selected "A"
Option 2 (autocomplete string option): is there a way to tell "A" was selected in Option 1 to better select what Option 2 should show?

rose tangle

you can just get the option

sharp ginkgoBOT

guide Accessing other values
In addition to filtering based on the focused value, you may also wish to change the choices displayed based on the value of other arguments in the command. The following methods work the same in AutocompleteInteraction:...

rose tangle

consider that autocomplete choices are cached so if you type "A" and your bot responds with [1, 2, 3] then typing "A" again will immediately show those same options again, even if you typed something else in another option, and you won't get an autocomplete interaction

safe wigeon
safe wigeon
vast bloom

guy asking me this, have guild tags been implemented by the api / by the library yet and if so what property are they

sharp ginkgoBOT
tardy sable

oop you got it twice myDudes

vast bloom

ty

steel bronze

For the new Continer using when doing it in json is the thumbnail the same then? or how would add an thumbnail

rose tangle

could you elaborate on what you mean with "is the thumbnail the same then"

the same as what?

sharp ginkgoBOT

guide suggestion for @steel bronze:
guide Thumbnail
A Thumbnail is a display component that is visually similar to the thumbnail field inside an embed. Thumbnails are added as accessory inside a Section component, support alt text for accessibility, and can be marked as a spoiler. You can use the ThumbnailBuilder class to easily create a Thumbnail component: For more information about using attachments in components refer to the guide on attaching images in embeds.

steel bronze

okay so for example
in an Container for media gallery its

{
          "type": 12,  // ComponentType.MEDIA_GALLERY
          "items": [
            {
              "media": {"url": "https://websitewithopensourceimages/coyote.webp"},
            }
          ]
        },

What is the type for thumbnail if I wanna add thumbnail in my Container

rose tangle

why not use the ComponentType enum

but correctly, since your comment says .MEDIA_GALLERY but it's .MediaGallery

enums used to be in SCREAMING_SNAKE in v13, in case you're using an ai it's outdated

sharp ginkgoBOT
steel bronze

thanks

also maybe this is something you guys wanna fix
The undefined

rose tangle

yeah that's a known issue, only happens in the unversioned docs iirc

wintry laurel

i assume this is a discord issue? (launching activity) never had this

stable sun

Yea

odd moon

If I have a piece of code that can cause simultaneous requestes to

await interaction.guild.channels.fetch(id)

Is that vulnerable to causing ratleimitting issues? Or will discord.js just handle the limits internally and it shouldn't cause problems 🤔

rose tangle

well the latter doesn't guarantee you won't have problems

you can reach ratelimits with djs, and it will handle them, but you're already ratelimited, there's not much to do

handling means that requests (for that endpoint) will be queued until you're no longer ratelimited

it won't prevent you from getting ratelimited, that's on you

now, for that specific endpoint, you most likely already have the Guilds intent

in which case you already have channels cached, so that won't actually fetch

all .fetch(id) check in cache first unless you pass { force: true }

the only channels that aren't always cached are dm channels and threads

those will only be cached when you fetch or receive them from other payload

odd moon

Okay good to know. Sounds like it generally won't be an issue then because it checks cache first 👍

coarse storm

Is there any way to check a user's guild tag?

sharp ginkgoBOT
velvet cipher

that has a tag property

versed current

guys, when using channel.permissionsFor, does this also account for the permissions of the user has because of their roles?

unique shoal

Yes

tiny blade

can a bot set role icons with api?

sharp ginkgoBOT

documentation suggestion for @tiny blade:
propertysignature RoleEditOptions#icon discord.js@14.25.1
The icon for the role The EmojiResolvable should belong to the same guild as the role. If not, pass the emoji's URL directly

wary coral

yes, you can change a roles icon

naive hull

What is the fastest method to learn a very good js?(More likely for complex discord bots)

Bcz in js i only know to do containers codes

signal jewel
warm charm

hi can i get discord.js util like format the date like discord etc

idle fossil

ill do a v14 bot with chat but chat gbt is too dump why

sharp ginkgoBOT
steel trail

I meant the user that explicitly asked for a specific thing that my message specifically answers. You didn't ask a specific question, #how-to-get-help

warm charm

yeah thanks

tardy sable
idle fossil

ah okay i dont understand the docs very complicated i think

tardy sable

Start with the simple guides

idle fossil

where?

warm charm
idle fossil

thx blobreach

main axle

Hi, in creating UserSelectMenuBuilder can I filter users in menu or it will show all server users?

topaz bluff

You can set the default users to be selected in the menu, but you can't limit the users that are populated

main axle
sharp ginkgoBOT
fathom warren

hi, basically what I want to do is listen for user input until its valid, but the problem is I don't really know how can I do that most efficient way
the thing is i want to validate username for LastFM to make further requests through my miniwrapper for their API

Can anyone help?

polar karma

What's the issue with your current code?

tiny blade

how can we make our bot online as mobile phone?

polar karma

It's undocumented and unsupported

tiny blade

then how people do

polar karma
fathom warren

@polar karma want proof? wait a sec, ill show it

polar karma

No, don't need it

What part of "unsupported" is not being understood?

If discord wanted mobile bots, they would document the route (and then the library would support it)

fathom warren

if discord wanted to not let bots support custom device props, they would not allow that on identify :v

still, i do not use nor recommend that

fathom warren
trail hull

Do we know what's the recommended size for a discord section thumbnail accessory component?

loud quartz

We don't because how it's displayed has nothing to do with discord.js

You could try asking in ddevs at best

covert shore

when working with a presence, is there a way to get a game's largeImage even thought it's not in the asset property?

tardy sable

theres the large image url

sharp ginkgoBOT
tardy sable

if they arent in asset property you have to know which id the large image is

so by probably saving them somewhere

covert shore
tardy sable
azure forge

Is there a separator line feature in component v2 for plain text (not embed message/inline text) or is it not possible?

sharp ginkgoBOT
azure forge
bleak owl

a container is not an embed

azure forge

oh lol, I guess this YTer phrased it wrong.

loud quartz

it might happen to look like one, but beyond the background and ability to set color stripe, it's completely different

naive hull

Can we make containers have colors?

Like that vertical colored line at embeds

bleak owl

yes

sharp ginkgoBOT
naive hull
bleak owl

what are you confused about?

naive hull

Like,is it

.setAccentColor("color: blue");```
Or?
bleak owl

not exactly

you'll need to pass a number

or you can use

naive hull

Hex?

sharp ginkgoBOT
bleak owl

you could use a hex, but you need to use resolveColor(hex) to make it into a number

tardy sable

is there a reason djs doesnt do resolvecolor on hex strings for containers but they do for embeds?

naive hull

So,it is

.setAccentColor("color : 0x3498db");```
?
bleak owl

no, you don't use color:

naive hull

Arh

bleak owl
tardy sable
bleak owl

embeds accept a ColorResolvable, containers do not

clear garnet
tardy sable

hm alright

naive hull

The new components V2 are so complicated

bleak owl

not really, it's pretty well explained in the guide

naive hull

Yes,i saw it,but i still can t understand some things or find them,and since im new to js,its very hard for me

bleak owl

that would be why it's so difficult

the guide can help you understand most things that the api offers

the guide does expect you to have prior js knowledge though

naive hull

Ah,so its without color and ""

naive hull
frail yoke

Hi! Is discord API in down?

leaden wadi
main sail
stable sun
main sail

thanks

naive hull

How are named that bars where are multiple variants and you choose one of them?

tardy sable
naive hull
sharp ginkgoBOT

guide Select menu
Select menus allow you to limit user input to a preselected list of values. Discord also offers select menus linked directly to native Discord entities like users, roles, and channels. Since they behave very similarly to how they do in messages, please refer to the corresponding guide page for more information on configuring select menus. Here again, you wrap the select menu with a label component to add context to the selection and add the label to the modal:...

guide Select Menus
Select menus are interactive components which can be sent via messages, interaction responses, or in modals. This page is a follow-up to the slash commands section and action rows page. Please carefully read those pages first so that you can understand the methods used here. This page is for using select menus in messages. For using select menus in modals visit the modal page...

naive hull

Like that is named?I though is holding bar or smth

stable sun

There we go

stable sun
naive hull

Ty

drifting pecan

For slash command choices, is it possible to implement multi-select?

dense jackal
sharp ginkgoBOT
cobalt valley

Hi, I have a bot when I restart it the ram usage is 400mb but after 1 day it becomes 1gb I removed all in memory processing such as maps or sets but still cant find what the issue is. I don't have GUILD_MEMBERS intent and for message caching I have already added sweepers. Any ideas how can I fix it?

tiny blade

anyone do have idea what things a verification bot checks in their site when we are verfiying in a server?

steel trail
cobalt valley
steel trail What intents does your bot use?

It has GUILD_MEMBERS and MESSAGE_CONTENT but I don't use guild members any more so I have removed it from the client declaration only MESSAGE_CONTENT is used for now and VOICE_STATE_UPDATES

steel trail

Just those two intents? No Guilds, no GuildMessages, no others?

steel trail

And what makeCache or sweepers settings do you have exactly?

cobalt valley
hybrid fable

User.id is a "snowflake"
when saving that into a database, can I save it as integer or do I have to save it as a string? wellThink
never had to deal with that data type

tardy sable
hybrid fable

alright thanks

steel trail
sleek mural

After sending an ephemeral message, how can I later edit it?
Does interaction.message.edit() work?
For me it is just showing unknown message even thought console.log(interaction.message) shows the message

sharp ginkgoBOT
sleek mural

It was interaction.update() that I was looking for, thanks for the help tho, I might of not explained well what I wanted

topaz bluff

Ephemeral messages can only be interacted with using an interaction webhook

Normal endpoints don't work on them

o7

Ya. If you want to edit the base message after a button or select menu interaction, update is what you want

sleek mural

Alright, thanks

wise valley

name[INVALID_COMMUNITY_PROPERTY_NAME]: Contains words not allowed for servers in Server Discovery

What is this issue and how can I resolve it? My ticket system only provides this.

topaz bluff

That doesn't look like a DJS issue... rather a Server Discovery issue... likely due to some blacklisted words in the name of your server / channels... you should contact Discord Support if you have any futher issues as we can't help with that

wise valley

thx

steel trail
celest grail

Hi everyone, I need your help.
I have audio files in OPUS format. When I create an audio resource for playback in my bot, the library uses FFmpeg if inlineVolume is set to true, as described in the documentation.

However, when multiple users start using the bot at the same time, I notice a significant CPU spike. I need to keep inlineVolume: true, but I’d like to avoid these CPU performance issues.

Has anyone faced a similar problem or found a way to reduce CPU usage while keeping inline volume control enabled?

spice knoll

Hi, I'm developing a Discord bot that will only available in 1 specific guild. I've hit rate limit on deploy commands yesterday because my bot redeploys commands on every startup (ts watch). Should I create a separate file for command deployment to avoid this, or is there any recommanded way to check if there are any changes in my commands before deploying them ?

stable sun

You should just be setting them

spice knoll
module.exports = (client: ExtendedClient): void => {
    const slashCommands: SlashCommandBuilder[] = [];

    const slashCommandsPath: string = join(__dirname, '../slashCommands');
    const slashCommandsDir: string[] = readdirSync(slashCommandsPath);

    slashCommandsDir.forEach((folder) => {
        const dirPath: string = join(slashCommandsPath, folder);
        if (statSync(dirPath).isDirectory()) {
            const slashCommandFiles = readdirSync(dirPath).filter((file) => file.endsWith('.js'));
            slashCommandFiles.forEach((file: string) => {
                const command: SlashCommand = require(join(dirPath, file)).default;
                slashCommands.push(command.command);
                client.slashCommands.set(command.command.name, command);
            });
        }
    });

    const rest: REST = new REST({ version: '10' }).setToken(process.env.TOKEN);
    rest.put(Routes.applicationCommands(process.env.CLIENT_ID), {
        body: slashCommands.map((command: SlashCommandBuilder) => command.toJSON()),
    })
        .then((data: any) => {
            console.log(color('text', `🔥 Successfully loaded ${color('variable', data.length)} slash command(s)`));
        })
        .catch((e) => {
            console.log(e);
        });
};

This is my current code, is using the PUT endpoint removing all commands and re adding them ?

stable sun

No

Smth is off if ur hitting 200 new commands (distinguished by name) per day

Are you constantly changing command names?

spice knoll

Not at all

I think I'm confused and the message "“The resource service has hit a rate limit.”
was not related to commands then ?

stable sun

That could mean anything

I don’t think that’s from d.js tho

spice knoll

The error was in my discord client

stable sun

Show the entire error

spice knoll

actually the message was (in french) "Le service de ressources est soumis à une limitation de débit"

Nothing else so that's not explicit. And my command interactions threw errors : DiscordAPIError[10062]: Unknown interaction

I went sleeping and now all is working fine so I must have hit a ratelimit somewhere

stable sun

Need the stack trace of the error

Ur deploy script should be separate anyways. Only run when you change the SlashCommandBuilder or add/remove a command

I need the stack trace of the original error you got though

spice knoll

I'll change that yeah

stable sun

All of the details the error prints out

I mean the other one

spice knoll

Related to the message I got in my discord client ?

stable sun

You mean the discord app?

spice knoll

Yeah actually I got that message in the discord app

stable sun

That’s not related to your bot

You’re doing smth too many times too fast in the app

spice knoll

Maybe clicking on a button or something

stable sun

Yea

spice knoll

But weirdly using the /ping command didnt work either after this

stable sun

What shows up in the app when you run it?

And console, if anything

spice knoll

the Unknown interaction error message in my discord.js console and the message with rate limit in my discord app

I think I've been trying to click on buttons too fast and Discord blocked me from doing any interaction

stable sun

Could be

If they did, then the bot shouldn’t be receiving anything

spice knoll

When hosting my bot should I have a separate script to deploy my commands on a guild ?

stable sun

Yea

spice knoll

Thanks for your advices.

hybrid fable

when fetching messages like this, are the messages cached or will this issue an api call everytime?

    const channel = await discord.client.channels.fetch(queue.queueChannelId);
    const message = await (channel as TextChannel).messages.fetch(queue.queueMessageId);
hybrid fable

thanks

wary coral
hybrid fable
dusky storm

How do I use Modify Current Member I tried to find in docs but I was unable to find it im using it to try to make a whitelabel system to have a custom profile picture, bio and nickname

sharp ginkgoBOT
topaz bluff

@dusky storm guild.members.editMe()

dusky storm

I don't see editMe

topaz bluff

whats your djs version?

dusky storm

Just a sec im trying to update it

topaz bluff

That was added in 14.23.0 so you'll need at least that version but should use latest

dusky storm

There we go I needed to update it

what do I need to pass for the avatar image?

topaz bluff

i dont know for certain as I haven't used it but most likely an AttachmentBuilder

polar karma

The docs can be clicked through and it will tell you what it accepts

dusky storm
topaz bluff

avatar: null should clear it

sleek mural

How do I find out who banned someone without fetching from audit log?

topaz bluff

The GuildBanAdd event does not display WHO issued the ban, only the reason. You have to fetch the audit log to see who perfomed the ban

sleek mural
sharp ginkgoBOT
vagrant rampart

Is it possible to disable (hide) specific global slash command on specific server?

bleak owl

you would just use guild commands in that case

vagrant rampart

i am afraid of ratelimits actually

i want to add ability for guild owners to disable specific bot commands on their server

tardy sable
tiny condor

I think sapphire bot does it per guild since if you disable slash commands they will not be enabled at all

So it's definitely possible but maybe for larger bots with different limits

subtle girder

if the bot needs 10 second to process something
I must use deferReply or discord will say interaction failed, and throw Unknown interaction when interaction.reply()

but what if StringSelectMenuInteraction.update()?
execute deferUpdate() and then update() will create a new message iirc.

topaz bluff
subtle girder
topaz bluff

yes i believe so... but i would test it to make sure

subtle girder

yes, tysm!

topaz bluff

youre welcome... i haven't done it for a long time and i remember it being kinda weird that you deferUpdate but then need to editReply after... but that's just the naming of the endpoints

bright summit

how to get a guild's server tag? I want to directly get a guilds' server tag but not user's primary guild

I tried to hit /guilds/id on rest but I can't see anything related to server tag too

loud quartz

Discord never put/documented it there

So not much you can do about it

bright summit
tiny condor
bright summit
loud quartz

Not much more to say than too bad

It's not there, nothing we can do about it, ask discord to add it there

tiny blade

can i make a form and look for a dev?