2021-08-19 14:19:14 +00:00
|
|
|
import Command from "../../classes/command.js";
|
2021-07-31 05:04:38 +00:00
|
|
|
|
|
|
|
class BroadcastCommand extends Command {
|
|
|
|
// yet another very hacky command
|
|
|
|
run() {
|
|
|
|
return new Promise((resolve) => {
|
2021-11-03 00:43:37 +00:00
|
|
|
const owners = process.env.OWNER.split(",");
|
2022-03-31 05:42:03 +00:00
|
|
|
if (!owners.includes(this.author.id)) return "Only the bot owner can broadcast messages!";
|
2021-07-31 05:04:38 +00:00
|
|
|
if (this.args.length !== 0) {
|
|
|
|
this.ipc.broadcast("playbroadcast", this.args.join(" "));
|
|
|
|
this.ipc.register("broadcastSuccess", () => {
|
|
|
|
this.ipc.unregister("broadcastSuccess");
|
|
|
|
resolve("Successfully broadcasted message.");
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
this.ipc.broadcast("broadcastend");
|
|
|
|
this.ipc.register("broadcastEnd", () => {
|
|
|
|
this.ipc.unregister("broadcastEnd");
|
|
|
|
resolve("Successfully ended broadcast.");
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
static description = "Broadcasts a playing message until the command is run again or the bot restarts";
|
|
|
|
}
|
|
|
|
|
2021-08-19 14:19:14 +00:00
|
|
|
export default BroadcastCommand;
|