ahmed349
ahmed349
DIAdiscord.js - Imagine a boo! 👻
Created by ahmed349 on 4/24/2024 in #djs-questions
InteractionNotReplied, sometimes occurs
ahhh must have missed that while reading the documentation, and i am also to blame for not figured it out intuitively, thank you very much
6 replies
DIAdiscord.js - Imagine a boo! 👻
Created by ahmed349 on 4/24/2024 in #djs-questions
InteractionNotReplied, sometimes occurs
i am testing getting wrong letters in the game of hangman, but sometimes it works and gives me the proper response, and sometimes it just breaks and gives the aforementioned error
6 replies
DIAdiscord.js - Imagine a boo! 👻
Created by ahmed349 on 4/24/2024 in #djs-questions
InteractionNotReplied, sometimes occurs
without including most of the gamelogic, this is how my code works, manipulating an array of active game sessions to see who is playing what game, and if statements to give appropriate replies when they fail/win the game depending on the input
async function execute(interaction){
let userId = interaction.user.id;
let session = activeGameSessions[Object.keys(activeGameSessions).find(str => str == userId)];
if (session == undefined) {
session = await createNewSession(userId);
interaction.reply('YO, Guess this word\n' + session.revealedWord);
return;
}

let input = interaction.options.getString('string');
console.log(input);
if (!input) return;

if (input.length > 1){
if (session.attemptWord(input)){
interaction.reply('GG, ig\n' + session.revealedWord);
delete(activeGameSessions[userId]);

return;
}
else {
interaction.reply('Nope, stupid nerd\n' + session.revealedWord);
}
}
else {
if (session.attemptLetter(input)){
interaction.reply('Les gooooo!!1\n' + session.revealedWord)
}
else {
interaction.reply('Nope, bad letter my boy\n' + session.revealedWord);
}
}

interaction.followUp(`Holy moly your lives are at ${session.lives} pepperoni`);
}
async function execute(interaction){
let userId = interaction.user.id;
let session = activeGameSessions[Object.keys(activeGameSessions).find(str => str == userId)];
if (session == undefined) {
session = await createNewSession(userId);
interaction.reply('YO, Guess this word\n' + session.revealedWord);
return;
}

let input = interaction.options.getString('string');
console.log(input);
if (!input) return;

if (input.length > 1){
if (session.attemptWord(input)){
interaction.reply('GG, ig\n' + session.revealedWord);
delete(activeGameSessions[userId]);

return;
}
else {
interaction.reply('Nope, stupid nerd\n' + session.revealedWord);
}
}
else {
if (session.attemptLetter(input)){
interaction.reply('Les gooooo!!1\n' + session.revealedWord)
}
else {
interaction.reply('Nope, bad letter my boy\n' + session.revealedWord);
}
}

interaction.followUp(`Holy moly your lives are at ${session.lives} pepperoni`);
}
6 replies
DIAdiscord.js - Imagine a boo! 👻
Created by ahmed349 on 4/22/2024 in #djs-questions
error importing json
oh ok thanks
5 replies