koholaz
koholaz
DIAdiscord.js - Imagine an app
Created by koholaz on 9/16/2024 in #djs-questions
forum post reaction + join
hello i am trying to make it so my bot will automatically join new forum posts in the server. my code can be found below:
if (message.author.bot) return;
console.log('message recieved')
if (message.channel instanceof ForumChannel) {
console.log('pass the forum check')
if (message.author.bot) return;
console.log('message recieved')
if (message.channel instanceof ForumChannel) {
console.log('pass the forum check')
it is printing my message recieved to the console, however it is failing to print the pass the forum check to the console. i recieve no errors, yet it doesnt join nor react nor print that confirmation message.
4 replies
DIAdiscord.js - Imagine an app
Created by koholaz on 9/9/2024 in #djs-questions
Error Adding Buttons To Message
I am working on creating an application system for my Discord server, but that is irrelevant to the issue. I am trying to add Flag and Deny buttons to the embed that is sent to the submitted applications channel. Here is my code:
const flag = new ButtonBuilder({
customId: 'flag',
label: 'Flag',
style: ButtonStyle.Secondary,
emoji: '👋'
})

const deny = new ButtonBuilder({
customId: 'deny',
label: 'Deny',
style: ButtonStyle.Secondary,
emoji: '🙁'
})

const row = new ActionRowBuilder<ButtonBuilder>().addComponents([flag, deny])
await applicationsChannel.send({ embeds: [embed], components: [row] });
const flag = new ButtonBuilder({
customId: 'flag',
label: 'Flag',
style: ButtonStyle.Secondary,
emoji: '👋'
})

const deny = new ButtonBuilder({
customId: 'deny',
label: 'Deny',
style: ButtonStyle.Secondary,
emoji: '🙁'
})

const row = new ActionRowBuilder<ButtonBuilder>().addComponents([flag, deny])
await applicationsChannel.send({ embeds: [embed], components: [row] });
Here is the error that I am getting:
Type 'ActionRowBuilder<ButtonBuilder>' is not assignable to type 'APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>'.
Property 'type' is missing in type 'ActionRowBuilder<ButtonBuilder>' but required in type 'ActionRowData<MessageActionRowComponentBuilder | MessageActionRowComponentData>'.
Type 'ActionRowBuilder<ButtonBuilder>' is not assignable to type 'APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>'.
Property 'type' is missing in type 'ActionRowBuilder<ButtonBuilder>' but required in type 'ActionRowData<MessageActionRowComponentBuilder | MessageActionRowComponentData>'.
I have been at this for over 2 days now can still can't figure a fix out. I am using DJS version 14.15.3 and Node version 21.6.2. Thanks!
8 replies
DIAdiscord.js - Imagine an app
Created by koholaz on 9/9/2024 in #djs-questions
error when trying to add a button to a message
heya, i am trying to make an application system for my discord server. i am trying to add an action row with buttons, but i keep getting the same error no matter what i do. here is my code:
const row = new ActionRowBuilder<ButtonBuilder>()
.addComponents(
new ButtonBuilder()
.setCustomId('submit')
.setLabel('Submit')
.setStyle(ButtonStyle.Success),
new ButtonBuilder()
.setCustomId('cancel')
.setLabel('Cancel')
.setStyle(ButtonStyle.Danger)
);

await (introMessage.channel as DMChannel).send({
content: 'Please confirm your responses:',
components: [row] // THE ERROR IS ON THIS LINE !!
});
const row = new ActionRowBuilder<ButtonBuilder>()
.addComponents(
new ButtonBuilder()
.setCustomId('submit')
.setLabel('Submit')
.setStyle(ButtonStyle.Success),
new ButtonBuilder()
.setCustomId('cancel')
.setLabel('Cancel')
.setStyle(ButtonStyle.Danger)
);

await (introMessage.channel as DMChannel).send({
content: 'Please confirm your responses:',
components: [row] // THE ERROR IS ON THIS LINE !!
});
this is the error i am getting
Type 'ActionRowBuilder<ButtonBuilder>' is not assignable to type 'APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>'.
Property 'type' is missing in type 'ActionRowBuilder<ButtonBuilder>' but required in type 'ActionRowData<MessageActionRowComponentData | MessageActionRowComponentBuilder>'.
Type 'ActionRowBuilder<ButtonBuilder>' is not assignable to type 'APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>'.
Property 'type' is missing in type 'ActionRowBuilder<ButtonBuilder>' but required in type 'ActionRowData<MessageActionRowComponentData | MessageActionRowComponentBuilder>'.
some help would be extremely appreciated!
3 replies