Facebook
From Me, 1 Year ago, written in JavaScript.
This paste is a reply to me from Me - view diff
Embed
Download Paste or View Raw
Hits: 170
  1. const Discord = require('discord.js');
  2. const client = new Discord.Client();
  3. const ayarlar = require('./ayarlar.json');
  4. const chalk = require('chalk');
  5. const moment = require('moment');
  6. var Jimp = require('jimp');
  7. const { Client, Util } = require('discord.js');
  8. const weather = require('weather-js')
  9. const fs = require('fs');
  10. const db = require('quick.db');
  11. const http = require('http');
  12. const express = require('express');
  13. require('./util/eventLoader.js')(client);
  14. const path = require('path');
  15. const request = require('request');
  16. const snekfetch = require('snekfetch');
  17. const queue = new Map();
  18. const YouTube = require('simple-youtube-api');
  19. const ytdl = require('ytdl-core');
  20.  
  21.  
  22. const app = express();
  23. app.get("/", (request, response) => {
  24.   console.log(Date.now() + " Ping tamamd─▒r.");
  25.   response.sendStatus(200);
  26. });
  27. app.listen(process.env.PORT);
  28. setInterval(() => {
  29.   http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`);
  30. }, 280000);
  31.  
  32. var prefix = ayarlar.prefix;
  33.  
  34. const log = message => {
  35.     console.log(`${message}`);
  36. };
  37.  
  38. client.commands = new Discord.Collection();
  39. client.aliases = new Discord.Collection();
  40. fs.readdir('./komutlar/', (err, files) => {
  41.   if (err) console.error(err);
  42.     log(`${files.length} komut y├╝klenecek.`);
  43.     files.forEach(f => {
  44.         let props = require(`./komutlar/${f}`);
  45.         log(`Y├╝klenen komut: ${props.help.name}.`);
  46.         client.commands.set(props.help.name, props);
  47.         props.conf.aliases.forEach(alias => {
  48.             client.aliases.set(alias, props.help.name);
  49.         });
  50.     });
  51. });
  52.  
  53.  
  54.  
  55.  
  56. client.reload = command => {
  57.     return new Promise((resolve, reject) => {
  58.         try {
  59.             delete require.cache[require.resolve(`./komutlar/${command}`)];
  60.             let cmd = require(`./komutlar/${command}`);
  61.             client.commands.delete(command);
  62.             client.aliases.forEach((cmd, alias) => {
  63.                 if (cmd === command) client.aliases.delete(alias);
  64.             });
  65.             client.commands.set(command, cmd);
  66.             cmd.conf.aliases.forEach(alias => {
  67.                 client.aliases.set(alias, cmd.help.name);
  68.             });
  69.             resolve();
  70.         } catch (e) {
  71.             reject(e);
  72.         }
  73.     });
  74. };
  75.  
  76. client.load = command => {
  77.     return new Promise((resolve, reject) => {
  78.         try {
  79.             let cmd = require(`./komutlar/${command}`);
  80.             client.commands.set(command, cmd);
  81.             cmd.conf.aliases.forEach(alias => {
  82.                 client.aliases.set(alias, cmd.help.name);
  83.             });
  84.             resolve();
  85.         } catch (e) {
  86.             reject(e);
  87.         }
  88.     });
  89. };
  90.  
  91.  
  92.  
  93.  
  94. client.unload = command => {
  95.     return new Promise((resolve, reject) => {
  96.         try {
  97.             delete require.cache[require.resolve(`./komutlar/${command}`)];
  98.             let cmd = require(`./komutlar/${command}`);
  99.             client.commands.delete(command);
  100.             client.aliases.forEach((cmd, alias) => {
  101.                 if (cmd === command) client.aliases.delete(alias);
  102.             });
  103.             resolve();
  104.         } catch (e) {
  105.             reject(e);
  106.         }
  107.     });
  108. };
  109.  
  110. client.elevation = message => {
  111.     if (!message.guild) {
  112.         return;
  113.     }
  114.     let permlvl = 0;
  115.     if (message.member.hasPermission("BAN_MEMBERS")) permlvl = 2;
  116.     if (message.member.hasPermission("ADMINISTRATOR")) permlvl = 3;
  117.     if (message.author.id === ayarlar.sahip) permlvl = 4;
  118.     return permlvl;
  119. };
  120.  
  121. var regToken = /[\w\d]{24}\.[\w\d]{6}\.[\w\d-_]{27}/g;
  122. // client.on('debug', e => {
  123. //   console.log(chalk.bgBlue.green(e.replace(regToken, 'that was redacted')));
  124. // });
  125.  
  126. client.on('warn', e => {
  127.     console.log(chalk.bgYellow(e.replace(regToken, 'that was redacted')));
  128. });
  129.  
  130. client.on('error', e => {
  131.     console.log(chalk.bgRed(e.replace(regToken, 'that was redacted')));
  132. });
  133. ////log kanal─▒////
  134.  
  135.  
  136. client.on("roleCreate", async role => {
  137.  
  138.   var kanal = await db.fetch(`modlogK_${role.guild.id}`)
  139.   if (!kanal) return;
  140. var kanal2 = role.guild.channels.find('name', kanal)  
  141.  
  142.   const embed = new Discord.RichEmbed()
  143.   .setColor("RANDOM")
  144.   .setAuthor(`Bir Rol Olu┼čturuldu!`, role.guild.iconURL)
  145.   .addField("Rol", `\`${role.name}\``, true)
  146.   .addField("Rol Rengi Kodu", `${role.hexColor}`, true)
  147.   kanal2.send(embed);
  148.  
  149. });
  150.  
  151. client.on("roleDelete", async role => {
  152.  
  153.   var kanal = await db.fetch(`modlogK_${role.guild.id}`)
  154.   if (!kanal) return;
  155. var kanal2 = role.guild.channels.find('name', kanal)    
  156.  
  157.   const embed = new Discord.RichEmbed()
  158.   .setColor("RANDOM")
  159.   .setAuthor(`Bir Rol Kald─▒r─▒ld─▒!`, role.guild.iconURL)
  160.   .addField("Rol", `\`${role.name}\``, true)
  161.   .addField("Rol Rengi Kodu", `${role.hexColor}`, true)
  162.   kanal2.send(embed);
  163.  
  164. });
  165.  
  166. client.on("roleUpdate", async role => {
  167.  
  168.   if (!log[role.guild.id]) return;
  169.  
  170.  var kanal = await db.fetch(`modlogK_${role.guild.id}`)
  171.   if (!kanal) return;
  172. var kanal2 = role.guild.channels.find('name', kanal)
  173.  
  174.   const embed = new Discord.RichEmbed()
  175.   .setColor("RANDOM")
  176.   .setAuthor(`Bir Rol G├╝ncellendi!`, role.guild.iconURL)
  177.   .addField("Rol", `\`${role.name}\``, true)
  178.   .addField("Rol Rengi Kodu", `${role.hexColor}`, true)
  179.   kanal2.send(embed);
  180.  
  181. });
  182.  
  183.  
  184.   client.on('channelCreate', async (channel,member) => {
  185.     var kanal = await db.fetch(`modlogK_${member.guild.id}`)
  186.     const hgK = member.guild.channels.find('name', kanal)
  187.     if (!hgK) return;
  188.         if (!channel.guild) return;
  189.             if (channel.type === "text") {
  190.                 var embed = new Discord.RichEmbed()
  191.                 .setColor(3066993)
  192.                 .setAuthor(channel.guild.name, channel.guild.iconURL)
  193.                 .setDescription(`<#${channel.id}> kanal─▒ olu┼čturuldu. _(metin kanal─▒)_`)
  194.                 .setFooter(`ID: ${channel.id}`)
  195.                 embed.send(embed);
  196.             };
  197.             if (channel.type === "voice") {
  198.                 var embed = new Discord.RichEmbed()
  199.                 .setColor("RANDOM")
  200.                 .setAuthor(channel.guild.name, channel.guild.iconURL)
  201.                 .setDescription(`${channel.name} kanal─▒ olu┼čturuldu. _(sesli kanal)_`)
  202.                 .setFooter(`ID: ${channel.id}`)
  203.                 hgK.send({embed});
  204.             }
  205.        
  206.     })
  207.        
  208.     client.on('channelDelete', async channel => {
  209.             const fs = require('fs');
  210.         var kanal = await db.fetch(`modlogK_${channel.guild.id}`)
  211.  
  212.         const hgK = channel.guild.channels.find('name', kanal)
  213.         if (!hgK) return;
  214.             if (channel.type === "text") {
  215.                 let embed = new Discord.RichEmbed()
  216.                 .setColor("RANDOM")
  217.                 .setAuthor(channel.guild.name, channel.guild.iconURL)
  218.                 .setDescription(`${channel.name} kanal─▒ silindi. _(metin kanal─▒)_`)
  219.                 .setFooter(`ID: ${channel.id}`)
  220.                 hgK.send({embed});
  221.             };
  222.             if (channel.type === "voice") {
  223.                 let embed = new Discord.RichEmbed()
  224.                 .setColor("RANDOM")
  225.                 .setAuthor(channel.guild.name, channel.guild.iconURL)
  226.                 .setDescription(`${channel.name} kanal─▒ silindi. _(sesli kanal)_`)
  227.                 .setFooter(`ID: ${channel.id}`)
  228.                 hgK.send({embed});
  229.             }
  230.        
  231.     });
  232.  
  233.  
  234. client.on("guildCreate", guild => {
  235. const tesekkurler = new Discord.RichEmbed()
  236. .setColor("RANDOM")
  237. .setTitle("Te┼čekk├╝rler")
  238. .setFooter(`${ayarlar.botad─▒}`)
  239. .setTimestamp()
  240. .setDescription(`Beni sunucuya ekledi─čin i├žin te┼čekk├╝rler herhangi bir sorunda destek sunucuma gelebilirsin. [Destek Sunucum](https://bit.ly/35uTZRN)`)
  241. guild.owner.send(tesekkurler)
  242.  
  243.  
  244. });
  245.  
  246. client.on('guildMemberAdd', async (member, guild, message) => {
  247.     let hgbbkanal = await db.fetch(`hgbbkanal_${member.guild.id}`)
  248.     if (!hgbbkanal) return
  249.  
  250.     var embed = new Discord.RichEmbed()
  251.         .setTitle(`:inbox_tray: Bir Ki┼či, Sunucuya kat─▒ld─▒.`)
  252.         .addField(`**:newspaper: Sunucuya Kat─▒lan**: ${member.user.tag}`, `Ho┼čgeldin, Kurallar─▒ Okuyarak Devam Edebilirsin.`)
  253.         .setDescription(`Kurallar─▒m─▒z─▒ Okuduktan Sonra Sohbet Etmeye Ba┼člayabilirsin`)
  254.         .addField(`:tada:**Sunucudaki Ki┼či Say─▒s─▒**: ${member.guild.members.size} `, `Daha Fazla Ki┼či davet Ederek Bu Say─▒y─▒ ├ço─čaltabilirsin`)
  255.         .setTimestamp()
  256.         .setFooter(`${ayarlar.botad─▒}`)
  257.         .setColor('RANDOM')
  258.     member.guild.channels.get(hgbbkanal).send(embed)
  259.   let tag = await db.fetch(`tag_${member.guild.id}`)
  260.  
  261.   if (!tag) return
  262.   member.setNickname(tag.replace('{uye}', member.user.username))
  263. });
  264. client.on('message', message => {
  265.   if (message.content === 'sa') {
  266.     message.reply("Aleyk├╝m Selam Dostum, Nas─▒ls─▒n?")
  267.     }
  268.     });
  269. client.on('message', message => {
  270.   if (message.content === 'iyi') {
  271.     message.reply('├ľyleyse Bende iyi ');
  272.   }
  273. });
  274. client.on('message', message => {
  275.   if (message.content === 'iyiyim') {
  276.     message.reply("├ľyleyse Bende iyiyim");
  277.   }
  278. });
  279. client.on('message', message => {
  280.   if (message.content === 'k├Ât├╝') {
  281.   message.reply("Aaa? Niye ki ├ťz├╝ld├╝m Bak ┼čimdi")
  282. }
  283. });
  284. client.on('message', message => {
  285.   if (message.content === 'nas─▒ls─▒n') {
  286.     message.reply('Ben iyiyim Peki Sen?');
  287.   }
  288. });
  289. //istedi─činiz yere ekleyin bot.js de/Uyar─▒lmadan ├Ânce aral─▒kta g├Ânderilmesine izin verilen maksimum mesaj miktar─▒/Yasaklanmadan ├Ânce aral─▒kta g├Ânderilmesine izin verilen maksimum ileti miktar.// ms kullan─▒c─▒larda zaman miktar─▒, yasaklanmadan ├Ânce aral─▒k de─či┼čkeninin maksimumunu g├Ânderebilir.// Uyar─▒ mesaj─▒, kullan─▒c─▒ya h─▒zl─▒ gideceklerini belirten kullan─▒c─▒ya g├Ânderilir..//Yasak mesaj, yasaklanm─▒┼č kullan─▒c─▒y─▒ ,Banlar/Bir kullan─▒c─▒n─▒n uyar─▒lmadan ├Ânce bir zaman dilimi i├žinde g├Ânderebilece─či maksimum kopya say─▒s─▒//Bir kullan─▒c─▒n─▒n yasaklanmadan ├Ânce bir zaman diliminde g├Ânderebildi─či maksimum kopya say─▒s// Spamdan sonraki zaman// Spam Atan Kullan─▒c─▒lar Verilecek R
  290.  
  291.  
  292.  
  293. client.on('message', msg => {
  294. var emoj = client.emojis.get("668533310628167680")
  295.   if (msg.content.toLowerCase() === '<@643881402227621898>') {
  296.                 if (!msg.guild.member(msg.author).hasPermission("BAN_MEMBERS")) {
  297.                 msg.author.sendMessage(`Efendim, Ben, ${ayarlar.botad─▒}, Beni Kullanmak i├žin Kullanman Gereken Prefix: ${ayarlar.prefix}`)
  298.                 } else {
  299.                 msg.reply(`Efendim, Ben ${ayarlar.botad─▒}, <a:rain:669067249407229991> Beni Kullanmak i├žin Kullanman Gereken Prefix(├ľnEki): ${ayarlar.prefix}'dir. ┼×imdilik Ho┼čcakal.`);
  300.                 }
  301.         }
  302. });
  303.  
  304. client.on('guildMemberRemove', async (member, guild, message) => {
  305.    let hgbbkanal = await db.fetch(`hgbbkanal_${member.guild.id}`)
  306.  
  307.    if (!hgbbkanal) return
  308.  
  309.    var embed = new Discord.RichEmbed()
  310.        .setTitle("Biri Sunucudan ├ç─▒kt─▒,")
  311.        .setDescription(`├ç─▒kan Ki┼či: ${member.user.tag}`)
  312.        .addField(`Sunucuda Kalan Ki┼či Say─▒s─▒: ${member.guild.members.size}` ,`Bu Say─▒y─▒ Arkada┼člar─▒n─▒ Davet Ederek Y├╝kseltebilirsin`)
  313.        .addField(`G├Âr├╝┼č├╝r├╝z`, `E─čer Banlanmad─▒ysan Kap─▒m─▒z Her Zaman A├ž─▒k!`)
  314.        .setColor('RANDOM')
  315.    member.guild.channels.get(hgbbkanal).send(embed)
  316. })
  317.  
  318. client.on('guildCreate', guild => {
  319.  var guilds = '662986133835087882';
  320.  var channeldi = '665565760873299979';
  321.  const embed = new Discord.RichEmbed()
  322.    .setColor("RANDOM")
  323.    .setAuthor(`Bir Sunucuya Ba┼čar─▒l─▒ Bir ┼×ekilde Eklendim`)
  324.    .setThumbnail(guild.iconURL)
  325.    .addField("Sunucu Ad─▒", guild.name)
  326.    .addField("Kurucu", guild.owner)
  327.    .addField("Sunucu ID", guild.id, true)
  328.    .addField("Toplam Kullan─▒c─▒", guild.memberCount, true)
  329.    .addField("Toplam Kanal", guild.channels.size, true)
  330.  client.guilds.get(guilds).channels.get(channeldi).send(embed);
  331. });
  332.  
  333. client.on('guildDelete', guild => {
  334.  var guild = '662986133835087882';
  335.   var kanalid = '665659028432617502';
  336.   const embedw = new Discord.RichEmbed()
  337.  .setColor("RANDOM")
  338.    .setAuthor(`At─▒ld─▒m`)
  339.    .setThumbnail(guild.iconURL)
  340.    .addField("Sunucu Ad─▒", guild.name)
  341.    .addField("Kurucu", guild.owner)
  342.    .addField("Sunucu ID", guild.id, true)
  343.    .addField("Toplam Kullan─▒c─▒", guild.memberCount, true)
  344.    .addField("Toplam Kanal", guild.channels.size, true)
  345.   client.guilds.get(guild).channels.get(kanalid).send(embedw);
  346. });
  347.  
  348. client.on('guildDelete', guild => {
  349. const uzuldum = new Discord.RichEmbed()
  350. .setTitle('Beni Sunucundan Att─▒─č─▒na ├ťz├╝ld├╝m')
  351. .setDescription('L├╝tfen Beni Neden Att─▒─č─▒n─▒ v!bug <neden> Olarak A├ž─▒klar M─▒s─▒n?')
  352. .addField("Beni Geri Eklemek ─░stersen", `[Buraya T─▒klayabilirsin](https://bit.ly/2QrM7w6)`)
  353. .addField(`${ayarlar.botad─▒} BOT Ekibi Olarak`, `Hepimiz ├ťz├╝ld├╝k Ke┼čke Atmasayd─▒n, Tabiki Geri Ekleyebilirsin TET S├óma BOT Ekibi Sunar..`)
  354. guild.owner.send(uzuldum)
  355. });
  356.  
  357. client.on("message", async message => {
  358.  if(message.content.startsWith(prefix)) return;
  359.  if(message.author.bot) return;
  360.  
  361.  var id = message.author.id;
  362.  var gid = message.guild.id;
  363.  
  364.  var xp = await db.fetch(`xp_${id}_${gid}`);
  365.  var lvl = await db.fetch(`lvl_${id}_${gid}`);
  366.  var xpToLvl = await db.fetch(`xpToLvl_${id}_${gid}`);
  367.  
  368.  
  369.  if(!lvl) {
  370.  
  371.    db.set(`xp_${id}_${gid}`, 5);
  372.    db.set(`lvl_${id}_${gid}`, 1);
  373.    db.set(`xpToLvl_${id}_${gid}`, 100);
  374.  
  375.  } else {
  376.  
  377.    var random = Math.random() * (8 - 3) + 3;
  378.    db.add(`xp_${id}_${gid}`, random.toFixed());
  379.    console.log(xp);
  380.  
  381.    if(xp > xpToLvl) {
  382.    
  383.      db.add(`lvl_${id}_${gid}`, 1);
  384.      db.add(`xpToLvl_${id}_${gid}`, await db.fetch(`lvl_${id}_${gid}`) * 100);
  385.      var lvl = await db.fetch(`lvl_${id}_${gid}`);
  386.      message.channel.send("Tebrikler, " + message.author + ". Seviye atlad─▒n! Yeni seviyen: **" + lvl + "**");
  387.      var role = message.guild.roles.get(await db.fetch(`role_${gid}_${lvl}seviye`));
  388.      if(!role) return;
  389.      else {
  390.        message.member.addRole(role);
  391.        message.channel.send("Tebrikler! **" + lvl + "** seviye olarak @" + role.name + " rol├╝n├╝ kazand─▒n─▒z.");
  392.      }
  393.    
  394.    }
  395.  
  396.  }
  397.  
  398.  
  399.  
  400. });
  401.  
  402.  
  403. client.on('message', async (message, member) => {
  404.  let ke = await db.fetch(`kufur_${message.guild.id}`)
  405.  
  406.  if (ke === "kapali" || ke === undefined || ke === null){
  407.    return;
  408.  } else if (ke === "acik") {
  409.    let k├╝f├╝r = ["pezeveng", "porn", "amk", "amc─▒k", "yarrak", "sik", "am─▒na kodu─čum", "kaltak", "yav┼čak", "orospu", "pi├ž", "anan─▒ sikim", "sikik", "g├Ât", "pezevenk", "gavat", "meme"]
  410.    if (k├╝f├╝r.some(word => message.content.includes(word))){
  411.        if (!message.member.hasPermission("BAN_MEMBERS")) {
  412.        message.delete();
  413.        const embed = new Discord.RichEmbed()
  414.        .setTitle("Bu Sunucuda K├╝f├╝r Yasaklanm─▒┼č")
  415.        .setDescription(`L├╝tfen Bir Daha K├╝f├╝r Etme. Aksi Takdirde Sunucudan At─▒labilirsin`)
  416.        .setFooter("CatBOT")
  417.        .setTimestamp()
  418.        .setColor("RANDOM")
  419.        message.channel.send(embed)
  420.      }
  421.    }
  422.  
  423.  }
  424. })
  425. client.on('message', async (message, member) => {
  426.  let ke = await db.fetch(`reklam_${message.guild.id}`)
  427.  
  428.  if (ke === "kapali" || ke === undefined || ke === null){
  429.    return;
  430.  } else if (ke === "acik") {
  431.    let reklam = ["discord.gg", "bit.ly", "http", "discord.gg/", "https", ".org", ".com", ".cf", ".tk", ".xyz", "www."]
  432.    if (reklam.some(word => message.content.includes(word))){
  433.        if (!message.member.hasPermission("BAN_MEMBERS")) {
  434.        message.delete();
  435.     const embed = new Discord.RichEmbed()
  436.    .setTitle("Bu Sunucuda Reklam Yasaklanm─▒┼č")
  437.    .setDescription(`Bir Daha Reklam Yaparsan At─▒labilir Veya Banlanabilirsin!`)
  438.    .setFooter(`${ayarlar.botad─▒}`)
  439.    .setTimestamp()
  440.    .setColor("RANDOM")
  441.   message.channel.send(embed)
  442.     }
  443.    }
  444.  
  445.  }
  446. })
  447.  
  448. const { GOOGLE_API_KEY } = require('./ayarlar.json');
  449. const youtube = new YouTube(GOOGLE_API_KEY)
  450.  
  451. client.on('message', async msg => {
  452.  
  453.         if (msg.author.bot) return undefined;
  454.         if (!msg.content.startsWith(prefix)) return undefined;
  455.  
  456.         const args = msg.content.split(' ');
  457.         const searchString = args.slice(1).join(' ');
  458.         const url = args[
  459.  
  460.         if (command === '├žal') {
  461.                 const voiceChannel = msg.member.voiceChannel;
  462.                 if (!voiceChannel) return msg.channel.sendEmbed(new Discord.RichEmbed()
  463.      .setColor('RANDOM')
  464.      .setTimestamp()
  465.      .setTitle("┼×ark─▒ Ba┼člat─▒lam─▒yor")
  466.      .setDescription(`**L├╝tfen Bir Sesli Kanala Giri┼č Yap─▒n─▒z** Aksi Takdirde M├╝zik Ba┼člat─▒lamayacak..`)
  467.      .setFooter(`${ayarlar.botad─▒}`));
  468.    const permissions = voiceChannel.permissionsFor(msg.client.user);
  469.                 if (!permissions.has('CONNECT')) {
  470.                         return msg.channel.sendEmbed(new Discord.RichEmbed()
  471.    .setColor('RANDOM')
  472.    .setTitle('┼×ark─▒ Ba┼člat─▒lam─▒yor')
  473.    .setDescription("**L├╝tfen Yetki Veriniz** Aksi Takdirde M├╝zik Ba┼člat─▒lamayacak.")
  474.                 .setTimestamp()
  475.    .setFooter(`${ayarlar.botad─▒}`));
  476.    }
  477.                 if (!permissions.has('SPEAK')) {
  478.                          return msg.channel.sendEmbed(new Discord.RichEmbed()
  479.      .setColor('RANDOM')
  480.      .setTitle('┼×ark─▒ ba┼člat─▒lam─▒yor.')
  481.      .setDescription('**L├╝tfen mikrofonumu a├ž─▒n─▒z**. Aksi Takdirde M├╝zik Ba┼člat─▒lamayacak.')
  482.      .setTimestamp()
  483.      .setFooter(`${ayarlar.botad─▒}`));
  484.    }
  485.  
  486.                 if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) {
  487.                         const playlist = await youtube.getPlaylist(url);
  488.                         const videos = await playlist.getVideos();
  489.                 for (const video of Object.values(videos)) {
  490.                                 const video2 = await youtube.getVideoByID(video.id); // eslint-disable-line no-await-in-loop
  491.                                 await handleVideo(video2, msg, voiceChannel, true); // eslint-disable-line no-await-in-loop
  492.                         }
  493.                          return msg.channel.sendEmbed(new Discord.RichEmbed)
  494.      .setTitle(`**? | Oynatma Listesi: **${playlist.title}** Kuyru─ča Eklendi!**`)
  495.                 } else {
  496.                         try {
  497.                                 var video = await youtube.getVideo(url);
  498.                         } catch (error) {
  499.                                 try {
  500.                                         var videos = await youtube.searchVideos(searchString, 10);
  501.                                         let index = 0;
  502.          
  503.                                  msg.channel.sendEmbed(new Discord.RichEmbed()                
  504.         .setTitle(`${ayarlar.botad─▒} | ┼×ark─▒ Se├žimi`)
  505.         .setAuthor(`${msg.author.tag}`, msg.author.avatarURL)
  506.         .setDescription(`${videos.map(video2 => `**${++index} -** ${video2.title}`).join('\n')}`)
  507.         .setFooter('L├╝tfen 1-10 aras─▒nda bir rakam se├žiniz 10 saniye i├žinde liste iptal edilecektir.')
  508.         .setTimestamp()
  509.         .setColor('RANDOM'));
  510.        
  511.                                         try {
  512.                                                 var response = await msg.channel.awaitMessages(msg2 => msg2.content > 0 && msg2.content < 11, {
  513.                                                         maxMatches: 1,
  514.                                                         time: 10000,
  515.                                                         errors: ['time']
  516.                                                 });
  517.                                         } catch (err) {
  518.                                                 console.error(err);
  519.                                                  return msg.channel.sendEmbed(new Discord.RichEmbed()
  520.            .setColor('RANDOM')
  521.            .setTitle('Se├žim ─░ptal Edilmi┼čtir.')
  522.            .setDescription("L├╝tfen Tekrar Deneyiniz Bu sefer Se├žiminizi 10 saniyede Yap─▒n─▒z Aksi Takdirde Se├žim Yine ─░ptal Edilecektir")
  523.            .setTimestamp()
  524.            .setFooter(`${ayarlar.botad─▒}`));
  525.          }
  526.                                         const videoIndex = parseInt(response.first().content);
  527.                                         var video = await youtube.getVideoByID(videos[videoIndex - 1].id);
  528.                                 } catch (err) {
  529.                                         console.error(err);
  530.                                         return msg.channel.sendEmbed(new Discord.RichEmbed()
  531.  
  532.          .setFooter(`${ayarlar.botad─▒}`)                            
  533.          .setTimestamp()                            
  534.          .setColor('RANDOM')
  535.          .setTitle('Arad─▒m Fakat Hi├ž Bir Sonu├ž ├ç─▒kmad─▒')
  536.          .setDescription(`L├╝tfen ┼×ark─▒n─▒n ismini Do─čru Giriniz. E─čer Do─čru Girdiyseniz Ve Sonu├ž Bulunam─▒yorsa Di─čer ┼×ark─▒lar─▒ Deneyiniz Yine Bulunam─▒yorsa L├╝tfen ${ayarlar.prefix}bug Sonu├ž Bulunamad─▒ Hatas─▒ Yaz─▒n─▒z.`));
  537.                }
  538.            }
  539.                         return handleVideo(video, msg, voiceChannel);
  540.      
  541.                 }
  542.         } else if (command === 'atla') {
  543.                 if (!msg.member.voiceChannel) if (!msg.member.voiceChannel) return msg.channel.sendEmbed(new Discord.RichEmbed()
  544.    .setColor('RANDOM')
  545.    .setDescription('L├╝tfen ├Âncelikle sesli bir kanala kat─▒l─▒n─▒z. Ve ┼čark─▒ a├ž─▒n─▒z')
  546.    .setTitle("Hi├ž Bir ┼×ark─▒ Atlat─▒lamad─▒")
  547.           .setFooter(`${ayarlar.botad─▒}`)
  548.    .setTimestamp());                                                                                        
  549. if (!serverQueue) return msg.channel.sendEmbed(new Discord.RichEmbed()
  550.     .setColor('RANDOM')
  551.     .setTitle('Hi├ž Bir M├╝zik Atlat─▒lamad─▒')
  552.     .setFooter(`${ayarlar.botad─▒}`)                                        
  553.     .setTimestamp()
  554.     .setDescription(`L├╝tfen ├ľnceliikle Sesli Bir Kanala Kat─▒l─▒n─▒z Ve ┼×ark─▒ a├ž─▒n─▒z`));
  555.                 serverQueue.connection.dispatcher.end('M├╝zik Ba┼čar─▒yla Atlat─▒ld─▒');
  556.                 return undefined;
  557.         } else if (command === 'sonland─▒r') {
  558.                 if (!msg.member.voiceChannel) if (!msg.member.voiceChannel) return msg.channel.sendEmbed(new Discord.RichEmbed()
  559.    .setColor('RANDOM')
  560.    .setDescription('L├╝tfen ├Âncelikle sesli bir kanala kat─▒l─▒n─▒z.')
  561.    .setTitle("┼×ark─▒ Sonland─▒r─▒lamd─▒")                                                                        
  562.    .setFooter(`${ayarlar.botad─▒}`)                                                                                        
  563.    .setTimestamp());                                                                                        
  564.                 if (!serverQueue) return msg.channel.sendEmbed(new Discord.RichEmbed()
  565.     .setColor('RANDOM')
  566.     .setTitle("┼×ark─▒ Durdurulamad─▒")
  567.     .setTimestamp()                                              
  568.     .setFooter(`${ayarlar.botad─▒}`)                              
  569.     .setDescription('├çal─▒nan ┼×ark─▒ Bulunamad─▒.'));                                              
  570.                 msg.channel.send(`:stop_button: **${serverQueue.songs[0].title}** Adl─▒ M├╝zik Durduruldu`);
  571.                 serverQueue.songs = [];
  572.                 serverQueue.connection.dispatcher.end('M├╝zik Bitti');
  573.                 return undefined;
  574.         } else if (command === 'ses') {
  575.                 if (!msg.member.voiceChannel) if (!msg.member.voiceChannel) return msg.channel.sendEmbed(new Discord.RichEmbed()
  576.    .setColor('RANDOM')
  577.    .setTitle("Ses Seviyesi Bulunamad─▒")
  578.    .setFooter(`${ayarlar.botad─▒}`)
  579.    .setTimestamp()                                                                                        
  580.    .setDescription('L├╝tfen ├Âncelikle sesli bir kanala kat─▒l─▒n─▒z. Ondan Sonra Da ┼×ark─▒ a├ž─▒p Bu Komutu Kullanabilirsiniz'));
  581.                 if (!serverQueue) return msg.channel.sendEmbed(new Discord.RichEmbed()
  582.     .setColor('RANDOM')
  583.     .setTimestamp()
  584.     .setTitle("Ses Seviyesi Bulunamad─▒")
  585.     .setFooter(`${ayarlar.botad─▒}`)
  586.     .setDescription('Hi├ž Bir M├╝zik ├çalmamakta'));                                              
  587.                 if (!args[1]) return msg.channel.sendEmbed(new Discord.RichEmbed()
  588.    .setTitle("Ses Seviyesi")
  589.    .setDescription(`┼×uanki Ses Seviyesi: **${serverQueue.volume}**`)
  590.    .setFooter(`${ayarlar.botad─▒}`)
  591.    .setTimestamp()
  592.    .setColor('RANDOM'))
  593.                 serverQueue.volume = args[1];
  594.                 serverQueue.connection.dispatcher.setVolumeLogarithmic(args[1] / 5);
  595.                 return msg.channel.sendEmbed(new Discord.RichEmbed()
  596.    .setTitle("L├╝tfen Kulak Sa─čl─▒─č─▒n─▒z ─░├žin Fazla Sesli A├žmay─▒n")
  597.    .setDescription(`:hammer:  Ses Seviyesi Ba┼čar─▒yla Ayarlan─▒yor: **${args[1]}**`)
  598.    .setFooter(`${ayarlar.botad─▒}`)
  599.    .setTimestamp()
  600.    .setColor('RANDOM'));                            
  601.         } else if (command === '├žalan') {
  602.                 if (!serverQueue) return msg.channel.sendEmbed(new Discord.RichEmbed()
  603.    .setTitle("├çalan M├╝zik Bulunmamakta")
  604.    .setFooter(`${ayarlar.botad─▒}`)
  605.    .setTimestamp()
  606.    .setDescription("E─čer ┼×imdi M├╝zik a├žarsan─▒z S─▒ra Beklemiceksiniz")
  607.    .setColor('RANDOM'));
  608.                 return msg.channel.sendEmbed(new Discord.RichEmbed()
  609.    .setColor('RANDOM')
  610.    .setTitle(`${ayarlar.botad─▒} | ├çalan M├╝zik`)                            
  611.    .addField('Ba┼čl─▒k', `[${serverQueue.songs[0].title}](${serverQueue.songs[0].url})`, true)
  612.    .addField("S├╝re", `${serverQueue.songs[0].durationm}:${serverQueue.songs[0].durations}`, true))
  613.         } else if (command === 'kuyruk') {
  614.    let index = 0;
  615.                 if (!serverQueue) return msg.channel.sendEmbed(new Discord.RichEmbed()
  616.    .setTitle("S─▒rada M├╝zik Bulunmamakta")
  617.    .setDescription("E─čer ┼×imdi M├╝zik A├žarsan─▒z Kimseyi Beklemiceksiniz.")
  618.    .setFooter(`${ayarlar.botad─▒}`)                                              
  619.    .setTimestamp()                                                                                              
  620.    .setColor('RANDOM'));
  621.                   return msg.channel.sendEmbed(new Discord.RichEmbed()
  622.    .setColor('RANDOM')
  623.    .setTimestamp()
  624.    .setFooter(`${ayarlar.botad─▒}`)
  625.    .setTitle('┼×ark─▒ Kuyru─ču')
  626.    .setDescription(`${serverQueue.songs.map(song => `**${++index} -** ${song.title}`).join('\n')}`))
  627.    .addField('┼×u anda ├žal─▒nan: ' + `${serverQueue.songs[0].title}`);
  628.         } else if (command === 'duraklat') {
  629.                 if (serverQueue && serverQueue.playing) {
  630.                         serverQueue.playing = false;
  631.                         serverQueue.connection.dispatcher.pause();
  632.                         return msg.channel.sendEmbed(new Discord.RichEmbed()
  633.      .setDescription(`E─čer Devam Ettirmek isterseniz ${ayarlar.prefix}devam Yazman─▒z Yeterlidir.`)
  634.      .setTitle("┼×ark─▒ Ba┼čar─▒yla Duraklat─▒ld─▒")
  635.      .setFooter(`${ayarlar.botad─▒}`)                            
  636.      .setTimestamp()                          
  637.      .setColor('RANDOM'));
  638.    }
  639.                 return msg.channel.send('├çalan M├╝zik Bulunmamakta');
  640.         } else if (command === 'devam') {
  641.                 if (serverQueue && !serverQueue.playing) {
  642.                         serverQueue.playing = true;
  643.                         serverQueue.connection.dispatcher.resume();
  644.                         return msg.channel.sendEmbed(new Discord.RichEmbed()
  645.      .setTitle('┼×ark─▒n─▒n Keyfini ├ç─▒kar')
  646.      .setDescription("Ba┼čar─▒yla M├╝zik devam ediyor.")
  647.      .setFooter(`${ayarlar.botad─▒}`)      
  648.      .setTimestamp()              
  649.      .setColor('RANDOM'));
  650.    }
  651.                 return msg.channel.sendEmbed(new Discord.RichEmbed()
  652.    .setTitle("├çalan M├╝zik Bulunmamakta.")
  653.    .setDescription("L├╝tfen Bir M├╝zik a├ž─▒n─▒z.")
  654.    .setFooter(`${ayarlar.botad─▒}`)
  655.    .setTimestamp()
  656.    .setColor('RANDOM'));
  657.         }
  658.  
  659.  
  660.         return undefined;
  661. });
  662.  
  663. async function handleVideo(video, msg, voiceChannel, playlist = false) {
  664.    const serverQueue = queue.get(msg.guild.id);
  665.    const song = {
  666.        id: video.id,
  667.        title: video.title,
  668.        url: `https://www.youtube.com/watch?v=${video.id}`,
  669.    durationh: video.duration.hours,
  670.    durationm: video.duration.minutes,
  671.        durations: video.duration.seconds,
  672.      zg: video.raw.snippet.channelId,
  673.      best: video.channel.title,
  674.      views: video.raw.views,
  675.    };
  676.         if (!serverQueue) {
  677.                 const queueConstruct = {
  678.                         textChannel: msg.channel,
  679.                         voiceChannel: voiceChannel,
  680.                         connection: null,
  681.                         songs: [],
  682.                         volume: 5,
  683.                         playing: true
  684.                 };
  685.                 queue.set(msg.guild.id, queueConstruct);
  686.  
  687.                 queueConstruct.songs.push(song);
  688.  
  689.                 try {
  690.                         var connection = await voiceChannel.join();
  691.                         queueConstruct.connection = connection;
  692.                         play(msg.guild, queueConstruct.songs[0]);
  693.                 } catch (error) {
  694.                         console.error(`:warning: **┼×ark─▒ Sisteminde Problem Var Hata Nedeni: ${error}**`);
  695.                         queue.delete(msg.guild.id);
  696.                         return msg.channel.sendEmbed(new Discord.RichEmbed()
  697.      .setTitle(`:warning: **┼×ark─▒ Sisteminde Problem Var ${error}**`)
  698.      .setDescription(`L├╝tfen Daha Sonra Tekrar Deneyin Olmazsa ${error}'u ┼×u ┼čekilde ┼čikayet ediniz ${ayarlar.prefix}bug ${error}.`)
  699.       .setFooter("┼×ikayet Ettiyseniz Sorununuz En K─▒sa zamanda ├ç├Âz├╝lecektir")
  700.       .setTimestampl()
  701.       .setColor('RANDOM'))
  702.                 }
  703.         } else {
  704.                 serverQueue.songs.push(song);
  705.                 console.log(serverQueue.songs);
  706.                 if (playlist) return undefined;
  707.                 return msg.channel.sendEmbed(new Discord.RichEmbed()
  708.     .setTitle(`:arrow_heading_up:  **${song.title}** Adl─▒ M├╝zik Kuyru─ča Eklendi!`)
  709.     .setDescription('┼×ark─▒n─▒z Sizden ├ľnceki ┼×ark─▒lar Bitti─činde Ba┼člayacakt─▒r')
  710.     .setFooter(`${ayarlar.botad─▒}`)
  711.     .setTimestamp()
  712.     .setColor('RANDOM'))
  713.         }
  714.         return undefined;
  715. }
  716.  
  717. function play(guild, song) {
  718.         const serverQueue = queue.get(guild.id);
  719.  
  720.         if (!song) {
  721.                 serverQueue.voiceChannel.leave();
  722.                 queue.delete(guild.id);
  723.                 return;
  724.         }
  725.         console.log(serverQueue.songs);
  726.  
  727.         const dispatcher = serverQueue.connection.playStream(ytdl(song.url))
  728.                 .on('end', reason => {
  729.                         if (reason === '**Yay─▒n Ak─▒┼č H─▒z─▒ Yeterli De─čil.**') console.log('M├╝zik Bitti.');
  730.                         else console.log(reason);
  731.                         serverQueue.songs.shift();
  732.                         play(guild, serverQueue.songs[0]);
  733.                 })
  734.                 .on('error', error => console.error(error));
  735.         dispatcher.setVolumeLogarithmic(serverQueue.volume / 5);
  736.  
  737.          serverQueue.textChannel.sendEmbed(new Discord.RichEmbed()                                  
  738.   .setTitle(`${ayarlar.botad─▒} | :microphone: M├╝zik Ba┼člad─▒`)
  739.   .addField('\nBa┼čl─▒k', `[${song.title}](${song.url})`, true)
  740.   .addField("\nSes Seviyesi", `${serverQueue.volume}%`, true)
  741.   .addField("S├╝re", `${song.durationm}:${song.durations}`, true)
  742.   .addField("Video ID", `${song.id}`, true)
  743.   .addField("Kanal ID", `${song.zg}`, true)
  744.   .addField("Kanal ─░smi", `${song.best}`, true)
  745.   .addField("Video Linki", `${song.url}`, true)                              
  746.   .setFooter(`${ayarlar.botad─▒}`)
  747.   .setTimestamp()                            
  748.   .setColor("RANDOM"))
  749.     }
  750.    client.on("guildMemberAdd", async member => {
  751. let kanal = await db.fetch(`otok_${member.guild.id}`)  
  752. let rol = await db.fetch(`otorol_${member.guild.id}`)  
  753. let mesaj =  db.fetch(`otomesaj_${member.guild.id}`)  
  754. if(!kanal) return
  755.  
  756. if(!mesaj) {
  757.  
  758.   client.channels.get(kanal).send(':loudspeaker: :inbox_tray: Otomatik Rol Verildi Seninle Beraber `'+member.guild.memberCount+'` Ki┼čiyiz! Ho┼čgeldin! `'+member.user.username+'`')
  759. member.addRole(rol)
  760.   return
  761. }
  762.  
  763. if(mesaj) {
  764.   var mesajs = await db.fetch(`otomesaj_${member.guild.id}`).replace("-uye-", `${member.user.tag}`).replace("-rol-", `${member.guild.roles.get(rol).name}`).replace("-server-", `${member.guild.name}`).replace("-uyesayisi-", `${member.guild.memberCount}`).replace("-botsayisi-", `${member.guild.members.filter(m => m.user.bot).size}`).replace("-bolge-", `${member.guild.region}`).replace("-kanalsayisi-", `${member.guild.channels.size}`)
  765.   member.addRole(rol)
  766.   client.channels.get(kanal).send(mesajs)
  767.  
  768. }  
  769.  
  770. });
  771.  
  772. client.login(ayarlar.token);