diff --git a/commands/general/broadcast.js b/commands/general/broadcast.js index 923c2c8..73b33d7 100644 --- a/commands/general/broadcast.js +++ b/commands/general/broadcast.js @@ -4,7 +4,8 @@ class BroadcastCommand extends Command { // yet another very hacky command run() { return new Promise((resolve) => { - if (this.message.author.id !== process.env.OWNER) return "Only the bot owner can broadcast messages!"; + const owners = process.env.OWNER.split(","); + if (!owners.includes(this.message.author.id)) return "Only the bot owner can broadcast messages!"; if (this.args.length !== 0) { this.ipc.broadcast("playbroadcast", this.args.join(" ")); this.ipc.register("broadcastSuccess", () => { diff --git a/commands/general/channel.js b/commands/general/channel.js index ee8d108..2abf34e 100644 --- a/commands/general/channel.js +++ b/commands/general/channel.js @@ -4,7 +4,8 @@ import Command from "../../classes/command.js"; class ChannelCommand extends Command { async run() { if (!this.message.channel.guild) return "This command only works in servers!"; - if (!this.message.member.permissions.has("administrator") && this.message.member.id !== process.env.OWNER) return "You need to be an administrator to enable/disable me!"; + const owners = process.env.OWNER.split(","); + if (!this.message.member.permissions.has("administrator") && !owners.includes(this.message.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!"; diff --git a/commands/general/command.js b/commands/general/command.js index a927303..10620b6 100644 --- a/commands/general/command.js +++ b/commands/general/command.js @@ -5,7 +5,8 @@ import * as collections from "../../utils/collections.js"; class CommandCommand extends Command { async run() { if (!this.message.channel.guild) return "This command only works in servers!"; - if (!this.message.member.permissions.has("administrator") && this.message.member.id !== process.env.OWNER) return "You need to be an administrator to enable/disable me!"; + const owners = process.env.OWNER.split(","); + if (!this.message.member.permissions.has("administrator") && !owners.includes(this.message.member.id)) return "You need to be an administrator to enable/disable me!"; if (this.args.length === 0) return "You need to provide what command to enable/disable!"; if (this.args[0] !== "disable" && this.args[0] !== "enable") return "That's not a valid option!"; diff --git a/commands/general/eval.js b/commands/general/eval.js index 437835e..5aa1457 100644 --- a/commands/general/eval.js +++ b/commands/general/eval.js @@ -3,7 +3,8 @@ import Command from "../../classes/command.js"; class EvalCommand extends Command { async run() { - if (this.message.author.id !== process.env.OWNER) return "Only the bot owner can use eval!"; + const owners = process.env.OWNER.split(","); + if (!owners.includes(this.message.author.id)) return "Only the bot owner can use eval!"; const code = this.args.join(" "); try { const evaled = eval(code); diff --git a/commands/general/evalraw.js b/commands/general/evalraw.js index 12e4566..c12bfb4 100644 --- a/commands/general/evalraw.js +++ b/commands/general/evalraw.js @@ -3,7 +3,8 @@ import Command from "../../classes/command.js"; class EvalRawCommand extends Command { async run() { - if (this.message.author.id !== process.env.OWNER) return "Only the bot owner can use evalraw!"; + const owners = process.env.OWNER.split(","); + if (!owners.includes(this.message.author.id)) return "Only the bot owner can use evalraw!"; const code = this.args.join(" "); try { const evaled = eval(code); diff --git a/commands/general/exec.js b/commands/general/exec.js index 490a108..5052a9d 100644 --- a/commands/general/exec.js +++ b/commands/general/exec.js @@ -6,7 +6,8 @@ import Command from "../../classes/command.js"; class ExecCommand extends Command { async run() { - if (this.message.author.id !== process.env.OWNER) return "Only the bot owner can use exec!"; + const owners = process.env.OWNER.split(","); + if (!owners.includes(this.message.author.id)) return "Only the bot owner can use exec!"; const code = this.args.join(" "); try { const execed = await exec(code); diff --git a/commands/general/imagereload.js b/commands/general/imagereload.js index 55264dc..70958e3 100644 --- a/commands/general/imagereload.js +++ b/commands/general/imagereload.js @@ -2,7 +2,8 @@ import Command from "../../classes/command.js"; class ImageReloadCommand extends Command { async run() { - if (this.message.author.id !== process.env.OWNER) return "Only the bot owner can reload the image servers!"; + const owners = process.env.OWNER.split(","); + if (!owners.includes(this.message.author.id)) return "Only the bot owner can reload the image servers!"; const amount = await this.ipc.command("image", { type: "reload" }, true); if (amount > 0) { return `Successfully connected to ${amount} image servers.`; diff --git a/commands/general/info.js b/commands/general/info.js index 6d9824c..12ebf75 100644 --- a/commands/general/info.js +++ b/commands/general/info.js @@ -7,7 +7,7 @@ const exec = promisify(baseExec); class InfoCommand extends Command { async run() { - const owner = await this.ipc.fetchUser(process.env.OWNER); + const owner = await this.ipc.fetchUser(process.env.OWNER.split(",")[0]); const stats = await this.ipc.getStats(); return { "embed": { diff --git a/commands/general/prefix.js b/commands/general/prefix.js index 89c7620..5ade823 100644 --- a/commands/general/prefix.js +++ b/commands/general/prefix.js @@ -6,7 +6,8 @@ class PrefixCommand extends Command { if (!this.message.channel.guild) return "This command only works in servers!"; const guild = await database.getGuild(this.message.channel.guild.id); if (this.args.length !== 0) { - if (!this.message.member.permissions.has("administrator") && this.message.member.id !== process.env.OWNER) return "You need to be an administrator to change the bot prefix!"; + const owners = process.env.OWNER.split(","); + if (!this.message.member.permissions.has("administrator") && !owners.includes(this.message.member.id)) return "You need to be an administrator to change the bot prefix!"; await database.setPrefix(this.args[0], this.message.channel.guild); return `The prefix has been changed to ${this.args[0]}.`; } else { diff --git a/commands/general/reload.js b/commands/general/reload.js index ae94f17..e5c7f25 100644 --- a/commands/general/reload.js +++ b/commands/general/reload.js @@ -4,7 +4,8 @@ class ReloadCommand extends Command { // quite possibly one of the hackiest commands in the bot run() { return new Promise((resolve) => { - if (this.message.author.id !== process.env.OWNER) resolve("Only the bot owner can reload commands!"); + const owners = process.env.OWNER.split(","); + if (!owners.includes(this.message.author.id)) resolve("Only the bot owner can reload commands!"); if (this.args.length === 0) resolve("You need to provide a command to reload!"); this.ipc.broadcast("reload", this.args[0]); this.ipc.register("reloadSuccess", () => { diff --git a/commands/general/restart.js b/commands/general/restart.js index 3992aff..14704aa 100644 --- a/commands/general/restart.js +++ b/commands/general/restart.js @@ -2,7 +2,8 @@ import Command from "../../classes/command.js"; class RestartCommand extends Command { async run() { - if (this.message.author.id !== process.env.OWNER) return "Only the bot owner can restart me!"; + const owners = process.env.OWNER.split(","); + if (!owners.includes(this.message.author.id)) return "Only the bot owner can restart me!"; await this.client.createMessage(this.message.channel.id, Object.assign({ content: "esmBot is restarting." }, this.reference)); diff --git a/commands/general/soundreload.js b/commands/general/soundreload.js index f1bcfe5..3d9ea73 100644 --- a/commands/general/soundreload.js +++ b/commands/general/soundreload.js @@ -4,7 +4,8 @@ class SoundReloadCommand extends Command { // another very hacky command run() { return new Promise((resolve) => { - if (this.message.author.id !== process.env.OWNER) return "Only the bot owner can reload Lavalink!"; + const owners = process.env.OWNER.split(","); + if (!owners.includes(this.message.author.id)) return "Only the bot owner can reload Lavalink!"; this.client.sendChannelTyping(this.message.channel.id); this.ipc.broadcast("soundreload"); this.ipc.register("soundReloadSuccess", (msg) => { diff --git a/commands/general/stats.js b/commands/general/stats.js index 96d41f7..82ebd55 100644 --- a/commands/general/stats.js +++ b/commands/general/stats.js @@ -11,7 +11,7 @@ class StatsCommand extends Command { async run() { const uptime = process.uptime() * 1000; const connUptime = this.client.uptime; - const owner = await this.ipc.fetchUser(process.env.OWNER); + const owner = await this.ipc.fetchUser(process.env.OWNER.split(",")[0]); const stats = await this.ipc.getStats(); return { embed: { diff --git a/commands/tags/tags.js b/commands/tags/tags.js index 238bb84..caa1976 100644 --- a/commands/tags/tags.js +++ b/commands/tags/tags.js @@ -22,14 +22,16 @@ class TagsCommand extends Command { if (this.args[1] === undefined) return "You need to provide the name of the tag you want to delete!"; const getResult = await database.getTag(this.message.channel.guild.id, this.args[1].toLowerCase()); if (!getResult) return "This tag doesn't exist!"; - if (getResult.author !== this.message.author.id && !this.message.member.permissions.has("manageMessages") && this.message.author.id !== process.env.OWNER) return "You don't own this tag!"; + const owners = process.env.OWNER.split(","); + if (getResult.author !== this.message.author.id && !this.message.member.permissions.has("manageMessages") && !owners.includes(this.message.author.id)) return "You don't own this tag!"; await database.removeTag(this.args[1].toLowerCase(), this.message.channel.guild); return `The tag \`${this.args[1].toLowerCase()}\` has been deleted!`; } else if (this.args[0].toLowerCase() === "edit") { if (this.args[1] === undefined) return "You need to provide the name of the tag you want to edit!"; const getResult = await database.getTag(this.message.channel.guild.id, this.args[1].toLowerCase()); if (!getResult) return "This tag doesn't exist!"; - if (getResult.author !== this.message.author.id && !this.message.member.permissions.has("manageMessages") && this.message.author.id !== process.env.OWNER) return "You don't own this tag!"; + const owners = process.env.OWNER.split(","); + if (getResult.author !== this.message.author.id && !this.message.member.permissions.has("manageMessages") && !owners.includes(this.message.author.id)) return "You don't own this tag!"; await this.setTag(this.args.slice(2).join(" "), this.args[1].toLowerCase(), this.message, true); return `The tag \`${this.args[1].toLowerCase()}\` has been edited!`; } else if (this.args[0].toLowerCase() === "own" || this.args[0].toLowerCase() === "owner") {