Skip to content

Commit

Permalink
Set Interval for set activity
Browse files Browse the repository at this point in the history
  • Loading branch information
ttbowen committed Nov 27, 2023
1 parent 17fe37e commit f39ea1f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/mrwhale-discord/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { SqliteStorageProvider } from "@mrwhale-io/core";
import { Events } from "discord.js";
import * as path from "path";

import { SqliteStorageProvider } from "@mrwhale-io/core";
import * as config from "./config.json";
import { version } from "./package.json";
import { DiscordBotClient } from "./src/client/discord-bot-client";
import { INTENTS } from "./src/constants";
import { startServer } from "./server";

const SET_ACTIVITY_INTERVAL = 5 * 60 * 1000; // 5 minutes

const bot = new DiscordBotClient(
{
commandsDir: path.join(__dirname, "./src/commands"),
Expand All @@ -31,7 +33,9 @@ bot.client.login(config.token);

bot.client.once(Events.ClientReady, () => {
bot.commandDispatcher.ready = true;
bot.client.user.setActivity(`in ${bot.client.guilds.cache.size} servers`);
setInterval(() => {
bot.client.user.setActivity(`in ${bot.client.guilds.cache.size} servers`);
}, SET_ACTIVITY_INTERVAL);
});

process.on("unhandledRejection", (err) => {
Expand Down

0 comments on commit f39ea1f

Please sign in to comment.