Kod Adam Asmaca v12

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:
harryzzers#7700
Katılım
19 Eyl 2021
Mesajlar
1,522
Tepkime puanı
424
Şehir
Yurtdışı
Kod için teşekkürler. Fakat komutunuzu CODE olarak yazar mısınız?
 
harryzzers#7700
Katılım
19 Eyl 2021
Mesajlar
1,522
Tepkime puanı
424
Şehir
Yurtdışı
Yeni olduğum için code olarak yazmayı bilmiyorum. Discord adresimden yardım edebilirsiniz: TastyFox#0008
Sıkıntı yok, kodunuzu
Kod:
bu şekilde yapar mısınız? Biraz kurcalarsanız </> seçeneğinden yapabilirsiniz.
 

Konuyu 0 kişi okuyor. (0 kayıtlı üye ve 0 ziyaretçi)

  • Bilgi