Skip to content

Commit

Permalink
Add promotion check on client ready and set daily interval
Browse files Browse the repository at this point in the history
  • Loading branch information
ryandward committed Dec 13, 2024
1 parent 2fb369e commit eeeaac9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions events/ready.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
// Assuming discord.js is properly typed, otherwise you might need to install types via npm i @types/discord.js
import { Events } from 'discord.js';
import { TSClient } from '../types';
import { checkForPromotions } from './check_for_promotions.js';

export const name = Events.ClientReady;
export const once = true;

export async function execute(client: TSClient) {
if (client.user) {
console.log(`Ready! Logged in as ${client.user.tag}`);
checkForPromotions().catch(console.error);

setInterval(
() => {
checkForPromotions().catch(console.error);
},
24 * 60 * 60 * 1000,
);
// 24 hours in milliseconds
}
else {
console.log('Client is not logged in yet');
Expand Down

0 comments on commit eeeaac9

Please sign in to comment.