chomens-bot-js/commands/botvisibility.js

26 lines
973 B
JavaScript
Raw Normal View History

2022-08-14 05:51:45 -04:00
/* eslint-disable max-len */
module.exports = {
name: 'botvisibility',
alias: [],
description: 'Changes the bot\'s visibility',
usage: '<hash> <true|false>',
trusted: 1,
execute: function(bot, username, usernameraw, sender, prefix, args) {
if (args[0]===bot.hash) {
if (args[1]==='true') {
bot.visibility = true;
bot.chat('/essentials:vanish disable');
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: 'The bot\'s visibility is now ', color: 'white'}, {text: 'visible', color: 'green'}]));
} else if (args[1]==='false') {
bot.visibility = false;
bot.chat('/essentials:vanish enable');
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: 'The bot\'s visibility is now ', color: 'white'}, {text: 'invisible', color: 'gold'}]));
} else {
throw new SyntaxError('Invalid argument');
}
} else {
throw new Error('Invalid hash');
}
},
};