diff --git a/commands/general/base64.js b/commands/general/base64.js index f4c9ac6..3e7abf4 100644 --- a/commands/general/base64.js +++ b/commands/general/base64.js @@ -12,10 +12,10 @@ class Base64Command extends Command { this.success = true; if (command === "decode") { const b64Decoded = Buffer.from(string, "base64").toString("utf8"); - return `\`\`\`\n${await clean(b64Decoded)}\`\`\``; + return { html: `
${await clean(b64Decoded)}
` }; } else if (command === "encode") { const b64Encoded = Buffer.from(string, "utf8").toString("base64"); - return `\`\`\`\n${b64Encoded}\`\`\``; + return { html: `
${b64Encoded}
` }; } } diff --git a/commands/general/broadcast.js b/commands/general/broadcast.js deleted file mode 100644 index 9e65fb9..0000000 --- a/commands/general/broadcast.js +++ /dev/null @@ -1,52 +0,0 @@ -import Command from "../../classes/command.js"; -import database from "../../utils/database.js"; -import { endBroadcast, startBroadcast } from "../../utils/misc.js"; - -class BroadcastCommand extends Command { - async run() { - const owners = process.env.OWNER.split(","); - if (!owners.includes(this.author)) { - this.success = false; - return "Only the bot owner can broadcast messages!"; - } - const message = this.options.message ?? this.args.join(" "); - if (message?.trim()) { - await database.setBroadcast(message); - startBroadcast(this.client, message); - if (process.env.PM2_USAGE) { - process.send({ - type: "process:msg", - data: { - type: "broadcastStart", - message - } - }); - } - return "Started broadcast."; - } else { - await database.setBroadcast(null); - endBroadcast(this.client); - if (process.env.PM2_USAGE) { - process.send({ - type: "process:msg", - data: { - type: "broadcastEnd" - } - }); - } - return "Ended broadcast."; - } - } - - static flags = [{ - name: "message", - type: 3, - description: "The message to broadcast" - }]; - - static description = "Broadcasts a playing message until the command is run again or the bot restarts"; - static adminOnly = true; - static dbRequired = true; -} - -export default BroadcastCommand; \ No newline at end of file diff --git a/commands/general/channel.js b/commands/general/channel.js deleted file mode 100644 index b1750c3..0000000 --- a/commands/general/channel.js +++ /dev/null @@ -1,53 +0,0 @@ -import db from "../../utils/database.js"; -import Command from "../../classes/command.js"; - -class ChannelCommand extends Command { - async run() { - this.success = false; - if (!this.guild) return "This command only works in servers!"; - const owners = process.env.OWNER.split(","); - if (!this.member.permissions.has("ADMINISTRATOR") && !owners.includes(this.member.id)) return "You need to be an administrator to enable/disable me!"; - if (this.args.length === 0) return "You need to provide whether I should be enabled or disabled in this channel!"; - if (this.args[0] !== "disable" && this.args[0] !== "enable") return "That's not a valid option!"; - - const guildDB = await db.getGuild(this.guild.id); - - if (this.args[0].toLowerCase() === "disable") { - let channel; - if (this.args[1]?.match(/^?$/) && this.args[1] >= 21154535154122752n) { - const id = this.args[1].replaceAll("@", "").replaceAll("#", "").replaceAll("!", "").replaceAll("&", "").replaceAll("<", "").replaceAll(">", ""); - if (guildDB.disabled.includes(id)) return "I'm already disabled in this channel!"; - channel = this.guild.channels.get(id) ?? await this.client.rest.channels.get(id); - } else { - if (guildDB.disabled.includes(this.channel.id)) return "I'm already disabled in this channel!"; - channel = this.channel; - } - - await db.disableChannel(channel); - this.success = true; - return `I have been disabled in this channel. To re-enable me, just run \`${guildDB.prefix}channel enable\`.`; - } else if (this.args[0].toLowerCase() === "enable") { - let channel; - if (this.args[1]?.match(/^?$/) && this.args[1] >= 21154535154122752n) { - const id = this.args[1].replaceAll("@", "").replaceAll("#", "").replaceAll("!", "").replaceAll("&", "").replaceAll("<", "").replaceAll(">", ""); - if (!guildDB.disabled.includes(id)) return "I'm not disabled in that channel!"; - channel = this.guild.channels.get(id) ?? await this.client.rest.channels.get(id); - } else { - if (!guildDB.disabled.includes(this.channel.id)) return "I'm not disabled in this channel!"; - channel = this.channel; - } - - await db.enableChannel(channel); - this.success = true; - return "I have been re-enabled in this channel."; - } - } - - static description = "Enables/disables classic commands in a channel (use server settings for slash commands)"; - static arguments = ["[enable/disable]", "{id}"]; - static slashAllowed = false; - static directAllowed = false; - static dbRequired = true; -} - -export default ChannelCommand; diff --git a/commands/general/command.js b/commands/general/command.js deleted file mode 100644 index 06caaca..0000000 --- a/commands/general/command.js +++ /dev/null @@ -1,44 +0,0 @@ -import db from "../../utils/database.js"; -import Command from "../../classes/command.js"; -import * as collections from "../../utils/collections.js"; - -class CommandCommand extends Command { - async run() { - this.success = false; - if (!this.guild) return "This command only works in servers!"; - const owners = process.env.OWNER.split(","); - if (!this.member.permissions.has("ADMINISTRATOR") && !owners.includes(this.member.id)) return "You need to be an administrator to enable/disable me!"; - if (this.args.length === 0) return "You need to provide whether you want to enable/disable a command!"; - if (this.args[0] !== "disable" && this.args[0] !== "enable") return "That's not a valid option!"; - if (!this.args[1]) return "You need to provide what command to enable/disable!"; - if (!collections.commands.has(this.args[1].toLowerCase()) && !collections.aliases.has(this.args[1].toLowerCase())) return "That isn't a command!"; - - const guildDB = await db.getGuild(this.guild.id); - const disabled = guildDB.disabled_commands ?? guildDB.disabledCommands; - const command = collections.aliases.get(this.args[1].toLowerCase()) ?? this.args[1].toLowerCase(); - - if (this.args[0].toLowerCase() === "disable") { - if (command === "command") return "You can't disable that command!"; - if (disabled?.includes(command)) return "That command is already disabled!"; - - await db.disableCommand(this.guild.id, command); - this.success = true; - return `The command has been disabled. To re-enable it, just run \`${guildDB.prefix}command enable ${command}\`.`; - } else if (this.args[0].toLowerCase() === "enable") { - if (!disabled?.includes(command)) return "That command isn't disabled!"; - - await db.enableCommand(this.guild.id, command); - this.success = true; - return `The command \`${command}\` has been re-enabled.`; - } - } - - static description = "Enables/disables a classic command for a server (use server settings for slash commands)"; - static aliases = ["cmd"]; - static arguments = ["[enable/disable]", "[command]"]; - static slashAllowed = false; - static directAllowed = false; - static dbRequired = true; -} - -export default CommandCommand; diff --git a/commands/general/donate.js b/commands/general/donate.js index e7f8913..f49c4d5 100644 --- a/commands/general/donate.js +++ b/commands/general/donate.js @@ -20,7 +20,7 @@ class DonateCommand extends Command { } catch (e) { // no-op } - return `${prefix}Like esmBot? Consider supporting the developer on Patreon to help keep it running! https://patreon.com/TheEssem`; + return `${prefix}Like esmBot (or mrmBot)? Consider supporting Essem on Patreon to help keep it running! https://patreon.com/TheEssem`; } static description = "Learn more about how you can support esmBot's development"; diff --git a/commands/general/ping.js b/commands/general/ping.js deleted file mode 100644 index 0e20a9a..0000000 --- a/commands/general/ping.js +++ /dev/null @@ -1,27 +0,0 @@ -import Command from "../../classes/command.js"; - -class PingCommand extends Command { - async run() { - if (this.type === "classic") { - const pingMessage = await this.client.rest.channels.createMessage(this.message.channelID, Object.assign({ - content: "🏓 Ping?" - }, this.reference)); - await pingMessage.edit({ - content: `🏓 Pong!\n\`\`\`\nLatency: ${pingMessage.timestamp - this.message.timestamp}ms${this.message.guildID ? `\nShard Latency: ${Math.round(this.client.shards.get(this.client.guildShardMap[this.message.guildID]).latency)}ms` : ""}\n\`\`\`` - }); - } else { - await this.interaction.createMessage({ - content: "🏓 Ping?" - }); - const pingMessage = await this.interaction.getOriginal(); - await this.interaction.editOriginal({ - content: `🏓 Pong!\n\`\`\`\nLatency: ${pingMessage.timestamp - Math.floor((this.interaction.id / 4194304) + 1420070400000)}ms${this.interaction.guildID ? `\nShard Latency: ${Math.round(this.client.shards.get(this.client.guildShardMap[this.interaction.guildID]).latency)}ms` : ""}\n\`\`\`` - }); - } - } - - static description = "Pings Discord's servers"; - static aliases = ["pong"]; -} - -export default PingCommand; \ No newline at end of file diff --git a/commands/general/qrread.js b/commands/general/qrread.js index 8136d89..7041de9 100644 --- a/commands/general/qrread.js +++ b/commands/general/qrread.js @@ -16,7 +16,7 @@ class QrReadCommand extends Command { const qrBuffer = jsqr(rawData.data, rawData.info.width, rawData.info.height); if (!qrBuffer) return "I couldn't find a QR code!"; this.success = true; - return `\`\`\`\n${await clean(qrBuffer.data)}\n\`\`\``; + return { html: `
${await clean(qrBuffer.data)}
` }; } static description = "Reads a QR code";