#What you mean how did your add it
1 messages ยท Page 1 of 1 (latest)
.then(async interaction =>
const StartTimeInput = interaction.fields.getTextInputValue(StartTime);
const EndTimeInput = interaction.fields.getTextInputValue(EndTime);
const StartProofInput = interaction.fields.getTextInputValue(StartProof);
const EndProofInput = interaction.fields.getTextInputValue(EndProof);
const TotalTimeInput = interaction.fields.getTextInputValue(TotalTime);
@thorny oyster
You need a { and }
oh
i keep getting
Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
at ChatInputCommandInteraction.reply (/Users/oerston25/Desktop/test-bot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:102:46)
at Client.<anonymous> (/Users/oerston25/Desktop/test-bot/index.js:76:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:394:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
code: 'InteractionAlreadyReplied'
}
await interaction.reply(`${interaction.user.tag}, your patrol log has been submitted. You will get a notice in your Direct Messages on the status of your log.`),
await ApproveChl.send({ embeds: [PendingEmbed] })
this is the only spot where i have something sent
@thorny oyster
Use followUp
ApproveChl.followUp ?
No the top one
Ok
And also what is ApproveChl ?
same error
const ApproveChl = client.channels.cache.get('1034095095261184040');
and it still gave the interaction already replied error when i changed it to followu[
Show me the full code
same err
Can you show me the interaction event listener
how so
Your interaction event file
like index.js?
Where your put interactionCreate event ?
client.on('interactionCreate', async (interaction) => {
try {
const RestrictedUsers = await Restricted.findOne({ where: { user: interaction.user.id } })
console.log(RestrictedUsers.user)
if (RestrictedUsers.user == interaction.user.id) return interaction.reply('no');
} catch {};
const command = client.commands.get(interaction.commandName);
if (!command) return;
try {
await command.execute(interaction);
} catch (error) {
console.error(error);
await interaction.reply({ embeds: [errorEmbed], ephemeral: true });
}
});
Can you show me full code of how your handle modal submit
awaitModalSubmit() thing
Ye show me
yes it does
ReferenceError: StartTimeInput is not defined
at Object.execute (/Users/oerston25/Desktop/test-bot/commands/modal.js:64:28)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Client.<anonymous> (/Users/oerston25/Desktop/test-bot/index.js:73:5)
node:events:491
console.log(interaction)?
it never submits the modal i dont think
Line 64 show me
.setDescription(${StartTimeInput})
oh its b/c i moved the const stuff below the embed builder
You need to put the embed below the const StartTimeInput in then()
yup
@thorny oyster https://sourceb.in/ohP1rBbN3P
here is the interaction
being logged
Then the error ?
Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
at ChatInputCommandInteraction.reply (/Users/oerston25/Desktop/test-bot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:102:46)
at Client.<anonymous> (/Users/oerston25/Desktop/test-bot/index.js:76:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:394:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
code: 'InteractionAlreadyReplied'
}
Is this full error ?
Why awaitPatrolModalSubmit() ?
cuz thats the modal id
What its should be awaitModalSubmit()
Can you put on srcbin
Log interaction.fields
Ok
Okay change your interaction.fields to interaction.fields.fields
the log?
Yes
Sorry if i replied late because i use a phone xD
it ok
Now on your code change from interaction.fields.getTextInputValue() to interaction.fields.fields.getTextInputValue()
Do you have a modal handler ?
uhm no, i was just using a filter
Umm are you sure because i see the code you gived it to me is just a modal builder
Or is it a command ?
Oh yeah
I think you need to handle the modal submit inside interactionCreate event
if (interaction.isModalSubmit()) {
// Further code
}
oh so i put my code in there
Ye and remove the awaitModalSubmit() inside here
Okay.
Okay
do i still need the filter?
Nope
And dont forget to check
if (interaction.customId === 'PatrolLog') {
// Further code
}
if (interaction.isModalSubmit()) {
^
ReferenceError: interaction is not defined
at Object.<anonymous> (/Users/oerston25/Desktop/test-bot/index.js:84:1)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47
oh
Did you put on interactionCreate event
You did not put the code inside interactionCreate
oh
wdym
Put first then ill explain to you
i did
it doesnt submit the modal now
Show me the updated code
Why do you have a nested event listeners
idk
Okay basically i tell you what is nested listeners
client.on('ready', ...);
client.once(Events.ClientReady, ...);
Use either one only
If you want a bottom one then remove the first one
And for interactionCreate event you have another Events.InteractionCreate event nested
I can help you to clean the code but it takes 3 min or something if you want to
Okay hold on
Thank u
@manic willow, here your go https://sourceb.in/JLEQAaLXyf
thank you
throw er; // Unhandled 'error' event
^
ReferenceError: StartTime is not defined
at Client.<anonymous> (/Users/oerston25/Desktop/test-bot/index.js:82:72)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:394:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21)
Your welcome
I forgot one thing you can change interaction.fields.fields to interaction.fields back
Okay.
Cool, this one everything set
throw er; // Unhandled 'error' event
^
ReferenceError: StartTime is not defined
at Client.<anonymous> (/Users/oerston25/Desktop/test-bot/index.js:82:65)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:394:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21)
``` i keep getting this err
On your interactionCreate event you need to add a string on StartTime, EndTime, StartProof, EndProof and TotalTime
And everything set
wdym add a string, i have that in my cmd file
Add a string quotation like this
'StartTime'
You had it as ```js
// Like this
StartTime
// Change to
'StartTime'
Show me updated code and i tell you the line
Oh alright
const StartTimeInput = interaction.fields.getTextInputValue('StartTime');
const EndTimeInput = interaction.fields.getTextInputValue('EndTime');
like this?
Ya all of it
๐
one more question
How would i make it so if the user doesnt have a certain role it wont let them use it
i know how to do that
but i wanna do it with role name
not id
Yes
Use some()
has. role name => or something right?
If you use has() need to provide an role id
if (member.roles.cache.some(r => r.name === 'pizza'));
?
.some() not .has()
yes i just chabged
Ya
if (!interaction.user.roles.cache.some(r => r.name === 'pizza')) return await interaction.reply('u dont have perms');
like that?
Ye
doesnt work
k
still dont work
You want to check if the user have or doesnt have ?
Then remove the ! and change to !== 'pizza'
OK
still dont work
if (interaction.member.roles.cache.some(r => r.name !== 'pizza'))
return await interaction.reply('u dont have perms');
Do you have pizza role ?
yes
Well then try this
const isRole = interaction.member.roles.cache.some(r => r.name === 'pizza');
console.log(isRole);
Tell me its return true or false
So the member does not have the role with that name
๐
@delicate python
if (interaction.member.roles.cache.some(r => r.name !== 'Parks Canada'))
this doesnt work
Do the same i gived to you
what is this