const axios = require("axios"); module.exports = { config: { name: "quiz", aliases: ["qz"], version: "0.0.7", author: "Azadx69x", role: 0, category: "game", }, onStart: async function ({ api, event, usersData }) { try { if (!global.GoatBot.onReply) global.GoatBot.onReply = new Map(); const quizApi = "https://azadx69x-all-apis-top.vercel.app/api/quiz"; const q = (await axios.get(quizApi)).data.data; const options = { A: q.options[0].slice(3), B: q.options[1].slice(3), C: q.options[2].slice(3), D: q.options[3].slice(3) }; const quizMsg = `ā•­ā”€ā”€ā– šš”šˆš™ š†š€šŒš„ ā–ā”€ā”€ā•® 😺 š‘øš’–š’†š’”š’•š’Šš’š§: ${q.question} šŸ… šŽš©š­š¢šØš§: ${options.A} šŸ…‘ šŽš©š­š¢šØš§: ${options.B} šŸ…’ šŽš©š­š¢šØš§: ${options.C} šŸ…“ šŽš©š­š¢šØš§: ${options.D} ──────────────── šŸ“ š‘¹š’†š’‘š’š’š š’˜š’Šš’•š’‰ š€, š, š‚ š’š« šƒ`; api.sendMessage(quizMsg, event.threadID, (err, info) => { global.GoatBot.onReply.set(info.messageID, { type: "reply", commandName: this.config.name, author: event.senderID, messageID: info.messageID, correctAnswer: q.answer.toUpperCase() }); setTimeout(() => { try { api.unsendMessage(info.messageID); } catch {} global.GoatBot.onReply.delete(info.messageID); }, 40000); }, event.messageID); } catch (error) { api.sendMessage(`āŒ š„š«š«šØš«: ${error.message}`, event.threadID, event.messageID); } }, onReply: async function ({ api, event, Reply, usersData }) { if (!Reply) return; const { correctAnswer, author } = Reply; if (event.senderID !== author) return api.sendMessage( "🐸 š„š¢ššš š­š¦š« šŖš®š¢š³ š§šš š›ššš›š², šœš”š®šš„š¢š§š  š©šØš§š ", event.threadID, event.messageID ); const userReply = event.body.trim().toUpperCase(); if (!["A", "B", "C", "D"].includes(userReply)) return api.sendMessage( "āŒ š‘šžš©š„š² šØš§š„š² š€, š, š‚ šØš« šƒ!", event.threadID, event.messageID ); const userData = await usersData.get(author); const rewardCoins = 500; const rewardExp = 121; try { await api.unsendMessage(Reply.messageID); } catch {} global.GoatBot.onReply.delete(Reply.messageID); if (userReply === correctAnswer.toUpperCase()) { await usersData.set(author, { money: userData.money + rewardCoins, exp: userData.exp + rewardExp, data: userData.data }); return api.sendMessage( `āœ… š‚šØš«š«šžšœš­ š€š§š¬š°šžš«!\nšŸŽ +${rewardCoins} š‚šØš¢š§š¬\n⭐ +${rewardExp} š„š—š`, event.threadID, event.messageID ); } else { return api.sendMessage( `šŸ’” ššØš©šž, š­š”ššš­ā€™š¬ š°š«šØš§š !\nāœ” š‘š¢š š”š­ š€š§š¬š°šžš«: ${correctAnswer}`, event.threadID, event.messageID ); } } };