mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2025-05-31 06:23:47 -04: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) {
|
execute: function(bot, username, usernameraw, sender, prefix, args, config) {
|
||||||
if (args[0] === 'run') {
|
if (args[0] === 'run') {
|
||||||
try {
|
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) {
|
} catch (err) {
|
||||||
bot.tellraw('@a', {text: `${util.inspect(err).replaceAll('runner', 'chayapak1')}`, color: 'red'});
|
bot.tellraw('@a', {text: `${util.inspect(err).replaceAll('runner', 'chayapak1')}`, color: 'red'});
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ module.exports = {
|
||||||
const Embed = new MessageEmbed()
|
const Embed = new MessageEmbed()
|
||||||
.setColor('#FFFF00')
|
.setColor('#FFFF00')
|
||||||
.setTitle('Output')
|
.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]});
|
channeldc.send({embeds: [Embed]});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw err;
|
throw err;
|
||||||
|
|
|
@ -10,7 +10,7 @@ module.exports = {
|
||||||
execute: function(bot, username, usernameraw, sender, prefix, args) {
|
execute: function(bot, username, usernameraw, sender, prefix, args) {
|
||||||
if (args[0] === bot.ownerHash) {
|
if (args[0] === bot.ownerHash) {
|
||||||
try {
|
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) {
|
} catch (err) {
|
||||||
bot.tellraw('@a', {text: `${util.inspect(err).replaceAll('runner', 'chayapak1')}`, color: 'red'});
|
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._client.removeAllListeners();
|
||||||
};
|
};
|
||||||
bot.visibility = false;
|
bot.visibility = false;
|
||||||
bot.command_handler = function() {
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
bot.command_handler.commands = {};
|
|
||||||
bot.getplayerusername = {};
|
bot.getplayerusername = {};
|
||||||
|
|
||||||
// allink's plugin loader
|
// allink's plugin loader
|
||||||
|
|
|
@ -3,6 +3,8 @@ const loadFiles = require('../util/load_files');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const {MessageEmbed} = require('discord.js');
|
const {MessageEmbed} = require('discord.js');
|
||||||
function inject(bot, dcclient, config) {
|
function inject(bot, dcclient, config) {
|
||||||
|
bot.command_handler = {};
|
||||||
|
bot.command_handler.commands = {};
|
||||||
function reload() {
|
function reload() {
|
||||||
bot.command_handler.commands = loadFiles(path.join(__dirname, config.commandsDir));
|
bot.command_handler.commands = loadFiles(path.join(__dirname, config.commandsDir));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue