Law
Law
Explore posts from servers
DIAdiscord.js - Imagine an app
Created by Law on 10/21/2023 in #djs-questions
Discord v14.8.0 Modal Submit not working.
I fixed the interaction by adding a interaction.reply message which has worked to solve the issue with the modal.
17 replies
DIAdiscord.js - Imagine an app
Created by Law on 10/21/2023 in #djs-questions
Discord v14.8.0 Modal Submit not working.
I'm not understanding because I have a block of code running inside the scope of the .then callback
17 replies
DIAdiscord.js - Imagine an app
Created by Law on 10/21/2023 in #djs-questions
Discord v14.8.0 Modal Submit not working.
const { CaptchaGenerator } = require('captcha-canvas');
const { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder, AttachmentBuilder, ModalBuilder, TextInputBuilder} = require('discord.js');
const array = [];

module.exports = {
name: 'verify',
description: 'Verify that you are not a bot',
devOnly: true,
testOnly: true,

callback: async (client, interaction) =>{
const captcha = new CaptchaGenerator()
.setDimension(150, 600)
.setCaptcha({size: 60, characters: 10})
.setDecoy({ opacity: 1, size: 40 })
.setTrace()

const buffer = captcha.generateSync();

const verifyAttachment = new AttachmentBuilder(buffer, { name: 'captcha.png'});


const embed = new EmbedBuilder()
.setTitle('Keyed Chaos Captcha')
.setDescription('Please complete the captcha!')
.setImage('attachment://captcha.png')

console.log(`Example captcha text:${captcha.text}\n`);

const target = interaction.user.id;

let checkmk = new ButtonBuilder()
.setCustomId('answer')
.setLabel('Answer Captcha')
.setStyle(ButtonStyle.Success);

const row = new ActionRowBuilder()
.addComponents(checkmk);



response = await interaction.reply({
embeds:[embed],
files: [verifyAttachment],
components: [row],
ephemeral: true,
fetchReply: true
});

const filter = (interaction) => interaction.customId === 'answer';
response.awaitMessageComponent({filter, time: 15_000})
.then(interaction => {
console.log(`${interaction.customId} was clicked!`)
const modal = new ModalBuilder()
.setCustomId('verification')
.setTitle('Keyed Chaos Verification')
.addComponents([
new ActionRowBuilder().addComponents(
new TextInputBuilder()
.setCustomId('verification-answer')
.setLabel('Answer')
.setStyle(2)
.setMaxLength(10)
.setRequired(true),
),
]);
interaction.showModal(modal);
const filter = (interaction) => interaction.customId === 'verification';
interaction.awaitModalSubmit({filter, time: 15_000})
.then(interaction => {
console.log(`${interaction.customId} was submitted`)
interaction.getText
})
.catch(console.error);






})
.catch(console.error);

},
};
const { CaptchaGenerator } = require('captcha-canvas');
const { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder, AttachmentBuilder, ModalBuilder, TextInputBuilder} = require('discord.js');
const array = [];

module.exports = {
name: 'verify',
description: 'Verify that you are not a bot',
devOnly: true,
testOnly: true,

callback: async (client, interaction) =>{
const captcha = new CaptchaGenerator()
.setDimension(150, 600)
.setCaptcha({size: 60, characters: 10})
.setDecoy({ opacity: 1, size: 40 })
.setTrace()

const buffer = captcha.generateSync();

const verifyAttachment = new AttachmentBuilder(buffer, { name: 'captcha.png'});


const embed = new EmbedBuilder()
.setTitle('Keyed Chaos Captcha')
.setDescription('Please complete the captcha!')
.setImage('attachment://captcha.png')

console.log(`Example captcha text:${captcha.text}\n`);

const target = interaction.user.id;

let checkmk = new ButtonBuilder()
.setCustomId('answer')
.setLabel('Answer Captcha')
.setStyle(ButtonStyle.Success);

const row = new ActionRowBuilder()
.addComponents(checkmk);



response = await interaction.reply({
embeds:[embed],
files: [verifyAttachment],
components: [row],
ephemeral: true,
fetchReply: true
});

const filter = (interaction) => interaction.customId === 'answer';
response.awaitMessageComponent({filter, time: 15_000})
.then(interaction => {
console.log(`${interaction.customId} was clicked!`)
const modal = new ModalBuilder()
.setCustomId('verification')
.setTitle('Keyed Chaos Verification')
.addComponents([
new ActionRowBuilder().addComponents(
new TextInputBuilder()
.setCustomId('verification-answer')
.setLabel('Answer')
.setStyle(2)
.setMaxLength(10)
.setRequired(true),
),
]);
interaction.showModal(modal);
const filter = (interaction) => interaction.customId === 'verification';
interaction.awaitModalSubmit({filter, time: 15_000})
.then(interaction => {
console.log(`${interaction.customId} was submitted`)
interaction.getText
})
.catch(console.error);






})
.catch(console.error);

},
};
17 replies
DIAdiscord.js - Imagine an app
Created by Law on 10/21/2023 in #djs-questions
Discord v14.8.0 Modal Submit not working.
Will do one moment
17 replies
DIAdiscord.js - Imagine an app
Created by Law on 10/21/2023 in #djs-questions
Discord v14.8.0 Modal Submit not working.
Is it possible I am missing something else?
17 replies
DIAdiscord.js - Imagine an app
Created by Law on 10/21/2023 in #djs-questions
Discord v14.8.0 Modal Submit not working.
Alright, and I did get it to work where I am getting the console log from the promisified collector but the modal keeps saying something went wrong and doesn't close out
17 replies
DIAdiscord.js - Imagine an app
Created by Law on 10/21/2023 in #djs-questions
Discord v14.8.0 Modal Submit not working.
Okay so this sounds like its a method that acts similar to a collector object right?
17 replies
DIAdiscord.js - Imagine an app
Created by Law on 10/21/2023 in #djs-questions
Discord v14.8.0 Modal Submit not working.
changing that currently
17 replies
DIAdiscord.js - Imagine an app
Created by Law on 10/21/2023 in #djs-questions
Discord v14.8.0 Modal Submit not working.
I'm wondering if it has something to do with line 69 - line 76 creating the issue with the modal submission.
client.on(Event.InteractionCreate, async interaction =>{
if(!interaction.isModalSubmit()) return;

if(interaction.customId === 'verification'){
const modalAnswer = interaction.fields.getTextInputValue('verification-answer');
console.log(`Answer: ${modalAnswer}\n`);
await interaction.ModalSubmitInteraction(( "Your modal has been submitted"), ephemeral = true);
}
client.on(Event.InteractionCreate, async interaction =>{
if(!interaction.isModalSubmit()) return;

if(interaction.customId === 'verification'){
const modalAnswer = interaction.fields.getTextInputValue('verification-answer');
console.log(`Answer: ${modalAnswer}\n`);
await interaction.ModalSubmitInteraction(( "Your modal has been submitted"), ephemeral = true);
}
17 replies
DIAdiscord.js - Imagine an app
Created by Law on 10/21/2023 in #djs-questions
Discord v14.8.0 Modal Submit not working.
I've updated it
17 replies
DIAdiscord.js - Imagine an app
Created by Law on 10/21/2023 in #djs-questions
Discord v14.8.0 Modal Submit not working.
Will this break anything ?
17 replies
DIAdiscord.js - Imagine an app
Created by Law on 10/21/2023 in #djs-questions
Discord v14.8.0 Modal Submit not working.
It keeps saying something went wrong when I am trying to press submit on the modal, and I'm not getting the reply from the interaction.
17 replies
DIAdiscord.js - Imagine an app
Created by Law on 10/21/2023 in #djs-questions
Discord v14.8.0 Modal Submit not working.
Thank you I didn't realize I needed that option and didn't know about it either.
17 replies
DIAdiscord.js - Imagine an app
Created by Law on 10/15/2023 in #djs-questions
Unable to show modal from button interaction. (discord V14.8.0)
@werewolvinny 👻🌈 Thank you this worked
16 replies
DIAdiscord.js - Imagine an app
Created by Law on 10/15/2023 in #djs-questions
Unable to show modal from button interaction. (discord V14.8.0)
Taking a look at it as we speak
16 replies
DIAdiscord.js - Imagine an app
Created by Law on 10/15/2023 in #djs-questions
Unable to show modal from button interaction. (discord V14.8.0)
I can retry using a collector most definitely and thank you.
16 replies
DIAdiscord.js - Imagine an app
Created by Law on 10/15/2023 in #djs-questions
Unable to show modal from button interaction. (discord V14.8.0)
Looking at what you sent me @werewolvinny 👻🌈 and that applies from what I understand to the submission of the modal and not actually showing the modal after the button click
16 replies
DIAdiscord.js - Imagine an app
Created by Law on 10/15/2023 in #djs-questions
Unable to show modal from button interaction. (discord V14.8.0)
I thought it may be the listeners but I was unsure really thank you for confirming that for me.
16 replies
DIAdiscord.js - Imagine an app
Created by Law on 10/15/2023 in #djs-questions
Unable to show modal from button interaction. (discord V14.8.0)
I will see if I can update my DJs without breaking captcha-canvas package
16 replies
DIAdiscord.js - Imagine an app
Created by Law on 10/15/2023 in #djs-questions
Unable to show modal from button interaction. (discord V14.8.0)
An example of the bot running
16 replies