chomens-bot-js/commands/botvisibility.js
ChomeNS 6895a37104 bot.tellraw()
i totally did not used the search icon thing in vscode
2022-11-07 18:30:37 +07:00

51 lines
1.9 KiB
JavaScript

/* eslint-disable max-len */
const {MessageEmbed} = require('discord.js');
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.tellraw('@a', ['', {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.tellraw('@a', ['', {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');
}
},
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
if (message.member.roles.cache.some((role) => role.name === 'Trusted')) {
if (args[0]==='true') {
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]});
} else if (args[0]==='false') {
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!');
}
},
};