Discord.js kullanılarak yazılmış bir eğlence komutu. Komutu kullan ve şanslı sayını öğren. Kurulum için aşağıdaki talimatları izleyin.
⚠ Botunuza hangisi uygunsa o kodu kullanın.
Kurulum için aşağıdaki adımları izleyin;
- Bu kod projenizdeki komutlar ya da commands adındaki klasöre atılmalıdır. Eğer eklemeyi bilmiyorsanız buraya tıklayın.
- Komut içerisindeki gerekli yerleri kendinize göre düzenleyebilirsiniz.
- Gerekli modüller: Discord.js
Discord.js v13 için;
// Komutlar klasörüne atılmalıdır.
// Bu komut Staup tarafından hazırlanmıştır.
const Discord = require('discord.js');
exports.run = (client, message, args) => {
const sayilar = [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"20",
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28",
"29",
"30",
"31",
"32",
"33",
"34",
"35",
"36",
"37",
"38",
"39",
"40"
];
var sayi = sayilar[Math.floor(Math.random() * sayilar.length)];
message.channel.send(`Şanslı sayın: ${sayi}`)
};
exports.conf = {
enabled: true,
guildOnly: true,
aliases: [],
permLevel: 0
};
exports.help = {
name: 'şanslısayım',
description: 'Şanslı sayınızı öğrenin.',
usage: 'şanslısayım'
};
Discord.js v14 için;
// Komutlar klasörüne atılmalıdır.
// Bu komut Staup tarafından hazırlanmıştır.
const { MessageEmbed } = require('discord.js');
module.exports = {
name: 'şanslısayım',
description: 'Şanslı sayınızı öğrenin.',
usage: 'şanslısayım',
execute(message, args) {
const sayilar = [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"20",
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28",
"29",
"30",
"31",
"32",
"33",
"34",
"35",
"36",
"37",
"38",
"39",
"40"
];
var sayi = sayilar[Math.floor(Math.random() * sayilar.length)];
message.channel.send(`Şanslı sayın: ${sayi}`)
},
};
Bu komut, kullanıcıya rastgele bir şanslı sayı gönderir ve Discord.js v13 ve v14 sürümlerine uygun olarak iki ayrı versiyonda sunulmuştur.