Döviz Komutu | Discord Bot Komutları #1 | xahmetfurkan

28 Mar 2020
107
1
İndex.php
Herkese merhabalar.
Bugün sizlere Discord Botunuza ekleyebileceğiniz "Döviz" komutunu tanıtacağım. Veriler Türkiye Cumhuriyeti Merkez Bankası (TCBM) Kurlar sayfasından çekilmektedir.


Not: Kendi discord botum ingilizce olduğu için kod ingilizcedir. Komutun kullanımı değiştirmek için yani <prefix>döviz yapmak için 251. satırda ki "name" alanını değiştirebilerek yapabilirsiniz.

Örnek Kullanımı :

ydlnCN.png

ydlUzc.png



Gerekli Modül : tcmb-doviz


Döviz Komutu Kodları :
Kod:
const Discord = require("discord.js")
const client = new Discord.Client()
const TCMB_Doviz = require('tcmb-doviz');
const Doviz = new TCMB_Doviz();
const ayarlar = require("../ayarlar.json")
var prefix = ayarlar.prefix;
exports.run = async (client, message, args) => {
  
    if(!args[0]) {
        let embed = new Discord.RichEmbed();
        embed.setDescription(":x: Error | Example Use = "+ ayarlar.prefix + `currency USD \n Currency unit codes = \`\`USD EUR AUD DKK GBP CHF SEK CAD KWD NOK JPY SAR BGN RON RUB IRR CNY PKR QAR\`\``);
        embed.setColor("RED");
        message.channel.send({embed: embed});
    }
    if (args[0] === "USD"){
        const res = await Doviz.getKur("USD");
        const tarih = await Doviz.guncelTarih();
        let embed = new Discord.RichEmbed();
        embed.setAuthor(`${res.isim} Current Exchange Analysis`,message.author.avatarURL);
        embed.setDescription(`İnformations [Merkez Bankası(TCMB)](https://www.tcmb.gov.tr/kurlar/kurlar_tr.html) withdrawing from.\n Updated on \`\`${tarih}\`\` `);
        embed.setColor("RED");
        embed.addField(`Buying`,res.alis);
        embed.addField(`Selling`,res.satis,true);
        embed.addField(`Unit Code`,res.kod,true);
        message.channel.send({embed: embed});
    }
   if(args[0] === "EUR"){
const res = await Doviz.getKur("EUR");
const tarih = await Doviz.guncelTarih();
let embed = new Discord.RichEmbed()
embed.setAuthor(`${res.isim} Current Exchange Analysis`,message.author.avatarURL)
embed.setDescription(`İnformations [Merkez Bankası(TCMB)](https://www.tcmb.gov.tr/kurlar/kurlar_tr.html) withdrawing from.\n Updated on \`\`${tarih}\`\` `)
embed.setColor("RED")
embed.addField(`Alış`,res.alis)
embed.addField(`Satış`,res.satis,true)
embed.addField(`Birim Kodu`,res.kod,true)
message.channel.send({embed: embed});
   }
   if(args[0] === "AUD"){
const res = await Doviz.getKur("AUD");
const tarih = await Doviz.guncelTarih();
let embed = new Discord.RichEmbed()
embed.setAuthor(`${res.isim} Current Exchange Analysis`,message.author.avatarURL)
embed.setDescription(`İnformations [Merkez Bankası(TCMB)](https://www.tcmb.gov.tr/kurlar/kurlar_tr.html) withdrawing from.\n Updated on \`\`${tarih}\`\` `)
embed.setColor("RED")
embed.addField(`Buying`,res.alis)
embed.addField(`Selling Code`,res.satis,true)
embed.addField(`Unit Code`,res.kod,true)
message.channel.send({embed: embed});
   }
   if(args[0] === "DKK"){
const res = await Doviz.getKur("DKK");
const tarih = await Doviz.guncelTarih();
let embed = new Discord.RichEmbed()
embed.setAuthor(`${res.isim} Current Exchange Analysis`,message.author.avatarURL)
embed.setDescription(`İnformations [Merkez Bankası(TCMB)](https://www.tcmb.gov.tr/kurlar/kurlar_tr.html) withdrawing from.\n Updated on \`\`${tarih}\`\` `)
embed.setColor("RED")
embed.addField(`Buying`,res.alis)
embed.addField(`Selling`,res.satis,true)
embed.addField(`Unit Code`,res.kod,true)
message.channel.send({embed: embed});
   }
   if(args[0] === "GBP"){
const res = await Doviz.getKur("GBP");
const tarih = await Doviz.guncelTarih();
let embed = new Discord.RichEmbed()
embed.setAuthor(`${res.isim} Current Exchange Analysis`,message.author.avatarURL)
embed.setDescription(`İnformations [Merkez Bankası(TCMB)](https://www.tcmb.gov.tr/kurlar/kurlar_tr.html) withdrawing from.\n Updated on \`\`${tarih}\`\` `)
embed.setColor("RED")
embed.addField(`Buying`,res.alis)
embed.addField(`Seling`,res.satis,true)
embed.addField(`Unit Code`,res.kod,true)
message.channel.send({embed: embed});
   }
   if(args[0] === "CHF"){
const res = await Doviz.getKur("CHF");
const tarih = await Doviz.guncelTarih();
let embed = new Discord.RichEmbed()
embed.setAuthor(`${res.isim} Current Exchange Analysis`,message.author.avatarURL)
embed.setDescription(`İnformations [Merkez Bankası(TCMB)](https://www.tcmb.gov.tr/kurlar/kurlar_tr.html) withdrawing from.\n Updated on \`\`${tarih}\`\` `)
embed.setColor("RED")
embed.addField(`Buying`,res.alis)
embed.addField(`Selling`,res.satis,true)
embed.addField(`Unit Code`,res.kod,true)
message.channel.send({embed: embed});
   }
   if(args[0] === "SEK"){
const res = await Doviz.getKur("SEK");
const tarih = await Doviz.guncelTarih();
let embed = new Discord.RichEmbed()
embed.setAuthor(`${res.isim} Current Exchange Analysis`,message.author.avatarURL)
embed.setDescription(`İnformations [Merkez Bankası(TCMB)](https://www.tcmb.gov.tr/kurlar/kurlar_tr.html) withdrawing from.\n Updated on \`\`${tarih}\`\` `)
embed.setColor("RED")
embed.addField(`Buying`,res.alis)
embed.addField(`Selling`,res.satis,true)
embed.addField(`Unit Code`,res.kod,true)
message.channel.send({embed: embed});
   }
   if(args[0] === "CAD"){
const res = await Doviz.getKur("CAD");
const tarih = await Doviz.guncelTarih();
let embed = new Discord.RichEmbed()
embed.setAuthor(`${res.isim} Güncel Kur Analizi`,message.author.avatarURL)
embed.setDescription(`İnformations [Merkez Bankası(TCMB)](https://www.tcmb.gov.tr/kurlar/kurlar_tr.html) withdrawing from.\n Updated on \`\`${tarih}\`\` `)
embed.setColor("RED")
embed.addField(`Buying`,res.alis)
embed.addField(`Selling`,res.satis,true)
embed.addField(`Unit Code`,res.kod,true)
message.channel.send({embed: embed});
   }
   if(args[0] === "KWD"){
const res = await Doviz.getKur("KWD");
const tarih = await Doviz.guncelTarih();
let embed = new Discord.RichEmbed()
embed.setAuthor(`${res.isim} Current Exchange Analysis`,message.author.avatarURL)
embed.setDescription(`İnformations [Merkez Bankası(TCMB)](https://www.tcmb.gov.tr/kurlar/kurlar_tr.html) withdrawing from.\n Updated on \`\`${tarih}\`\` `)
embed.setColor("RED")
embed.addField(`Buying`,res.alis)
embed.addField(`Selling`,res.satis,true)
embed.addField(`Unit Code`,res.kod,true)
message.channel.send({embed: embed});
   }
   if(args[0] === "NOK"){
const res = await Doviz.getKur("NOK");
const tarih = await Doviz.guncelTarih();
let embed = new Discord.RichEmbed()
embed.setAuthor(`${res.isim} Current Exchange Analysis`,message.author.avatarURL)
embed.setDescription(`İnformations [Merkez Bankası(TCMB)](https://www.tcmb.gov.tr/kurlar/kurlar_tr.html) withdrawing from.\n Updated on \`\`${tarih}\`\` `)
embed.setColor("RED")
embed.addField(`Buying`,res.alis)
embed.addField(`Selling`,res.satis,true)
embed.addField(`Unit Code`,res.kod,true)
message.channel.send({embed: embed});
   }
   if(args[0] === "JPY"){
const res = await Doviz.getKur("JPY");
const tarih = await Doviz.guncelTarih();
let embed = new Discord.RichEmbed()
embed.setAuthor(`${res.isim} Current Exchange Analysis`,message.author.avatarURL)
embed.setDescription(`İnformations [Merkez Bankası(TCMB)](https://www.tcmb.gov.tr/kurlar/kurlar_tr.html) withdrawing from.\n Updated on \`\`${tarih}\`\` `)
embed.setColor("RED")
embed.addField(`Buying`,res.alis)
embed.addField(`Selling`,res.satis,true)
embed.addField(`Unit Code`,res.kod,true)
message.channel.send({embed: embed});
   }
   if(args[0] === "SAR"){
const res = await Doviz.getKur("SAR");
const tarih = await Doviz.guncelTarih();
let embed = new Discord.RichEmbed()
embed.setAuthor(`${res.isim} Current Exchange Analysis`,message.author.avatarURL)
embed.setDescription(`İnformations [Merkez Bankası(TCMB)](https://www.tcmb.gov.tr/kurlar/kurlar_tr.html) withdrawing from.\n Updated on \`\`${tarih}\`\` `)
embed.setColor("RED")
embed.addField(`Buying`,res.alis)
embed.addField(`Selling`,res.satis,true)
embed.addField(`Unit Code`,res.kod,true)
message.channel.send({embed: embed});
   }
   if(args[0] === "BGN"){
const res = await Doviz.getKur("BGN");
const tarih = await Doviz.guncelTarih();
let embed = new Discord.RichEmbed()
embed.setAuthor(`${res.isim} Current Exchange Analysis`,message.author.avatarURL)
embed.setDescription(`İnformations [Merkez Bankası(TCMB)](https://www.tcmb.gov.tr/kurlar/kurlar_tr.html) withdrawing from.\n Updated on \`\`${tarih}\`\` `)
embed.setColor("RED")
embed.addField(`Buying`,res.alis)
embed.addField(`Selling`,res.satis,true)
embed.addField(`Unit Code`,res.kod,true)
message.channel.send({embed: embed});
   }
   if(args[0] === "RON"){
const res = await Doviz.getKur("RON");
const tarih = await Doviz.guncelTarih();
let embed = new Discord.RichEmbed()
embed.setAuthor(`${res.isim} Current Exchange Analysis`,message.author.avatarURL)
embed.setDescription(`İnformations [Merkez Bankası(TCMB)](https://www.tcmb.gov.tr/kurlar/kurlar_tr.html) withdrawing from.\n Updated on \`\`${tarih}\`\` `)
embed.setColor("RED")
embed.addField(`Buying`,res.alis)
embed.addField(`Selling`,res.satis,true)
embed.addField(`Unit Code`,res.kod,true)
message.channel.send({embed: embed});
   }
   if(args[0] === "RUB"){
const res = await Doviz.getKur("RUB");
const tarih = await Doviz.guncelTarih();
let embed = new Discord.RichEmbed()
embed.setAuthor(`${res.isim} Current Exchange Analysis`,message.author.avatarURL)
embed.setDescription(`İnformations [Merkez Bankası(TCMB)](https://www.tcmb.gov.tr/kurlar/kurlar_tr.html) withdrawing from.\n Updated on \`\`${tarih}\`\` `)
embed.setColor("RED")
embed.addField(`Buying`,res.alis)
embed.addField(`Selling`,res.satis,true)
embed.addField(`Unit Code`,res.kod,true)
message.channel.send({embed: embed});
   }
   if(args[0] === "IRR"){
const res = await Doviz.getKur("IRR");
const tarih = await Doviz.guncelTarih();
let embed = new Discord.RichEmbed()
embed.setAuthor(`${res.isim} Current Exchange Analysis`,message.author.avatarURL)
embed.setDescription(`İnformations [Merkez Bankası(TCMB)](https://www.tcmb.gov.tr/kurlar/kurlar_tr.html) withdrawing from.\n Updated on \`\`${tarih}\`\` `)
embed.setColor("RED")
embed.addField(`Buying`,res.alis)
embed.addField(`Selling`,res.satis,true)
embed.addField(`Unit Code`,res.kod,true)
message.channel.send({embed: embed});
   }
   if(args[0] === "CNY"){
const res = await Doviz.getKur("CNY");
const tarih = await Doviz.guncelTarih();
let embed = new Discord.RichEmbed()
embed.setAuthor(`${res.isim} Current Exchange Analysis`,message.author.avatarURL)
embed.setDescription(`İnformations [Merkez Bankası(TCMB)](https://www.tcmb.gov.tr/kurlar/kurlar_tr.html) withdrawing from.\n Updated on \`\`${tarih}\`\` `)
embed.setColor("RED")
embed.addField(`Buying`,res.alis)
embed.addField(`Selling`,res.satis,true)
embed.addField(`Unit Code`,res.kod,true)
message.channel.send({embed: embed});
   }
   if(args[0] === "PKR"){
const res = await Doviz.getKur("PKR");
const tarih = await Doviz.guncelTarih();
let embed = new Discord.RichEmbed()
embed.setAuthor(`${res.isim} Current Exchange Analysis`,message.author.avatarURL)
embed.setDescription(`İnformations [Merkez Bankası(TCMB)](https://www.tcmb.gov.tr/kurlar/kurlar_tr.html) withdrawing from.\n Updated on \`\`${tarih}\`\` `)
embed.setColor("RED")
embed.addField(`Buying`,res.alis)
embed.addField(`Selling`,res.satis,true)
embed.addField(`Unit Code`,res.kod,true)
message.channel.send({embed: embed});
   }
   if(args[0] === "QAR"){
const res = await Doviz.getKur("QAR");
const tarih = await Doviz.guncelTarih();
let embed = new Discord.RichEmbed()
embed.setAuthor(`${res.isim} Current Exchange Analysis`,message.author.avatarURL)
embed.setDescription(`İnformations [Merkez Bankası(TCMB)](https://www.tcmb.gov.tr/kurlar/kurlar_tr.html) withdrawing from.\n Updated on \`\`${tarih}\`\` `)
embed.setColor("RED")
embed.addField(`Buying`,res.alis)
embed.addField(`Selling`,res.satis,true)
embed.addField(`Unit Code`,res.kod,true)
message.channel.send({embed: embed});
   }
}
exports.conf = {
  enabled: true,
  guildOnly: false,
  aliases: ["doviz","kur","dövizkur","kuranaliz","kurgetir","dövizanaliz","usd","euro","dolar","eur"],
  permLevel: 0
};
exports.help = {
  name: 'currency',
  description: 'Güncel Döviz kurlarını gösterir.',
  usage: 'currency'
};
 
Üst

Turkhackteam.org internet sitesi 5651 sayılı kanun’un 2. maddesinin 1. fıkrasının m) bendi ile aynı kanunun 5. maddesi kapsamında "Yer Sağlayıcı" konumundadır. İçerikler ön onay olmaksızın tamamen kullanıcılar tarafından oluşturulmaktadır. Turkhackteam.org; Yer sağlayıcı olarak, kullanıcılar tarafından oluşturulan içeriği ya da hukuka aykırı paylaşımı kontrol etmekle ya da araştırmakla yükümlü değildir. Türkhackteam saldırı timleri Türk sitelerine hiçbir zararlı faaliyette bulunmaz. Türkhackteam üyelerinin yaptığı bireysel hack faaliyetlerinden Türkhackteam sorumlu değildir. Sitelerinize Türkhackteam ismi kullanılarak hack faaliyetinde bulunulursa, site-sunucu erişim loglarından bu faaliyeti gerçekleştiren ip adresini tespit edip diğer kanıtlarla birlikte savcılığa suç duyurusunda bulununuz.