#djs-help-v14
78874 messages · Page 20 of 79
I create the attachment like this from imageBuffer
const attachment = new AttachmentBuilder(imageBuffer, { name: "result.png" });
Ah. If you're embeding it in the same message it won't show up in attachments. Not sure the cleanest way to check for it
I thought it was just message.embeds that were updated in
I cant find the solution on the internet, do you know where to look?
anyone know how i can put fields like this in a container?
You can get it from the embed thumbnail at least. Embed.thumbnail.url
Maybe it should be but I don't see it either. Edit: It isn't in the message returned by REST so I assume it's intentional
fields don't exist in containers
i use .setImage(attachment://result.png)
after doing const attachment = new AttachmentBuilder(imageBuffer, { name: "result.png" });
can fields be remade in a similar way? I need to stack text top to bottom then do that 3 times next to eachother
Then the URL from the image
No, there's no component in containers that allows for inline text like fields
documentation suggestion for @keen phoenix:
Embed discord.js@14.19.3
Represents an embed.
damn thats sad
embeds still exist
containers are just a new way of using components
yea but if i need fields that basically means this new update doesnt provide anything I can use right
or is there some way i can use embeds with the new containers
of course it does, just not fields, authors, footers
embeds and containers are not the same
and cannot be used together
Apparently Discord only provides the filename and description of attachment for withResponse
but lets say I want to make something like this. Since this embed basically relies entirely on fields I dont really think I can do anything new with the containers v2
@keen phoenix so call interaction.fetchReply() manually if you really need the attachments
you won't be able to have them separated like that in a container, but you can use separators which are horizontal and make your data horizontal as well
the url is just for discord to understand which file I mean, it wont work in the browser. I need to add a downloda button to my embed that downloads the attachment
same thing
attachments: 0 in what .fetchReply() returns
I don't understand, what does the browser have to do with it?
the url should be in the image regardless of the platform
fetchReply is what d.js used to do
I think they might be trying to generate a new URL for an expired attachment link by putting it in an embed?
If it’s expired, the image wouldn’t be fetchable in the first place
Even if it was gonna expire, why send another message when you can just refetch the original message?
iirc fetching the message always returns a non expired url either way
unless it's from an ephemeral message
If you have an expired attachment but not the original message you can put it in an embed to view it inside the discord client
you sure? because since it's expired it should be completely useless
If you use a url as an attachment, d.js fetches it and sends the file alongside the json payload
I thought I was sure but I'm going to double check... I thought I still had some expired URLs being used as assets in embeds. That's not re-sending them each time though
You think they are using expired links in the embed itself?
That was my guess based on the URL not working in browser and needing a "download" button for something anyone could just click
@stable sun@hallow mesa@rose tangle All I'm trying to do is send an image inside an embed and also provided a download button
where does the image come from?
I generate it
That download button won’t work forever unless you link it outside of Discord
send the embed and edit it later with the discord url
Attachment urls have expiry time
because you can't have the url before uploading it
thats okay I just need it to work for a while
also this
Yeah, but I could just get the url discord gives it and then update the button to point to that..
yeah, that's what I'm suggesting
But yeah if I wasnt so ... I should've given up much earlier and just I shoulve just looked up how to host a file server
though I'm pretty sure all clients have a button to download
URL buttons don’t trigger interactions
pretty sure they meant to update after replying, not on another interaction
Unless ur gonna setup a webserver that fetches the message
Oh
Yeah, I found out you cant have the url before sending the image
So I would like to send the embed with the image... get the image url update the button to point to it
and what's the issue?
I cant find the attachment url anywhere
The attachment isn’t included in the returned message
I tried .fetchReply, includeResponse...
isn't it on embeds[0].image.url or something like that?
That’s the attachment scheme
hmm makes sense ig
They’re attaching an image file that’s used in the embed
maybe ask in ddevs if nobody here has a clue
Can you show the code with the fetchReply?
yeah
const reply = await interaction.reply({
embeds: [responseEmbed],
files: [attachment],
components: [row.toJSON()],
});
console.log(reply)
const resp = await interaction.fetchReply()
console.log(resp)
attachments are always an empty Collection
Can you comment out the log for reply?
I use this to be sure
Log resp.attachments
what does image.proxyUrl say?
if present anyways
Message.attachments field should always be present, never undefined
I'm talking about image.proxyUrl
I said it was an empty array
since it's marked as optional
But ur search bar shows 0 results
Yeah my bad, I ran clear
Which image do you mean?
Does the attachment get returned if you exclude the embeds & components in your reply?
embeds[0].image
It will return this, thats not a real url it needs to be uploaded first
so both url and proxyUrl say that?
Where do you get the embeds?
message.embeds
Yes it does
Sounds like Discord just stores it on the message differently if its used in an embed/component then. I'd try resp.embeds[0].image then like Amgelo suggested
That's with you re-adding the embed & components into the message, right?
Such a weird issue
Embed is edited in
did you undo this
ah, then after the edit
🥶
though this shows the embed in the first reply?
I'm confusion
That worked damn, I checked the returns a few times but I guess I relied on searching for attachments too much
which one is the url? for future reference
.url or .proxyUrl?
I would assume both
Yep. Thanks so much guys
Since that's the data Discord is giving back. The attachment schema should only be for uploading the attachment
Afterwards Discord places the actual attachment URL(s) into their respective fields (url & proxyUrl)
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName("membercount")
.setDescription("Shows the total members, online members, and server boosts."),
async execute(interaction) {
await interaction.deferReply({ ephemeral: true });
const guild = interaction.guild;
const guildName = interaction.guild.name;
const guildIcon = guild.iconURL({ dynamic: true });
const totalMembers = guild.memberCount;
const boostCount = guild.premiumSubscriptionCount;
const boostTier = guild.premiumTier;
const embed = new EmbedBuilder()
.setAuthor({
name: `${guildName}`,
iconURL: guildIcon,
})
.setColor("#2b2d31")
.addFields(
{ name: "Member Count", value: `${totalMembers}`, inline: true },
{ name: "Online Members", value: `${onlineMembers}`, inline: true },
{ name: "Server Boosts", value: `${boostCount} (Level ${boostTier})`, inline: true })
await interaction.editReply({ embeds: [embed]});
},
};```
/membercount isnt popping up when i refresh discord
Did you run your command registration script again?
yes
Are you deploying your commands globally or to a specific guild?
also, this is unrelated but those are sync actions, fast enough to not require a defer
oh alr
globally
Thanks a lot. @rose tangle@clear garnet@stable sun
Run console.log(await client.application.commands.fetch()) in your ready event and see if the command shows up in that Collection
it doesnt
Then it sounds like your commands didn't actually get registered
how do i register?
If you're following our guide, it would be the deploy-commands.js file
alright what now?
whats the doc
Do you not have a command deployment/registration script?
I have a RegisterCommands.js but i dont think script
Creating Your Bot: Registering slash commands
read more
Sorry, I got pulled away for work. What I am able to do is take an expired link that doesn't work in-browser and put it as the image in an embed (not using attachments://) and it previews fine. You can then click the image to generate a new link that can be shared outside of Discord (until that one new expires)
const reply = await interaction.reply({
embeds: [new EmbedBuilder().setThumbnail(expired)],
});```
Where expired is `https://cdn.discordapp.com/attachments/942902871974895667/1095746625189716008/1036765044081426483.png?ex=66915911&is=66900791&hm=390a6929786533a01e8e5a0f311cdb7facb9d19bf7925590cb0d33d74bbb0cd1&`
maybe since the client is authenticated it's able to get a refreshed url and use that instead of the "real" one
that's my best guess
Yeah something like that. And if you fetch the message and check the embed, it has a different expiration timestamp than the expired one I provided. Edit: Or maybe just Discord replacing any expired URLs it receives with new ones 🤷
It keeps saying "Loaded 0 buttons" even though I have one.
"loading" buttons sounds like a custom button handler...without seeing you're code, that's meaningless to us
what code would you need to see
I have no idea. Whatever code "loads" your buttons
Again, DiscordJS doesn't have anything like that, so I have no idea where to even begin to help you
alr
alr nvm then
Hi guys, I'm working with fetchAuditLogs() to do kick/leave logs and I ran into a problem.
I tried kicking the member first and it works, then I try to leave the server normally but it says as if it was kicked like the first time, why?
if i remember right leaving doesn't trigger an audit log entry, so you are probably just reading the kick entry from the previous test
Just as i thought, can i solve this somehow?
Narrow it to a certain time frame relative to when the leave event was emitted, as well as the user in question if you haven't already
I will try it out, thanks to both of you for the help 
is there any way to know approximately how many messages there are in a channel?
not reliably
Is there any way to get the NATIVE NAMEs from https://discord.com/developers/docs/reference#locales instead of LANGUAGE NAME like I get from const { Locale } = require( 'discord-api-types/v10' );?
I'm not sure if there's a built in way, but since every option is already visible, you can make your own Map/Collection using the locale as the key
Maybe I can just pass all the codes through https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames#language_display_names?
Anything special I should know about RoleSelectMenuBuilder? I've got channel selects working fine but no matter what I do I cannot get the role selector to pick roles even on a base testing command
what seems to be the problem
Interaction failed no matter what I do.
const { SlashCommandBuilder, ActionRowBuilder, RoleSelectMenuBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('testroleselect')
.setDescription('Test role select menu'),
async execute(interaction) {
const roleSelect = new RoleSelectMenuBuilder()
.setCustomId('test-role-select')
.setPlaceholder('Select roles')
.setMinValues(1)
.setMaxValues(5);
const row = new ActionRowBuilder().addComponents(roleSelect);
await interaction.reply({
components: [row],
content: 'Test role select menu below:'
});
},
async select(interaction) {
console.log('[testroleselect] customId:', interaction.customId);
console.log('[testroleselect] incoming values:', interaction.values);
await interaction.update({
components: [],
content: `You selected roles: ${interaction.values.join(', ')}`
});
}
};
No logs from anything too so unsure what's wrong.
What is this select function? Is this part of your interaction handler that's running this? What's the logic (your code, not your thought process, just to be clear) behind that?
Aka, show us your Client#on("interactionCreate")
Is it possible to query a CategoryChannel to see how many channels are in this category?
documentation suggestion for @verbal plinth:
CategoryChannel#children discord.js@14.19.3
A manager of the channels belonging to this category
https://discord.js.org/docs/packages/discord.js/14.19.3 next time always keep a browser tab open at this location and navigate around whenever you have problems
I just didn't know that children were the channel inside. Sorry.
brother, excuse me, it has a whole description there.
function activityPresenceTHING() {
async function updatePresence() {
const uptime = process.uptime();
const used = process.memoryUsage().heapUsed / 1024 / 1024;
const presence = [
{
status: 'online',
name: `Uptime: ${formatUptime(parseInt(uptime, 10))}`,
type: ActivityType.Custom,
nextDelay: 7500
},
{
status: 'online',
name: `Memory Usage: ${used.toFixed(2)} MB`,
type: ActivityType.Custom,
nextDelay: 7500
},
{
status: 'online',
name: `Shard ID: ${bot.shard.ids[0]}`,
type: ActivityType.Custom,
nextDelay: 3000
}
];
let idx = 0;
async function loopPresence() {
const current = presence[idx];
if (current) {
await bot.user.setPresence({
activities: [{ name: current.name, type: current.type }],
status: current.status
});
idx = (idx + 1) % presence.length;
setTimeout(loopPresence, current.nextDelay);
}
}
loopPresence();
}
if (bot.user) updatePresence();
}
i did that code (with a jsdoc on the presence) to make presences in ease and easier but it doesnt set it on the bot, can help me please?
ig you should put current presence outside loopPresence()
did you call activityPresenceTHING()? @trim basin
yes in the ready event
you can put console.log inside each method to log different thing, and you can tell where things fail
okay let me try
in loopPresence put
console.log(`current position ${idx} | name ${current.name} | type ${current.type} | timeout ${current.nextDelay}`)
try replacing await bot.user.setPresence({...}) to let pres = await bot.user.setPresence({...})
oh okay
and pres.then(() => {console.log("set presence success")}.catch(e => console.log(e.stack))
restart your bot, wait a few time, and show me what the console says
👍
plus ur new changed code
presence:INIT
loop:START
Unhandled Rejection!
Promise {
<rejected> TypeError: pres.then is not a function
at loopPresence (/home/befa/Documents/xxxxxxx/src/app.js:524:20)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
}
Reason: TypeError: pres.then is not a function
at loopPresence (/home/befa/Documents/xxxxxxx/src/app.js:524:20)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
dont know why
wait, try catch
juin 11 12:25:43 befaciDebian-ASUS node[44626]: presence:INIT
juin 11 12:25:43 befaciDebian-ASUS node[44626]: loop:START
juin 11 12:25:43 befaciDebian-ASUS node[44626]: loop:CHANGE = current position 1 | name Uptime: 0 days - 00:00:02 | type 4 | timeout 7500
no error @clear oar
https://pastebin.com/wyGP3GGN
what logging did you use im curius
ok revert this #djs-help-v14 message
it does this error
Use setPresence().then()
Not storing it and then trying to call it on a variable
odd. you can put #djs-help-v14 message instead of your own ples?
wait it works
ty for the help
const reply = await interaction.reply({
content: "Please select the winner",
components: [menu],
withResponse: true // updated API to use `withResponse` instead of `fetchReply`
});
const filter = (i: StringSelectMenuInteraction) => i.customId === interaction.id;
const collector = reply.createMessageComponentCollector({
componentType: ComponentType.StringSelect,
filter: filter,
time: 600_000
});
how am i supposed to create a message component collector with this withResponse option
Create it on reply.resource.message
hmm, why does it have a | null
(property) InteractionCallbackResponse.resource: InteractionCallbackResource | null
Because InteractionCallbackResponse can be created by any method responding to interactions. And showing a modal or responding to an autocomplete interaction don't create any resource
message.author
hi guy, who can help me?
are you trying to build the djs monorepo?
and how is it related to djs?
Hello! I was running the bot in the EU region and it worked normally. However, after moving it to run in the USA region, a large number of 'Unknown interaction' errors started occurring
like npm canvas, i cant, npm discord.js i cant
if you can't install any module it doesn't sound djs related then
didnt u know what's that error mean?
can you show your code that's causing the unknown interaction?
kinda, but that doesn't change my answer either way
That means your question is not related to djs. It's related to node-canvas. You can try your luck #1081585952654360687 if you want
event interactionCreate
name: "interactionCreate",
run: async (client, interaction) => {
if (interaction.isCommand()) {
const slashCommands = client.slashCommands.get(interaction.commandName);
if (!interaction.guild) return
if (!slashCommands) return client.slashCommands.delete(interaction.commandName)
try {
slashCommands.run(client, <Interaction>interaction);
} catch (error: any) {
console.error(error);
}
}
},
};
export default event;
slashcommand ping
data: {
name: "ping",
description: 'Ping',
},
run: async (client, interaction) => {
console.log(client)
await interaction.deferReply()
interaction.editReply({
embeds: [
{
description: "ping",
},
],
})
}
}
export default slashCommand;```
It happens with every command. I also tried using a prefix, and the bot reads messages very slowly.
and the full error?
also why do you defer and immediately editReply 
at handleErrors (/root/ChompuClusters/node_modules/@discordjs/rest/dist/index.js:748:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (/root/ChompuClusters/node_modules/@discordjs/rest/dist/index.js:852:23)
at async _REST.request (/root/ChompuClusters/node_modules/@discordjs/rest/dist/index.js:1293:22)
at async ChatInputCommandInteraction.deferReply (/root/ChompuClusters/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:123:22) {
requestBody: { files: undefined, json: { type: 5, data: [Object] } },
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1382350387209703547/aW50ZXJhY3Rpb246MTM4MjM1MDM4NzIwOTcwMzU0NzpKemUySnBCSEk1M2xHQTRQbFdVa0JmZzlRTnV5TVhPRXpBbDRUOERRSXNXSzZWbWNSZ05SOXdHeXhFSmp1bk1RVkRxZ1FoYzdWTDlhTlBZNE5Dcld4S3ZETjBNb0p1U1I4enF4YmhnWVlRV3JvN1l4UEVtNEZHTmsxbXR3aklCTA/callback?with_response=false'```
That sounds like your new host has a bad network connection then. Is it a dedicated host? Or a shared Hoster?
As a safeguard for long processing times
Host Hetzner 🥹
But there's nothing being processed in between. So that makes no sense or difference
Dedicated VPS with its own IP? Hetzner has many different offers I suppose
does hetzner even have usa servers?
last time I checked it only had in eu
ah, those are in the higher end
ask your support then
okay, thank you for help ❤️
Hetzner has no datacenters in USA though. You basically buy a server through Hetzner but in the end it's in another provider's datacenter and they simply resell it to you
Thank you for the information, I honestly didn’t know that 🥹 .
Hi,
How to add the "manage permissions" permission to a role ?
Thanks
Role#setPermissions() discord.js@14.19.3
Sets the permissions of the role.
// Set the permissions of the role
role.setPermissions([PermissionFlagsBits.KickMembers, PermissionFlagsBits.BanMembers])
.then(updated => console.log(`Updated permissions to ${updated.permissions.bitfield}`))
.catch(console.error);
Yes but I can't find "manage permissions" in the list 🤔
Sorry to bother you guys, I wrote this line and I'm getting an error that i've never seen before :')
const attachment = new discord.AttachmentBuilder().setName('Welcome.png').setFile(canvas.toBuffer());``````Error: the surface type is not appropriate for the operation```
how to add # Header in embed?
or some way to enlarge emoji
Embeds don't support most markdown. Best way to enlarge an emoji in an embed is attaching it as an image or thumbnail
how to add image to embed? i don't mean big image below but emoji in description or fields
You can check the ddocs here for what each role does. "Manage Permissions" isn't a thing
You don't. I would recommend checking out Components V2 if you want more control over the formatting
#announcements message
Because that's not a role permission. That's a channel override
Then how to add that to a role ?
PermissionOverwriteManager#create() discord.js@14.19.3
Creates permission overwrites for a user or role in this channel, or replaces them if already present.
// Create or Replace permission overwrites for a message author
message.channel.permissionOverwrites.create(message.author, {
SendMessages: false
})
.then(channel => console.log(channel.permissionOverwrites.cache.get(message.author.id)))
.catch(console.error);
So I absolutely have to loop through all channels if I want to add that server-wide ?
That or you use a role permission that does what you want like ManageServer
emoji zoom like this
With that being zoomed in with no other text to use as reference, that looks perfectly normal....what's your question? Or is this just a statement?
i mean if you add normal emoji the emoji will be very small but in the picture you can see it is very big
Unfortunately I don't have a choice, I've been asked to provide the ability to only give "manage permissions".
However :
export type PermissionOverwriteOptions = Partial<Record<keyof typeof PermissionFlagsBits, boolean | null>>;
```"Manage permissions" isn't in `PermissionFlagsBits` ?
^
It's probably not an Embed. It's probably a Container/TextDisplay
but when using embed command directly in discord, # header will be
whats the easiest way to support diff langs in your bot and commands
i18n
SlashCommandBuilder#setNameLocalization() discord.js@14.19.3
Sets a name localization for this command.
Ya. And that
whats does this do exactly deploy another command the same just a diff lang or adjust to the users langiage on discord
I can't find it...
Yup, as I said. It's not a role permission
Then how do I use channel.permissionOverwrites.create to add "manage permissions" ?
Because the docs says this very method uses properties of PermissionFlagsBits as well
im afraid it cant automatically detect user language on discord, but you could make a command for users to switch between languages of your bot
so what does it do then
if the users discord app is polish for example it will use the polish localization?
no, they will have to use the command to change languages manually
documentation suggestion for @steel yacht:
PermissionsBitField discord.js@14.19.3
Data structure that makes it easy to interact with a permission bitfield. All GuildMembers have a set of permissions in their guild, and each channel in the guild may also have PermissionOverwrites for the member that override their default permissions.
when this command is ran what will happen ?
The command name and description will be in their native language, but your response will always be in English
okay , so for example if my discord app on my system is polish it will show the command desc and name as polish but response will stay as english...
ChatInputCommandInteraction#locale discord.js@14.19.3
The locale of the user who invoked this interaction
You can use this to update your reply based on their locale
I get it, that's the variable type to provide the permission, but what's the actual bit field value for "manage permissions" ? It's not documented in PermissionFlagsBits
can help me please for my dashboard?
https://discord.com/channels/222078108977594368/1382390913522729030
That looks more like a Discord API question, not a DiscordJS question
oh sorry
but ty
There is none
So adding this channel permission overwrite to a role is not possible from a bot ?
A channel override and a role permission aren't the same thing. You are asking to do something impossible
Either add ManagePermissions to every channel manually, or find a role permission that fits your need
The Discord client allows giving a channel override to a role, that's what I'm trying to do from a bot, specifically the "manage permissions" override
But again, I cannot find the "manage permissions" override in this doc
The Docs I sent you was for PermissionFlagBits which is role permissions. PermissionBitField is used for channel overrides
I have followed the guide on the discord.js website, I am having trouble getting my slash commands to appear in my server
The type of PermissionBitField is :
export class PermissionsBitField extends BitField<PermissionsString, bigint>
```The type of `PermissionsString` is :
```ts
export type PermissionsString = keyof typeof PermissionFlagsBits;
```What am I missing ?
- Have you restarted your client? (Ctrl+R)
- Are you sure your deploy script worked correctly?
try ManageRoles
I have restarted multiple times, and I there is no errors
I can send the code?
Sure. Send the code
const { REST, Routes } = require('discord.js');
const { clientId, guildId, token } = require('./config.json');
const fs = require('node:fs');
const path = require('node:path');
const commands = [];
// Grab all the command folders from the commands directory you created earlier
const foldersPath = path.join(__dirname, 'commands');
const commandFolders = fs.readdirSync(foldersPath);
for (const folder of commandFolders) {
// Grab all the command files from the commands directory you created earlier
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
commands.push(command.data.toJSON());
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}
// Construct and prepare an instance of the REST module
const rest = new REST().setToken(token);
// and deploy your commands!
(async () => {
try {
console.log(`Started refreshing ${commands.length} application (/) commands.`);
// The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put(
Routes.applicationGuildCommands(clientId, guildId),
{ body: commands },
);
console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();```
Is the bot online?
yes
applicationGuildCommands
Are you sure you're using the correct guildID?
I can check again,
its the server id correct, when u right click on it?
Yes
yes, then its correct
Yes
Or you can just do applicationCommands which will deploy globally. For all servers (and user DMs)
?
Yes
Unless either of us made a typo, I'm on mobile
nope not working
Maybe its the command not the command handler
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with Pong!'),
async execute(interaction) {
await interaction.reply('Pong!');
},
};```
Does it log „successfully reloaded…“?
wdym
When you run the bot, does it log this command reload thing you call after calling rest.put()
Ahh, aight. So it doesnt
Can i see your main file?
Or in short, do you call/load your command handler somewhere somehow?
Because it doesnt really look like you do to me
You need to actually run the deployment script. Not your main file
It's a separate script for good reason
so what should I do instead?
the index.js?
Run the file you shared with node filename.js
A permission overwrite doesn't have an ID ?
Always did it in one 🥴
Running my bot always reloads the commands
Is there a way I can make it eaiser?
Depends on how often you reload the commands. You could get rate limited
ah, ill keep it as that for now but it is working!
Yesn't. It's associated to the role or user id it applies to
Then how do I check whether a role has permission overwrites in a channel, then create or update depending on that ?
Basically I see there's an upsert method but private, so how do I replicate an upsert behavior ?
PermissionOverwriteManager#create() discord.js@14.19.3
Creates permission overwrites for a user or role in this channel, or replaces them if already present.
// Create or Replace permission overwrites for a message author
message.channel.permissionOverwrites.create(message.author, {
SendMessages: false
})
.then(channel => console.log(channel.permissionOverwrites.cache.get(message.author.id)))
.catch(console.error);
Oh so it does "upsert"
If you want to only change a single permission on top of what might already be there: get from cache by id and if it exists add your change with edit
PermissionOverwriteManager#edit() discord.js@14.19.3
Edits permission overwrites for a user or role in this channel, or creates an entry if not already present.
// Edit or Create permission overwrites for a message author
message.channel.permissionOverwrites.edit(message.author, {
SendMessages: false
})
.then(channel => console.log(channel.permissionOverwrites.cache.get(message.author.id)))
.catch(console.error);
So partial upsert
This would be upsert rather, create is insertOrReplace
Hmm, I see, thanks
is it possible, for buttons to only be seen by people with a certain role?
no, if the user can see the message they can use the button
alright,ty
no
the most you can do is set a min and max length when building
How can I make my own using discord.js?
Your own what?
My bot own server
bots can't make guilds any more due to a recent change
That guild will soon automatically be transferred to the bot owner (July 15th)
O
const bannerAttatchment = new discord.AttachmentBuilder().setFile('./Images/guildtagbanner.png').setName('guildtagbanner.png');
const banner = new discord.MediaGalleryBuilder({
items: [
{
description: "guildtagbanner",
media: {
url: 'attachment://guildtagbanner.png',
},
},
],
});
container.addMediaGalleryComponents(banner);
components[0].components[1].items[0].media.url[UNFURLED_MEDIA_ITEM_REFERENCED_ATTACHMENT_NOT_FOUND]: The referenced attachment ("attachment://guildtagbanner.png") was not found```
Can someone please help me? Thank you.
are you sending the attachment in files when responding?
ah F me man XD i was using attatchments insted of files in send()
Thanks for reminding me 🤦♂️ my bad
question. in mod view u can see a users total messages etc, is it possible to get this data through api?
no
components v2 supports cotainers? (like can i put buttons in the top or middle of embend and put other text under them)
yes, you can add an action row to a container
You can try yourself at discord.builders with components v2
this is dope thx
thx
to not confuse others and yourself i'd recommend not using "embed" to describe components
the two concepts are quite disjunct from each other - despite some visual similarities
Is this yet possible in D.JS v14 or v15? Just seen it on JDA :<
yes
Oh, dope, what is that called? So I can find the docs
components
image gallery followed by a ton of sections with a button accessoire then closing out with an action row containing 3 buttons
Very interesting, will look more into it! Thank you.
how do you get the buttons like too right or on the bottom?
Is there anyway to force a bot to disconnect? (Basically, when he stops running, he stays online for a few minutes, I would like him to be immediatly offline.)
process.exit() will stop it immediately, but can't do anything about the bot showing as online in discord
Client#destroy() discord.js@14.19.3
Logs out, terminates the connection to Discord, and destroys the client.
section with a button accessory, and an action row, respectively
@loud plinth you can try this
Thanks.
How can I view new user tags through the bot?
not documented yet, so only through rest requests
How can I do this through the rest api then?
discord.js does not support features until they are officially documented.
While there might be a way for these features to work, it can change at any time without any notice
Is there a way to get the raw API object for a MessageContextMenuCommandInteraction's target message through the interactionCreate event? Or raw API messages in general without fetching them through REST?
I have a command to look at API data for messages, but I'd like to also see the undocumented properties that djs is stripping out. For messages my bot can access I'm able to fetch the raw message again through Client.rest and the channelMessages Route, but I don't think there's a way to re-fetch an interaction so for other servers I only have the djs Message object.
I figure I can set up a listener for the raw INTERACTION_CREATE event and get it from there, but I'd prefer not to unless that's the only solution.
you can fetch interaction replies, that's what fetchReply does
and no, there isn't a way to access the raw object
so you pretty much listed the only two options, either listen to raw or raw fetch
alternatively if you care much about raw data you can use /core
but depending in your bot that can be a medium or a big refactor
Ah that's what I figured. Was just hoping it was easily accessible. This was a feature I was hoping to expand on but it's not worth the effort of switching to core since I do use caches quite a bit
I'll look into how much of a pain it would be to have one command run off the raw event but it might be easier to just check the console when I need to lol
Im curious why you need raw data?
We only strip out undocumented items as far as I know
Because theyre not mapped to the structure
Just curious to check out undocumented features when they get added
Fair enough
why not just the raw fetch?
Is there a way to fetch a raw interaction? Not my reply but the one received by INTERACTION_CREATE?
ah, you want the interaction itself
Yeah
I misunderstood, thought you wanted the reply
yeah, can't fetch that
All good. It was a wordy request. For messages my bot can access I do re-fetch the target message for some extra info
ManageServer, is that a permission a GuildMember can have? Or is that only something on a role. If that makes any sense whatsoever
members and roles share the same permission enum
permissions: {
userPermissions: ["Administrator"],
botPermissions: []
},
Where permissions is
type permissions = {
userPermissions: PermissionResolvable[],
botPermissions: PermissionResolvable[]
}
Am i using the wrong one? ManageServer doesn't come up
Because it's ManageGuild
Pretty sure
Ah, that comes up. Gonna assume they are the same then ofc?
It's guild
Server is only the "human" name for a guild
Api calls them guilds
So does d.js
Guilds intent, GuildMember, message.guild
Etc
The app says the permission is ManageServer 😭, ughrr this is annoying. It's fine though, since ig most people think of it as a server not a guild (maybe?)
Again
Human facing name for api's guild is server
Yh 🙏, thanks though
Events.Raw
if (packet.t !== 'PRESENCE_UPDATE') return
you can get it here
Which is also undocumented
How is this part done?
I did content + button next to it - but no clue how to add a picture, name, and small description similar to this. :<
Documentation doesn't seem to have much on it either
IIRC, the image is actually just 4 emojis and the rest is just normal text
yea, it was 1 image at first then later it was changed to 4 emojis
@shadow tartan if you haven't seen it yet they posted the video recording of that stream, might make it easier to follow along how they built and modified that demo app
Ah, interesting, definitely have to look into that sometime then xD
Thank you both of you!
I see you aren't in the Discord Developers server, the link to the video is in their server-news channel, link to the server is in #useful-servers
not too versed in programming yet but is there any reason why i can't send v2 components/containers via channel.send?
library doesnt support it but unsure why
You can. Just make sure you're supplying the IsComponentsV2 flag
Can you show your code and the error you're getting?
Found it 🙂 https://www.youtube.com/watch?v=GVeIqO0pGE4
oh! had no idea. error:
0|index | DiscordAPIError[50035]: Invalid Form Body
0|index | components[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (1,).
You aren't passing the components v2 flag
is there somewhere in the docs i can read about it
tried passing it after you guys told me about it but still getting an error
MessageFlags#IsComponentsV2 discord.js@14.19.3
This flag is required to use new components
thanks dude
Wha
I linked to the channel because you never showed your code or how you tried passing it
Oh, they already left. Nevermind.
You can't fix stupid
for some reason my embeds keep sending twice?
Are you doing Channel#send and if you are, is there multiple processes of your bot running?
(I don't think it would happen if using interactions, since that would cause "unknown interaction" issues rather than double sending)
possibly? how do I check that
Stop your local process and see if commands still execute
im kinda new to this, how would I stop them
In your terminal, Ctrl+C force stops any current process
and js wait for it to go offline?
Yes. If doesn't, then that you're answer. The bot is running somewhere still
ok it went offline, so now start it back up with the node .
ok, i think that fixed it do i need to turn it off every time if i wanna update somthing?
Correct
So that means my guess was incorrect. Can you share your code from the "double sending" embed?
Only works on V15, right? Or does it work on the latest version of V14 as well?
Yes. You need to restart the process for any code changes to go into effect
alrigty,
v14 fully supports all documented API features
v15 is just a "dev" version and has no current plans to launch as there's no need for it at this time
is there also help for putting a bot on hosting? it may be confusing i hear
Gotya
Depends on the host. Is it a console or a full VPS. But that's not really a DJS question. You can ask in #1081585952654360687 if you have issues
im not sure ig? i js want my bot to be on full time
There's some recommended providers in #resources
There's 2 major types of hosts. A process host (like Linode) that simply just runs your bot program for you, you might get some other stuff like a small amount of storage but you don't typically get much more than just a console output. Then there's a VPS (virtual private server) which is a full desktop environment which is just like a normal computer that you have on all the time
i think i just need the one that runs it for me, cause i just want it to be up so like we can use it for moderation and such
hi
is channel.permissionOverwrites.edit
is work in last update
Good day, I wanted to know if it is possible to transmit sound to the sound panel via a button. Example: I press a button in the bot and the sound panel plays.
no
then another question, is it possible to somehow get bots to the user in which guild he is without using a selfbot
thanks for the answer
I need to get the guild tag specifically
Can you please elaborate on your question?
Are you trying to get all servers the user is in where your bot is also in?
Or are you just trying to get the user's tag?
trying to get user tag
Thats an undocumented feature, you would need to fetch the user manually through the REST API to get the tag.
Client#rest discord.js@14.19.3
The REST manager of the client
REST#get() discord.js@14.19.3
Runs a get request from the api
thanks for the answer
May I ask if awaitMessageComponent for interact is better or filter interaction from event fired is better when compare on huge amount of number await interaction from user . Sometime button_id may not included enough all data so I confuse about 2 wait of implement.
- I understand that
await...just setTimeout base on filter ofeventfired. I just don't know if it really a notice delay if huge number of user and server process
The answer is really depending on what sort of workflow you need
await is better suited to a situation where you're looking for a single button response on a specific message, like a Confirm button on a ban or something
Using filtering on an interactionCreate listener is better suited to multiple permanent buttons that you need to listen to repeatedly
what exactly is a Mentionable option in SlashCommandBuilder#addMentionableOption?
anything mentionable, roles, channels, members, etc
also emojis?
No
sad
same, is this a known issue?
NASA did block discord URLs from accessing their image URLs (possibly because there were too many requests or something)
Oh not NASA specific, any link I put in there never loads:
const __MEDIA_LINKS = new MediaGalleryBuilder()
for (let j = 0; j < 5; j++) {
if (!args[j].value.includes('.com/')) continue;
__MEDIA_LINKS.addItems(new MediaGalleryItemBuilder()
.setURL(args[j].value)
)
}
where args is any link i provide
tested w/ https:// imgur.com/gallery/baby-flamingo-tap-dancing-MfRDjx0
loads infinitely, then times out
That's not an image URL. You'd need the actual image, not a website containing the image
lame, discord embeds it just fine if it's sent as a message
Because a website url contains data to form images into embeds
is there a djs function to escape new lines?
The issue was in fetching the image NASA sends the image correctly, you working on a space related bot?
can I use discord timestamps like <t:${now}:D> in embed title? will it display?
yes
do you mean markdown?
no, new lines
DiscordJS only really has formatter functions for Discord Markdown
What new line characters are you trying to remove? Are they from an API or user input?
user input- \n
You'll probably need to create your own formatter/sanitizer
Question: if I have an embed that the bot sent with a button, and 24 hours passes by after the embed was sent. Then a community member presses that button. Will the button work?
How to send the new containers through a webhook?
yes
Same as a normal message plus withComponents: true
alright thanks
and to send the container itself as part of a components property?
Yes
Can someone take a look at #1382719473898750122
I am sorry if its against the rules to ask for it, but I am in a big hurry and I need a response time ASAP.
Is it the same with containers? I am receiving an error.
Did you add withComponents: true?
yes.
DiscordAPIError[50035]: Invalid Form Body
components[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (1,).
components[1][UNION_TYPE_CHOICES]: Value of field "type" must be one of (1,).
at handleErrors (C:\Users\Danie\Downloads\LA-TEST-NEW\node_modules\@discordjs\rest\dist\index.js:748:13)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async SequentialHandler.runRequest (C:\Users\Danie\Downloads\LA-TEST-NEW\node_modules\@discordjs\rest\dist\index.js:1149:23)
at async SequentialHandler.queueRequest (C:\Users\Danie\Downloads\LA-TEST-NEW\node_modules\@discordjs\rest\dist\index.js:980:14)
at async _REST.request (C:\Users\Danie\Downloads\LA-TEST-NEW\node_modules\@discordjs\rest\dist\index.js:1293:22)
at async Webhook.send (C:\Users\Danie\Downloads\LA-TEST-NEW\node_modules\discord.js\src\structures\Webhook.js:227:15)
This is the error
The first component is a text builder, and the second is a container
could you share your code? specifically the send line
let message;
if (element.alert_webhook && element.id !== config.guildID) {
const webhook = await client.fetchWebhook(element.alert_webhook);
console.log(components)
if (webhook)
message = webhook.send({ components: components, files: attachments ?? undefined, withComponents: true });
}
if (!message) {
message = channel.send({/*embeds: embeds,*/ components: components, files: attachments ?? undefined, flags: MessageFlags.IsComponentsV2});
}
This is the send lines. Through the bot it is sent as expected
you need to add the flag to the webhook message. it needs both withComponents and MessageFlags.IsComponentsV2
hello i have weird problem my bot working in server vps and other server not working what is the problem?
Gotta be more specific than "not working"
mean in vps server is working and the command working but in other vps server not working and the command
Not working...how
Are you getting an error in your terminal? Is the client giving any errors?
no error in the consol its showing me online
then what is "not working". we're unable to help if you don't give more information on your issue
Without any more information, I can't really offer any help.... It could be anything
there is no error in the consol that i can undrstand where is the issue
what makes you say there is an issue at all then?
because there is the same file but i use in different vps server one server is working and the other server is not
there is no error
you keep saying it is "not working" without saying what is not working. unless you actually state your issue we're done here
the command not working
Not working is meaningless. If you can't show any errors anywhere, then your guess is as good as ours
Let's say I have a container with an action row with two buttons in it. does it count as 4 components?
or at least say what you do, what you expect to happen and what happens instead
yes
I believe so
And the limit is 30 components in one message, correct?
vps server i use it the command is working in other server the command not working
You're going in circles
You already said it works in one place, and doesn't in the other
What you aren't saying is what is happening that makes you say it's not working
Is there any place I can have proof read my code? I'm new to using java script and I think it should work however, with the hourish wait for commands to go global, it would be nice to be able to have help proofreading it
There has not been an hour wait for global commands to propagate for several years now
Plus
Guild commands exist too, if you want to test them
There is no better proofreader of js than node
Alrighty, Ill try it out! Also, thanks for letting me know about not having to wait, I was told that I would have to so I just assumed 
Ok so
There is a difference between global and guild commands in context of deploying changes/new commands
but it boils down to how those new commands are delivered to your discord
Mhm. Mine has to work in DMs and thus it has to be global to my understanding
not quite
ah, well, sure
it has to be global, was thinking of something else
but
they are deployed and available immediately
what isn't there immediately, is your discord knowing that the global stuff changed
so you might still want to ctrl+r to have it load new commands
hmm ok
that's not the case for guild commands, but indeed that won't do for dms
So all I need to do is get a host for my code, run it, proofread it, go from there
Depending on the size of your bot, your commands (even global commands) should load practically instantly. You just have to reload your client for them to show up (Ctrl+R)
the size of the bot is irrelevant for that 
It's fine lol, I got they meant :)
- don't randomly ping users here (#rules 5)
- this server is english only
- this channel is for support only
doesn't exempt them from following #rules
Hi, I've been having issues with RAM because of discord.js's cache, is there a way to make discord.js cache using redis?
I am not sure, but what intents are you using? removing unused intents can lower ram usage
I'm using the two other intents except the message content intent
(roughly) how many servers are you in, how many shards are you running, and what is your memory usage
Because, no I don't believe you can use Redis for the DJS cache...you can however sweep the cache to help clean it to
where is the guide for componets v2
900 guilds, 5 shards (I think, I don't remember).
Memory usage is above average i go on some of my bots (20 servers)
More than 300MB
Here's the WIP guide page
https://deploy-preview-1620--discordjs-guide.netlify.app/
They could prob add custom cache to the main lib other than we needing to use @discordjs/core to actually implement redis :/
Just saw a forum post saying I would need to use @discordjs/core
There are more than three intents. What are all intents you use (in client options)?
thanks
Will happen in a new version, not possible in current state since it needs cache to be async, currently all cache operations are sync
Best way to reduce RAM load is limiting the intents to only those you actually need
I get an unknown interaction error and I couldn't find a solution.
Common causes of DiscordAPIError[10062]: Unknown interaction:
- Initial response took more than 3 seconds ➞ defer the response *.
- Wrong interaction object inside a collector.
- Two processes handling the same command (the first consumes the interaction, so it won't be valid for the other instance)
* Note: you cannot defer modal or autocomplete value responses
Start here
I can post the code if you can fix it.
Yes you can
I tried all of them but there was no solution
C:\Users\tribhuvan\Desktop\Bet Buddies>npm i discord.js
[..................] - idealTree:Bet Buddies: sill idealTree buildDeps```
huh?
ohk
There's currently a widespread online outage. I'm guessing Cloudflare
not just npm?
Cloudflare R2 maybe ?
I need it so much, can you help me please?
Going to also need an error...and that file is almost certainly not the problem. Your command handler is likely the one at fault
You're also welcome to ask for help, no guarantee we are able to, or even willing to find your solution.
so sad
can someone help me?
that is not discord.js related. #1081585952654360687
okay sir
When does the API usually come back online? I need an approximate or typical time?
there is no approximate
there never is
if there was it wouldnt be an outage but rather planned downtime
and this isn't the right place to ask either way
We are not Discord, just some nerds who develop Discord bots!
- /report appeals and age updates
- /howtoreport reports (harassment/hacking/spam/abuse)
- /support anything Discord related
- /billing payment/nitro
- /feedback feedback/feature requests
ok so, I already added my bot to my server, and one command works perfectly, but I added a second one, saved the code, used the "node index.js" and "nodemon" on the terminal but the 2nd command doesn't work
it doesn't even show, does someone know?
can you be more specific on "does not work"
it's a slash command, well, when I write "/" on the discord chat, it shows the 1st command, but no the 2nd
did you register it?
node deploy-commands.js? Yeah
did you restart your discord app?
ok, didn't do that one, how do I restart it?
like, restart the token?
no, your actual discord app like the one you use to message here
ohhh
ok, it works now, it was as simply as that, thanks mate
you're welcome
sometimes the cache doesn't update so restarting your app helps
I just can't seem to get it to work
and define doesnt work
wdym?
what is the current issue you are having?
what do you mean by cant get it to work
to me that means your bot is not even running
it is
then define what exactly doesnt work
what errors do you get
hosting discord.js/website locally should be enough to get docs working? official online version is having big issues rn due to cloudflare dying
CombinedError (2)
Received one or more errors
1 ExpectedValidationError > s.instance(V)
| Expected
|
| Expected:
| | [Function: ButtonBuilder]
|
| Received:
| | undefined
2 ExpectedValidationError > s.instance(V)
| Expected
|
| Expected:
| | [Function: ThumbnailBuilder]
|
| Received:
| | undefined
at _UnionValidator.handle (/home/container/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1965:23)
at _UnionValidator.parse (/home/container/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:972:90)
at SectionBuilder.toJSON (/home/container/node_modules/@discordjs/builders/dist/index.js:2169:37)
at /home/container/node_modules/@discordjs/builders/dist/index.js:1870:64
at Array.map (<anonymous>)
at ContainerBuilder.toJSON (/home/container/node_modules/@discordjs/builders/dist/index.js:1870:35)
at /home/container/index.js:15338:28
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
there we go
sections require an accessory
whether that be a button or thumbnail
you could just look at the dts file though?
should be much simpler than hosting the docs locally
Good luck doing that while npm is down. Unless you had a working clone of the monorepo before already
I added a thumbnail
didn't even think about it, ehhh, thanks
not on all sections
ooh?
line 44
with stuff separated as much as I have, no auto type-resolving on JS, meaning I have to find through d.ts manually anyway, so for that browser version seems easier :D but yea, with no npm won't be able to anyway, thanks for help
what should I do there
add an accessory
cause this new stuff confuses me
.
isn't there text there?
thats not an accessory
so it needs a button or something like that?
yes
.
what should I do if I don't want a button there
dont use a section
just add text directly to the container
alr
one sec
just this:
.addTextDisplayComponents(text => text.setContent('*Select a ticket type*'))
yes, have you tried
yes
CombinedError (2)
Received one or more errors
1 ExpectedValidationError > s.instance(V)
| Expected
|
| Expected:
| | [Function: ButtonBuilder]
|
| Received:
| | undefined
2 ExpectedValidationError > s.instance(V)
| Expected
|
| Expected:
| | [Function: ThumbnailBuilder]
|
| Received:
| | undefined
at _UnionValidator.handle (/home/container/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1965:23)
at _UnionValidator.parse (/home/container/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:972:90)
at SectionBuilder.toJSON (/home/container/node_modules/@discordjs/builders/dist/index.js:2169:37)
at /home/container/node_modules/@discordjs/builders/dist/index.js:1870:64
at Array.map (<anonymous>)
at ContainerBuilder.toJSON (/home/container/node_modules/@discordjs/builders/dist/index.js:1870:35)
at /home/container/index.js:15335:28
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
did I make the same mistake somewhere else?
yes
oops
yk where?
thats up to you to figure out
did you actually delete the section you replaced with top level text
I got the error fixed but now it says I used embed somewhere but I checked and I don't see it
are you editing a message?
embeds: []
since properties that aren't sent in the edit are kept
so you're trying to add the components, but keep the embeds, which isn't possible
thanks, let's see now
need to explicitly set the embeds as empty
I made it:
message.edit({
embeds: [],
components: [container.toJSON()],
flags: MessageFlags.IsComponentsV2
})
but I still get the same error???
which is?
also you don't need to explicitly serialize the container
you can pass it directly
but it's the same thing
I changed nothing and now it's fixed lol, maybe it didn't save properly haha
Thank you so much for your help and you too @zenith violet!
can anyone help ?
The property 'addComponents' not exist on type 'ActionRowBuilder<ButtonBuilder>'.
Can you show your code?
sure
"@discordjs/builders": "^1.11.2",
"@discordjs/rest": "^2.5.0",
"@discordjs/util": "^1.1.1",
"discord.js": "14.19.3",```
discord.js includes multiple sub-packages, installing these separately can mess with internal code:
[0;31mnpm [0;0muninstall discord-api-types @discordjs/rest @discordjs/builders
[0;34myarn [0;0mremove discord-api-types @discordjs/rest @discordjs/builders
[0;33mpnpm [0;0mremove discord-api-types @discordjs/rest @discordjs/builders
okay okay i catch so to install all at the same?
i removed and reinstaled but eq
"@discordjs/builders": "^1.11.2",
"@discordjs/rest": "^2.5.0",
"@discordjs/util": "^1.1.1",
"discord.js": "^14.19.3",```
the versions are the same
the tag doesn't tell you to install them
so?
read it
notice how the subcommands say uninstall and remove
not install
okay now understand
Installing the subpackages separately when you also have discord.js installed means you're likely to cause data structure mismatches as the format of the data might have changed between versions
ok ok
If I have a Message that I got from a MessageContextMenuCommandInteraction, how would I go about reading the content of that message if it was forwarded?
targetMessage.content just returns ''
I am trying to parse information from the text of a message by right clicking on it, and it's working fine for normal messages but I haven't been able to get it working for messages that were forwarded.
interaction.channel can be null, why is that?
Do you have the MessageContent intent?
I'm not 100% certain if even with that, if you are able to get the content of a forwarded message m
Yes. And I am able to get the content of normal messages
Do you specifically have the MessageContent intent, rather than GuildMessages
Yes. It's a user installed app, not a guild installed app, as well
Oh that's probably why. User apps need to reference messages directly to receive their content
I tried using fetchReference on the message but that returned an error as well, presumably because the bot isn't installed on the server. I didn't really expect that one to work.
I suppose the workaround is going to the origin of the message, as long as I have permission to view it. I was hoping that wouldn't be necessary but oh well.
Thanks for trying to help .
Can't I edit a container?
You could try asking in the dapi server for more questions about user installed apps
Yes you can, just like any other message. You just have to rebuild the container data to edit it (same as embeds)
I swear djs has a helper method to resolve colours, but i can't find it...
ok nvm it is resolveColor, I just couldn't see it coming up on the imports..
i got DiscordAPIError[50013]: Missing Permissions
with url: 'https://discord.com/api/v10/channels/1380198175847092334/webhooks'
how could a webhook missing permission to send message ?
What's the full error including stack
Can a section have more than one button accessory?
i’m pretty sure, yes
unless i’m mistaken which if i am, i’m sorry
no worries
You can only have one accessory(IE button) per section
Is it possible for a bot to know which user deleted a message (through the Events.messageDelete event)?
No, you'll have to check audit log https://discordjs.guide/popular-topics/audit-logs.html#who-deleted-a-message
alright, thanks!
Looks more like missing permissions to either get or create a webhook
Since there's no webhook id or token that would be required to send to one
user installed apps
failing at i.reply({components: [actrow2], embeds: [success("Success!", "This is an emerpheral message. None except you can see it. You have 15 seconds to choose your favourite user", i.user)], flags: MessageFlags.Ephemeral}).then(__ => { for a reason i cant decipher because it says it's discord.js's error (ik that's my fault)
How might I be able to have an AI run a command on my discord bot?
Easy way to get the message that came before a message in a channel? I have the Message object of one, need the one before it
What sort of command are we talking? You'd have to provide an interface for it to execute functions
You can't decipher that there are too many default values?
Use case is that I put some nicely formatted info in a message that comes before an extremely barebones poll, and need that info when the poll closes
You set the max selections to less than the number of defaults
oh? thanks
channel.messages.fetch using the before and limit options
Just any ordinary slash command. I'm using some random model I found on groqcloud which I've turned into a chat bot thing, I was hoping it could also run commands if I told it to.
Thanks mate salute
@unique shoal is it vencord btw?
it is not
bots cannot run other bot's slash commands
why ping monbrey?
oops idk
Not other bots, have a bot run it's own command, like commandkit's ai system
I have no idea how that works
Not really, since they're built for user-interaction with the Discord UI
but you can make your own code run its own functions if that's what you're asking
what the fuck is vencord?
You can execute bot functions however you like but there wont be an interaction to reply it
you can make a command that sends and receive AI reply from AI provider's API if that's what you want
how to interaction.ignore() to ignore an interaction?
you dont
respond to the user so they know it was successful
btw should the function in filter: (...) => {...} return true or false so the interaction is ignored?
The filter on a collector?
yes
true will collect it for response, false will ignore it
ok thx
btw i want to somehow make the collect thingy to display "..." until collection end instead of replying with "InTErActION fAiLED"
i.channel.createMessageComponentCollector({
time: 15000,
componentType: ComponentType.UserSelect,
filter: (i) => {i.user.id == m.author.id && i.customId == "dropdown"},
max: 1
}).on("collect", interaction => {
// interaction.deferReply() // not workin.
}).on('end', (i2) => {
if(i2.size < 1) return;
m.channel.send(i2.first()?.users?.first()?.username)
i.reply({content: "Success", flags: MessageFlags.Ephemeral})
})
Third-party client.
Man's just wants free emojis
why is this thing ignoring all interactions?
-_- so i cant use discord attachments?
Preferably not so we can actually read the code
I (and anyone else in mobile) would have to download your file and a code editor to be able to help you
you have to help us to help you
your filter doesn't return anything
since it's wrapped in {} it requires an actual return <something>
OoOoO thanks
👀 that simple thing i ignored..
In the announcement post for ^14.9.0, the entire container is highlighted due to the everyone tag, but when I try to replicate it using <@&roleid> it doesn't highlight/ping on my end, and I cannot find anything on the api/searching regarding it. I know it's probably something super simple I'm overlooking - just figured I'd pop in here to see if anyone had a quick answer.
how to undefer deferred thing? i want to make my thing "thinking" until the collection end
check your allowedMentions in your client constructor
you mean how to edit the thinking message?
if so, editReply
one updates the message, other replies
Cheers. I knew I was missing something simple.
Hello, how can i only allow a specific guild/server only have a slashcommand? For example i want the /ping slashcommand on this server/guild only. And other server cant use it.
Creating Your Bot: Registering slash commands - Guild commands
read more
Do you need GUILD_MEMBERS intents if you just want to check if a member that used a command exist/joined in a specific guild/server ?
hello why is using strings like '0099FF' as the embed color no longer supported?
The function to resolve colors only existed in d.js, not the builders subpackage. D.js added it on. You can call resolveColor("#rrggbb") if you still want to do it
No
That’s only required to fetch all members of a Guild
<3
how can you check if your bot is able to send messsages in a specific channel (that is, has the permissions to)
hey guys, quick question, so i'm brushing up on my js skills, and it is telling me about web or language, which one is more suitable?
"web or language"?
you mean web (frontend) or server (backend)?
also are you asking for learning to make djs bots?
because it isn't a djs related question but I'm trying to see the relation
documentation suggestion for @main mason:
TextChannel#permissionsFor() discord.js@14.19.3
Gets the overall set of permissions for a member or role in this channel, taking into account channel overwrites.
you'll have to focus on the server side
i'm totally new to this so idk what to do
all i'm used to is the language
pretty much they meant "that javascript that runs on web or node.js"
did components v2 get rid of setTimestamp?
components v2 are not embeds
setTimestamp for embeds still exists
ohhhhhhhh
well that kinda sucks. thanks
You can add a timestamp markdown anywhere in your container any way you like though
Guys I need help with mongoDB
Where i need to go? https://discord.com/channels/222078108977594368/1081585952654360687 here?
they didn't mention node though, they said "web or language", hence my question
what does this mean
"language" here they use is confusing, either they mean "that javascript that runs on web", and i kind of think the rest of it is "that javascript that power console.log("bye world")"
None of this is djs related, so keep it to #1081585952654360687 or #archive-offtopic
How do you make sure a mention in an embed (V2) doesn't actually cause a mention?
tag suggestion for @misty swift:
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"] } }
if bot has custom emojis in buttons or components, and channel disallows external emojis, will that prevent message from sending, throwing Missing Permissions?
no, the emoji will simply show as :name: instead of as the actual emoji
if we're talking guild emoji. application emojis are not restricted by that permission
but in buttons, will it just not show it? or it ignores perms there
Hi! does anyone have a guide for components v2? because it seems there is no guide in guide website yet
or I need to interpret the discord.js docs by myself?
there is a preview guide https://deploy-preview-1620--discordjs-guide.netlify.app/popular-topics/components-v2.html
ah, I see, thanks alot
haha, google detects this as fake
well, it is a preview. not yet merged or released. so it kinda is
why are the images so blurry 
are they?
because they are stretched to fit the screen but they only show a small portion of a screen (the component) ic
I have a command with permissions that are required to use it, I defined them like "Administrator", I check then like this
if (userPerms.length) {
if (!permissionCheck(message.member, userPerms)) {
message.member.permissions.missing()
}
}
const permissionCheck = (
member: GuildMember,
permissions: PermissionResolvable[]
) => member.permissions.any(permissions, true);
I see there's GuildMember#permissions#missing. How do I use that here to show the missing permissions? Missing takes bits: BitFieldResolvable<PermissionsString, bigint>. Do I need to construct a new bitfield?
just remove the [], an array of Permission strings is PermissionResolvable in itself
PermissionResolvable discord.js@14.19.3
Data that can be resolved to give a permission number. This can be:* A string (see Flags)* A permission number* An instance of PermissionsBitField* An Array of PermissionResolvable
Oh 💀 thanks 😭
To get the bot member it's guild.members.me. Is it null for things like user apps, no bot scope type thing? If it's null, is it safe to fetch it? Or just assume it's not available
assume its not available I think
if the guild is cached, the bot's member should be cached as well
Ok, thanks. Time to come up with some catchy message to tell the user they invited the bot wrong
You can always try to fetch it. You won't have a Guild instance at all when no bot scope or user app
It'll realistically only be null if you limited GuildMemberManager cache
Which I won't be, and I won't be doing any user app stuff either. So is it still worth fetching it?
If it would be null: sure. But that shouldn't ever happen then
Ok, I won't fetch it then
What happens when sharding if you try and fetch the bot's GuildMember? I heard with channel's i may add the channel to a shard the guild doesn't belong in or something?
Can always do await guild.members.fetchMe() which will check cache like other fetches do too first
You shouldn't have the Guild to do that with in the first place
And if you do: you already fetched something wrongly
Is it worth it? Ig this is like fetching a channel when it should already be in the cache (text channels for example)
Is what worth what?
You're running two conversations at once here
Is it worth calling .fetchMe? Since if it's null, fetching will most likely result in an error anyway. I wouldn't want to do an api request if it's most likely going to result in an error
Fetching should never result in an error. Because if you have an actual Guild instance you have a bot user in there. Otherwise you shouldn't have a Guild instance in the first place
In other words: if it errors you found an error in your code
Ah, sorry yes I understand you now. I shall fetch then 🙏. Thanks a lot
I also have a question regarding sharding. shards: "auto" uses internal sharding? Does the guide cover benefits and drawbacks of using auto vs the other form of sharding? If not is it possible to have a very quick rundown?
Hey so I seem to have an issue, but I don't know what's happening.
My bot randomly got a ConnectTimeoutError, so I assumed it was with the network of my host, then I got 3 lines of DOMException [AbortError.
I restarted my bot and it worked when I tested, but it's appearing offline to discord, and it isn't responding. There's nothing on my console. How do I debug this?
ConnectTimeout errors are network issues. Sometimes there's blips your end. Add the debug event, client.on("debug", console.log) and provide the logs.
It's possible that you hit a cloudflare ban however, if you get no logs
I see, I'll take a look, thanks!
hey does anyone know how to offline my bot
presence: {
status: "offline",
}
invisible* sorry
i ran it like how do i stop it tho(that is what i meant)
ctrl + c
does not help but okay
your going to need to elaborate. stop your bot or the status displaying?
It does if you do that in your console running it
internal sharding is easier to setup. But it runs a single process for all shards. There comes a point where that won't be fast enough to handle all your guilds in sufficient time. That's where benefit of internal sharding ends
Has anyone done any kinda, not benchmarks, but is there a number of shards where that becomes a reasonable thing to switch to? Or is it just better to switch to the other form of sharding from the get go
Thanks as well
About 10 shards (give or take)
Oh ok, that's actually a lot better then I was thinking. And these would run on worker threads which is a thread?
They can, if you configure it to
Default behavior is no threads
And if they don't use worker threads, does it spawn a new process or something?
Are we talking internal or traditional sharding now?
The one which isn't "auto", the one which doesn't run just in one process
They use child processes or worker threads, yea
Internal sharding can run worker threads for the gateway connection of the shards too though, which is why I got confused
Oh sorry, my bad. Ok that's cool. Thanks for explaining, appreciate it
stop the bot
How do you run your bot in the first place? Because gwapes told you how to stop it if run from a console
i did node index.js
and then idk how to stop it
Then use ctrl+c in that same terminal you did node
So it just happened again, the bot is offline, but nothing in the console (process is still running)
[CLIENT DEBUG]
[WS => Shard 0] Waiting for event ready for 15000ms
[CLIENT DEBUG]
[WS => Shard 0] Shard received all its guilds. Marking as fully ready.
Bot is now online!
[CLIENT DEBUG]
[WS => Shard 0] First heartbeat sent, starting to beat every 41250ms
[CLIENT DEBUG]
[WS => Shard 0] Heartbeat acknowledged, latency of 30ms.
[CLIENT DEBUG]
[WS => Shard 0] Heartbeat acknowledged, latency of 30ms.
(node:270857) ExperimentalWarning: buffer.File is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
[CLIENT DEBUG]
[WS => Shard 0] Heartbeat acknowledged, latency of 31ms.
[CLIENT DEBUG]
// more stuff of heartbeat acknowledged...
[CLIENT DEBUG]
[WS => Shard 0] Heartbeat acknowledged, latency of 33ms.
Maybe you just aren't getting any activity? It's still connected
In other words, how do you know it's offline. Just from discord?
i've ran /help, and the bot is not responding
I'm not 100% on how to debug that. Someone else, like Qjuh if he's still lurking may know more
When i initially start it, I am able to run commands, but i think after about 10 mins? maybe 15? it just goes offline
Is the bot user offline?
yeah
How did you check?
Member list
I was trying to run /commands but it is not working(it does not show on the thing)
And yet the heartbeats continue?
no, i'm not getting any new heartbeats
Is node even running then?
Have you deployed your commands to discord?
don't know how
Creating Your Bot: Registering slash commands
read more
ohhhhh, was gonna do step 3 in the guide
You have to finish the guide before any of it will work
You can't stop halfway through. Because you need each part for them to work
Yes, node is running. The bot was running perfectly fine before this, until i encountered a ConnectTimeoutError, followed with DOMException [Abort Error] 3 times. Before this was me getting Unknown Interaction and a few Invalid Form Body (i think because i was following up, and the reply was non-existent?). I restarted it, and i'm facing this issue where it works for the first 10 mins, and it dies after that
Can you show those errors then? Your initial message here suggested the heartbeats were the last logs you got
Now, yes. But the things that caused that started this (or at least i suspect) is that. I'll get the logs
yeah following it step by step
this was the initial error logs that caused my bot to be offline the first time
Then if you restart it works again for around 10 mins?
yup!
but it doesn't send an error, the node process isn't terminated, but there doesn't seem to be any new heartbeats
it could be less than 10 mins tbh, i can't really time when it goes out
could this be a cloudflare ban?
They normally last a bit longer though to my knowledge. Simply restarting and waiting ~10 mins for it to stop again seems strange. Is this a vps? Shared ips?
Cloudflare ban would cause your bot to not be able to login at all. This seems more like something in your network changed. What kind of server are you running this on?
a VPS
I don't think it's a shared IP, but i'll try to contact my host to see if there's an issue
Did you try running your bot locally and see if the issue happens there too?
no, but i can try
this might sound trivial to you, but i need help to get my bot reacting to a direct message.
i already added the GatewayIntentBits.DirectMessages but the MessageCreate event doesnt trigger on a new DM to the bot.
receiving messages in servers the bot is in, works. just not in DMs
To receive direct message events on "messageCreate" with your bot, you will need:
- The
DirectMessagesgateway intent - The
Channelpartial setting
ok missed the partials.
thanks.
/root/100/165/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1254
return errors.length === 0 ? Result.ok(transformed) : Result.err(new CombinedPropertyError(errors, this.validatorOptions));
^
CombinedPropertyError: Received one or more errors
at _ArrayValidator.handle (/root/100/165/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1254:70)
at _ArrayValidator.parse (/root/100/165/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:972:90)
at EmbedBuilder.addFields (/root/100/165/node_modules/@discordjs/builders/dist/index.js:235:31)
at ed (/root/100/165/commands/col.js:204:14)
at InteractionCollector.<anonymous> (/root/100/165/commands/col.js:77:35)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
errors: [
[
0,
CombinedPropertyError: Received one or more errors
at _ObjectValidator.handleIgnoreStrategy (/root/100/165/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:2136:70)
at _ObjectValidator.handleStrategy (/root/100/165/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1983:47)
at _ObjectValidator.handle (/root/100/165/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:2089:17)
at _ObjectValidator.run (/root/100/165/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:958:23)
at _ArrayValidator.handle (/root/100/165/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1248:37)
at _ArrayValidator.parse (/root/100/165/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:972:90)
at EmbedBuilder.addFields (/root/100/165/node_modules/@discordjs/builders/dist/index.js:235:31)
at ed (/root/100/165/commands/col.js:204:14)
at InteractionCollector.<anonymous> (/root/100/165/commands/col.js:77:35)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
errors: [ [ 'value', [ExpectedConstraintError] ] ]
}
]
]
}
on em.addFields({name:`**allowed users: **`, value:`<@${dat.users.join(">\n<@")}>`,inline:true})}
How long is the string you're passing as a value? Looks like it's way too long
The value has a max length of 1024 characters
i don't think cause usually the error will said that, but i will check
If you caught the error and logged it properly it would yes. But that looks like an uncaught exception
So I've ran it locally multiple times, and it's still online (and sending heartbeat) after some time ~ 20 mins. I assume this is my host issue then?
i had an error when i tried deploy commands.
Komutlar deploy edilirken hata oluştu:
DiscordAPIError[20012]: You are not authorized to perform this action on this application
at handleErrors (C:\Users\Administrator\Desktop\mete is coming\node_modules\@discordjs\rest\dist\index.js:748:13)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async SequentialHandler.runRequest (C:\Users\Administrator\Desktop\mete is coming\node_modules\@discordjs\rest\dist\index.js:1149:23)
at async SequentialHandler.queueRequest (C:\Users\Administrator\Desktop\mete is coming\node_modules\@discordjs\rest\dist\index.js:980:14)
at async _REST.request (C:\Users\Administrator\Desktop\mete is coming\node_modules\@discordjs\rest\dist\index.js:1293:22)
at async C:\Users\Administrator\Desktop\mete is coming\deploy-commands.js:53:22 {
requestBody: {
files: undefined,
json: [
[Object], [Object],
[Object], [Object],
[Object], [Object],
[Object], [Object],
[Object], [Object]
]
},
rawError: {
message: 'You are not authorized to perform this action on this application',
code: 20012
},
code: 20012,
status: 403,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1151501088722272357/commands'
}```
How can't i be don't authorized
Is your token valid?
yes i just created it
Then can you share your code?
deploy code? Yes ofc.
const { REST, Routes } = require('discord.js');
const { clientId, token } = require('./config.json');
const fs = require('node:fs');
const path = require('node:path');
const commands = [];
const baseCommandsPath = path.join(__dirname, 'commands', 'slash');
const commandCategories = fs.readdirSync(baseCommandsPath, { withFileTypes: true })
.filter(dirent => dirent.isDirectory())
.map(dirent => dirent.name);
for (const category of commandCategories) {
const categoryPath = path.join(baseCommandsPath, category);
const commandFiles = fs.readdirSync(categoryPath).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const filePath = path.join(categoryPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
commands.push(command.data.toJSON());
} else {
console.log(`[UYARI] ${filePath} komutunda "data" veya "execute" özelliği eksik`);
}
}
}
const rootCommandFiles = fs.readdirSync(baseCommandsPath).filter(file => file.endsWith('.js'));
for (const file of rootCommandFiles) {
const filePath = path.join(baseCommandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
commands.push(command.data.toJSON());
} else {
console.log(`[UYARI] ${filePath} komutunda "data" veya "execute" özelliği eksik`);
}
}
const rest = new REST().setToken(token);
(async () => {
try {
console.log(`Toplam ${commands.length} adet slash komutu (/) yenileniyor...`);
const data = await rest.put(
Routes.applicationCommands(clientId),
{ body: commands },
);
console.log(`Başarıyla ${data.length} adet slash komutu (/) yüklendi.`);
} catch (error) {
console.error('Komutlar deploy edilirken hata oluştu:');
console.error(error);
}
})();```
I'm guessing your clientId does not match the one for your token
Oh u are right
Because at first glance, that looks fine
i forgot change it
would it ok if i delete the code?
that's basically a copy from the guide?
yeah, i didn't meant it
Ya you can delete it, I didn't see anything wrong
Its too big and the chat looking mess because of it. If u get wrong im sorry
It'll scroll out of view soon.
Ya, it's kinda the point of this channel
guys, how many modal max i can do in discord?
DiscordAPIError[50035]: Invalid Form Body
application_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake.
guild_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake.
at handleErrors (C:\Users\Public\Documents\Discord bot\node_modules\@discordjs\rest\dist\index.js:748:13)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async SequentialHandler.runRequest (C:\Users\Public\Documents\Discord bot\node_modules\@discordjs\rest\dist\inde
x.js:1149:23)
at async SequentialHandler.queueRequest (C:\Users\Public\Documents\Discord bot\node_modules\@discordjs\rest\dist\in
dex.js:980:14)
at async _REST.request (C:\Users\Public\Documents\Discord bot\node_modules\@discordjs\rest\dist\index.js:1293:22)
at async C:\Users\Public\Documents\Discord bot\deploy-commands.js:37:16 {
requestBody: { files: undefined, json: [ [Object], [Object], [Object] ] },
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: { application_id: [Object], guild_id: [Object] }
},
code: 50035,
status: 400,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/undefined/guilds/undefined/commands'
}
Idk if this error is common or not( this is for regsitering slash commands
show deploy commands
K
const { clientId, guildId, token } = require('./config.json');
const fs = require('node:fs');
const path = require('node:path');
const commands = [];
// Grab all the command folders from the commands directory you created earlier
const foldersPath = path.join(__dirname, 'commands');
const commandFolders = fs.readdirSync(foldersPath);
for (const folder of commandFolders) {
// Grab all the command files from the commands directory you created earlier
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
commands.push(command.data.toJSON());
}
else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}
// Construct and prepare an instance of the REST module
const rest = new REST().setToken(token);
// and deploy your commands!
(async () => {
try {
console.log(`Started refreshing ${commands.length} application (/) commands.`);
// The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put(
Routes.applicationGuildCommands(clientId, guildId),
{ body: commands },
);
console.log(`Successfully reloaded ${data.length} application (/) commands.`);
}
catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();
bro can u do screen?
i dont know where's 37 line
k
What does this mean?
lemme scrn shot
like modals
No, that part I get...but max what? Modals themselves or inputs in the modal?
modals themselves
before was only 5 modals, can u do more?
It's not 5 modals. It's 5 inputs in a modal. There is no max for modals
Modals are components, so it doesn't get stored anywhere, it is identified by the customID
Is that ur code? or u get it somewhere
oh, okay tank you sir
that is what the thing gave me as a test and i'm learning how to set it up
Do you actually have clientId and guildId defined in your config.json?
yeah
i think u need do client id and guild id
Add a console.log for clientId and guildId because it looks like they are misformed. They're objects rather than strings
console.log(cliendId)
console.log(guildId)
sorry, mb he's begginer so i did it for him
If they're beginner enough to not know how to log things to the console, they should be looking at #resources rather than this channel
i know how to log and stuff
Here's the part of the error I found that (for future reference...errors can be a pain to read)
it is giving me an undefined
Can you share the contents of your config.json without revealing your token?
undefined
undefined
k
samthino, can i make so many modules? or the bot won't start
"clientID": "1382947794087579739",
"guildID": "1380031274542174208"
}
(without token)
JavaScript is case-sensitive, guildID is not guildId, and likewise for your client ID
never noticed that(i'm stupid sometimes)
What type of components are those? Like "ranks" and "whyuwant"
works
Well that is more than 5
oh okay, so i can do only 5 ty
so i've one more question, how i can count all messages from someone user in guild
like cache messages
You can't unless you count them yourself
Which is almost guaranteed to get you rate limited
okay sir, ty so much
I know, it sucks but Discord does not expose the information from the search function or members tab to bots...would be useful tho
stand bro, fr ahahah
is anything wrong and how do i fix this:
If you have duplicate commands on your server, you registered both global and guild commands.
You can remove the duplicates by resetting either the global or guild commands
- Resetting global commands:
rest.put(Routes.applicationCommands(clientId), { body: [] }) - Resetting guild commands:
rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: [] })
what is the differnce between global and guild commands
Exactly the name . Global is for all servers and DMs
Guild commands only show up in 1 server (or whatever servers you deploy the commands to)
So having 2 of each command in your server means you deployed your commands both as global and as guild commands for that server
k
its not possible to setRoles with the RoleSelectMenuBuilder right?
correct
its possible in the api though? idk if i read it right
wondering if anyone has any workaround for setting roles that the bot can assign via the position of the role. use case: reapply roles upon reentering the server. you can select roles above the bot but then can't give them back to the person joining
You can either set the bots role no higher than any roles you don't want to assign, or you can set a blacklist/whitelist for re-assignable roles on rejoin
I'm asking if there's a way to filter roles i don't want settable in a RoleSelectMenuBuilder
There is not a way to have specific roles not visible in a role select menu. They're all visible, or you can make your own list (of up to 25) with a string select
Does the 50 requests per second rate limit include sending messages through a webhook?