#djs-help-v14
78874 messages · Page 63 of 79
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)
/**
* 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;
}
}
in this memberCount is not available either the guild is
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
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.
I don't understand the guide about seeking audio resources
what prism-media does?
seeking means finding right?
can someone help me?
yes?
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?
ContainerBuilder#addMediaGalleryComponents() discord.js@14.25.1
Adds media gallery components to this container.
A,ty
Or - if you want it as thumbnail - you'll use a section with accessory
It Don t work to acces the code on git hub
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
That's the signature of the method, yes... you use it the same way you use the other addX methods you already have
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.
If you need a detailed guide
Im so dumb
THis helped alot, im back to see ing normal numbers for 8k servers tyvm
| {
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
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?)
it throws when the guilds becomes available: false
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 ?
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:
- show the original event this is called from or
- 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?
welcome , autorole, autonick
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
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
console.log(guild) in there and show that log
And does that cause 0? Where did you log this (in which of your functions)?
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
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
});
},
};
Where are you registering this file?
events folder
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?
Nope
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.
It's clientReady instead of ready correct?
On more recent versions of djs, yes
But using the Enum is also even better
Oops not that one
This one
Okay
Is there docs for deploying commands?
Registering Commands
For fully functional slash commands, you need three important pieces of code:...
@torn orchid ⏫
yeah, i got it
Ok :3
Is there any event that gets triggered when a member uses the guild tag? guildMemberUpdate doesn’t seem to work for this?
Can webhooks send v2 Components?
Yes.
its userupdate
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)
nope, only 100 messages at a time
and only from the past 2 weeks
although you can delete a single message at any time
oh okay. can i do multiple bulkdelete calls then or am i going to get rate limited?
you could, but you will probably get rate limited if done too often
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)?
ok thanks ill add some cooldown then
documentation suggestion for @north vale:
ModalSubmitFields#getStringSelectValues() discord.js@14.25.1
Gets the values of a string select component given a custom id
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
idk all i hear is that its dynamic so theres no point in specifying the exact rate limits since its different for everyone
thanks, chatgpt almost tricked me
most ai arent up to date with latest updates and will hallucinate
just check the docs
the docs are the best resource for anything djs dev related
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'
}
]
}
you need to send the MessageFlags.IsComponentsV2 flag
Oh, thank you
Its giving me invalid token even tho my token is valid, someone knows this fix?
cant be other that your token is invalid. maybe show your client login code
uh, no im not showing you my token but.. i can login perfectly fine with my python enviorment.
but on js its just saying invalid..´?
NEVERMIND GUYSS
well something happen to their profile so gg
Damn...left because he probably forgot to load dotenv or add the env file flag
What version of discord js are you using
theyre gone
Lol
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
It's not documented by discord nor do we support it
Cuz someone told me that is made by tricking Discord's api
My answer remains
And ik that you need to modify the discord.js file
Ok, thanks anyways :3
Im gonna crash out im still waiting for the merge request for my language 💔
are you referring to discord.js? can you be more specific on what you're referring to?
nono the discord presence icrawl made
this is the channel for discord.js v14. if you would like to have general conversations about that, please ask in #archive-offtopic
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"
}
}
its against tos i think so i wouldnt recommend
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
How to set bot's svr avatar and banner ?
GuildMemberManager#editMe() discord.js@14.25.1
Edits the current application's guild member in a guild.
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
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)
You need to use editMe I believe
documentation suggestion for @wraith cedar:
GuildMemberManager#editMe() discord.js@14.25.1
Edits the current application's guild member in a guild.
TypeError: Cannot read properties of undefined (reading 'editMe')
guild.members.editMe() is what you used?
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
Yea I did that and it says it updated but I don't see the update
What’s ur d.js version? npm ls discord.js
14.25.1
Also make sure the url is valid
It is
If you open it up on a browser do you get the image?
Incognito browser ideally as well
Yeah
Have you also restarted your discord client? (Ctrl+R) Could he a caching issue
Been trying since yesterday
Try a different image
Could just be looking in the wrong guild
Timeout duration was set to 1.
(Use `node --trace-warnings ...` to show where the warning was created) ```
What is this?
setting a timeout for over 30 years seems a bit excessive
But I still see a lot of bots creators doing this :/
For the last time. We won't support this. Take this elsewhere, not in the support channels. This is off-topic
What channel should I use then
None on this server
Idk any other server giving this type of support
Then you know exactly 0 servers that do. We don't either. Now stop
Ok gudbai
member.user.tag is depriciated?
yes
why is it it does work at some places and some places it dosent
.replace(/{user.tag}/g, member.user.tag) should i use member.user.username now
Yes you should use usernames. Tags dont exist anymore
-# except for bot users
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
It's not deprecated. It depends on what you want it to do
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;
The guild as whole or a specific channel on the guild?
lets say channel
Because channels have overwrites, so it may differ per channel
GuildChannel#permissionsFor() discord.js@14.25.1
Gets the overall set of permissions for a member or role in this channel, taking into account channel overwrites.
PermissionsBitField#has() discord.js@14.25.1
Checks whether the bitfield has a permission, or multiple permissions.
can you explain to me what is a bitfield?
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
But for working with it in djs all you need to know is "a set of flags"
alright
btw, how much I can rely on ChatGPT?
instead of asking here newbie questions
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
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
ok, thx
if u can dm me
this is not related to d.js, please don't post questions like that here. ask their support
K
Hey, how does one set the channel status like this in Discord.js? Is it even possibe?
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
Ah okay, I found something like this online too but was skeptical, thanks for letting me know :D
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
it fetches all the threads in the channel
thank you
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?
iirc your bot needs to be verified in order to put slash commands in the bio
my bot is verified
i think most popular commands show up there once your bot is getting used
oh ok, well then idk
😑 ..
lol
question for ddevs server not djs
alright, so it's not through code right?
probably not no
alright thx
Its possible to get the content of message that contains a mention to the bot without the required message intents?
Yes. The content of the message will be included in any messages that mention the bot
Thank you
how can I check if message is sent by the bot?
message.author.bot or if your own bot message.author.id === client.user.id
User#bot discord.js@14.25.1
Whether or not the user is a bot
nice thx
TS18047: bot.user is possibly null
is that a error message? show your code
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;
}
whast bot defined as in bot.user.id?
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],
});
in that case your message.author.bot check is sufficient enough
wdym, he will ignore own messages?
the client user is a bot too. it will get ignored with that check
If client is not ready <Client>.user can be null, here it would be typed as Client<false> which means not ready. Dont use your client instance directly, most of d.js structures have client property you can access, like in your case, message.client
In places where not available, pass it around as function params
I should pass bot instance to a function?
oh wait, message.client is a reference to a bot client?
In places you don't have a means to access it, here you already pass message, which has message.client
Yes
Most of d.js structures have client property. You can check the docs to verify
awesome, that solved, thx
how can i prevent null for guildId?
safe chaining? message?.guildId
theres normally always a guildId unless youre working in dms
use an if statement to guard that it's present
ok
@bleak owl
#rules 5
sorry,
at any v14 update i can use the Media Builder
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
its not documented yet by discord and afaik not accessible via the api
😔 yeah i took a glance at djs docs
thank u
just use the latest version. assuming your referring to the media gallery component
I know you can add emojies in buttons and stuff, but is there a way to add custom emojies in dropdown menues?
theres an emoji property when setting options
documentation suggestion for @leaden wadi:
StringSelectMenuOptionBuilder#setEmoji() discord.js@14.25.1
Sets the emoji to display on this option
ty
is there a kind of input for a modal for dates / hours?
nope
ty will just make select with hours i guess
They're not actively working on one but they are aware of the request and it's being considered
allowedMentions: { repliedUser: false }
Does this make it so that when the bot explicitly mentions someone in a message, it would not send the notification?
Does timestamp in footer section of embed message work just fine?
No I don't believe so. It behaves like this button
Do you mean does it correctly show the time? Yes
Oh I see, weird, then. I will figure out why
that’s what i thought so too, i have repliedUser as false in client setting. Can you override that setting when sending a message?
yes
You can control which entities receive notifications via the allowedMentions option. You can:
- Set a default on the client
- Set for a specific message
- Use the
repliedUserkey to disable in-line reply mentions
{ ..., allowedMentions: { parse: ["users", "roles"] } }
Thanks 🙏
how can I get information about a server tag?
documentation suggestion for @versed ivy:
UserPrimaryGuild#tag discord.js@14.25.1
The user's guild tag. Limited to 4 characters
That’s for a user what I meant is for the guild itself
it's not available on the guild object
This makes no sense at all how can I see a member’s tag but not the server’s tag itself? It feels like discord is forcing you to scrape members just to get the tag manually.
ask discord ¯_(ツ)_/¯
I’m afraid that if I ask they might remove the tag option even from members
it's not on members to begin with 
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?
Not in any automatic way, but you can use it to identify things yes
ah k, is there any way to replace, for example, a specific textdisplaycomponent text with another?
when you fetch a guild member, you get their main guild from the user object
with an embed you can just invoke the set method again but with containers it just adds a new component 😅
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?
can you show the full error? also by default max value is always 1 so you dont have to specify max value 1
there is no javascript error, its discord telling me in the modal I am not allowed to submit because the field is required
thats eldritch language for the field being required
oh okay you have to setRequired to false then
StringSelectMenuBuilder#setRequired() builders@1.13.0
Sets whether this select menu is required.
oh my, is it true by default? 
that didnt even cross my mind because I just assumed you have to enforce it with true
yes by default its true
yo, how can do that?
It's an action row of buttons in a container
Yes, but it's inside the embed. What is it called?
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.
Container
Not embed
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
please read the docs you were linked
ok, thx
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
TextInputBuilder#setValue() builders@1.13.0
Sets the value for this text input.
you'd need to re-send the modal with the values filled already
oh thats clever
and also obnoxious
thanks, I think that should work out great!
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
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
I have a select field in there, can I also set that?
StringSelectMenuBuilder
nvm sorry didnt see the setOptions
Sure
might also be a better idea to just use a package that handles various date inputs until discord adds a date picker. I use https://www.npmjs.com/package/chrono-node
StringSelectMenuOptionBuilder#setDefault() builders@1.13.0
Sets whether this option is selected by default.
Set default
this doesnt exist for me on 14.25.1
oh its on the option..
hmm, how can I resend the modal?
on my "modal trigger", which is a slash command, I use interaction.showModal
for my modal handler, it tells me:
I checked interaction.reply but can't find a way to send a modal there 
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
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?
thats a thing? 👀
the latter, yeah
well if you program it
that's not a thing in djs if that's what you mean
from my understanding, which is limited of course, modals are not that interactive that I could create a preview in there 
can discord rest api create a invite link of a server?
ah no, a preview embed
you submit and the preview updates
oh I see, and I can probably send the preview as an ephermal message too
documentation suggestion for @tiny blade:
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);
clever 
so yes?
yeah
omg 15 second cooldown, pain
but I figured you wanted the how, not just yes/no
nope, just yes/no. thanks
yeah it's also helpful for the user in case there's string inputs to figure whether they like how it looks
yea thats a really cool idea, I will do that in the future
for now I landed on this

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
any of you do have knowledge about edge functions? i need a quick - fix
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
you are somewhere deferring it then
Sounds like it the interaction is being deferred. You cant defer then show a modal. Are you catching errors for this function?
ah... I was deferring it in the modal handler (so after submission) and it shows that as "I am waiting for the slash command to finish", so I was looking in the wrong place
Hello, i just converted textinputbuilder which sliced with labelbuilder, anyone knows if in LabelBuilder the description is required too?
no thats optional
k then i get an issue related to something else i guess... ill check and come back if i cant fix
thanks
might come handy https://modal.builders/?generate=djs to see if youre building it correctly
also the modal guide is now upto date
oh okay
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.
Yeah cannot find the issue
Error message linked
Code transcripted from 3 files: https://sourceb.in/b5dgiGbAbk
And where do you call showModal(...)?
const { partnershipModal } = require('../modals/partnertools.js')
interaction.showModal(partnershipModal)
forgot to link that part sorry
There is no such export in your Partnertools file
does the reload command work on Windows 11?
yeah i just checked again and found out, ill check if that was the issue lmao
That doesn't sound related to djs at all
the reload command is part of the discord.js guide
works now, so smart that i forgot to change the reference file when changing all bruh XD
thank you
Why would it not? Node.js says they are compatible with windows 11. djs is compatible with Node.js
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.
hot-esm is a package and outside the scope of djs and this channel. use #1081585952654360687 for futher question on hot loading commands
okay
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 💦
documentation suggestion for @hybrid fable:
Guild#scheduledEvents discord.js@14.25.1
A manager of the scheduled events of this guild
thanks 
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
There will be a new guide, but it is currently not written. The "legacy" guide is the current guide
so I can use it and assume im working with the most current info? Thank you!
correct
thanks a ton!
Is there a more reliable way to check for boosters?
guildMemberUpdate listener works good but it seems to miss them every now and again
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.
}
});
like the tag says it's only for new boosters, furthermore you'd need the member cached or the member partial
right i realize it only changes if the premiumSince changes but even beyond that its missing some
do you have all members cached or do you have the member partial, like I mentioned?
how would i know if i did
by checking your code?
check if you fetch all members on start or have the partial on your client constructor
no partials in the client just intents
there's the boost message, if the guild has it enabled
there's also nothing to fetch the members on startup
hmm that could work since the author of those messages is the person who boosted but it feels like a bit of a hack
also doesn't work for unboosting
you have the update event for unboosting
then most likely those misses are from uncached members
yeah that lines up with what i've seen
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
I'd just enable the partial
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.
thanks
@rose tangle do i need to fetch any members from the partials? or is just seeing if the premiumSince property is there enough
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
right but i can't just fetch every single member that triggers a guild member update
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
why did amgelo just recommend enabling partials instead then
maybe a more reliable method would be checking to see if the premiumSubscriptionCount changed and then going through premiumSubscriberRole
because you'd then have the event being emitted
which you currently don't
why would it be more reliable?
less sources for events, the guilds would always be cached
i enabled it and adjusted the code to handle partial data although it seems like typescript didn't differentiate it
maybe i did something wrong
you mean more performant then, maybe it is
though you'd still need all members cached for the role to figure who actually boosted
unless you don't want that
if i just wanted the count i'd use premiumSubscriptionCount and be on with it
can you show what you did and show what you mean?
yeah
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
}
}
the guild premiumSubscriptionCount doesnt update instantly tho iirc
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
thats fine it wouldn't have to be instant, it would probably work for other use cases
- 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
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) {
}
}
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
with the system messages channel?
yep
ill probably go with this then
maybe audit logs could work but that's another intent and more permissions
i assume new joiners are cached by the bot while its logged in?
if you have the GuildMembers intent
ah yeah
alright well ill go with the code with partials as it is right now and add fetching the guild members on startup
you can remove the partials since you'd have all data anyways
a partial member wouldn't be emitted
oh i see
also as we speak it picked up on a new booster before the system messages channel did
weird from my experience they happen at the same time
🤷♂️ they got the premium subscriber role
it is odd
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?
having multiple commands in the same file probably isn't a good idea if you want to combine it with a dynamic loader
its possible but if you wanted to do that exporting and importing the command objects for your registration script would be the way to go
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.
also djs doesn't handle command files at all
that's why the guide takes you through building such a system yourself
so it's more suited for #1081585952654360687 since it's a js question
ill figure it out eventually.
thanks anyway though, ima try to find this and read it a little closer
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.
if you're trying to get audio from youtube, that is against tos, which we will not help you with
It was specifically spotify / soundcloud I was working with
spotify doesn't allow playback from their api
Saddest news I've heard thus far. What platforms do work without going against tos ?
check soundcloud's tos, but none of this is related to discord.js, sorry
copy
Hello, question: Is it possible to know when a user's last nitro boost was?
is there any person i could pay for them to help find the issue in my code
No
I understand, thank you.
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
Wdym "put the command back"?
back to the main file
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
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
That’s absurd
Are you running off of a raspberry pi or some ancient computer?
No its a highspec PC that cost me a pretty penny
If you setup your handler correctly, you can have components and such in separate file too
obviously I didnt make this code but yeah
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
well if I had known that I would've stuck to js instead of python
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
Yikes, gl my friend
I've already learned everything about discord.py Im moving to .js since its faster and has more up to date information
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
This was as far as I got before I got lost what to do next
Should start with the command handler first
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
Yea
Pretty sure the guide starts you off like that anyways
Huh, it doesn’t
yeah thats what put me off with .js at first how it wants you to run them in different files
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"
oh yeah that is pretty simple
i'll play around with it. thnaks
This is with every single programing language nothing to do with js
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
thats pretty much what I did with python
Good for you, it isn't good practice though you should learn to organize your code
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
DJS guide is a great way to start learning this, so I suggest following the guide as it shows
The guide started off w/ the handler tho
Yeah as in if he follows it
well thanks for the help chewinky
You were the only help
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: [] });
}
in future, please also describe in what way your bot doesn't achieve what you want as well
but in this case, awaitMessageComponent only awaits 1 component interaction
each button click is a separate interaction, so you'll want to use the event based collector instead (<Message>.createMessageComponentCollector())
Sorry about that, I'll try to remember that.
I'll see if that will help, though
The old guide showed you how to use if else chain/switch with a separate section for factoring commands out into separate files
Oh, you mean old as in more than 3 years ago https://github.com/discordjs/guide/pull/1281
Yea
Guess I just called myself old
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
Because a role select can hold multiple values whereas the other fields can only have one value
what is the scope called for send you direct message permissions
hi, is there a maximum amount of components i can have in a modal?
5
damn alr
samtino what is the scope called for send you direct message permissions
Bots don't need a scope to DM
its a user install bot. no mutual servers but bot should be able to send dm
I believe so, yes. Just bring a user app should be enough
how its showing "send you direct message"
by being user-installable
user-installable apps can send dms to people that have installed it without sharing a server
@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
i know that user installed apps can dm you without any scope, im just asking how this app is showing "send you direct message" permission on authorization page while others don't?
"others don't"? yes they do
if they are user installable
and after you selected that you want it installed on your account
That's not a user-app. That's just oauth2
that's an oauth2 flow, not, yeah
im confused, then how to make a user-app?
Go to Installation. Toggle on User Install
In dev portal>your bot
both are on, only one should be ?
Depends if you want only user install or be able to install to guild too
ye both i want, and its already on
Do you want/need full OAuth2 flow too? Or why/where is that screenshot of oauth2 flow coming from?
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
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
nvm, i found the solution
thanks anyways
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 (?)
documentation suggestion for @tawny roost:
Message#fetchReference() discord.js@14.25.1
Fetches the Message this crosspost/reply/pin-add references, if available to the client
or just <Message>.reference.messageId if you only need the id
The intents limit is only for the amount of servers right, not members?
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
Thank you! 🦆
I’ve also forgotten the docs link, just got back from a break, so kinda forgot everything 😂
I just cba to move it to a team, it's for a single server but about 20k members
why the "#" dosn't work properly in embed
doesnt work in embeds
hmmm, thank you
You can use a container with components v2
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
from my understanding you have some kind of embed editor that also shows the embed in real time? just get the embed data then with interaction.message.embeds
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
you can either put it inside a cache or do your regex approach of extracting data from the embed
Inside a cache? 
You probably mean I somehow store it programmitcally with the message id or whatever snowflake and restore it from there right?
Or can i attach meta data to a message?
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
A cache like a map
alright thanks, wanted to make sure there isnt somethng I am missing that makes it cleaner
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
you still need to reply to the submit interaction
why not update the message to one without buttons, saying it succeeded
I do reply to that, but I already die because of the error on message delete
I changed the order, if the delete is after the reply it still fails
cause it's ephermal 
you should also use interaction.deleteReply() as i dont think you can reference an ephemeral message for message.delete()
(unless im confused)
what's the issue with that?
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
the "submitted" non preview version should no longer be ephermal, and afaik you can't turn an ephermal message to not being ephermal afterwards
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
looks like this for some context, so with the button I basically want to delete the ephermal message its part of:
oh 
just remove the action row... yea I can also do that as a easy solution, thanks!
but if I can't delete it, I am not sure it will let me edit it, I will give it a try
you can't use message.edit, you'd use interaction.update
you can't do much with messages from ephemeral interactions
does anyone know why presenceUpdate doesn't fire when an activity's properties changes (i.e. end timestamp)
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
I am doing a reply afterwards telling the user that it was successfull
I used the interaction.update as you suggested, and it worked, thank you!
I will try the deferUpdate and deleteReply to see if its what I was looking for
The embed is pretty big so I feel like it would be better for the user to not see it after confirming its fine
you can edit it out to the success message then
timestamp like a game activity or song?
that did exactly what I wanted it to, thank you 
but you were right, now the bot responds to a message that doesn't exist anymore, so its weird
I will use the version where I just edit out the submit button 🙏
yea a song (I'm using premid for YT Music Presence)
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?
you can also deferUpdate
god bless, I didnt see that one, thank you so much 
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
Defer doesn't block buttons, no
nope didnt block anything out of the ordinary 
so I did a deferUpdate with followUp for errors + the final success message, and did a editReply for deleting the buttons as usual 🙏
It's why the "trick" of "not having to respond" works with deferUpdate
I think I am getting the hang of interactions now thanks for the help
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.
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
for some reason the presenceUpdate event doesn't fire when I pause
I can show code
Sure
do I post a snippet directly in chat or do I upload it somewhere?
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?
you arent hitting any ratelimits by getting the data from client events
they said "get user presence", not receive
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 🤷
but having them in cache defeats entire reason they are trying to even do this workaround
I'm trying to see how often I can run guild.users.fetch(...).presence
users don't have presence
and fetching a member does not come with their presence
wait no I meant guild.members
for the precise reason presence is behind a privileged intent
I have the intent active because it's a bot that's gonna be in 1 server and only fetching my presence
that doesn't change the fact that it's behind and intent
for cached members in djs presence doesnt update?
that only changes that you are free to enable it, it doesn't change how API works for you
what would update if nothign would get fetched
if they would just be taken from cache
wym?
presence is tied to gateway
you can't just HTTP GET member's presence
i might be misunderstanding you but to see if a members is offline/online etc i dont have to fetch them again
you can't even do that if you wanted, as i already said. you only know if thye are online or not because their presence came to you one way or another via any gateway events
this is my own websocket in which the 'presenceUpdate' and it gets sent to the websocket
okay, let's back it up a bit because now you're mixing your stuff into what discord does or sends
so a cached member does get their presence updated if i have the gateway event?
it might even get cached with the event, if discord happens to send enough data with the presence update
and you have partials enabled
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
Is the event not running at all?
the event runs for everything but when the start and end timestamps change for some reason
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?
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!
Ty 🤝🏼
need 14.24.0 at least...but you should use @latest
Wait, is it possible to display an image in a modal?
no i dont believe so
only accept file uploads
ya no it is not
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.
advaith pls fix
turns out there was a little tweaking I needed to do with PreMiD's youtube music presence config in order to make it work properly. Thanks all who extended help
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
no
I think you can get a preview. IDK if bots can use the route
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.
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.
documentation suggestion for @main mason:
Message#interactionMetadata discord.js@14.25.1
Partial data of the interaction that this message is a result of
(more specifically MessageInteractionMetadata.user)
tysm!

They can
Client#fetchGuildPreview() discord.js@14.25.1
Obtains a guild preview from Discord, available for all guilds the bot is in and all Discoverable guilds.
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?
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 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?
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.
which one is common/better way?
i guess bot?
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.
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
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.
no? we can do store all logic of buttons interaction in bot?
Okay I have no idea what your question is, sorry
no problem, thanks anyways
Obviously the bot needs to handle interactions with Discord. I'm saying that for you to be able to have your bot do something from a website, you need that internal communication.
Either through a HTTP API or some kind of message queue
Click the link in the guide post I sent. That explains everything
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?
you should only receive events after the client is ready
And most of these events have a way of giving you ClientUser without passing client in the event handler, invite.client guild.client etc
hm, that's a good idea actually... some of this code is really old and possibly uninformed
The only events that could emit before client is ready are shardX events like shardReady
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?
specify guild context only when deploying and use the inCachedGuild typeguard if using ts
CommandInteraction#inCachedGuild() discord.js@14.25.1
Indicates whether this interaction is received from a cached guild.
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?
If there is no bot user in that guild (app invited without bot scope) or you don't login with Guilds intent
Thank you. That's not something I'm supporting right now so it's probably safe to just assert otherwise.
Don't assert. Use the inCachedGuild() method to check and not do what you're supposed to do if it's false
well that's an assertion
that one change (along with a corresponding update to a custom type) eliminated at least 20 errors xD
Okay, another similar one 😅 when can the channel property of a chatinputcommand (now with cached guild) be null?
Don't think it should be null, if you hover over the ChatInputCommandInteraction object does it show <"cached">
seems like this is an inherited property
what is interaction typed as?
inb4 latest discord.js (14.25.1)
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...
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 ^^
wrong server
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?
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
what is the usage of setId in ButtonBuilder?
for internal usage, like a note
can we pass the data in it?
yh you can set any string in it iirc
BaseSelectMenuBuilder#setId() discord.js@14.25.1
Sets the id (not the custom id) for this component.
nvm only supports number
so is that number accessed while managing interaction?
yes you will receive the id with interaction
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?
the deprecation warning should be telling you the alternative
ModalBuilder#addLabelComponents() builders@1.13.0
Adds label components to this modal.
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?
do you have the GuildMembers intent in your client and enabled in the dev portal?
do you have correct intent
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
any errors?
I don't see any :*(
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
place the console log and see if youre receiving the event
yeah but I already have a trycatch with a console.error in the code above guys
the try catch won't do anything if the code isn't even executing
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
what is config.visitorRole?
thats irrelevant
its a roleID coming from a config object
it would throw error if that id isnt correct
will test
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?
yes
I have confirmed the role ID exists and matches my config
so you placed the console log in the code snippet you showed and it logged on member join?
yes exactly it logged my user ID and username
place another console log right after adding role
adding the console log fixed it
could it have been a race condition?
I have never seen adding a console log change logic
are you sure you didnt change anything else?
I swear I didn't lol I will show you git commits
anyways, I am sorry for wasting your time
no i dont have to see it but you wont know what fixed it now
thank you so much for helping me out
do intents maybe take some time to propagate?
no, that's not how intents work
the code was probably not properly saved imo
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?
you can just get the option
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:...
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
Oh, didn't know that was possible. That's neat
That's pretty unfortunate, but it's better than nothing
guy asking me this, have guild tags been implemented by the api / by the library yet and if so what property are they
User#primaryGuild discord.js@14.25.1
The primary guild of the user
documentation suggestion for @vast bloom:
User#primaryGuild discord.js@14.25.1
The primary guild of the user
oop you got it twice 
ty
For the new Continer using when doing it in json is the thumbnail the same then? or how would add an thumbnail
could you elaborate on what you mean with "is the thumbnail the same then"
the same as what?
guide suggestion for @steel bronze:
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.
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
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
thanks
also maybe this is something you guys wanna fix
The undefined
yeah that's a known issue, only happens in the unversioned docs iirc
i assume this is a discord issue? (launching activity) never had this
Yea
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 🤔
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
Okay good to know. Sounds like it generally won't be an issue then because it checks cache first 👍
Is there any way to check a user's guild tag?
documentation suggestion for @coarse storm:
User#primaryGuild discord.js@14.25.1
The primary guild of the user
that has a tag property
guys, when using channel.permissionsFor, does this also account for the permissions of the user has because of their roles?
Yes
can a bot set role icons with api?
documentation suggestion for @tiny blade:
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
so yes?
yes, you can change a roles icon
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
The fastest way to learn is by doing
hi can i get discord.js util like format the date like discord etc
ill do a v14 bot with chat but chat gbt is too dump why
time discord.js@14.25.1
Formats a date into a short date-time string.
u mean me?
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
yeah thanks
okay
Ai isnt up to date just learn by reading the docs
ah okay i dont understand the docs very complicated i think
Start with the simple guides
where?
thx 
Hi, in creating UserSelectMenuBuilder can I filter users in menu or it will show all server users?
You can set the default users to be selected in the menu, but you can't limit the users that are populated
well how can I set the default users?
documentation suggestion for @main axle:
UserSelectMenuBuilder#setDefaultUsers() builders@1.13.0
Sets default users for this auto populated select menu.
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?
What's the issue with your current code?
how can we make our bot online as mobile phone?
It's undocumented and unsupported
then how people do
Don't use maxProcessed
Dunno, we don't support it here so I've never learned
by editing properties in @discordjs/ws, still its undocumented and every update will require redoing it
@polar karma want proof? wait a sec, ill show it
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)
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
max then? oh nvm, sorry im tired after work
Do we know what's the recommended size for a discord section thumbnail accessory component?
We don't because how it's displayed has nothing to do with discord.js
You could try asking in ddevs at best
when working with a presence, is there a way to get a game's largeImage even thought it's not in the asset property?
wdym with game large image?
theres the large image url
documentation suggestion for @covert shore:
RichPresenceAssets#largeImageURL() discord.js@14.25.1
Gets the URL of the large image asset
if they arent in asset property you have to know which id the large image is
so by probably saving them somewhere
yea unfortunately games like roblox and minecraft don't send assets so I was curious on how I'd get around it.
pretty sure discord uses the igdb api for games so you can maybe work through there
Is there a separator line feature in component v2 for plain text (not embed message/inline text) or is it not possible?
ContainerBuilder#addSeparatorComponents() discord.js@14.25.1
Adds separator components to this container.
if I am not wrong, container is the "embed" message in v2, no?
a container is not an embed
oh lol, I guess this YTer phrased it wrong.
it might happen to look like one, but beyond the background and ability to set color stripe, it's completely different
Can we make containers have colors?
Like that vertical colored line at embeds
yes
ContainerBuilder#setAccentColor() discord.js@14.25.1
Sets the accent color of this container.
i understand nothing from this files
what are you confused about?
Like,is it
.setAccentColor("color: blue");```
Or?
not exactly
you'll need to pass a number
or you can use
Hex?
you could use a hex, but you need to use resolveColor(hex) to make it into a number
is there a reason djs doesnt do resolvecolor on hex strings for containers but they do for embeds?
So,it is
.setAccentColor("color : 0x3498db");```
?
no, you don't use color:
Arh
accent color takes a number or RGBTuple which is listed in the discord docs
embeds do too? but djs alreadys transform hex strings to integers for embeds
embeds accept a ColorResolvable, containers do not
Because EmbedBuilder in v14 is an extension of the EmbedBuilder from @discordjs/builders to add additional resolving capabilities in d.js land. containers however are not - they’re just directly re-exported with no extension which as far as I remember is for simplicity purposes within the library
hm alright
The new components V2 are so complicated
not really, it's pretty well explained in the guide
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
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
Ah,so its without color and ""
Yeh,i am trying to learn better and better
Hi! Is discord API in down?
Yes there are currently some issues going on https://discordstatus.com/
hi is there a way on how i do it on CV2?
https://discord.com/channels/222078108977594368/1451837674725052416
No need to cross-post/advertise help question. I do check the forum channel too
thanks
How are named that bars where are multiple variants and you choose one of them?
Need more context than that. Show screenshot
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:...
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...
Like that is named?I though is holding bar or smth
There we go
Select menu
Ty
For slash command choices, is it possible to implement multi-select?
no use a string select menu
Learn more about Node.js:
Events > Upcoming Nodejs Meetings
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?
anyone do have idea what things a verification bot checks in their site when we are verfiying in a server?
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
Just those two intents? No Guilds, no GuildMessages, no others?
And what makeCache or sweepers settings do you have exactly?
I dont have any makeCache but a few days back I added message sweepers but I don't see any difference
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? 
never had to deal with that data type
theyre too big too be considered integers, they should be handled as string
alright thanks
A lifetime of 0 means you won't sweep anything... what are you doing with messages in your code? Do you use any cache at all, if not you could disable it with makeCache instead
Okay I'll try thanks
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
documentation suggestion for @sleek mural:
ChatInputCommandInteraction#editReply() discord.js@14.25.1
Edits a reply to this interaction.
// Edit the initial reply to this interaction
interaction.editReply('New content')
.then(console.log)
.catch(console.error);
It was interaction.update() that I was looking for, thanks for the help tho, I might of not explained well what I wanted
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
Alright, thanks
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.
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
thx
There is at least one number that is forbidden in channel names because it's associated with fashism... common issue for ticket bots that need to skip that one number
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?
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 ?
The only way ur hitting that rate limit is by removing all commands and re-adding them
You should just be setting them
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 ?
No
Smth is off if ur hitting 200 new commands (distinguished by name) per day
Are you constantly changing command names?
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 ?
That could mean anything
I don’t think that’s from d.js tho
The error was in my discord client
Show the entire error
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
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
I'll change that yeah
All of the details the error prints out
I mean the other one
Related to the message I got in my discord client ?
You mean the discord app?
Yeah actually I got that message in the discord app
That’s not related to your bot
You’re doing smth too many times too fast in the app
Maybe clicking on a button or something
Yea
But weirdly using the /ping command didnt work either after this
What shows up in the app when you run it?
And console, if anything
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
Could be
If they did, then the bot shouldn’t be receiving anything
When hosting my bot should I have a separate script to deploy my commands on a guild ?
Yea
Thanks for your advices.
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);
it will check cache first
thanks
also for type guard use BaseChannel#isTextBased() instead of as TextChannel
thanks, I skipped it here cause there is a lot of contracts before, so I wanted to safe 3 lines of code by doing this
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
GuildMemberManager#editMe() discord.js@14.25.1
Edits the current application's guild member in a guild.
@dusky storm guild.members.editMe()
I don't see editMe
whats your djs version?
Just a sec im trying to update it
That was added in 14.23.0 so you'll need at least that version but should use latest
There we go I needed to update it
what do I need to pass for the avatar image?
i dont know for certain as I haven't used it but most likely an AttachmentBuilder
The docs can be clicked through and it will tell you what it accepts
How do i set it back to default so the stuff of the actual bot
avatar: null should clear it
How do I find out who banned someone without fetching from audit log?
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
So if I am making an antinuke, where it kicks if they ban over 10 people in 5 minutes and someone bans like 11 people in 1 second, will I be fetching auditlog 10 times in 1 second to find who it is and ban them, allowing them to possibly ban more people?
Or is there a auditlog event that I can listen for?
Is it possible to disable (hide) specific global slash command on specific server?
you would just use guild commands in that case
i am afraid of ratelimits actually
i want to add ability for guild owners to disable specific bot commands on their server
they can hide command by removing everyone view permission for a slash command but admins will still be able to see
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
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.
so I should use deferUpdate() and editReply()?
yes i believe so... but i would test it to make sure
yes, tysm!
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
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
Discord never put/documented it there
So not much you can do about it
yup. looks like it isn't, but is there a way to access with the rest api?
It isn't documented but all uou need is the guild id to see if a user has that tag
yup I know, but I wanted to get it directly from the guild not from a member
Not much more to say than too bad
It's not there, nothing we can do about it, ask discord to add it there
can i make a form and look for a dev?
