mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
hash check in commands plugin and change servereval description
This commit is contained in:
parent
a15a529103
commit
90b7d09650
11 changed files with 59 additions and 88 deletions
|
@ -6,11 +6,7 @@ module.exports = {
|
|||
trusted: 1,
|
||||
usage: '<hash> <c:|command>',
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[0] === hash) {
|
||||
bot.core.run(`essentials:sudo * ${args.slice(1).join(' ')}`);
|
||||
} else {
|
||||
throw new Error('Invalid hash');
|
||||
}
|
||||
bot.core.run(`essentials:sudo * ${args.slice(1).join(' ')}`);
|
||||
},
|
||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
||||
if (message.member.roles.cache.some((role) => role.name === 'Trusted')) {
|
||||
|
|
|
@ -11,27 +11,23 @@ module.exports = {
|
|||
],
|
||||
trusted: 1,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[0] === hash) {
|
||||
if (args[1] === 'true' || args[1] === 'on') {
|
||||
bot.visibility = true;
|
||||
bot.chat('/essentials:vanish disable');
|
||||
bot.tellraw(selector, [{text: 'The bot\'s visibility is now ', color: 'white'}, {text: 'visible', color: 'green'}]);
|
||||
} else if (args[1] === 'false' || args[1] === 'off') {
|
||||
bot.visibility = false;
|
||||
bot.chat('/essentials:vanish enable');
|
||||
bot.tellraw(selector, [{text: 'The bot\'s visibility is now ', color: 'white'}, {text: 'invisible', color: 'gold'}]);
|
||||
} else if (!args[1]) {
|
||||
bot.visibility = !bot.visibility;
|
||||
const greenOrGold = bot.visibility ? 'green' : 'gold';
|
||||
const visibleOrInvisible = bot.visibility ? 'visible' : 'invisible';
|
||||
const enableOrDisable = bot.visibility ? 'disable' : 'enable';
|
||||
bot.chat(`/essentials:vanish ${enableOrDisable}`);
|
||||
bot.tellraw(selector, [{text: 'The bot\'s visibility is now ', color: 'white'}, {text: visibleOrInvisible, color: greenOrGold}]);
|
||||
} else {
|
||||
throw new SyntaxError('Invalid argument');
|
||||
}
|
||||
if (args[1] === 'true' || args[1] === 'on') {
|
||||
bot.visibility = true;
|
||||
bot.chat('/essentials:vanish disable');
|
||||
bot.tellraw(selector, [{text: 'The bot\'s visibility is now ', color: 'white'}, {text: 'visible', color: 'green'}]);
|
||||
} else if (args[1] === 'false' || args[1] === 'off') {
|
||||
bot.visibility = false;
|
||||
bot.chat('/essentials:vanish enable');
|
||||
bot.tellraw(selector, [{text: 'The bot\'s visibility is now ', color: 'white'}, {text: 'invisible', color: 'gold'}]);
|
||||
} else if (!args[1]) {
|
||||
bot.visibility = !bot.visibility;
|
||||
const greenOrGold = bot.visibility ? 'green' : 'gold';
|
||||
const visibleOrInvisible = bot.visibility ? 'visible' : 'invisible';
|
||||
const enableOrDisable = bot.visibility ? 'disable' : 'enable';
|
||||
bot.chat(`/essentials:vanish ${enableOrDisable}`);
|
||||
bot.tellraw(selector, [{text: 'The bot\'s visibility is now ', color: 'white'}, {text: visibleOrInvisible, color: greenOrGold}]);
|
||||
} else {
|
||||
throw new Error('Invalid hash');
|
||||
throw new SyntaxError('Invalid argument');
|
||||
}
|
||||
},
|
||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
||||
|
|
|
@ -68,25 +68,20 @@ module.exports = {
|
|||
trusted: 1,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (!bot.cloops) bot.cloops = [];
|
||||
|
||||
if (args[0] === hash) {
|
||||
if (args[1] === 'add' && args[3]) {
|
||||
if (!Number(args[2]) && Number(args[2]) !== 0) throw new SyntaxError('Invalid interval');
|
||||
add(args.slice(3).join(' '), args[2], bot);
|
||||
bot.tellraw(selector, [{text: 'Added command ', color: 'white'}, {text: `${args.slice(3).join(' ')}`, color: 'aqua'}, {text: ' with interval ', color: 'white'}, {text: `${args[2]}`, color: 'green'}, {text: ' to the cloops', color: 'white'}]);
|
||||
} else if (args[1] === 'list') {
|
||||
list(bot, false, null, selector);
|
||||
} else if (args[1] === 'remove') {
|
||||
remove(args[2], bot);
|
||||
bot.tellraw(selector, [{text: 'Removed cloop '}, {text: args[2], color: 'aqua'}]);
|
||||
} else if (args[1] === 'removeall') {
|
||||
clear(bot);
|
||||
bot.tellraw(selector, [{text: 'Removed all looped commands', color: 'white'}]);
|
||||
} else {
|
||||
throw new SyntaxError('Invalid argument');
|
||||
}
|
||||
if (args[1] === 'add' && args[3]) {
|
||||
if (!Number(args[2]) && Number(args[2]) !== 0) throw new SyntaxError('Invalid interval');
|
||||
add(args.slice(3).join(' '), args[2], bot);
|
||||
bot.tellraw(selector, [{text: 'Added command ', color: 'white'}, {text: `${args.slice(3).join(' ')}`, color: 'aqua'}, {text: ' with interval ', color: 'white'}, {text: `${args[2]}`, color: 'green'}, {text: ' to the cloops', color: 'white'}]);
|
||||
} else if (args[1] === 'list') {
|
||||
list(bot, false, null, selector);
|
||||
} else if (args[1] === 'remove') {
|
||||
remove(args[2], bot);
|
||||
bot.tellraw(selector, [{text: 'Removed cloop '}, {text: args[2], color: 'aqua'}]);
|
||||
} else if (args[1] === 'removeall') {
|
||||
clear(bot);
|
||||
bot.tellraw(selector, [{text: 'Removed all looped commands', color: 'white'}]);
|
||||
} else {
|
||||
throw new Error('Invalid hash');
|
||||
throw new SyntaxError('Invalid argument');
|
||||
}
|
||||
},
|
||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
||||
|
|
|
@ -20,11 +20,9 @@ module.exports = {
|
|||
usage: '<hash>',
|
||||
trusted: 1,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[0] === hash) {
|
||||
|
||||
crash(bot);
|
||||
} else {
|
||||
throw new Error('Invalid hash');
|
||||
}
|
||||
|
||||
},
|
||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
||||
if (message.member.roles.cache.some((role) => role.name === 'Trusted')) {
|
||||
|
|
|
@ -7,24 +7,16 @@ module.exports = {
|
|||
trusted: 1,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[1] === 'on') {
|
||||
if (args[0] === hash) {
|
||||
bot.eaglercrashstarted = true;
|
||||
bot.eaglercrash = setInterval(async function() {
|
||||
if (bot.eaglercrashstarted === true) return bot.core.run('minecraft:playsound block.note_block.harp record @a ~ ~ ~ 100000000000000000000000000000000000000 1 0');
|
||||
}, 0);
|
||||
bot.core.run('minecraft:tellraw @a ["",{"text":"Eaglercrash started","color":"white"}]');
|
||||
} else {
|
||||
throw new Error('Invalid hash');
|
||||
}
|
||||
bot.eaglercrashstarted = true;
|
||||
bot.eaglercrash = setInterval(async function() {
|
||||
if (bot.eaglercrashstarted === true) return bot.core.run('minecraft:playsound block.note_block.harp record @a ~ ~ ~ 100000000000000000000000000000000000000 1 0');
|
||||
}, 0);
|
||||
bot.core.run('minecraft:tellraw @a ["",{"text":"Eaglercrash started","color":"white"}]');
|
||||
}
|
||||
if (args[1] === 'off') {
|
||||
if (args[0] === hash) {
|
||||
clearInterval(bot.eaglercrash);
|
||||
bot.eaglercrashstarted = false;
|
||||
bot.core.run('minecraft:tellraw @a ["",{"text":"Eaglercrash stopped","color":"white"}]');
|
||||
} else {
|
||||
throw new Error('Invalid hash');
|
||||
}
|
||||
clearInterval(bot.eaglercrash);
|
||||
bot.eaglercrashstarted = false;
|
||||
bot.core.run('minecraft:tellraw @a ["",{"text":"Eaglercrash stopped","color":"white"}]');
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -6,11 +6,9 @@ module.exports = {
|
|||
usage: '<hash>',
|
||||
trusted: 1,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[0] === hash) {
|
||||
|
||||
bot.end('end command');
|
||||
} else {
|
||||
throw new Error('Invalid hash');
|
||||
}
|
||||
|
||||
},
|
||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
||||
if (message.member.roles.cache.some((role) => role.name === 'Trusted')) {
|
||||
|
|
|
@ -6,10 +6,8 @@ module.exports = {
|
|||
usage: '<hash> <command>',
|
||||
trusted: 1,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[0] === hash) {
|
||||
|
||||
bot.core.run('minecraft:execute unless entity @s[name= run ] run ' + args.slice(1).join(' '));
|
||||
} else {
|
||||
throw new Error('Invalid hash');
|
||||
}
|
||||
|
||||
},
|
||||
};
|
||||
|
|
|
@ -6,10 +6,8 @@ module.exports = {
|
|||
usage: '<hash> <gamemode>',
|
||||
trusted: 1,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[0] === hash) {
|
||||
|
||||
bot.core.run(`minecraft:execute unless entity @s[name= run ] run gamemode ${args[1]} @a[name=!${bot.username}]`);
|
||||
} else {
|
||||
throw new Error('Invalid hash');
|
||||
}
|
||||
|
||||
},
|
||||
};
|
||||
|
|
|
@ -4,18 +4,14 @@ const {stylize} = require('../util/colors/minecraft');
|
|||
module.exports = {
|
||||
name: 'servereval',
|
||||
alias: [],
|
||||
description: 'Eval command without vm2',
|
||||
description: 'Basically eval command but without vm2',
|
||||
trusted: 2,
|
||||
usage: '<ownerhash> <code>',
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[0] === ownerhash) {
|
||||
try {
|
||||
bot.tellraw(selector, {text: `${util.inspect(eval(args.slice(1).join(' ')), {stylize: stylize})}`.substring(0, 32000)});
|
||||
} catch (err) {
|
||||
bot.tellraw(selector, {text: `${util.inspect(err).replaceAll('runner', 'chayapak1')}`, color: 'red'});
|
||||
}
|
||||
} else {
|
||||
throw new Error('Invalid OwnerHash');
|
||||
try {
|
||||
bot.tellraw(selector, {text: `${util.inspect(eval(args.slice(1).join(' ')), {stylize: stylize})}`.substring(0, 32000)});
|
||||
} catch (err) {
|
||||
bot.tellraw(selector, {text: `${util.inspect(err).replaceAll('runner', 'chayapak1')}`, color: 'red'});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -6,10 +6,8 @@ module.exports = {
|
|||
usage: '<hash> <player>',
|
||||
trusted: 1,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[0] === hash) {
|
||||
|
||||
bot.core.run(`minecraft:execute unless entity @s[name= run ] run tp @a ${args.slice(1).join(' ')}`);
|
||||
} else {
|
||||
throw new Error('Invalid hash');
|
||||
}
|
||||
|
||||
},
|
||||
};
|
||||
|
|
|
@ -24,6 +24,12 @@ function inject(bot, dcclient, config) {
|
|||
if (prefix === '*' && message.endsWith('*') && message !== '*') return;
|
||||
if (!command) throw new Error(`Unknown command: "${commandName}"`);
|
||||
|
||||
if (command.trusted === 1) {
|
||||
if (args[0] !== hash) throw new Error('Invalid hash');
|
||||
} else if (command.trusted === 2) {
|
||||
if (args[0] !== ownerhash) throw new Error('Invalid OwnerHash');
|
||||
}
|
||||
|
||||
if (prefix === config.discord.prefix) {
|
||||
if (typeof command.discordExecute === 'undefined') throw new Error('This command is not yet supported on discord!');
|
||||
command.discordExecute(bot, username, usernameraw, sender, prefix, args, channeldc, message, config);
|
||||
|
|
Loading…
Reference in a new issue