Fix ready event running multiple times

This commit is contained in:
Essem 2022-10-01 12:02:18 -05:00
parent a50c86a0e2
commit f781fb1ae5
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C

View file

@ -6,8 +6,12 @@ import { logger } from "../utils/logger.js";
import { readFileSync } from "fs"; import { readFileSync } from "fs";
const { types } = JSON.parse(readFileSync(new URL("../config/commands.json", import.meta.url))); const { types } = JSON.parse(readFileSync(new URL("../config/commands.json", import.meta.url)));
let ready = false;
export default async (client) => { export default async (client) => {
if (ready) return;
// send slash command data
if (types.application) { if (types.application) {
try { try {
await send(client); await send(client);
@ -30,5 +34,7 @@ export default async (client) => {
checkBroadcast(client); checkBroadcast(client);
activityChanger(client); activityChanger(client);
ready = true;
logger.log("info", "Started esmBot."); logger.log("info", "Started esmBot.");
}; };