#djs-in-dev-version

35223 messages · Page 20 of 36

tame gazelle

like I've an EmbedBuilder and I just want to add a field at the 3rd position

plain roverBOT
copper jetty

<EmbedBuilder>.spliceFields(3, 1, field)

idle galleon

It should be 0, not 1, unless he wants to overwrite that position

copper jetty

Ok sorry

tame gazelle

I'll try thanks

slow storm

It's coming soon 🎉

chilly zephyr
forest elm

TextInputStyle.Paragraph, not Long

chilly zephyr

Ah right right

thorny haven
const { IntentsBitField } = require('discord.js')

const mean = new Mean({
    intents: [
        IntentsBitField.Flags.Guilds,
        IntentsBitField.Flags.GuildMessages,
        IntentsBitField.Flags.GuildBans,
        IntentsBitField.Flags.GuildMembers,
        IntentsBitField.Flags.GuildPresences,
        IntentsBitField.Flags.GuildVoiceStates,
        IntentsBitField.Flags.GuildScheduledEvents,
        IntentsBitField.Flags.MessageContent
    ],
    allowedMentions: { parse: ["users", "roles"] }
});
tame gazelle
thorny haven

you also don't see it in the screenshot

tame gazelle
thorny haven

the average value of what?

tame gazelle

didn't get

thorny haven

Internet coolstory

north mulch

Check pinned message

tough egret

ty ❤️

idle galleon

Are you sure photo isn't null?

silver robin

how does the new voice work &~~ where is the new guide url for it (dev version)~~

tough gulch
fierce hatch

hello, i did ```js
guild.commands.create(new discord.SlashCommandBuilder()
.setName('soko')
.setDescription('Play sokoban')
.addSubcommand(subcommand =>
subcommand
.setName('create')
.setDescription('Create your own soko map')
.addStringOption(option => option.setName('map').setDescription('The soko map to create'))
)
.addSubcommand(subcommand =>
subcommand
.setName('play')
.setDescription('Play a custom soko map')
// .addStringOption(option => option.setName('map').setDescription('The soko map to create'))
)
)

outer bane

you have to call toJSON on the builder

fierce hatch
outer bane you have to call toJSON on the builder

so like this? ```js
new discord.SlashCommandBuilder()
.setName('soko')
.setDescription('Play sokoban')
.addSubcommand(subcommand =>
subcommand
.setName('create')
.setDescription('Create your own soko map')
.addStringOption(option => option.setName('map').setDescription('The soko map to create'))
)
.addSubcommand(subcommand =>
subcommand
.setName('play')
.setDescription('Play a custom soko map')
// .addStringOption(option => option.setName('map').setDescription('The soko map to create'))
)
.toJSON()

it still does not show the sub commands

knotty plover

Cant see any reason

Toggle it's permissions in the server settings, might be related to that bug

fierce hatch

sure, let me try

fierce hatch

yea it worked, ty

problem tho, i ran the soko play command and it just ran the soko command itself, after i logged interaction.commandName it logged soko so how do i check the name of the subcommand?

and also the command itself does not appear when i do /soko only soko play and soko create appear

pallid ice

get it like an option: ChatInputCommandInteraction#options.getSubcommand() === 'subcommand name here'

forest mulch

this is what i use in v13:

if (channel.type === "GUILD_STAGE_VOICE") {
 //code...
};```

is this how i would do this in v14-dev?
```js
import { ChannelType } from "discord-api-types/v10";

if (channel.type === ChannelType.GuildStageVoice) {
 //code...
};```
knotty plover

Yes

outer bane

that is to be expected, if a command has subcommands you cannot use the base command

fierce hatch

i see, is there a way to have the base command tho?

river harbor

no

subcommands are classified as options

fierce hatch
thorny haven

hello, as in the realities of interaction.deferReply({ephemeral: true }), send interaction without flag 64 (ephemeral)

thorny haven
idle galleon

Why?

thorny haven

well, I want the interaction to be under flag 64 first, and then it will come out as a normal message

I'll try interaction.channel.send() ham

ripe jackal

Hello I was just trying out the djs v14 version, and I cant make it respond to my commands, I have enabled the message content intent for the bot but it still doesn't work.

copper jetty

Hello! You dont need any intents to use commands

ripe jackal

Oh,

But may I know why my bot isnt responding to anything?

I can give u the code if you want



const Discord = require('discord.js')
const client = new Discord.Client({
  intents: 32767,
  partials: ['MESSAGE','CHANNEL']
})
const prefix = "^^"
const fs = require('fs')



client.commands = new Discord.Collection()

const commandHandler = fs.readdirSync("./Commands")

for(file of commandHandler){
  if(!file.endsWith(".js")) {
     fs.readdirSync("./Commands").filter(file => !file.endsWith(".js")).forEach(dir => {
         const f = fs.readdirSync(`./Commands/${dir}`).filter(file => file.endsWith(".js"))
      f.forEach(x => {         
   let commandName = x.split(".")[0]
 let command =  require(`./Commands/${dir}/${commandName}`)
   client.commands.set(command.name, command)
   })
  })
 }
  if(file.endsWith(".js")) {
    let commandName = file.split(".")[0]
    let command = require(`./Commands/${commandName}`)
 client.commands.set(command.name, command)
}
}

client.on("messageCreate", async message => {
  if(message.content.startsWith(prefix)){
    const args = message.content.slice(prefix.length).trim().split(/ +/g)
    const commandName = args.shift()
     const command = client.commands.find(cmd => cmd.name.includes(commandName))
    
    if(!command) return;  console.log(`${message.author.tag} used and undefined command`); 
    command.run(client, message, args, Discord)  
 
  }
    if(message.content === 'test'){
   message.reply('testing') 
 }
})



client.login('token')``` sorry if im flooding the chat
idle galleon

ephemeral is not editable

copper jetty

You need interactionCreate event listener

ripe jackal
pallid ice

yes

you're not listening for interactionCreate events which are needed for slash commands

copper jetty
ripe jackal

oh

I'm not exactly doing slash commands

I'm just tryna test out the modals

pallid ice

oh I assumed

ripe jackal

Its alright

copper jetty
ripe jackal
const { ButtonBuilder, ActionRowBuilder } = require("discord.js")
module.exports = {
  name: 'modal',
  run: async (client,message,args) =>{
    const btn = new ButtonBuilder()
    .setLabel('Button')
    .setStyle('SECONDARY')
    .setCustomId('modal')

  const row = new ActionRowBuilder()
    .addComponents(btn)

    message.channel.send({components:[row]})
  }
}``` heres the button

It was in another file so I didn't show it

pallid ice

thats not gonna work

ripe jackal

Oh..

pallid ice

modals are an interaction response

ripe jackal

But a button is an interaction isnt it?

pallid ice

it is, but you're not responding to a button with that, you're responding to a message

copper jetty

If you want to make the bot respons to messages then you need Guilds GuildMessages and MessageContent intent

pallid ice

no

copper jetty
ripe jackal
pallid ice

if you insist on all intents you need 131071

ripe jackal

ooh

pallid ice

but it's ill advised

pallid ice
ripe jackal But a button is an interaction isnt it?

you need to send a message with the button attached to it, then listen for that button press customId with either an interactionCreate listener or an InteractionCollector and then respond to that interaction with a modal

there's a brief guide in the pins on how modals work and how to use them

ripe jackal
pallid ice

well, you're missing the message content/embed

you can't just send a button on it's own

it needs to be attached to something

ripe jackal

But it was possible tho

pallid ice

it's not

ripe jackal

hmm

pallid ice
message.channel.send({
  content: 'this is the text of the message',
  components: [row]
})

you could send an array of embeds instead of content if you prefer

pallid ice

you're welcome

sterile hemlock
ripe jackal

But it still doesnt respond tho

sterile hemlock

The purpose of intents is to limit it to what you need

pallid ice

and the guide gives enough warnings about the use of magic numbers. nothing wrong with using them if you know the risks of them changing etc

ripe jackal
  const row = new ActionRowBuilder()
    .addComponents(btn)``` I reckon im doing this wrong, I'm sorry I'm not so familiar with the errors in v14, this is my first time```js
this.components.push(...components);
                            ^

TypeError: Found non-callable @@iterator``` my error ^^
tame gazelle
ripe jackal
ripe jackal
tame gazelle

no prob

ripe jackal

Also @pallid ice, not to prove you wrong or anything, just wanted to confirm, u can send a button without any content

pallid ice

good to know

thanks

dawn phoenix

that's new then, had to u200B that before

sterile hemlock

I think it's been like that for a while

I've been able to send just components for a bit

ripe jackal

Me too

pallid ice

I tried once during the v13 dev and failed so never tried again haha

uncut kelp

Oh that definitely was not possible before

ripe jackal

It is pretty recent

pallid ice
zenith basin

Hey, how buggy has v14 been? Like im wondering if I should use it for my bot or not... as the modals would work great for what im making. I know its in dev and stuff so its naturally buggy but just wondering peoples experience withi t

nocturne kayak

wait for v13.7 or install modal pr if you just wanted modal

zenith basin

yeah its just the modals I want

nocturne kayak
terse jewel

is there any website instance of update into v14 guide online ?

terse jewel

tty

wicked tusk
dawn phoenix

your log coverage is pretty bad

if nothing logs, execution stops before those lines

wicked tusk

i know but why

logging above await interaction.showModal(modal);
if (!interaction.isModalSubmit()) return;

logs it

but below it doesn't log

can anyone please help?

dawn phoenix

not too sure what's confusing about that?

you are within a block that is guarded by interaction.isSelectMenu() (line 7)
on that same interaction you now guard that it has to be a modal submit, else you return (line 45)? how's that supposed to work?

wicked tusk

so i remove line 7?

dawn phoenix

so you stop coding for a second, think about what you want and fix your logic

also, since i'm allergic to people using #find by key: <Collection>.get(key) (line 48)

plain roverBOT

Don't use the find method to query a Collection by key (mostly the associated id)

- someCollection.find(structure => structure.id === "348607796335607817")
+ someCollection.get("348607796335607817")
wicked tusk

ok sorry sir i will fix that later

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

TypeError: Cannot read properties of undefined (reading 'getTextInputValue')

what does that mean?

jaunty vault
wicked tusk

but this correct tho?

const _title = interaction.fields.getTextInputValue('title');

jaunty vault

interaction.fields is undefined

wicked tusk

this is how i defenied interaction that wrong?

client.on('interactionCreate', async (interaction) => {

and then i have this const { member, channel } = interaction; as well

wicked tusk

then why it says TypeError: Cannot read properties of undefined (reading 'getTextInputValue')

jaunty vault
wicked tusk

wdym?

jaunty vault

is interaction an instance of ModalSubmitInteraction

wicked tusk

no, how do i do so?

hoary fox
wicked tusk

so like this if (!interaction.isModalSubmit()) return; ?

wicked tusk
zenith basin
thorny haven
wicked tusk

Where is the problem?

    client.on('interactionCreate', async (interaction) => {
            if (!interaction.isSelectMenu()) return;
            let embed = new Discord.EmbedBuilder()
            .setTitle("Quick Help")
          .setDescription(
            `You can find a list of **frequently asked questions** and other **guides** here.`
          )
          .setColor(client.config.color);
                if(interaction.values[0] === "bugModal"){
                    await interaction.update({ embeds: [embed] });
                    let bugEmbed = new Discord.EmbedBuilder()
                    .setColor("#6861fe")
                    .setDescription("Bla Bla")
             interaction.reply({
                embeds: [
                    bugEmbed
                ],
                ephemeral: true,
            });
        }

    })

C:\Users\Simon Stark\Desktop\koojeAPI\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:101
if (this.deferred || this.replied) throw new Error('INTERACTION_ALREADY_REPLIED');
^

Error [INTERACTION_ALREADY_REPLIED]: The reply to this interaction has already been sent or deferred.
at SelectMenuInteraction.reply (C:\Users\Simon Stark\Desktop\koojeAPI\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:101:46)
at Client.<anonymous> (C:\Users\Simon Stark\Desktop\koojeAPI\modules\others\quickhelp.js:18:26)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
[Symbol(code)]: 'INTERACTION_ALREADY_REPLIED'
}

hoary fox

u can update and reply in one interaction

wicked tusk

Then how can i make it, that this is going to be rested after the interaction replied

hoary fox

<interaction>.message.edit(...) ?

wicked tusk

oh yea true thanks

zenith basin

Is there a modal collector?

Like how theres one for a select menu and button

plain roverBOT
zenith basin

ah thankyou!

plain roverBOT

class Intents (extends BitField)
Data structure that makes it easy to calculate intents.

exotic nexus

can you not show modals for interactions that have already been replied to?

copper jetty

no

dawn phoenix

showing a modal is a type of interaction response

wicked tusk
    const channel = await client.channels.fetch('964183272202592306')
    const lastMessages = await channel.messages.fetch({ limit: 10 });
    const systemMessage = lastMessages.reverse().find(message => message.system)
    if (systemMessage) await systemMessage.delete();

Why is this not working?

dawn phoenix

please elaborate, you've been here long enough to know that "not working" is not a sufficient error description

wicked tusk

i understand that, if i had an error i would send it in here as well

undone yew
hybrid folio

i tried yesterday and to delete a system message yesterday and got an error like "u can't delete system message" 😕

wicked tusk
wicked tusk
jaunty vault

Collection#cache isn't a thing

wicked tusk

so what do i do?

jaunty vault

remove .cache

wicked tusk

still not deleting

jaunty vault

then systemMessage isn't found

wicked tusk

is reaction.message.channel a thing?

jaunty vault

yes

wicked tusk

ah i thought maybe this would work but no
const lastMessages = await reaction.channel.messages.fetch({ limit: 10 });

proven wolf

Dont need to await get method from cache

Is not a Promise

wicked tusk

will this make a big difference if await it or not?

jaunty vault

Yes
you must await fetch to make it work well

wicked tusk

so this isn't working either

    const channel = client.channels.cache.get('964183272202592306')
    const lastMessages = await channel.messages.fetch({ limit: 10 });
    const systemMessage = lastMessages.reverse().find(message => message.system)
    if (systemMessage) await systemMessage.delete();
jaunty vault

log systemMessage

wicked tusk

<ref *1> Message {
channelId: '964183272202592306',
guildId: '934213686468423780',
id: '973647815878250516',
createdTimestamp: 1652206128807,
type: 18,
system: true,
content: 'asdad',
author: ClientUser {
id: '938176229918531604',
bot: true,
system: false,
flags: UserFlagsBitField { bitfield: 0 },
username: 'koojeAPI',
discriminator: '2132',
avatar: 'f71d5abe9707f106dd3805d60f0ed76a',
banner: undefined,
accentColor: undefined,
verified: true,
mfaEnabled: true
},
pinned: false,
tts: false,
nonce: null,
embeds: [],
components: [],
attachments: Collection(0) [Map] {},
stickers: Collection(0) [Map] {},
editedTimestamp: null,
reactions: ReactionManager { message: [Circular *1] },
mentions: MessageMentions {
everyone: false,
users: Collection(0) [Map] {},
roles: Collection(0) [Map] {},
_members: null,
_channels: null,
crosspostedChannels: Collection(0) [Map] {},
repliedUser: null
},
webhookId: null,
groupActivityApplication: null,
applicationId: null,
activity: null,
flags: MessageFlagsBitField { bitfield: 0 },
reference: {
channelId: '973647815878250516',
guildId: '934213686468423780',
messageId: undefined
},
interaction: null
}

logging

uncut kelp

Some system messages cannot be deleted, but that's a thread system message, so it should be fine

That looks like it will work to me

noble kernel

.destroy() doesn't always take my bot offline, anyone know why?

copper jetty

it takes a while to change status

brazen knoll

is user.member on a reaction Event partial?

vague coyote

user.member isn't a thing? Thonk

brazen knoll

yeah no i had a stroke, dont mind me

is msg.member on any message events partial?

vague coyote

that depends, is msg partial?

brazen knoll

so fetching the message fetches the member?

vague coyote

should do?

brazen knoll

okay thanks

vague coyote

not sure tho

brazen knoll

it seems like <guild>.fetchAuditLogs() is not ratelimit checked internally

got API banned for sending too many requests 4 times

5 now

uncut kelp

How do you know you're not getting rate limited?

brazen knoll

but thats the point, i am

internal ratelimit checks should prevent sending too many requests by checking the response headers, and it seems like thats not happening

oh, no im getting API banned because i cant login for an hour

knotty plover

Do you have any evidence of this

brazen knoll

does a Request log showing 40 audit log requests in less than 5 seconds count as evidence?

knotty plover

Rate limit queuing happens in the rest layer. For it not to happen then the endpoint itself would have to be not sending back headers

knotty plover
brazen knoll

by the rest request and response events

brazen knoll

@knotty plover should i open a issue on d.js?

knotty plover

I haven't looked at the logs yet

I'm mobile right now, can if you want

brazen knoll

will do

tough gulch

This may be a bot permission issue

Nope, that wasn't it either

The bot has permission to embed links and attach files now, and it still doesn't work

anyone else got any ideas? All I want is to take the picture the user set as an attachment and echo it back in the command response

knotty plover

If youre using slash commands the everyone role needs those permissions

Slash command responses are webhooks

tough gulch

The everyone role does have the proper permissions

I doubt this will make a difference, but am I supposed to be using const { Routes } = require('discord-api-types/v10');

v10 or v9

tame gazelle

d.js v14 uses Discord API v10

tough gulch

Okay

If I enter the URL the command sends in the browser the photo shows up fine

it's just nothing shows up in the return message

Or rather, just the text shows up

Can you send an embed and contents at the same time?

knotty plover

yes

tough gulch

Got it working, I'm a derp

I accidentally reset the reply variable below the code I copied and pasted

however it's working with embed, not files

is that the right way to do it?

Here's the code again that's working:

reply = { content: textResponse, embeds: [new EmbedBuilder().setURL(photo.url).setThumbnail(photo.url).setTitle("Photo").toJSON()] };```
distant basin

what did i do wrong?

sterile hemlock

We don't support external libraries like discord-modals. This is DJS. Modals have been included in the dev branch of DJS, and are coming in v13.7.0

exotic nexus

the api is already very fast, I doubt it's measurably faster

idle galleon

Newer api versions generally contains more features and other changes that can't be back-ported w/o breaking current applications using it

proven ocean

how bot can selfmute itself, not server mute?

proven ocean
plain roverBOT
ripe jackal

Hello, Im making a modal and It only seems to be able to accept 5 actionRow's, is there anyway I can add more?, possibly 6?

timid jasper

i dont think it's possible

ripe jackal

Oh, Thankyou for your kind time

dawn phoenix

5 rows, 1 per row => 5

ripe jackal

yes?

Can you add more than 1 components to 1 row?

dawn phoenix

no, that's the limit

only components for modals (at the moment at least) are text input short and paragraph which is 1 per row

ripe jackal

Hmm, alright thanks!

clear glade

I'm trying to make slash commands in v14 so I needed help registering them but I ran into this problem:

sinful smelt
clear glade
copper jetty

429 means ratelimit

clear glade
copper jetty 429 means ratelimit

Oh, no I'm not
Actually this is the code from my v13 slash handler which I was trying to use with a v14 bot so updated the interactionCreate event which looks like this so I assumed I'm using something which has to be updated

vague depot

how to cheak uptime of the bot with eval command

plain roverBOT

Documentation suggestion for @vague depot:
property Client#uptime
How long it has been since the client last entered the READY state in milliseconds

hoary fox

or process.uptime()

jaunty vault

that's not the same as client

hoary fox
dawn phoenix

probably in the same ballpark for most applications, i'd think

jaunty vault

it's not exactly the same, but around the same

dawn phoenix

-ev [client.uptime, process.uptime()]

forest geyserBOT
dawn phoenix

"number of seconds" who thought that was a good idea notLikeCat

dark minnow

Does the makeCache message property will create a Limited Collection for each channel, or a global Limited Collection for all channels? (Considering my setup uses Limited Collection) I just want to know if I need a bigger limit to adreess all channels or a smaller one to adress one channel!

noble kernel

is GuildMember.moderatable checking if the user can be timed out?

hoary fox
slender sky

Hello,
How to use the fetchReply property in the showModal function ?
Help please

forest elm

there is no fetchReply property in the showModal function

forest elm

modals arent components

plain roverBOT
slender sky

yes I had seen this one but I'm looking to do a collector's item on it but that's ok thanks anyway

proven wolf

@slender sky

slow storm
noble kernel

Invalid bitfield flag or number: MANAGE_GUILD???

woeful pollen

ManageGuild

plain roverBOT
noble kernel

ohhhhh ty

terse jewel

in discord js v14 member.roles.add() changed ??

jagged marsh
terse jewel

read the error, it says MEMBER_ROLE_UPDATE is not an int, that is an issue with some logger you have

you want MemberRoleUpdate instead I believe (nevermind don't believe that's an enum)

pliant salmon

does the beta already support the new permission system for interactions?

vague coyote

partly

dull mulchBOT

pr_open #7861 in discordjs/discord.js by vladfrangu opened <t:1651164195:R> (review required)
feat(builders): add new command permissions v2
📥 npm i discordjs/discord.js#feat/application-commands-v2-for-builders

stuck solstice

RangeError: Non-link buttons cannot have a url

new ButtonBuilder().setURL("https://www.example.com/").setLabel("Example button");
idle galleon

You have to set the button type

uncut kelp

Forgot to set the type?

copper jetty

you need to set style to Link

stuck solstice

Ah dum me LUL

frank moss
c.permissionOverwrites.has
``` this code was working in v12, but I couldn't find the equivalent of this code in v13, can you help?
honest carbon

Is it possible to close a modal interaction even if the user didn't do anything? I'm trying to make a time limit that the user can use the modal, then it close by itself if they didn't do anything.

honest carbon
iron bobcat

can we show a modal on a deferred interaction ?

<Interaction>.showModal
Error [INTERACTION_ALREADY_REPLIED]: The reply to this interaction has already been sent or deferred.

knotty plover

no

frank moss
iron bobcat
vocal raven

is there currently a request for keeping string hex colors on the EmbedBuilder class?

vague coyote
vocal raven

word

plain roverBOT
vague coyote

That is indeed correct

discord.js exports EmbedBuilder that overwrites setColor from the builder

vocal raven

so I should use everything from discord.js directly unless if it doesn't already support it?

vague coyote

You use whatever you want and need

vocal raven

I want to not have to refactor

vague coyote

shrug

vocal raven
thick willow

.addChoices([{ "name": "Test", "value": "10" }])

is this the right way to add choices in discordjs dev v14 (latest)?

urban belfry
thick willow
thick willow
urban belfry looks good to me you have any errors or something?

this what i have used:```.addNumberOption(option => option.setName('time').setDescription('Time!')
.setRequired(true)
.addChoices([
{"name": 'Seconds', "value": 100},
{"name": 'Minutes', "value": 60000},
{"name": 'Hours', "value": 3600000},
{"name": 'Days', "value": 86400000},
]))

urban belfry

can you just install the dev version npm i @discordjs/builders@dev?

tame gazelle

or import from discord.js

thick willow
thick willow
urban belfry

heh it takes a rest parameter now? uuuuuuuuuuh this is awkward
@thick willow can you try to pass multiple parameters instead of an array

urban belfry

i have no idea what's up with that

ripe jackal
  if(interaction.customId === "id"){
    let embed = new 
 EmbedBuilder(interaction.message.embeds[0])
    .setColor('Green')

await interaction.update({embed[embed]})``` Hello, im trying to update my interaction by setting the color of an existing embed as green, but it says that my embed needs more values, I understand why this happens, is there anyway i can edit the existing embed to change the color?
copper jetty
ripe jackal
urban belfry

or just use EmbedBuilder.from()

ripe jackal
ripe jackal
scenic vortex

Hello! I'm trying to use modal windows, but an error appears, what's the problem?

SHOW_MODAL_ERROR: An error occurred when showing a modal. HTTPError [DiscordjsError]: Request to use token, but token was unavailable to the client.
plain roverBOT

Tag suggestion for @scenic vortex:
We do not provide any help with third party libraries like discord-buttons.
• Discord.js supports buttons natively: guide

jaunty vault
jagged marsh
scenic vortex

Oke, thanks

jagged marsh

but yes, you are using discord-modals, use the discord.js@dev modals if you need further support 👍

dawn phoenix

well, or ask the respective library, we cannot forbid you from using third party packages, but we cannot help you with them here
(and if you, dear reader, can and are okay with supporting it; kindly move to DMs)

we do ofc. recommend you use the native implementation

frank moss

How can I convert it to the number data type?

role.permissions

frank moss
dawn phoenix

you can't, really
bitints are bigger than the max safe integer in javascript
if you do convert it it will loose accuracy (which is arguably really bad for permissions)

frank moss

mongoose is not using bigint what can i do?

plain roverBOT

Documentation suggestion for @frank moss:
mdn BigInt.prototype.toString()
The toString() method returns a string representing the specified BigInt object. The trailing "n" is not part of the string.

final relic
            const row = new ActionRowBuilder()
                .addComponents([
                    new ButtonBuilder()
                        .setStyle(ButtonStyle.Primary)
                        .setEmoji('🖥️')
                        .setLabel('Test')
                        .setCustomId('test')
                ])
```What am I doing wrong here?
tame gazelle
final relic

No error, it just wont send. I thought maybe I made an obvious mistake that I just couldnt see

tame gazelle
final relic

Nvm i didnt get the channel how i was supposed to

TypeError: category.children.find is not a function

category.children.find(channel => channel.topic === `${i.user.id}`)
```Trynna check if a channel in `category` has a description equal to `i.user.id` and this worked in v13. What's it been changed to?
obtuse crater

category.children.cache.find

final relic

Oh yeah, tysm

dim moss

what is this err?

outer bane

invalid message component, perhaps you didn't put it in an actionrow?

dim moss

YESSSSSSSSSSSSS 🤦🏻‍♂️

finite mason

did someone already used getAttachment?
I keep getting that error:

    at CommandInteractionOptionResolver.get (C:\Users\user\WebstormProjects\kevee\bot\node_modules\discord.js\src\structures\CommandInteractionOptionResolver.js:78:15)
    at CommandInteractionOptionResolver._getTypedOption (C:\Users\user\WebstormProjects\kevee\bot\node_modules\discord.js\src\structures\CommandInteractionOptionResolver.js:95:25)
    at CommandInteractionOptionResolver.getAttachment (C:\Users\user\WebstormProjects\kevee\bot\node_modules\discord.js\src\structures\CommandInteractionOptionResolver.js:226:25)
    at Object.run (C:\Users\user\WebstormProjects\kevee\bot\commands\context\hi.js:10:41)
    at Client.<anonymous> (C:\Users\user\WebstormProjects\kevee\bot\index.js:116:25)
    at Client.emit (node:events:527:28)
    at InteractionCreateAction.handle (C:\Users\user\WebstormProjects\kevee\bot\node_modules\discord.js\src\client\actions\InteractionCreate.js:81:12)
    at Object.module.exports [as INTERACTION_CREATE] (C:\Users\user\WebstormProjects\kevee\bot\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (C:\Users\user\WebstormProjects\kevee\bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
    at WebSocketShard.onPacket (C:\Users\user\WebstormProjects\kevee\bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:447:22) {
  [Symbol(code)]: 'COMMAND_INTERACTION_OPTION_NOT_FOUND'
}```

like I'm using the correct option name

final relic

After showing my modal I create a collector. If I then click Cancel and get it to show the modal again and then submit, it collects it twice resulting in it creating 2 channels for me. Is there a way to kinda stop the collector if I "cancel" the modal?

dim moss

what is this for?

outer bane
outer bane
outer bane
dim moss
outer bane

*can't put more than 5 rows in a modal

dim moss
  const firstActionRow = new Discord.ActionRowBuilder().addComponents([firstInput]);
      const secondActionRow = new Discord.ActionRowBuilder().addComponents([secondInput]);
      const thirdActionRow = new Discord.ActionRowBuilder().addComponents([thirdInput]);
      const fourthActionRow = new Discord.ActionRowBuilder().addComponents([fourthInput]);
      const fifthActionRow = new Discord.ActionRowBuilder().addComponents([fifthInput]);
      const sixthActionRow = new Discord.ActionRowBuilder().addComponents([sixthInput]);
      const seventhActionRow = new Discord.ActionRowBuilder().addComponents([seventhInput]);
      const eighthActionRow = new Discord.ActionRowBuilder().addComponents([eighthInput]);
      const ninthActionRow = new Discord.ActionRowBuilder().addComponents([ninthInput]);

      adminForm.addComponents([firstActionRow, secondActionRow, thirdActionRow, fourthActionRow, fifthActionRow, sixthActionRow, seventhActionRow, eighthActionRow, ninthActionRow]);
      await interaction.showModal(adminForm);
    

oh ok tnx <3

outer bane

does your slash command has an attachment option with the name "hi" and did you add a file when submitting the command?

finite mason
final relic
outer bane

you can use the buttoninteraction's id

outer bane
final relic
outer bane

yes

all ids are unique

final relic
finite mason
final relic
urban belfry
final relic
final relic
urban belfry

it's an object property

final relic
outer bane

currently you have two collectors listening both to the same interaction. the idea is to use filters in such a way that each modal submit interaction is only getting picked up by a single collector, so you need something unique to identify it. your modals are triggered by buttons, each button interaction has a unique id so you can use that in your filter, to be able to compare it your modal interaction needs the information as well but luckily it has a customId which you can set to whatever you want, so you can store the button interaction id there

final relic
outer bane

the custom id is a string of up to 100 chars which you can set to whatever you want. put the interaction id in it, maybe something else to identify the modal, ...

final relic
outer bane

now you compare the customId from the received interaction to i.id in your filter (no need to stringify it, ids are already strings)

final relic
let filter = i => i.customId === 'openTicket' || i.customId === 'closeTicket';
```My filter looks like this, I don't have `i.id` in it?
outer bane

you might want to rename either the received button interaction or the filter parameter

final relic

Why do I need to rename my received button interaction?

outer bane
final relic
outer bane

in your filter you need access to both the button interaction and the modal submit interaction. since the latter is local to the filter function it would shadow the outer variable if both share the same name

final relic
outer bane
final relic
halcyon nest
outer bane

BitField.resolve still resolves string flags, and it's used in most BitField methods. no idea if it's intended or will be changed at some point

halcyon nest

Should I just keep using this? Or what are the alternatives

outer bane

I'd say use the enums, PermissionFlagsBits or Permissions.Flags in this case

halcyon nest
outer bane

why do you prefer an EnumResolver (which might be removed before the v14 release) over PermissionFlagsBits.ManageGuild?

you could even use PermissionFlagsBits['ManageGuild'] if you prefer ''

halcyon nest
forest elm

you can't use enumresolvers with that kind of input, it would have to be SCREAMING_CASE

halcyon nest

right I see, thanks

outer bane

no, use the d.js one, it's re-exported

halcyon nest

ok

halcyon nest
outer bane

you could probably achieve it with the PermissionsBitField class, it's not a "real enum" so it won't work both ways

outer bane

create a new instance and use toArray (should be called like that). what do you want to do exactly, there might be easier ways to do so

halcyon nest

convert for example 32n (bigint) to 'PermissionName'

outer bane

ig new PermissionsBitField(perm).toArray() should cover this, would also work with multiple permissions at once

halcyon nest

perfect, thanks

knotty plover

EnumResolvers are being removed I wouldnt rely on them

elder fog

what's the intent for joining a guild?

knotty plover

GUILDS

elder fog

thank you

livid raft

Are the message commands disabled in v14 now?

dawn phoenix

no

discord.js emits the event, what you do with that is on you
if you need content, supply and enable the intent - if your bot requires verification you have to apply for the intent and discord decides if it wants you to have it or not, "i need it for legacy content based commands" is, however, not a valid reason for them

dim moss

Is placeHolder requied for modals?

forest elm

the text input placeholder is not required

dim moss

okay tnx

dim moss

am I need Discord.GatewayIntentBits.GuildVoiceStates for listening to voiceStateUpdate?

vague coyote

obviously, yes

dim moss

😄

tnx! and something else

I have an interval in my ready event, Now for example I define something like a server there (outside the interval) and if I made some changes in my server for example change the server avatar, in the interval the avatar will changed too or not?

let iTzClub = client.guilds.cache.get('553528389898862594')
setInterval(async () => { console.log(iTzClub ) }, 360000);

I mean if I change something in the server the result of console log will changed too or not?

outer bane

if the guild isn't removed from the cache (either by leaving it or manually) the reference still points to the object in cache

d.js patches objects in place

scarlet tangle

yes

knotty plover

why are you on a weird docs branch

Its merged so just look at main docs

amber sequoia

in discord.js@dev message intent doesn't work (if u dont have it) ?

its supposed to work till a few more months...

knotty plover

If you dont have it you dont have it

if youre in less than 100 guilds theres nothing stopping you from having it

It needs to be enabled on API v10

amber sequoia

so discord.js@dev uses new api version

knotty plover

yes

keen garnet

Hi, I'm having an issue with ButtonBuilder in which .setEmoji() on a ButtonBuilder isn't working. Any ideas what could be causing this?

    return typeof value === "string" ? Result.ok(value) : Result.err(new ValidationError("s.string", "Expected a string primitive", value));
                                                                     ^

ValidationError: Expected a string primitive
    at StringValidator.handle (C:\Users\***\Desktop\***\discord\node_modules\@sapphire\shapeshift\dist\index.js:1372:70)      
    at StringValidator.parse (C:\Users\***\Desktop\***\discord\node_modules\@sapphire\shapeshift\dist\index.js:114:88)        
    at ButtonBuilder.setLabel (C:\Users\***\Desktop\***\discord\node_modules\@discordjs\builders\dist\index.js:604:48)        
    at listTemplates (C:\Users\***\Desktop\***\discord\commands\info\progress.js:486:5)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  validator: 's.string',
  given: { name: '▶️' }
}```
```js
const buttons = [
  new ButtonBuilder({})
    .setEmoji({ name: '◀️' })
    .setStyle(ButtonStyle.Secondary)
    .setCustomId('prevpage'),
  new ButtonBuilder({})
    .setLabel({ name: '▶️' })
    .setStyle(ButtonStyle.Secondary)
    .setCustomId('nextpage'),
];```

oh wait i didn't change the second button to .setEmoji

im dumb nevermind

slow storm

embed builder no longer have .length property?

tall verge

Face_Palm

copper jetty

I think setLabel takes a string

Not object

buoyant pecan
  const list = await client.guilds.cache.get("GUILDID").members.cache;
  list.forEach(member => {
    fs.appendFile("mems.txt", member.user.id + "\n");
  });

hey im trying to list all members on the guild, i get 191 but theres 247 members on there

a big portion of them didnt write anything for a longggg time

dawn phoenix

you are iterating all cached members

plain roverBOT
buoyant pecan

ohhh

buoyant pecan
dawn phoenix

well, click on the docs link above

Returns: Promise <(GuildMember|Collection <Snowflake, GuildMember>)>

frigid sleet

Hello, i try to fetch the Guild Owner

.addFields(
      [{
          name:'» Server Owner', 
          value:`\`${interaction.guild.fetchOwner().then(res => res.name)}(${interaction.guild.ownerId})\``,
          inline: false
      }]
    )

but in my embed it looks like this:

steel haven

Hi, Constants.Events... to was replace by what ? Please c:

forest elm
buoyant pecan
dawn phoenix

you mostly likely don't really want an array

you can just iterate the collection instead

buoyant pecan

hmmm

plain roverBOT

guide Additional Information: Collections
read more

frigid sleet
buoyant pecan
forest elm

await it

or just store the owner in a separate variable

dawn phoenix
frigid sleet
buoyant pecan
idle galleon
buoyant pecan

hmmmm

it only puts one member id in the file wtf

idle galleon

Use forEach instead of every

buoyant pecan

its an collection

idle galleon

Ok

Collections extends Map

buoyant pecan

hmmmm

idle galleon

mmmmh

buoyant pecan

ohhh bruh i forgot that

noiiice

i have every id

plain roverBOT
kind pulsar

How can i fix this?

dawn phoenix

guarding or asserting the channel type - presumably the former

hot yacht

Are there docs for localization yet?

vague coyote
gentle bane
"discord.js": "^14.0.0-dev.1652443445-d522320",
ember pagoda
gentle bane

thx

haughty lava

is the guide being update for v14

thorny haven
scarlet tangle
haughty lava

that's hasn't been updated for a long time

uncut kelp

But there's nothing to update

thorny haven

and no one wants to help me, okay xxamhm

haughty lava

add that

thorny haven

I've already inserted it into the code, it didn't help

haughty lava
        Discord.GatewayIntentBits.DirectMessageReactions,
        Discord.GatewayIntentBits.DirectMessageTyping,
        Discord.GatewayIntentBits.DirectMessages,
        Discord.GatewayIntentBits.GuildBans,
        Discord.GatewayIntentBits.GuildEmojisAndStickers,
        Discord.GatewayIntentBits.GuildIntegrations,
        Discord.GatewayIntentBits.GuildInvites,
        Discord.GatewayIntentBits.GuildMembers,
        Discord.GatewayIntentBits.GuildMessageReactions,
        Discord.GatewayIntentBits.GuildMessageTyping,
        Discord.GatewayIntentBits.GuildMessages,
        Discord.GatewayIntentBits.GuildPresences,
        Discord.GatewayIntentBits.GuildScheduledEvents,
        Discord.GatewayIntentBits.GuildVoiceStates,
        Discord.GatewayIntentBits.GuildWebhooks,
        Discord.GatewayIntentBits.Guilds,
        Discord.GatewayIntentBits.MessageContent,

try all the intents

and partials

haughty lava

BRO

ur CODE

thorny haven

what's the difference?

haughty lava

check the docs

thorny haven
haughty lava

things change bud

ok so

try the other one

and see

brave beacon

There is a way to know if a member click here ?

uncut kelp

No

brave beacon

oof

thorny haven
haughty lava try the other one

https://thumbsnap.com/i/889P3FRy.png not work ```js
const { GatewayIntentBits } = require('discord.js')

const Mean = require('./client/Mean');

const mean = new Mean({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildBans,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildScheduledEvents,
GatewayIntentBits.MessageContent
],
allowedMentions: {
parse: ["users", "roles"],
repliedUser: true
}
});```

haughty lava

uhhh

who pinged me

¯_(ツ)_/¯

tame gazelle

Guild#me => GuildMemberManager#me and Guild#fetchOwner() => GuildMemberManager#fetchOwner() ?

rancid dagger

hi, how can i set bot activity in discord.js v14 cuz setPresence and setActivity dont work ://

tame gazelle

they do
you just need to use the ActivityType enum for the type option

rancid dagger
rancid dagger

thank you

thorny haven
tame gazelle

huh?

thorny haven

What is it? what is not clear?

forest elm
tame gazelle

alright thanks

hot yacht
tame gazelle
    ExpectedConstraintError: Invalid string format
        at Object.run (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\@sapphire\shapeshift\dist\index.js:1413:64)
        at StringValidator.run (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\@sapphire\shapeshift\dist\index.js:106:27)
        at UnionValidator.handle (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\@sapphire\shapeshift\dist\index.js:983:32)
        at UnionValidator.parse (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\@sapphire\shapeshift\dist\index.js:113:88)
        at validateDefaultMemberPermissions (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\@discordjs\builders\dist\index.js:964:36)
        at MixedClass.setDefaultMemberPermissions (H:\IdrisGaming\Discord Bot\ObitoInteractions\node_modules\@discordjs\builders\dist\index.js:1458:29)
        at Object.<anonymous> (H:\IdrisGaming\Discord Bot\ObitoInteractions\commands\moderation\ban.js:12:10)
        at Module._compile (node:internal/modules/cjs/loader:1105:14)
        at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
        at Module.load (node:internal/modules/cjs/loader:981:32) {
      constraint: 's.string.regex',
      given: 'BanMembers',
      expected: 'expected /^\\d+$/.test(expected) to be true'
    }

how am I supposed to write the permission?

forest elm

you have to pass the permission number in a string (or not)

just use the enum

PermissionFlagsBits.BanMembers

tame gazelle

I thought we were able to pass strings like Permissions#has() ._.

forest elm

the builder would have to be extended in discord.js to add support for that

but its not currently

tame gazelle

good to know
thanks for the info

brave beacon

Does anyone have an idea how to get the information from a command / that activates a modal, like
/ping <option=180>

So get the value 180, now a form opens and at the end we get the value 180, I succeeded with a new Collections() except that if the person decides to close the form it can distort its value :/

forest elm

config.VerifiedRoleId is not a role id

white nebula

is it a string or number?

brazen knoll

Getting Response: Internal Server Error status: 500 is Discord API issue, not my Bot or D.js, right?

plucky pike

rest@dev seems to be missing a case to handle emoji creation?

it checks

if (status === 401 || status === 403 || status === 429) 
if (status === 200) 
if (status === 429)
if (status >= 500 && status < 600)
if (status >= 400 && status < 500) 
else return null;

but guild emoji creation is sending back a 201 (http "Created") so it falls through all code checks and returns null instead of decoded json

this is resulting in GuildEmojiCreateAction.handle trying to access createdEmoji.id while createdEmoji is null, and crashes

 const already = guild.emojis.cache.has(createdEmoji.id);
                                                        ^
TypeError: Cannot read properties of null (reading 'id')
    at GuildEmojiCreateAction.handle

is this known? did i mess up? should rest@dev not be used?

oh nvm this was edited yesterday, i was in a weird branch

@woven grove seems like #7747 killed emoji upload :(

woven grove

Based on your messages I don’t know what’s wrong now

Since you just said you were on a weird branch?

plucky pike

ignore that sorry, i just mean i was searching blame in a weird branch. once i got on main i saw that it was indeed a recent change

woven grove

Yeah it was most likely the undici PR

Can u make a tiny bot that reproduces the issue

Like a one file bot or smth

plucky pike

ig yeah

fringe marten

How to pass intents into this version/

I seem to run into an error when trying to pass them in

they arent a property of Discord

copper jetty
velvet jasper

If you missed the updates, EnumResolvers are now gone, you'll need to use enums from djs only now.

hybrid crest

getting Discord API Error 10015: Unknown Webhook when attempting to use button interactions to delete a message a bot sent

the bot has GuildMessages, DirectMesasges, Guilds, and GuildWebhooks intents

awaiting button.deleteReply() does not help, but i noticed that it's only firing after 3 seconds, which is intriguing

can anyone else confirm this or offer guidance?

copper jetty

I think it happens when you didn't reply and tried to delete reply

hybrid crest

it's not possible to add a button to a message that doesn't exist -- the message is still visible, not deleted, and is not ephemeral

copper jetty
hybrid crest

that's actually incorrect, read this response for details

silk topaz

what about doing button.message.delete() instead
when you receive a button interaction its not like you are receiving an interaction with the same reply as the one that sent the message with the button in it, so if you are calling buttonInteraction.deleteReply() directly after receiving the interaction then your error is normal.

@hybrid crest (sorry i forgot to reply to you)

well re reading the context again, did you try to use buttonInteraction.message.delete()? or, you could try to save the first interaction response (the one that has the buttons in it) and then call deleteReply() over that one

hybrid crest

please read the message that i replied to; it specifically recommends using buttonInteraction.deleteReply() as it doesn't require the manage messages permission

on a side note, i bring this up in here also because .update() isn't working either, leading me to believe that webhooks aren't being stored correctly

things sent by the bot through interactions have a webhook token stored, but the thing that's confusing me is that i'm getting halted for three seconds until a timeout would occur, and then getting "unknown webhook" in reference to the first interaction

silk topaz

could you share the relevant code for this? that could help a bit

do you want to get it from a regular message?, i dont think thats possible tho

jagged marsh

I have an error handler and all of a sudden I'm being spammed with multipleResolves immediately after the bot loads, of a Promise containing all interaction commands. It doesn't affect my bot's functionality whatsoever, but why might this be happening? I'd prefer to not have to disable that specific error logger.

Unsure if this is a djs@dev issue or not, but thought I'd post it here

hybrid crest
manic lynx

the bot doesnt send anything please help me.

nocturne kayak

that's not possible
show your code

stuck fiber

What is a TextInputComponent? is it like a modal?

pastel flare
stuck fiber

thanks

manic lynx
dawn phoenix

looks like a message including an embed if you have embeds disabled in user settings

manic lynx
const { 
  Client, 
  ChatInputCommandInteraction, 
  ApplicationCommandType, 
  ApplicationCommandOptionType, 
  EmbedBuilder 
} = require("discord.js");

module.exports = {
    name: "ping",
    description: "Returns a WebSocket ping.",
    type: ApplicationCommandType.ChatInput,
    options: [
      {
        name: 'ephemeral',
        description: 'Do you want to do the message ephemeral?',
        type: ApplicationCommandOptionType.Boolean,
        defaultMemberPermission: 'Administrator'
      }
    ],
    /**
     *
     * @param {Client} client
     * @param {ChatInputCommandInteraction} interaction
     * @param {String[]} args
     */
    run: async (client, interaction, args) => {
      const [ephemeral] = args;
      const pongMessage = await interaction.reply({ content: 'ping??', fetchReply: true, ephemeral: ephemeral })
        const embed = new EmbedBuilder()
      .setAuthor({ name: '🏓 Pong!'})
      .setColor('#008000')
      .setDescription(`Bots Ping: ${client.ws.ping}ms!\nApi Ping: ${pongMessage.createdTimestamp - interaction.createdTimestamp}ms!`)
      .setFooter({ text: interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ dynamic: true }) })
      return interaction.editReply({ embeds: [embed] })
    }
}
manic lynx
dawn phoenix

if you disable that bot embeds do not display

manic lynx
dawn phoenix

looks very much like you did

manic lynx

look this this had a content but doesnt appear.

dawn phoenix

that code sends an embed

manic lynx
dawn phoenix

?

manic lynx
const pongMessage = await interaction.reply({ content: 'ping??', fetchReply: true, ephemeral: ephemeral })```

ephemeral is defined

dawn phoenix

i have no idea what you are trying to hint at, but you are definitely - ultimately - sending an embed.

manic lynx
dawn phoenix

the embed itself doesn't show.
it's sent, it just doesn't show on your end
so you either have links disabled, discords embedding service has a hiccup, or something else blocks the display of embedded content

the only considerable instance i have seen of this (over years, repeatedly) is people disabling the "embed link previews" user setting

urban belfry

what does logging pongMessage give you?

it should help you narrow it down

manic lynx
const { Client, ChatInputCommandInteraction, ApplicationCommandType } = require("discord.js");

module.exports = {
    name: "test",
    description: "just a test",
    type: ApplicationCommandType.ChatInput,
    /**
     *
     * @param {Client} client
     * @param {ChatInputCommandInteraction} interaction
     * @param {String[]} args
     */
    run: async (client, interaction, args) => {
      interaction.reply({ content: 'Working' })
    }
}```
dawn phoenix

softPause no idea

manic lynx
dawn phoenix
manic lynx
dawn phoenix

so kindly stop pinging me, i don't know, i cannot help you
the only version of this i have seen is embeds being disabled

scarlet tangle

when discord.js v14

hmm

tame gazelle

when it's ready

scarlet tangle

when V14 is going to be stable?

dawn phoenix

literally 2 messages above yours

scarlet tangle
buoyant token

How different is v14 relatively v13?

urban belfry
solar spade

how can I close the modal after submit?

vague coyote
solar spade
proven wolf

Hi, there is still no way to know via the API if a member is timeout?

plain roverBOT
uncut kelp

still no way
There... was never not a way

proven wolf

thanks

proven wolf
granite yacht

How do we do .setPrecense in djs v14?

icy ferry

modals are coming out in v14 right ?

scarlet tangle
plain roverBOT
granite yacht

thats djs v13...

i need it in djs v14

plain roverBOT
granite yacht

THAT DOSENT WOK

only the status

is the type right?

jagged marsh

client.user.setPresence({ activities: [{ name: 'Test', type: ActivityType.Watching }], status: 'online' });

granite yacht

Where is activityType ?

like wich package?

jagged marsh

discord.js ?!?!?!!?

forest elm
jagged marsh

^^^^^

granite yacht
forest elm

const { ActivityType } = require('discord.js')

jagged marsh
granite yacht

setInterval(() => {
const activity = activities[Math.floor(Math.random() * activities.length)];
client.user.setPresence({
activities: [
{
name: "Test",
type: "3",
},
],
status: activity.status
})
}, 10000 );

forest elm

you didn't make it a number?

granite yacht

I did?

jagged marsh

no?

granite yacht
forest elm

looks like a string to me

granite yacht

Its how my friend said it was gonna be xD

jagged marsh

that– do you know javascript?

a number doesn't have quotes

I'd suggest learning basic javascript

granite yacht

I KNOw JS

jagged marsh

doubt

make it a number then

granite yacht

I did

jagged marsh

and?

granite yacht

Still not working 🙂

jagged marsh

well send your new code

granite yacht

setInterval(() => {
const activity = activities[Math.floor(Math.random() * activities.length)];
client.user.setPresence({
activities: [
{
name: activity.content,
type: 2
},
],
status: activity.status
})
}, 10000 );

forest elm

and show what activities is

granite yacht
jagged marsh
granite yacht
jagged marsh

that code should be working– can you send the whole file?

wicked tusk

how do i remove permissions for @everyone when creating a new channel?

forest elm

the guild id represents the @everyone role

wicked tusk

so?

forest elm

use the permissionOverwrites option and pass the guild id as the id

pseudo mirage

are modals limited only to interactions or can we use them for messages as well?

forest elm

interactions

pseudo mirage

also interaction.update for a select menu now returns unknown interaction after updating to 13.7

any reason why?

frank moss
pseudo mirage
frank moss

error

ok i found it

pseudo mirage

they should be all caps

im guessing

outer bane

use the ButtonStyle enum

outer bane
tame gazelle
frank moss

ty bro

warm basin

So whenever i create a voice channel currently after updating it returns a Type Error, its just this Simple line and thats the output i get from it ? Something that i am missing perhaps ? some bug ?

uncut kelp

I was able to reproduce that. Seems the channel does get created though

warm basin
uncut kelp

I have no idea why we're receiving null when creating a channel

Nvm now I do

Seems to be a rest bug, rip

warm basin

this bug seems to be pretty new tho 0.o

Probably something added recently.

forest elm

doesn't throw on my end Thonk
djs 14.0.0-dev.1652443445-d522320

warm basin

i am on djs 14.0.0-dev.1647259751.2297c2b

forest elm

update to the latest @dev and try again

warm basin

isnt that the latest ?

forest elm

what i sent is the latest

yours is 2 months old according to npm

warm basin

same issue

uncut kelp

@warm basin https://github.com/discordjs/discord.js/pull/7919 fixed that issue for me. The status when creating a channel was 201, but we were only looking for 200 which returned null, bad bad bad. It should be rolled out into the next dev version... so <t:1652572800:R>

warm basin

okay, sounds great, thanks ;D

granite yacht

my modals wont show up, how can i fix it, my code is:

    const modal = new ModalBuilder()
      .setCustomId('suggestionmodal')
      .setTitle('Suggestion');


      const titleofsuggestion = new TextInputBuilder()
            .setCustomId('titleofsuggesation')
            // The label is the prompt the user sees for this input
            .setLabel("Whats the title of your suggestion?")
            // Short means only a single line of text
            .setStyle(TextInputStyle.Short);

        const thesuggestion = new TextInputBuilder()
            .setCustomId('thesuggestion')
            .setLabel("What is the suggestion?")
            // Paragraph means multiple lines of text.
            .setStyle(TextInputStyle.Paragraph);


    const titleactionrow = new ActionRowBuilder().addComponents([titleofsuggestion])
    const suggestionactionrow = new ActionRowBuilder().addComponents([thesuggestion])

    modal.addComponents([titleactionrow, suggestionactionrow, ]);


        // Show the modal to the user
        await interaction.showModal(modal);

forest elm

are you getting any errors?

granite yacht

nOPE

copper jetty

did you run this code?

granite yacht

Yes

forest elm

add a console.log() in there to make sure that is executing

pseudo mirage

TextInputStyle is undefined

can how can i fix this

uncut kelp

By defining it?

rotund kite

Anyone can say me how to make this type of embed?

granite yacht

It worked now, kinda

but i get this error

forest elm

show the code

urban belfry
copper jetty
granite yacht
 const modal = new ModalBuilder()
  .setCustomId('myModal')
  .setTitle('My Modal');

// Add components to modal

// Create the text input components
const favoriteColorInput = new TextInputBuilder()
  .setCustomId('favoriteColorInput')
    // The label is the prompt the user sees for this input
  .setLabel("2 One")
    // Short means only a single line of text
  .setStyle(TextInputStyle.Short);

const hobbiesInput = new TextInputBuilder()
  .setCustomId('hobbiesInput')
  .setLabel("First one")
    // Paragraph means multiple lines of text.
  .setStyle(TextInputStyle.Paragraph);

// An action row only holds one text input,
// so you need one action row per text input.
const firstActionRow = new ActionRowBuilder().addComponents([favoriteColorInput]);
const secondActionRow = new ActionRowBuilder().addComponents([hobbiesInput]);

// Add inputs to the modal
modal.addComponents([firstActionRow, secondActionRow]);



    await interaction.showModal(modal);
forest elm

that's not it

granite yacht

then how?

forest elm

i meant that is not the code that caused that error

granite yacht

Then what do i show?

forest elm

the code that caused the error

which involves interaction.editReply()

granite yacht

Theres no EditReply

outer bane

last line of the stack trace?

granite yacht

Where?

this?

outer bane

I meant read the last line

at ...editReply

forest elm

somewhere in your code you're using <interaction>.editReply(), which is causing that error

granite yacht

I cant use it?

forest elm

you can use it under certain circumstances

i was just asking for you to show the code where you're using it

copper jetty

your editing nonexistent message

granite yacht

I defered the reply doe...

forest elm

if it's not the same, it's a similar colour, why does that matter?

it doesn't make it a different "type of embed"

urban belfry
rotund kite No

fetch the message, grab the embed data and see if you can find what you want
you just saying no doesn't really help
why no lol

rotund kite

Lol

quiet axle
TypeError: Cannot read properties of undefined (reading 'permissions')

code

message.guild.me.permissions.has("SendMessages")
outer bane
tall verge
signal rampart
const client = new Discord.Client({
    intents: [
        Discord.IntentsBitField.Flags.Guilds,
        Discord.IntentsBitField.Flags.GuildBans,
        Discord.IntentsBitField.Flags.GuildMembers,
        Discord.IntentsBitField.Flags.GuildMessages,
        Discord.IntentsBitField.Flags.MessageContent,
        Discord.IntentsBitField.Flags.GuildIntegrations,
    ],
});```
Error:
```if (!Object.hasOwn(given, key) || given[key] === undefined) {
               ^

TypeError: Object.hasOwn is not a function```

What's wrong?

outer bane

outdated node version

signal rampart

oh

scarlet tangle

how to fix this error?

TypeError: Cannot read properties of undefined (reading 'permissions')

my script:

if (!msg.guild.me.permissions.has(PermissionsBitField.Flags.SendMessages)) {
  // ...
}

in 14.0.0-dev.1652443445-d522320

outer bane
scarlet tangle

thx

TypeError: Cannot read properties of undefined (reading 'me')
bruh

restive iris

I... don't get how to use .addFields on an embed on the v14 preview
Is... there anything different from v13 on this? I found this example:

.addFields(
        { name: 'Regular field title', value: 'Some value here' },
        { name: '\u200B', value: '\u200B' },
        { name: 'Inline field title', value: 'Some value here', inline: true },
        { name: 'Inline field title', value: 'Some value here', inline: true },
    )
scarlet tangle

addFields must be an array

outer bane

addFields takes an array

restive iris

Well that was my reasoning at first

scarlet tangle
forest elm
outer bane

guild.members

scarlet tangle

thx again :3

restive iris

following the stack trace, it's from addFields

outer bane

catch the error and log it

restive iris
outer bane catch the error and log it
Error: Received one or more errors at ArrayValidator.handle (C:\Users\06589\Programmation\repos\meaxisnetwork-bot\node_modules\@sapphire\shapeshift\dist\index.js:399:70) at ArrayValidator.parse (C:\Users\06589\Programmation\repos\meaxisnetwork-bot\node_modules\@sapphire\shapeshift\dist\index.js:113:88) at EmbedBuilder.addFields (C:\Users\06589\Programmation\repos\meaxisnetwork-bot\node_modules\@discordjs\builders\dist\index.js:244:54) at C:\Users\06589\Programmation\repos\meaxisnetwork-bot\commands\profile.js:13:6 at processTicksAndRejections (node:internal/process/task_queues:96:5) {errors: Array(1), stack: "Error: Received one or more errors\n at ArrayVal…jections (node:internal/process/task_queues:96:5)", message: "Received one or more errors"}
outer bane

the error should include the wrong input and a hint at what's wrong

restive iris

I'll check if the vars I used in my fields are defined

outer bane

shapeshift errors override util.inspect which is used by console.log so logging the error with it should format it in a more readable way

restive iris

I'm already logging the error tho

forest elm

it doesn't use promises

restive iris

The code where I create my embed is wrapped in a promise

I can put the embed part in a try-catch if you want

Wrapping into try catch actually showed me good input

CombinedPropertyError (1)
  Received one or more errors

  input[3]
  | CombinedPropertyError (1)
  |   Received one or more errors
  |
  |   input.value
  |   | ValidationError > s.string
  |   |   Expected a string primitive
  |   |
  |   |   Received:
  |   |   | 128
```- OOOOH IT DOESN'T AUTOMATICALLY CONVERT TO STRING

Thanks for the help everyone

I feel dumb

hard bridge

Hi all, I'm having issues getting the embed from a message created by a followed channel (crossposted). I can catch the message using messageCreate, but the embeds array is 0 length. There is definitely an embed (and nothing else) in the incomming message. Any suggestions?

idle galleon
hard bridge

Is there a convenient way to catch that? I tried messageUpdated, but nothing was caught...

idle galleon

There’s no d

Just messageUpdate

hard bridge

Thanks, just need to wait for a new message to test lol. Hoping it was just a facepalm moment 😁

manic lynx
        let newChannel = await message.channel.clone();
        await message.channel.delete();
        await newChannel.send({ content: 'Please enjoy with a new channel :)' });```
Error: Cannot read the proterties of null ( reading: 'id' ) at node:modules
forest elm
manic lynx
forest elm

yes

hard bridge

Finally had a message come through from the other server, but its not triggering messageUpdate. (I tested with my own message, and the event is firing, just not for messages coming in from the other server). Any suggestions where else i could look? I've tried getting messages from the channels message cache but they seem to be missing the embed as well...

idle galleon
hard bridge

That enough?

idle galleon
hard bridge
dull mulchBOT
white nebula

@scarlet tangle ^

hard bridge

Thanks Kinect! Legend

manic lynx

channel.clone() and channel.delete() doesnt work.

uncut kelp

Cannot reproduce

manic lynx

cannot find the id of null

scarlet tangle

How do I delete the old Slash?

uncut kelp

Usually people would post their version alongside the problematic code sample... btw. You're just on an old version

manic lynx

help

urban belfry
manic lynx
plain roverBOT
urban belfry

that is that

idle galleon

That's is v14 docs atm

urban belfry

you can select the branch on the site

idle galleon

Until v14 becomes stable and we start working on v15

scarlet tangle

soon™

manic lynx

Im excited to test it!!

scarlet tangle

it's not even in the plans yet

v14 comes before v15 thinKappa

manic lynx

how do I set the slash command default permission?

red mountain

interesting, just tried using embed fields function, i wonder what methods got changed for that in v14

plain roverBOT
red mountain

perfect

scarlet tangle
red mountain

wait i actually used prefix method but alr, i will also check that

It worked, Ty

manic lynx
manic lynx

and also its returns array

red mountain

Welp alr

spiral mauve

I assume there is no way to determine if a Modal was cancelled? Is this an oversight or a limitation of Discord API?

nocturne kayak

the latter

spiral mauve

Wow, that's quite terrible. How can Discord claim this to be a "replacement" for the awaitMessages way of collecting a response when there's glaring flaws like this.

copper jetty

You cant determine if someone didnt sent a message too btw

exotic nexus

I think they mean the time option that collectors have

spiral mauve

You can work around that by simply waiting for the message to arrive (or filter for the response you want) or awaitMessages to time out. Even if the user fucks up and types something incorrectly, you can work with that by showing an error, or just filtering the messages so that only the correct message gets collected. With Modals, once the user cancels the Modal, there is no going back. The user can't open it again, and has to wait for the collector to time out before they can attempt again.

This sounds like some massive oversight on Discord's part, unless I'm missing something here.

forest elm

tbh to them, the interaction type is called MODAL_SUBMIT

spiral mauve

So what are developers supposed to do if a user accidentally cancels the Modal or decides that they want to cancel it and press a different button (which should bring out a different Modal)?

knotty plover

Just have a timer on waiting for the modal

And make sure your Modal customIds are unique so your listeners don't overlap and duplicate

I do this by putting the interaction I'd in it

spiral mauve
knotty plover Just have a timer on waiting for the modal

I do have a timer on it. I'm currently using awaitModalSubmit for all my modals. The problem here is that the code won't continue unless the timer runs out, or the modal is submitted. I suppose I will have to switch to collectors for this.

knotty plover

I'm not sure how that will change things

With collectors, wouldn't it be continuing before they've submitted in this situation?

nocturne kayak

so im using awaitModalSubmit() to collect modal interaction.
how would i prevent multiple collectors (persists if the user cancelled the modal) responding to 1 single modal interaction?

knotty plover

Use unique customIds

I do this by putting the interaction id that launched the modal in the modals custom id

cinder bane

components[0].components[5][COMPONENT_LAYOUT_WIDTH_EXCEEDED]: The specified component exceeds the maximum width?

copper jetty
exotic nexus

^ max 5 in one row

cinder bane

yeah i remember now, the limit is 5

copper jetty

Max 5 buttons or 1 select menu or 1 text input

thick dew
brazen knoll
(node:3909536) ExperimentalWarning: buffer.Blob is an experimental feature. This feature could change at any time
    at emitExperimentalWarning (node:internal/util:224:11)
    at new Blob (node:internal/blob:138:5)
    at _RequestManager.resolveRequest (/root/Bots/Ayako-v1.5/node_modules/@discordjs/rest/dist/index.js:887:36)
    at _RequestManager.queueRequest (/root/Bots/Ayako-v1.5/node_modules/@discordjs/rest/dist/index.js:845:46)
    at REST.request (/root/Bots/Ayako-v1.5/node_modules/@discordjs/rest/dist/index.js:995:32)
    at REST.post (/root/Bots/Ayako-v1.5/node_modules/@discordjs/rest/dist/index.js:986:17)
    at TextChannel.send (/root/Bots/Ayako-v1.5/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:175:38)``` whats this
copper jetty

Its a warning but i think you should update node

forest elm
deep elk

So are modals introduced in v14? Or are they in v13 too

urban belfry
deep elk

Alright

urban belfry

there's a wip guide for it that's currently a pr

brazen knoll
round marsh

I want to be able to open a modal on button click or on select menu is that possible?

urban belfry
thorny haven

not guild members

i - command interaction

tame gazelle

if i is a CommandInteraction why are you doing i++

thorny haven

👌

brave dagger

How can I show another modal after the user replied to the 1st one?

velvet jasper

You can’t

frigid sleet

how i add choices to ín v14?

.addStringOption(option => 
        option
        .setName('item')
        .setDescription('A description')
        .addChoices([
            {
                name:'North Country Parka',
                value:'ncp'
            },
            {
                name:`Worker\'s Cap`,
                value:'wc'
            },  
            {
                name:'Angry Rain Boots',
                value:'arb'
            },]
        )
pallid ice

so I'm not sure if this is intended or not or if maybe I'm just dumb.

since the perms v2 change, I've continued to use defaultPermission: false and when doing so the command will show in the Integrations tab as denied for everyone as expected. with the d.js changes merged for perms v2 I decided to move to the new system and use default_member_permissions: '0' instead.

I found that using my existing method of Guild#commands.set was having no effect and the commands were still usable by others

so I moved my command registration to the preferred method of rest and find that yes now people without the overwrites/admin etc can no longer use the command(s) however in Integrations it still shows the command as allow for everyone and I don't know why

urban belfry
frigid sleet
urban belfry

first,uninstall builders and update djs to the latest commit

wait what the heck, now it takes a rest parameter? 😭
@frigid sleet don't pass an array, pass multiple parameters

frigid sleet
pallid ice

thanks for the clarification. I assumed as much but just wanted to check here in case

oh ty ty!

river harbor

How do I import the user class?

I'm trying to run checks with instanceof

copper jetty
river harbor
copper jetty

it depends

dark minnow

It's safe to use the client rest to deploy guild commands, instead of creating a new rest

urban belfry

if you call the method through djs, you're most likely going to be making needless api calls leading to api spam leading to you getting rate limited

it's just considered best practice, that's all

dark minnow

Got it, thanks

urban belfry

we highly recommend the approach in the guide

river harbor

I'm making a program that actually reads the command deployment json, compares it to the currently registered commands and then makes any changes needed.

So you could do something like that.

(shit im very late to this)

river harbor
knotty plover

numbers can be text

You cant restrict it to just numbers though

How to... not doing something? I did say "cant"

IntentsBitfield in v14

If you're looking at the v14 changes preview guide sure

See pins

Just that page

granite yacht

Does .setRequired(true) exist in modals?

copper jetty

No

granite yacht

Alr

Uhm, how do i fix this?

copper jetty

Dont use getTextInputValue method on undefined

granite yacht

What do i use then?

copper jetty

Call this method on ModalSubmitFieldsResolver

granite yacht

???

Wdym? @copper jetty

plain roverBOT
granite yacht

soo

interaction.ModalSubmitFieldsResolver.getTextInputValue("value")?

thorny haven

coolstory

copper jetty

<ModalSubmitInteraction>.fields is ModalSubmitFieldsResolver

thorny haven

interactionModal.getTextInputValue("value")

granite yacht

do i have to import anything from the djs package to get it to work?

copper jetty

No

granite yacht
copper jetty

interaction.fields.getTextInputValue(name)

granite yacht

I get the getTextInputValue undefined

thorny haven
granite yacht
thorny haven
granite yacht

I get this now in interactionCreate

thorny haven
granite yacht

Works now

, i had a deferreply that i wasnt supposed to have 🤣

granite yacht

Whats the new GUILD_TEXT on channel

as im trying to check if its the right channel type

chnl.type !== "GUILD_TEXT"

this is the one currently

worked in djs v13, but not v14

vague coyote

GuildText probably

granite yacht

Ill try that

Didnt work

granite yacht

const chnl = interaction.options.getChannel("channel")

thats the code for the chnl

vague coyote

why do you need that anyway, just use the typeguard, chnl.isText()

granite yacht

Soo

if(chnl.isText()) {
console.log("true")

Like that?

vague coyote

that would be one way, yes

granite yacht

ill test that

That worked 😄 Ty ❤️

Im currently changing from djs v13 to djs v14

bc of modals xD

dawn phoenix

pst, modals are on v13 blobshh

vague coyote

we srsly need that announcement