chomens-bot-js/commands/botvisibility.js

52 lines
2 KiB
JavaScript
Raw Normal View History

2022-08-14 05:51:45 -04:00
/* eslint-disable max-len */
2022-10-14 04:46:41 -04:00
const {MessageEmbed} = require('discord.js');
2022-08-14 05:51:45 -04:00
module.exports = {
name: 'botvisibility',
alias: [],
description: 'Changes the bot\'s visibility',
usage: '<hash> <true|false>',
trusted: 1,
2022-11-16 06:41:30 -05:00
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
2022-11-16 06:09:37 -05:00
if (args[0] === hash) {
2022-11-07 07:26:38 -05:00
if (args[1] === 'true') {
2022-08-14 05:51:45 -04:00
bot.visibility = true;
bot.chat('/essentials:vanish disable');
2022-11-16 06:41:30 -05:00
bot.tellraw(selector, [{text: 'The bot\'s visibility is now ', color: 'white'}, {text: 'visible', color: 'green'}]);
2022-11-07 07:26:38 -05:00
} else if (args[1] === 'false') {
2022-08-14 05:51:45 -04:00
bot.visibility = false;
bot.chat('/essentials:vanish enable');
2022-11-16 06:41:30 -05:00
bot.tellraw(selector, [{text: 'The bot\'s visibility is now ', color: 'white'}, {text: 'invisible', color: 'gold'}]);
2022-08-14 05:51:45 -04:00
} else {
throw new SyntaxError('Invalid argument');
}
} else {
throw new Error('Invalid hash');
}
},
2022-10-14 04:46:41 -04:00
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
2022-11-07 08:08:29 -05:00
if (message.member.roles.cache.some((role) => role.name === 'Trusted')) {
2022-11-07 07:26:38 -05:00
if (args[0] === 'true') {
2022-10-14 04:46:41 -04:00
bot.visibility = true;
bot.chat('/essentials:vanish disable');
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setTitle('Bot\'s Visibility')
.setDescription('The bot\'s visibility is now visible');
channeldc.send({embeds: [Embed]});
2022-11-07 07:26:38 -05:00
} else if (args[0] === 'false') {
2022-10-14 04:46:41 -04:00
bot.visibility = false;
bot.chat('/essentials:vanish enable');
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setTitle('Bot\'s Visibility')
.setDescription('The bot\'s visibility is now invisible');
channeldc.send({embeds: [Embed]});
} else {
throw new SyntaxError('Invalid argument');
}
} else {
throw new Error('You\'re not in the trusted role!');
}
},
2022-08-14 05:51:45 -04:00
};