chomens-bot-js/commands/botvisibility.js

64 lines
2.8 KiB
JavaScript
Raw Permalink Normal View History

const { EmbedBuilder } = require('discord.js')
2022-08-14 05:51:45 -04:00
module.exports = {
name: 'botvisibility',
2022-11-20 03:37:25 -05:00
alias: ['botvis', 'togglevis', 'togglevisibility'],
2022-08-14 05:51:45 -04:00
description: 'Changes the bot\'s visibility',
usage: [
'<hash> <true|false>',
'<hash> <on|off>',
2022-11-27 02:35:28 -05:00
'<hash>'
],
2022-08-14 05:51:45 -04:00
trusted: 1,
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
if (args[1] === 'true' || args[1] === 'on') {
2022-11-27 02:35:28 -05:00
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') {
2022-11-27 02:35:28 -05:00
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]) {
2022-11-27 02:35:28 -05:00
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 }])
2022-08-14 05:51:45 -04:00
} else {
2022-11-27 02:35:28 -05:00
throw new SyntaxError('Invalid argument')
2022-08-14 05:51:45 -04:00
}
},
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
if (args[0] === 'true' || args[0] === 'on') {
2022-11-27 02:35:28 -05:00
bot.visibility = true
bot.chat('/essentials:vanish disable')
const Embed = new EmbedBuilder()
2022-12-01 05:15:30 -05:00
.setColor(config.discord.embedsColors.normal)
2022-11-27 02:35:28 -05:00
.setTitle('Bot\'s Visibility')
.setDescription('The bot\'s visibility is now visible')
channeldc.send({ embeds: [Embed] })
} else if (args[0] === 'false' || args[0] === 'off') {
2022-11-27 02:35:28 -05:00
bot.visibility = false
bot.chat('/essentials:vanish enable')
const Embed = new EmbedBuilder()
2022-12-01 05:15:30 -05:00
.setColor(config.discord.embedsColors.normal)
2022-11-27 02:35:28 -05:00
.setTitle('Bot\'s Visibility')
.setDescription('The bot\'s visibility is now invisible')
channeldc.send({ embeds: [Embed] })
} else if (!args[0]) {
2022-11-27 02:35:28 -05:00
bot.visibility = !bot.visibility
const visibleOrInvisible = bot.visibility ? 'visible' : 'invisible'
const enableOrDisable = bot.visibility ? 'disable' : 'enable'
bot.chat(`/essentials:vanish ${enableOrDisable}`)
const Embed = new EmbedBuilder()
2022-12-01 05:15:30 -05:00
.setColor(config.discord.embedsColors.normal)
2022-11-27 02:35:28 -05:00
.setTitle('Bot\'s Visibility')
.setDescription(`The bot's visibility is now ${visibleOrInvisible}`)
channeldc.send({ embeds: [Embed] })
2022-10-14 04:46:41 -04:00
} else {
2022-11-27 02:35:28 -05:00
throw new SyntaxError('Invalid argument')
2022-10-14 04:46:41 -04:00
}
2022-11-27 02:35:28 -05:00
}
}