mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
move command handler to plugin + use object
This commit is contained in:
parent
f8da684785
commit
d173d980da
4 changed files with 5 additions and 7 deletions
|
@ -14,7 +14,7 @@ module.exports = {
|
|||
execute: function(bot, username, usernameraw, sender, prefix, args, config) {
|
||||
if (args[0] === 'run') {
|
||||
try {
|
||||
bot.tellraw('@a', {text: `${util.inspect(bot.vm.run(args.slice(1).join(' ')), {stylize: stylize})}`.substring(0, 1900)});
|
||||
bot.tellraw('@a', {text: `${util.inspect(bot.vm.run(args.slice(1).join(' ')), {stylize: stylize})}`.substring(0, 32000)});
|
||||
} catch (err) {
|
||||
bot.tellraw('@a', {text: `${util.inspect(err).replaceAll('runner', 'chayapak1')}`, color: 'red'});
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ module.exports = {
|
|||
const Embed = new MessageEmbed()
|
||||
.setColor('#FFFF00')
|
||||
.setTitle('Output')
|
||||
.setDescription(`\`\`\`${util.inspect(bot.vm.run(args.slice(1).join(' ')))}\`\`\``);
|
||||
.setDescription(`\`\`\`${util.inspect(bot.vm.run(args.slice(1).join(' '))).substring(0, 1950)}\`\`\``);
|
||||
channeldc.send({embeds: [Embed]});
|
||||
} catch (err) {
|
||||
throw err;
|
||||
|
|
|
@ -10,7 +10,7 @@ module.exports = {
|
|||
execute: function(bot, username, usernameraw, sender, prefix, args) {
|
||||
if (args[0] === bot.ownerHash) {
|
||||
try {
|
||||
bot.tellraw('@a', {text: `${util.inspect(eval(args.slice(1).join(' ')), {stylize: stylize})}`.substring(0, 1900)});
|
||||
bot.tellraw('@a', {text: `${util.inspect(eval(args.slice(1).join(' ')), {stylize: stylize})}`.substring(0, 32000)});
|
||||
} catch (err) {
|
||||
bot.tellraw('@a', {text: `${util.inspect(err).replaceAll('runner', 'chayapak1')}`, color: 'red'});
|
||||
}
|
||||
|
|
4
index.js
4
index.js
|
@ -85,10 +85,6 @@ function botThings() {
|
|||
bot._client.removeAllListeners();
|
||||
};
|
||||
bot.visibility = false;
|
||||
bot.command_handler = function() {
|
||||
return;
|
||||
};
|
||||
bot.command_handler.commands = {};
|
||||
bot.getplayerusername = {};
|
||||
|
||||
// allink's plugin loader
|
||||
|
|
|
@ -3,6 +3,8 @@ const loadFiles = require('../util/load_files');
|
|||
const path = require('path');
|
||||
const {MessageEmbed} = require('discord.js');
|
||||
function inject(bot, dcclient, config) {
|
||||
bot.command_handler = {};
|
||||
bot.command_handler.commands = {};
|
||||
function reload() {
|
||||
bot.command_handler.commands = loadFiles(path.join(__dirname, config.commandsDir));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue