Advertisement
Guest User

Untitled

a guest
Dec 15th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require('discord.js');
  2. const settings = require('./settings.json');
  3. const client = new Discord.Client();
  4.  
  5. const fs = require('fs');
  6. const bot = new Discord.Client({disableEveryone: true})
  7. bot.modules = new Discord.Collection();
  8.  
  9. fs.readdir("./modules/", (err, files) => {
  10.   if(err) console.log(err)
  11.   let jsfile = files.filter(f => f.split(".").pop() === "js")
  12.   if(jsfile.lenght <= 0) {
  13.     console.log("❗ Couldn\'t find file.");
  14.     return;
  15.   }
  16.   jsfile.forEach((file, i) => {
  17.     let props = require(`./modules/${file}`)
  18.     console.log(`✔ Module ${file} has been successfully loaded!`);
  19.     bot.modules.set(props.help)
  20.   });
  21. });
  22.  
  23. prefix = "!"
  24. embedColor = "#2D81E7"
  25. //var modLogChannel =
  26. //var auditLogChannel =
  27.  
  28. //Сообщение в консоль о входе в сеть
  29. client.on('ready', () => {
  30.   console.log(`✔ Вошел как ${client.user.tag}, Готов к роботе!`);
  31. });
  32.  
  33. //Загрузчик
  34. client.on('kick', msg => {
  35.   let commandFile = bot.commands.get(commands.slice(prefix.length));
  36.   if(commandFile) commandFile.run(bot, msg, args);
  37. });
  38.  
  39.  
  40.  
  41. 2:
  42. const Discord = require('discord.js');
  43. const modules = requireAll({ directory: './modules' });
  44.  
  45. //Тестовая команда для nроверки пинга
  46. module.exports.run = async (bot, msg, args) => {
  47.   if (msg.author === client.user) return;
  48.   if (msg.content.startsWith(`${prefix}ping`)) {
  49.     const embed = new Discord.RichEmbed()
  50.       .setColor(embedColor)
  51.       .addField('**Пинг бота**', client.ping)
  52.       .setAuthor(
  53.         msg.author.tag,
  54.         msg.author.avatarURL
  55.       )
  56.     msg.channel.sendMessage(embed);
  57.   }
  58. };
  59.  
  60. module.exports.help = {
  61.     name: "ping"
  62. }
  63.  
  64.  
  65. err:
  66. Command don't work
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement