Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require('discord.js');
- const settings = require('./settings.json');
- const client = new Discord.Client();
- const fs = require('fs');
- const bot = new Discord.Client({disableEveryone: true})
- bot.modules = new Discord.Collection();
- fs.readdir("./modules/", (err, files) => {
- if(err) console.log(err)
- let jsfile = files.filter(f => f.split(".").pop() === "js")
- if(jsfile.lenght <= 0) {
- console.log("❗ Couldn\'t find file.");
- return;
- }
- jsfile.forEach((file, i) => {
- let props = require(`./modules/${file}`)
- console.log(`✔ Module ${file} has been successfully loaded!`);
- bot.modules.set(props.help)
- });
- });
- prefix = "!"
- embedColor = "#2D81E7"
- //var modLogChannel =
- //var auditLogChannel =
- //Сообщение в консоль о входе в сеть
- client.on('ready', () => {
- console.log(`✔ Вошел как ${client.user.tag}, Готов к роботе!`);
- });
- //Загрузчик
- client.on('kick', msg => {
- let commandFile = bot.commands.get(commands.slice(prefix.length));
- if(commandFile) commandFile.run(bot, msg, args);
- });
- 2:
- const Discord = require('discord.js');
- const modules = requireAll({ directory: './modules' });
- //Тестовая команда для nроверки пинга
- module.exports.run = async (bot, msg, args) => {
- if (msg.author === client.user) return;
- if (msg.content.startsWith(`${prefix}ping`)) {
- const embed = new Discord.RichEmbed()
- .setColor(embedColor)
- .addField('**Пинг бота**', client.ping)
- .setAuthor(
- msg.author.tag,
- msg.author.avatarURL
- )
- msg.channel.sendMessage(embed);
- }
- };
- module.exports.help = {
- name: "ping"
- }
- err:
- Command don't work
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement