scythe/src/utils/uptime-loop.ts

12 lines
545 B
TypeScript

import type { Client } from "discordx";
import { sleep } from "./underage"
import type { TextChannel } from "discord.js";
export const uptimeLoop = async (client: Client) => {
while(true) {
await sleep(30 * 1000);
const channel = client.channels.cache.get(Bun.env.SCYTHE_CHANNEL) as TextChannel;
const msg = await channel.messages.fetch(Bun.env.UPTIME_MESSAGE);
await msg.edit(`bot is up, last ping: <t:${Date.now()}:f> | if the ping was more than 1 minute ago, cosmic needs to check the bot lol :3`)
}
}