- TastyFox#0008
- Katılım
- 12 Ocak 2022
- Mesajlar
- 46
- Tepkime puanı
- 23
Kod:
// Bu Komut Komutlar Bölümüne Atılacaktır.
const { stripIndents } = require('common-tags');
let oyndurum = new Set();
const kelime = require('../kelimeler.json');
const db = require('quick.db')
module.exports.run = async (bot, message, args) => {
const paralar = db.fetch(`paralar_${message.author.id}`)
if (oyndurum.has(message.channel.id)) return message.reply('Kanal başına sadece bir adam asmaca oyunu meydana gelebilir.');
try {
let sayi = Math.floor(Math.random() * kelime.kelimeler.length);
const cevap = kelime.kelimeler[sayi].toLowerCase();
let point = 0;
let displayText = null;
let tahmin = false;
const confirmation = [];
const yanlış = [];
//Tasty Code
const display = new Array(cevap.length).fill('_');
while (cevap.length !== confirmation.length && point < 6) {
await message.channel.send(stripIndents`
${displayText === null ? '** Adam Asmaca**!' : displayText ? '**Çok iyisin!**' : '**Yanlış Harf!**'}
**Kelime:** \`${display.join(' ')}\`
**Yanlış Harfler:** ${yanlış.join(', ') || 'Yok'}
\`\`\`
_________
| |
| ${point > 0 ? '' : ''}
| ${point > 2 ? '┌' : ' '}${point > 1 ? '()' : ''}${point > 3 ? '┐' : ''}
| ${point > 4 ? '/' : ''} ${point > 5 ? '\\' : ''}
|
\`\`\`
`);
//Tasty Code
const filter = res => {
const choice = res.content.toLowerCase();
return res.author.id === message.author.id && !confirmation.includes(choice) && !yanlış.includes(choice);
};
const guess = await message.channel.awaitMessages(filter, {
max: 1,
time: 300000
//Tasty Code
});
if (!guess.size) {
await message.channel.send('Zamanın doldu!');
break;
}
const choice = guess.first().content.toLowerCase();
if (choice === 'end') break;
if (choice.length > 1 && choice === cevap) {
tahmin = true;
break; //Tasty Code
} else if (cevap.includes(choice)) {
displayText = true;
for (let i = 0; i < cevap.length; i++) {
if (cevap.charAt(i) !== choice) continue;
confirmation.push(cevap.charAt(i));
display = cevap.charAt(i);
}
} else {
displayText = false;
if (choice.length === 1) yanlış.push(choice);
point++;
}
}
// Tasty Code
oyndurum.delete(message.channel.id);
if (cevap.length === confirmation.length || tahmin) return message.channel.send(`**Tebrikler. kelimeyi buldun: **${cevap}!`);
return message.channel.send(`Maalesef bilemedin kelime bu: **${cevap}**`);
} catch (err) {
oyndurum.delete(message.channel.id);
return message.reply(`Olamaz! Bir Hata Verdi: \`${err.message}\``);
}
//Tasty Code
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: 0
};
//Tasty Code
exports.help = {
category: 'Oyun',
name: 'adamasmaca',
description: 'Adam asmaca oyununu oynarsınız.',
usage: 'adamasmaca'
};
Son düzenleme: