forked from cosmic/scythe
1
0
Fork 0
scythe/src/utils/uptime-loop.ts

17 lines
553 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:${Math.floor(Date.now()/1000)}:f> | if the ping was more than 1 minute ago, cosmic needs to check the bot lol :3`,
);
}
};