#djs-help-v14

78874 messages · Page 20 of 79

keen phoenix

It does it works fine the image shows up on the embed and I can click on it and get the link

I create the attachment like this from imageBuffer
const attachment = new AttachmentBuilder(imageBuffer, { name: "result.png" });

hallow mesa
stable sun

I thought it was just message.embeds that were updated in

keen phoenix
blissful tinsel

anyone know how i can put fields like this in a container?

hallow mesa
hallow mesa
bleak owl
keen phoenix

after doing const attachment = new AttachmentBuilder(imageBuffer, { name: "result.png" });

blissful tinsel
hallow mesa
unique shoal

No, there's no component in containers that allows for inline text like fields

sharp ginkgoBOT
bleak owl

embeds still exist

containers are just a new way of using components

blissful tinsel

or is there some way i can use embeds with the new containers

bleak owl

of course it does, just not fields, authors, footers

embeds and containers are not the same

and cannot be used together

stable sun

Apparently Discord only provides the filename and description of attachment for withResponse

blissful tinsel
stable sun

@keen phoenix so call interaction.fetchReply() manually if you really need the attachments

bleak owl

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

keen phoenix
hallow mesa Then the URL from the image

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

keen phoenix

attachments: 0 in what .fetchReply() returns

rose tangle

I don't understand, what does the browser have to do with it?

the url should be in the image regardless of the platform

stable sun

fetchReply is what d.js used to do

hallow mesa

I think they might be trying to generate a new URL for an expired attachment link by putting it in an embed?

stable sun

Even if it was gonna expire, why send another message when you can just refetch the original message?

rose tangle

iirc fetching the message always returns a non expired url either way

unless it's from an ephemeral message

hallow mesa

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

rose tangle

Thonk you sure? because since it's expired it should be completely useless

stable sun

If you use a url as an attachment, d.js fetches it and sends the file alongside the json payload

hallow mesa

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

stable sun

You think they are using expired links in the embed itself?

hallow mesa

That was my guess based on the URL not working in browser and needing a "download" button for something anyone could just click

keen phoenix

@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

rose tangle

where does the image come from?

keen phoenix

I generate it

stable sun
rose tangle

send the embed and edit it later with the discord url

stable sun

Attachment urls have expiry time

rose tangle

because you can't have the url before uploading it

keen phoenix

thats okay I just need it to work for a while

rose tangle
keen phoenix

Yeah, but I could just get the url discord gives it and then update the button to point to that..

rose tangle

yeah, that's what I'm suggesting

keen phoenix

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

rose tangle

though I'm pretty sure all clients have a button to download

stable sun

URL buttons don’t trigger interactions

rose tangle

pretty sure they meant to update after replying, not on another interaction

stable sun

Unless ur gonna setup a webserver that fetches the message

Oh

keen phoenix

So I would like to send the embed with the image... get the image url update the button to point to it

rose tangle

and what's the issue?

keen phoenix

I cant find the attachment url anywhere

stable sun

The attachment isn’t included in the returned message

keen phoenix

I tried .fetchReply, includeResponse...

rose tangle

isn't it on embeds[0].image.url or something like that?

stable sun
rose tangle

hmm makes sense ig

stable sun

They’re attaching an image file that’s used in the embed

rose tangle

maybe ask in ddevs if nobody here has a clue

stable sun

Can you show the code with the fetchReply?

keen phoenix

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

stable sun

Can you comment out the log for reply?

keen phoenix

I use this to be sure

stable sun

Log resp.attachments

rose tangle

what does image.proxyUrl say?

if present anyways

stable sun

Message.attachments field should always be present, never undefined

keen phoenix
rose tangle
keen phoenix
rose tangle

since it's marked as optional

stable sun
keen phoenix
keen phoenix
clear garnet
rose tangle
keen phoenix
rose tangle

so both url and proxyUrl say that?

keen phoenix

Where do you get the embeds?

rose tangle

message.embeds

clear garnet

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

keen phoenix
clear garnet

That's with you re-adding the embed & components into the message, right?

keen phoenix

Such a weird issue

stable sun

Embed is edited in

rose tangle

ah, then after the edit

keen phoenix

🥶

rose tangle

I'm confusion

keen phoenix

That worked damn, I checked the returns a few times but I guess I relied on searching for attachments too much

rose tangle

which one is the url? for future reference

.url or .proxyUrl?

clear garnet

I would assume both

keen phoenix

Yep. Thanks so much guys

clear garnet

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)

torn orchid
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
clear garnet

Did you run your command registration script again?

torn orchid

yes

clear garnet

Are you deploying your commands globally or to a specific guild?

rose tangle
torn orchid

oh alr

globally

keen phoenix

Thanks a lot. @rose tangle@clear garnet@stable sun

clear garnet
torn orchid globally

Run console.log(await client.application.commands.fetch()) in your ready event and see if the command shows up in that Collection

clear garnet

Then it sounds like your commands didn't actually get registered

torn orchid

how do i register?

clear garnet

If you're following our guide, it would be the deploy-commands.js file

torn orchid

alright what now?

whats the doc

clear garnet

Do you not have a command deployment/registration script?

torn orchid

I have a RegisterCommands.js but i dont think script

sharp ginkgoBOT

guide Creating Your Bot: Registering slash commands
read more

hallow mesa
    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&`
rose tangle

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

hallow mesa

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 🤷

torn orchid

It keeps saying "Loaded 0 buttons" even though I have one.

topaz bluff

"loading" buttons sounds like a custom button handler...without seeing you're code, that's meaningless to us

torn orchid

what code would you need to see

topaz bluff

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

torn orchid

alr

alr nvm then

jagged shell

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?

elfin scroll
jagged shell
clear garnet

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

jagged shell

I will try it out, thanks to both of you for the help crySparkle

zealous bison

is there any way to know approximately how many messages there are in a channel?

bleak owl

not reliably

past trellis
topaz bluff

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

past trellis
vital vortex

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

bleak owl

what seems to be the problem

vital vortex

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.

clear garnet

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?

topaz bluff

Aka, show us your Client#on("interactionCreate")

verbal plinth

Is it possible to query a CategoryChannel to see how many channels are in this category?

sharp ginkgoBOT
clear oar
verbal plinth

I just didn't know that children were the channel inside. Sorry.

clear oar
trim basin
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?

clear oar

ig you should put current presence outside loopPresence()

did you call activityPresenceTHING()? @trim basin

trim basin

yes in the ready event

clear oar
trim basin

okay let me try

clear oar

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({...})

trim basin

oh okay

clear oar

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

trim basin

👍

clear oar

plus ur new changed code

trim basin
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)

https://pastebin.com/wyGP3GGN

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

clear oar
clear oar
worthy drift

Use setPresence().then()

Not storing it and then trying to call it on a variable

clear oar
trim basin

wait it works

ty for the help

drifting dirge
        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

steel trail

Create it on reply.resource.message

drifting dirge

hmm, why does it have a | null
(property) InteractionCallbackResponse.resource: InteractionCallbackResource | null

steel trail

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

unique shoal

message.author

harsh elm

hi guy, who can help me?

rose tangle

are you trying to build the djs monorepo?

harsh elm

tryin to npm i smth, but i cant

rose tangle

and how is it related to djs?

spring bramble

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

harsh elm
rose tangle

if you can't install any module it doesn't sound djs related then

harsh elm
rose tangle
rose tangle
steel trail
spring bramble
rose tangle can you show your code that's causing the unknown interaction?

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.
rose tangle

and the full error?

also why do you defer and immediately editReply Thonk

spring bramble
rose tangle and the full error?
    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'```
steel trail

That sounds like your new host has a bad network connection then. Is it a dedicated host? Or a shared Hoster?

spring bramble
steel trail

But there's nothing being processed in between. So that makes no sense or difference

steel trail
rose tangle

does hetzner even have usa servers?

last time I checked it only had in eu

spring bramble
rose tangle

ah, those are in the higher end

ask your support then

spring bramble

okay, thank you for help ❤️

steel trail

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

spring bramble
steel yacht

Hi,
How to add the "manage permissions" permission to a role ?
Thanks

sharp ginkgoBOT

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

steel yacht

Yes but I can't find "manage permissions" in the list 🤔

sage igloo

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```
flint pier

how to add # Header in embed?

or some way to enlarge emoji

topaz bluff

Embeds don't support most markdown. Best way to enlarge an emoji in an embed is attaching it as an image or thumbnail

flint pier
topaz bluff
topaz bluff
topaz bluff
steel yacht

Because that's not a role permission. That's a channel override

steel yacht

Then how to add that to a role ?

sharp ginkgoBOT

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

steel yacht

So I absolutely have to loop through all channels if I want to add that server-wide ?

topaz bluff
flint pier

emoji zoom like this

topaz bluff

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?

flint pier

i mean if you add normal emoji the emoji will be very small but in the picture you can see it is very big

steel yacht
topaz bluff
flint pier

but when using embed command directly in discord, # header will be

rancid shoal

whats the easiest way to support diff langs in your bot and commands

chrome mirage

i18n

sharp ginkgoBOT
topaz bluff
rancid shoal
chrome mirage i18n

whats does this do exactly deploy another command the same just a diff lang or adjust to the users langiage on discord

topaz bluff

Yup, as I said. It's not a role permission

steel yacht

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

chrome mirage
rancid shoal

if the users discord app is polish for example it will use the polish localization?

chrome mirage

no, they will have to use the command to change languages manually

sharp ginkgoBOT
rancid shoal
topaz bluff
rancid shoal
sharp ginkgoBOT
topaz bluff

You can use this to update your reply based on their locale

steel yacht
trim basin
topaz bluff

That looks more like a Discord API question, not a DiscordJS question

#useful-servers

trim basin

oh sorry

but ty

steel yacht

So adding this channel permission overwrite to a role is not possible from a bot ?

topaz bluff

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

steel yacht

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

topaz bluff
steel yacht

But again, I cannot find the "manage permissions" override in this doc

topaz bluff

The Docs I sent you was for PermissionFlagBits which is role permissions. PermissionBitField is used for channel overrides

tawdry hull

I have followed the guide on the discord.js website, I am having trouble getting my slash commands to appear in my server

steel yacht
topaz bluff
tawdry hull

I can send the code?

topaz bluff

Sure. Send the code

tawdry hull

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);
    }
})();```
worthy drift

Is the bot online?

tawdry hull
topaz bluff

applicationGuildCommands

Are you sure you're using the correct guildID?

tawdry hull

I can check again,

its the server id correct, when u right click on it?

worthy drift

Yes

tawdry hull

yes, then its correct

topaz bluff
topaz bluff

Yes

Unless either of us made a typo, I'm on mobile

tawdry hull

nope not working

worthy drift

Maybe its the command not the command handler

tawdry hull
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('ping')
        .setDescription('Replies with Pong!'),
    async execute(interaction) {
        await interaction.reply('Pong!');
    },
};```
worthy drift

Does it log „successfully reloaded…“?

tawdry hull
worthy drift

When you run the bot, does it log this command reload thing you call after calling rest.put()

worthy drift

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

steel trail

You need to actually run the deployment script. Not your main file

It's a separate script for good reason

tawdry hull
worthy drift
steel yacht

A permission overwrite doesn't have an ID ?

worthy drift
tawdry hull
worthy drift

Depends on how often you reload the commands. You could get rate limited

tawdry hull
steel trail
steel yacht

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 ?

sharp ginkgoBOT

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

steel yacht

Oh so it does "upsert"

steel trail

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

sharp ginkgoBOT

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

steel yacht

So partial upsert

steel trail

This would be upsert rather, create is insertOrReplace

steel yacht

Hmm, I see, thanks

tawdry hull

is it possible, for buttons to only be seen by people with a certain role?

wary coral
vital barn

no

the most you can do is set a min and max length when building

lavish cedar

How can I make my own using discord.js?

steel trail

Your own what?

lavish cedar
polar karma

bots can't make guilds any more due to a recent change

steel trail
lavish cedar

O

polar karma
sage igloo
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.
zenith violet

are you sending the attachment in files when responding?

sage igloo

ah F me man XD i was using attatchments insted of files in send()

Thanks for reminding me 🤦‍♂️ my bad

tardy sable

question. in mod view u can see a users total messages etc, is it possible to get this data through api?

polar karma

no

vivid gorge

components v2 supports cotainers? (like can i put buttons in the top or middle of embend and put other text under them)

wary coral
worthy drift

You can try yourself at discord.builders with components v2

vivid gorge
crimson gale
shadow tartan

Is this yet possible in D.JS v14 or v15? Just seen it on JDA :<

crimson gale

yes

shadow tartan

Oh, dope, what is that called? So I can find the docs

crimson gale

components

image gallery followed by a ton of sections with a button accessoire then closing out with an action row containing 3 buttons

shadow tartan

Very interesting, will look more into it! Thank you.

torn orchid

how do you get the buttons like too right or on the bottom?

loud plinth

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

polar karma

process.exit() will stop it immediately, but can't do anything about the bot showing as online in discord

sharp ginkgoBOT
rose tangle
unique shoal
loud plinth

Thanks.

pliant snow

How can I view new user tags through the bot?

polar karma

not documented yet, so only through rest requests

pliant snow
sharp ginkgoBOT

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

hallow mesa

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.

rose tangle

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

hallow mesa

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

unique shoal

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

hallow mesa

Just curious to check out undocumented features when they get added

unique shoal

Fair enough

hallow mesa

Is there a way to fetch a raw interaction? Not my reply but the one received by INTERACTION_CREATE?

rose tangle

ah, you want the interaction itself

hallow mesa

Yeah

rose tangle

I misunderstood, thought you wanted the reply

yeah, can't fetch that

hallow mesa

All good. It was a wordy request. For messages my bot can access I do re-fetch the target message for some extra info

red coral

ManageServer, is that a permission a GuildMember can have? Or is that only something on a role. If that makes any sense whatsoever

rose tangle

members and roles share the same permission enum

red coral
    permissions: {
        userPermissions: ["Administrator"],
        botPermissions: []
    },

Where permissions is

type permissions = {
    userPermissions: PermissionResolvable[],
    botPermissions: PermissionResolvable[]
}

Am i using the wrong one? ManageServer doesn't come up

loud quartz

Because it's ManageGuild

Pretty sure

red coral

Ah, that comes up. Gonna assume they are the same then ofc?

loud quartz

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

red coral

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

loud quartz

Again

Human facing name for api's guild is server

red coral

Yh 🙏, thanks though

pliant snow
polar karma

Which is also undocumented

shadow tartan
topaz bluff
elfin scroll

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

shadow tartan

Ah, interesting, definitely have to look into that sometime then xD
Thank you both of you!

elfin scroll

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

lost gulch

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

topaz bluff

You can. Just make sure you're supplying the IsComponentsV2 flag

Can you show your code and the error you're getting?

lost gulch
loud quartz
lost gulch

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

loud quartz
sharp ginkgoBOT
lost gulch

thanks dude

loud quartz

Wha

I linked to the channel because you never showed your code or how you tried passing it

Oh, they already left. Nevermind.

tawdry hull

for some reason my embeds keep sending twice?

topaz bluff

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)

topaz bluff

Stop your local process and see if commands still execute

tawdry hull
topaz bluff

In your terminal, Ctrl+C force stops any current process

tawdry hull

and js wait for it to go offline?

topaz bluff

Yes. If doesn't, then that you're answer. The bot is running somewhere still

tawdry hull

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?

topaz bluff

Correct

So that means my guess was incorrect. Can you share your code from the "double sending" embed?

shadow tartan
topaz bluff
topaz bluff
tawdry hull

is there also help for putting a bot on hosting? it may be confusing i hear

shadow tartan

Gotya

topaz bluff
tawdry hull
topaz bluff
tawdry hull 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

tawdry hull
rain forum

hi
is channel.permissionOverwrites.edit
is work in last update

upbeat cedar

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.

snow onyx

no

upbeat cedar

then another question, is it possible to somehow get bots to the user in which guild he is without using a selfbot

upbeat cedar
upbeat cedar
snow onyx

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?

upbeat cedar

trying to get user tag

snow onyx

Thats an undocumented feature, you would need to fetch the user manually through the REST API to get the tag.

sharp ginkgoBOT
fiery idol

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 of event fired. I just don't know if it really a notice delay if huge number of user and server process
unique shoal

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

night kindle

what exactly is a Mentionable option in SlashCommandBuilder#addMentionableOption?

zenith violet
night kindle
zenith violet

No

night kindle
tacit pulsar

same, is this a known issue?

steel trail
tacit pulsar

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

loads infinitely, then times out

steel trail
tacit pulsar

lame, discord embeds it just fine if it's sent as a message

leaden shuttle

is there a djs function to escape new lines?

vague echo
fading girder

can I use discord timestamps like <t:${now}:D> in embed title? will it display?

vital barn
leaden shuttle
topaz bluff

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?

topaz bluff

You'll probably need to create your own formatter/sanitizer

grizzled venture

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?

coarse storm

How to send the new containers through a webhook?

topaz bluff
grizzled venture
coarse storm
topaz bluff

Yes

grizzled venture

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.

coarse storm
wary coral
coarse storm
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

wary coral

could you share your code? specifically the send line

coarse storm
wary coral 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

wary coral

you need to add the flag to the webhook message. it needs both withComponents and MessageFlags.IsComponentsV2

jaunty urchin

hello i have weird problem my bot working in server vps and other server not working what is the problem?

topaz bluff
jaunty urchin
topaz bluff

Not working...how

Are you getting an error in your terminal? Is the client giving any errors?

jaunty urchin
steel trail

then what is "not working". we're unable to help if you don't give more information on your issue

topaz bluff

Without any more information, I can't really offer any help.... It could be anything

jaunty urchin
steel trail

what makes you say there is an issue at all then?

jaunty urchin
jaunty urchin
steel trail

you keep saying it is "not working" without saying what is not working. unless you actually state your issue we're done here

topaz bluff

Not working is meaningless. If you can't show any errors anywhere, then your guess is as good as ours

coarse storm

Let's say I have a container with an action row with two buttons in it. does it count as 4 components?

steel trail

or at least say what you do, what you expect to happen and what happens instead

coarse storm

And the limit is 30 components in one message, correct?

loud quartz
jaunty urchin
loud quartz

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

desert sleet

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

loud quartz

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

desert sleet

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 dogeHaHa

loud quartz

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

desert sleet

Mhm. Mine has to work in DMs and thus it has to be global to my understanding

loud quartz

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

desert sleet

hmm ok

loud quartz

that's not the case for guild commands, but indeed that won't do for dms

desert sleet

So all I need to do is get a host for my code, run it, proofread it, go from there

topaz bluff
steel trail

the size of the bot is irrelevant for that Thonk

desert sleet

It's fine lol, I got they meant :)

steel trail
  • 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

misty cave

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?

wary coral
misty cave
topaz bluff

(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

misty swift

where is the guide for componets v2

misty cave
misty cave

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

steel trail
steel trail

Best way to reduce RAM load is limiting the intents to only those you actually need

thin knoll

I get an unknown interaction error and I couldn't find a solution.

sharp ginkgoBOT

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
topaz bluff

Start here

thin knoll

I can post the code if you can fix it.

topaz bluff

Yes you can

thin knoll
gray breach
C:\Users\tribhuvan\Desktop\Bet Buddies>npm i discord.js
[..................] - idealTree:Bet Buddies: sill idealTree buildDeps```

huh?
gray breach

ohk

topaz bluff

There's currently a widespread online outage. I'm guessing Cloudflare

zenith thistle

Cloudflare R2 maybe ?

thin knoll
topaz bluff

You're also welcome to ask for help, no guarantee we are able to, or even willing to find your solution.

harsh elm

can someone help me?

bleak owl
harsh elm

okay sir

eternal basin

When does the API usually come back online? I need an approximate or typical time?

zenith violet

there never is

if there was it wouldnt be an outage but rather planned downtime

rose tangle

and this isn't the right place to ask either way

sharp ginkgoBOT

We are not Discord, just some nerds who develop Discord bots!

crimson jetty

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?

bleak owl

can you be more specific on "does not work"

crimson jetty
bleak owl

did you register it?

crimson jetty
bleak owl

did you restart your discord app?

crimson jetty

ok, didn't do that one, how do I restart it?

like, restart the token?

bleak owl

no, your actual discord app like the one you use to message here

crimson jetty

ohhh

crimson jetty
bleak owl

you're welcome

sometimes the cache doesn't update so restarting your app helps

misty swift

I just can't seem to get it to work

sharp ginkgoBOT

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

zenith violet

and define doesnt work

misty swift
bleak owl

what is the current issue you are having?

zenith violet

what do you mean by cant get it to work

to me that means your bot is not even running

misty swift

it is

zenith violet

then define what exactly doesnt work

what errors do you get

vast falcon

hosting discord.js/website locally should be enough to get docs working? official online version is having big issues rn due to cloudflare dying

misty swift
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)
zenith violet

there we go

sections require an accessory

whether that be a button or thumbnail

misty swift
rose tangle

should be much simpler than hosting the docs locally

steel trail
misty swift
vast falcon
zenith violet
misty swift
zenith violet
vast falcon
rose tangle you could just look at the dts file though?

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

misty swift
zenith violet

add an accessory

misty swift

cause this new stuff confuses me

zenith violet
misty swift
zenith violet

thats not an accessory

misty swift
zenith violet

yes

zenith violet
misty swift

what should I do if I don't want a button there

zenith violet

dont use a section

just add text directly to the container

misty swift

alr

one sec

misty swift
zenith violet

yes, have you tried

misty swift

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?

zenith violet

yes

misty swift

oops

misty swift
zenith violet

thats up to you to figure out

did you actually delete the section you replaced with top level text

misty swift
rose tangle

are you editing a message?

misty swift

embed: null I got to add ig?

rose tangle

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

misty swift
rose tangle

need to explicitly set the embeds as empty

misty swift
rose tangle

which is?

also you don't need to explicitly serialize the container

you can pass it directly

but it's the same thing

misty swift
misty swift
versed sequoia

can anyone help ?
The property 'addComponents' not exist on type 'ActionRowBuilder<ButtonBuilder>'.

topaz bluff

Can you show your code?

versed sequoia

    "@discordjs/builders": "^1.11.2",
    "@discordjs/rest": "^2.5.0",
    "@discordjs/util": "^1.1.1",
    "discord.js": "14.19.3",```
sharp ginkgoBOT

discord.js includes multiple sub-packages, installing these separately can mess with internal code:

npm uninstall discord-api-types @discordjs/rest @discordjs/builders
yarn remove discord-api-types @discordjs/rest @discordjs/builders
pnpm remove discord-api-types @discordjs/rest @discordjs/builders
versed sequoia

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

rose tangle

the tag doesn't tell you to install them

versed sequoia
rose tangle

notice how the subcommands say uninstall and remove

not install

versed sequoia

okay now understand

topaz bluff

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

versed sequoia

ok ok

empty spear

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.

red coral

interaction.channel can be null, why is that?

topaz bluff
empty spear
topaz bluff
empty spear

Yes. It's a user installed app, not a guild installed app, as well

topaz bluff

Oh that's probably why. User apps need to reference messages directly to receive their content

empty spear

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 .

verbal cave

Can't I edit a container?

topaz bluff
topaz bluff
red coral

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..

pearl hazel
polar karma

What's the full error including stack

trail fog

Can a section have more than one button accessory?

bleak owl

i’m pretty sure, yes

unless i’m mistaken which if i am, i’m sorry

trail fog

no worries

wary coral
main mason

Is it possible for a bot to know which user deleted a message (through the Events.messageDelete event)?

main mason

alright, thanks!

unique shoal

Since there's no webhook id or token that would be required to send to one

rose tangle
clear oar

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)

bronze gorge

How might I be able to have an AI run a command on my discord bot?

shadow harness

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

unique shoal
unique shoal
shadow harness
unique shoal

You set the max selections to less than the number of defaults

unique shoal
bronze gorge
vital barn

it is not

rose tangle
rose tangle
clear oar
bronze gorge
rose tangle

I have no idea how that works

unique shoal
rose tangle

but you can make your own code run its own functions if that's what you're asking

unique shoal
unique shoal
clear oar

how to interaction.ignore() to ignore an interaction?

unique shoal

you dont

respond to the user so they know it was successful

clear oar
unique shoal

The filter on a collector?

clear oar
unique shoal

true will collect it for response, false will ignore it

clear oar

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})
})
uneven crater
topaz bluff

Man's just wants free emojis

clear oar

why is this thing ignoring all interactions?

sharp ginkgoBOT

tag suggestion for @clear oar:
To share long code snippets, use a service like gist, sourcebin, pastebin, or similar instead of posting them as large code blocks or files.

clear oar
topaz bluff

Preferably not so we can actually read the code

rose tangle

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

clear oar
rose tangle

your filter doesn't return anything

since it's wrapped in {} it requires an actual return <something>

clear oar

👀 that simple thing i ignored..

rare coral

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.

clear oar

how to undefer deferred thing? i want to make my thing "thinking" until the collection end

rose tangle
rose tangle

if so, editReply

clear oar

what's the difference between update and reply thingy?

rose tangle

one updates the message, other replies

rare coral
scenic berry

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.

sharp ginkgoBOT

guide Creating Your Bot: Registering slash commands - Guild commands
read more

knotty wind

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 ?

hollow crag

hello why is using strings like '0099FF' as the embed color no longer supported?

stable sun
stable sun

That’s only required to fetch all members of a Guild

main mason

how can you check if your bot is able to send messsages in a specific channel (that is, has the permissions to)

tough folio

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?

rose tangle

"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

sharp ginkgoBOT
rose tangle

you'll have to focus on the server side

tough folio

all i'm used to is the language

clear oar
hollow crag

did components v2 get rid of setTimestamp?

snow onyx

components v2 are not embeds

setTimestamp for embeds still exists

hollow crag

ohhhhhhhh

well that kinda sucks. thanks

steel trail
harsh elm

Guys I need help with mongoDB

red coral
harsh elm
rose tangle
clear oar
steel trail
misty swift

How do you make sure a mention in an embed (V2) doesn't actually cause a mention?

sharp ginkgoBOT

tag suggestion for @misty swift:
You can control which entities receive notifications via the allowedMentions option. You can:

{ ..., allowedMentions: { parse: ["users", "roles"] } }
haughty breach

if bot has custom emojis in buttons or components, and channel disallows external emojis, will that prevent message from sending, throwing Missing Permissions?

steel trail

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

haughty breach

but in buttons, will it just not show it? or it ignores perms there

empty cradle

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?

steel trail
empty cradle

ah, I see, thanks alot

haha, google detects this as fake

steel trail

well, it is a preview. not yet merged or released. so it kinda is

crimson gale

why are the images so blurry firT

steel trail

are they?

crimson gale

because they are stretched to fit the screen but they only show a small portion of a screen (the component) ic

red coral

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?

steel trail

just remove the [], an array of Permission strings is PermissionResolvable in itself

sharp ginkgoBOT
red coral

Oh 💀 thanks 😭

red coral

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

snow onyx

assume its not available I think
if the guild is cached, the bot's member should be cached as well

red coral

Ok, thanks. Time to come up with some catchy message to tell the user they invited the bot wrong

steel trail

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

red coral

Which I won't be, and I won't be doing any user app stuff either. So is it still worth fetching it?

steel trail

If it would be null: sure. But that shouldn't ever happen then

red coral

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?

steel trail

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

red coral

Is it worth it? Ig this is like fetching a channel when it should already be in the cache (text channels for example)

steel trail

Is what worth what?

You're running two conversations at once here

red coral

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

steel trail

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

red coral

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?

pliant root

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?

red coral

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

pliant root

I see, I'll take a look, thanks!

tough folio

hey does anyone know how to offline my bot

red coral

presence: {
status: "offline",
}

invisible* sorry

tough folio
red coral

ctrl + c

tough folio
wary coral
steel trail

It does if you do that in your console running it

steel trail
red coral

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

steel trail

About 10 shards (give or take)

red coral

Oh ok, that's actually a lot better then I was thinking. And these would run on worker threads which is a thread?

steel trail

They can, if you configure it to

Default behavior is no threads

red coral

And if they don't use worker threads, does it spawn a new process or something?

steel trail

Are we talking internal or traditional sharding now?

red coral

The one which isn't "auto", the one which doesn't run just in one process

steel trail

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

red coral

Oh sorry, my bad. Ok that's cool. Thanks for explaining, appreciate it

steel trail

How do you run your bot in the first place? Because gwapes told you how to stop it if run from a console

tough folio

and then idk how to stop it

steel trail

Then use ctrl+c in that same terminal you did node

pliant root
red coral ConnectTimeout errors are network issues. Sometimes there's blips your end. Add ...

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.
red coral

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?

pliant root
red coral

I'm not 100% on how to debug that. Someone else, like Qjuh if he's still lurking may know more

pliant root

When i initially start it, I am able to run commands, but i think after about 10 mins? maybe 15? it just goes offline

steel trail

Is the bot user offline?

pliant root

yeah

steel trail

How did you check?

pliant root

Member list

tough folio

I was trying to run /commands but it is not working(it does not show on the thing)

steel trail

And yet the heartbeats continue?

pliant root
steel trail

Is node even running then?

topaz bluff
tough folio
sharp ginkgoBOT

guide Creating Your Bot: Registering slash commands
read more

tough folio
topaz bluff

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

pliant root

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

steel trail

Can you show those errors then? Your initial message here suggested the heartbeats were the last logs you got

pliant root

Now, yes. But the things that caused that started this (or at least i suspect) is that. I'll get the logs

tough folio
pliant root

this was the initial error logs that caused my bot to be offline the first time

red coral

Then if you restart it works again for around 10 mins?

pliant root

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?

red coral

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?

steel trail

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?

pliant root

I don't think it's a shared IP, but i'll try to contact my host to see if there's an issue

steel trail

Did you try running your bot locally and see if the issue happens there too?

polar river

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

sharp ginkgoBOT

To receive direct message events on "messageCreate" with your bot, you will need:

polar river

ok missed the partials.
thanks.

pearl hazel
/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})}

topaz bluff

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

pearl hazel

i don't think cause usually the error will said that, but i will check

steel trail

If you caught the error and logged it properly it would yes. But that looks like an uncaught exception

pliant root
pliant root no, but i can try

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?

pliant forge

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

topaz bluff

Is your token valid?

pliant forge

yes i just created it

topaz bluff

Then can you share your code?

pliant forge

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);
    }
})();```
topaz bluff

I'm guessing your clientId does not match the one for your token

pliant forge

Oh u are right

topaz bluff

Because at first glance, that looks fine

pliant forge

i forgot change it

would it ok if i delete the code?

red coral

that's basically a copy from the guide?

pliant forge
topaz bluff

Ya you can delete it, I didn't see anything wrong

pliant forge

Its too big and the chat looking mess because of it. If u get wrong im sorry

steel trail

It'll scroll out of view soon.

topaz bluff

Ya, it's kinda the point of this channel

harsh elm

guys, how many modal max i can do in discord?

tough folio
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

tough folio
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);
    }
})();
harsh elm

bro can u do screen?

i dont know where's 37 line

tough folio

k

topaz bluff
tough folio

lemme scrn shot

harsh elm
topaz bluff

No, that part I get...but max what? Modals themselves or inputs in the modal?

harsh elm

before was only 5 modals, can u do more?

topaz bluff

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

harsh elm
tough folio
clear garnet
harsh elm

i think u need do client id and guild id

topaz bluff
tough folio lemme scrn shot

Add a console.log for clientId and guildId because it looks like they are misformed. They're objects rather than strings

harsh elm

sorry, mb he's begginer so i did it for him

clear garnet

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

topaz bluff

Here's the part of the error I found that (for future reference...errors can be a pain to read)

clear garnet

Can you share the contents of your config.json without revealing your token?

tough folio

undefined
undefined

harsh elm

samthino, can i make so many modules? or the bot won't start

tough folio
    "clientID": "1382947794087579739",
    "guildID": "1380031274542174208"
}

(without token)
clear garnet
tough folio
topaz bluff
harsh elm

What type of components are those? Like "ranks" and "whyuwant"

topaz bluff
harsh elm

so i've one more question, how i can count all messages from someone user in guild

topaz bluff

You can't unless you count them yourself

Which is almost guaranteed to get you rate limited

harsh elm

okay sir, ty so much

topaz bluff

I know, it sucks but Discord does not expose the information from the search function or members tab to bots...would be useful tho

tough folio

is anything wrong and how do i fix this:

sharp ginkgoBOT

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: [] })
tough folio

what is the differnce between global and guild commands

topaz bluff

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

vital vortex

its not possible to setRoles with the RoleSelectMenuBuilder right?

vital vortex

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

topaz bluff

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

vital vortex

I'm asking if there's a way to filter roles i don't want settable in a RoleSelectMenuBuilder

hallow mesa

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

coarse storm

Does the 50 requests per second rate limit include sending messages through a webhook?