Andrey0189

Untitled

Jun 5th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require("discord.js");
  2. const bot = new Discord.Client();
  3.  
  4. bot.login("");
  5.  
  6. //Настройка языка
  7. let welcome
  8. let lang
  9.  
  10. let p = '-'
  11. let helper = '452378419917750274'
  12. let devel = '452377533183426562'
  13. let tester = '452386855367737354'
  14. let one = '<:oneEmoji:451337518915387402>';
  15. let two = '<:twoEmoji:451337620589379586>';
  16. let three = '<:threeEmoji:451337648296951813>';
  17. let four = '<:fourEmoji:451337671818739713>';
  18. let five = '<:fiveEmoji:451337693973053452>';
  19.  
  20. //Функции
  21.  
  22. function randomInteger(min, max) {
  23.     return Math.floor(Math.random() * (max - min)) + min;
  24. }
  25.  
  26. async function multipleReact(message, arr) {
  27.     if (arr !== []) {
  28.         await message.react(arr.shift()).catch(console.error).then(function () {multipleReact(message,arr).catch();});
  29.     }
  30. }
  31.  
  32. bot.on('ready', () => {
  33.     bot.user.setActivity('БОТ ОБНОВЛЯЕТСЯ! НЕ ЮЗАТЬ МЕНЯ!',{ type: 'PLAYING' })
  34.     console.log('Welcome to Mac OS!');
  35. });
  36.  
  37. bot.on('guildCreate', (guild) => {
  38.     let channels = guild.channels.filter(channel => channel.type === 'text' && channel.permissionsFor(guild.members.get(bot.user.id)).has('SEND_MESSAGES'));
  39. if (channels.size > 0) channels.first().send(/*'Добро пожаовать в Mac OS! Спасибо, что выбрали нашего бота. Вы **лучшие**!. Для того чтобы начать мной пользоваться напишите команду -help'*/'Welcome to Mac OS 2.0! Thank you all for choosing my bot. If you want to use me, you need write the command -settings! Добро пожаовать в Mac OS 2.0! Спасибо, что выбрали нашего бота. Вы **лучшие**!. Для того чтобы начать мной пользоваться напишите команду -settings! Also, join my server! https://discord.gg/2P9mukc');
  40.     });
  41.  
  42. bot.on('message', (message) => {
  43.     if (message.channel.type !== 'text') return;
  44.     if (message.author.bot) return;
  45.     if(message.content.indexOf(p) !== 0) return;
  46.     const args = message.content.slice(p.length).trim().split(/ +/g);
  47.     const vote = message.content.slice(p.length).trim().split(/\|+/g);
  48.     const command = args.shift().toLowerCase();
  49.  
  50.     if(message.content == '-settings') {
  51.         message.channel.send('First, you need to choose a language. Write rus/eng').then(() => {
  52.             const collector = new Discord.MessageCollector(message.channel, m => m.author.id === message.author.id, { time: 60000 });
  53.             collector.on('collect', msg => {
  54.                 collector.stop();
  55.             if (msg.content === 'rus') {
  56.                 lang = 'rus';
  57.                 message.channel.send('Теперь я буду говорить на руссокм :flag_ru:' + lang);
  58.                
  59.        
  60.             }
  61.             else if (msg.content === 'eng') {
  62.                 message.channel.send('Now, I`ll talk on english language :flag_um:');
  63.                 lang = 'rus';
  64.                
  65.  
  66.             }
  67.             else {
  68.                 message.channel.send('Sorry, but I dont support this language :confused:');
  69.                
  70.             }
  71.         });
  72.         message.channel.send(lang);
  73.         collector.on('end', msg => {
  74.             message.channel.send(lang);
  75.             let prefixQuestion
  76.             let noArgsInPerfix
  77.             let myPrefix
  78.             if (lang === 'rus') {
  79.                 prefixQuestion = 'Теперь, вам нужно выбрать префикс. Примеры префиксов: `!` `;` `=` `-` `)` `>`. Для префикса нежелательно использовать буквы или использовать более трех символов. Напишите `prefix: сам префикс` внизу. Обязательно через пробел!';
  80.                 noArgsInPerfix = 'Вы не указали префикс'
  81.                 myPrefix = 'Теперь мой новый префикс - `'
  82.                 //message.channel.send(prefixQuestion + noArgsInPerfix + myPrefix);
  83.             } else if (lang === 'eng') {
  84.                 prefixQuestion = 'Now you need to choose prefix. Examples of prefixs: `!` `;` `=` `-` `)` `>`. Dont use letters or more than 3 symbols. Writeм `prefix: prefix` under the message'
  85.                 noArgsInPerfix = 'You did not write a prefix'
  86.                 myPrefix = 'Now my new prefix is - `'
  87.                 //message.channel.send(prefixQuestion + noArgsInPerfix + myPrefix);
  88.             }
  89.             message.channel.send(prefixQuestion).then(() => {
  90.                 const collector = new Discord.MessageCollector(message.channel, m => m.author.id === message.author.id, { time: 60000 });
  91.                 collector.on('collect', msg => {
  92.                     collector.stop();
  93.                 if (!args[0]) {
  94.                     message.channel.send(noArgsInPerfix);
  95.                 }
  96.                 else {
  97.                     p = args[0]
  98.                     message.channel.send(myPrefix + p + '`');
  99.                 }
  100.                 })
  101.             })
  102.             })
  103.         }
  104.     )}
  105. })
  106. //Остальной код был закомментирован
Advertisement
Add Comment
Please, Sign In to add comment