Advertisement
Guest User

Untitled

a guest
Mar 17th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.05 KB | None | 0 0
  1. const Discord = require("discord.js");
  2. const client = new Discord.Client();
  3. const yt = require('ytdl-core');
  4.  
  5. client.on('ready', () => {
  6. console.log('Logging into discord..');
  7. console.log(`
  8. By Kupir.yt
  9. `);
  10.  
  11. });
  12.  
  13. //جميع الحقوق محفوظة لدى كوبر الشمري
  14.  
  15.  
  16.  
  17.  
  18.  
  19. function commandIs(str, msg){
  20. return msg.content.toLowerCase().startsWith('.' + str);
  21. }
  22.  
  23. function pluck(array) {
  24. return array.map(function(item) { return item['name']; });
  25. }
  26.  
  27. function hasRole(mem, role) {
  28. if(pluck(mem.roles).includes(role)){
  29. return true;
  30. } else {
  31. return false;
  32. }
  33.  
  34. }
  35.  
  36.  
  37.  
  38.  
  39.  
  40. var servers = {};
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47. var q1 = "=quran 1"
  48.  
  49. var q2 = "=quran 2"
  50.  
  51. var q3 = "=quran 3"
  52.  
  53. var q4 = "=quran 4"
  54.  
  55.  
  56.  
  57.  
  58.  
  59. function play(connection, message) {
  60. var server = servers[message.guild.id];
  61.  
  62. server.dispatcher = connection.playStream(yt(server.queue[0], { fliter: "audionly" }));
  63.  
  64. server.queue.shift();
  65.  
  66. server.dispatcher.on("end", function() {
  67. if (server.queue[0]) play(connection, message);
  68. else connection.disconnect();
  69. });
  70. }
  71.  
  72. client.on("ready", () => {
  73. console.log(`Quran bot is in ${client.guilds.size} servers `)
  74. });
  75.  
  76. var PREFIX = ".";
  77.  
  78.  
  79.  
  80. //sowar
  81.  
  82.  
  83. client.on("message", message => {
  84.  
  85. if (message.content === q1 ) {
  86. message.react('🔊')
  87. const voiceChannel = message.member.voiceChannel;
  88. if (!voiceChannel) {
  89. return message.reply(`يرجى أن تكون في قناة صوتيه أولا!`);
  90. }
  91. voiceChannel.join()
  92. .then(connnection => {
  93. let stream = yt('https://www.youtube.com/watch?v=V4b9f9BQTKI', {audioonly: true});
  94. const dispatcher = connnection.playStream(stream);
  95. });
  96. }
  97.  
  98. if (message.content === q2 ) {
  99. message.react('🔊')
  100. const voiceChannel = message.member.voiceChannel;
  101. if (!voiceChannel) {
  102. return message.reply(`يرجى أن تكون في قناة صوتيه أولا!`);
  103. }
  104. voiceChannel.join()
  105. .then(connnection => {
  106. let stream = yt('https://youtu.be/0m02xNtR8gA', {audioonly: true});
  107. const dispatcher = connnection.playStream(stream);
  108. });
  109. }
  110.  
  111. if (message.content === q3 ) {
  112. message.react('🔊')
  113. const voiceChannel = message.member.voiceChannel;
  114. if (!voiceChannel) {
  115. return message.reply(`يرجى أن تكون في قناة صوتيه أولا!`);
  116. }
  117. voiceChannel.join()
  118. .then(connnection => {
  119. let stream = yt('https://www.youtube.com/watch?v=4JvY-MccxNk', {audioonly: true});
  120. const dispatcher = connnection.playStream(stream);
  121. });
  122. }
  123.  
  124. if (message.content === q4 ) {
  125. message.react('🔊')
  126. const voiceChannel = message.member.voiceChannel;
  127. if (!voiceChannel) {
  128. return message.reply(`يرجى أن تكون في قناة صوتيه أولا!`);
  129. }
  130. voiceChannel.join()
  131. .then(connnection => {
  132. let stream = yt('https://www.youtube.com/watch?v=Ktync4j_nmA', {audioonly: true});
  133. const dispatcher = connnection.playStream(stream);
  134. });
  135. }
  136.  
  137.  
  138.  
  139. //outher_cummon
  140.  
  141.  
  142. if(message.content === "=stop" ) {
  143. var servers = {};
  144.  
  145. if (message.guild.voiceConnection) message.guild.voiceConnection.disconnect();
  146.  
  147. }
  148.  
  149. if(message.content === "=quran") {
  150. message.channel.send(` QuranBot
  151. :mosque: =quran 1 : القران الكريم كامل بصوت الشيخ عبدالباسط عبدالصمد
  152.  
  153. :mosque: =quran 2 : سورة البقرة كاملة - القارئ الحاج ميثم التمار (QURAN)
  154.  
  155. :mosque: =quran 3 : القرآن الكريم كامل بصوت الشيخ عبد الرحمن السديس وسعود الشريم
  156.  
  157. :mosque: =quran 4 : القرآن الكريم كامل بصوت الشيخ المعيقلي
  158.  
  159. :mosque: =stop : لـ أيقاف تشغيل البوت `)
  160. }
  161.  
  162.  
  163. });
  164.  
  165.  
  166.  
  167. client.login("Token");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement