ahmed349
ahmed349
Explore posts from servers
DDeno
Created by ahmed349 on 11/22/2024 in #help
cant connect to mongo atlas via official driver or mongoose but works outside of deno
I am not sure how this relates to the issue at hand, could you clarify
3 replies
DDeno
Created by ahmed349 on 11/22/2024 in #help
cant connect to mongo atlas via official driver or mongoose but works outside of deno
import mongoose from "npm:mongoose";

const uri = 'mongodb+srv://no:[email protected]/?retryWrites=true&w=majority&appName=Cluster0'

async function run() {
await mongoose.connect(uri, {dbName: "sample_mflix"});
}

run().catch(console.dir);
import mongoose from "npm:mongoose";

const uri = 'mongodb+srv://no:[email protected]/?retryWrites=true&w=majority&appName=Cluster0'

async function run() {
await mongoose.connect(uri, {dbName: "sample_mflix"});
}

run().catch(console.dir);
code used by mongoose
3 replies
DIdiscord.js - Imagine ❄
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
DIdiscord.js - Imagine ❄
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
DIdiscord.js - Imagine ❄
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
DIdiscord.js - Imagine ❄
Created by ahmed349 on 4/22/2024 in #djs-questions
error importing json
oh ok thanks
5 replies