Compare commits

..

No commits in common. "90b099452416979c2da1c665269f5ed203ccef51" and "a421243973cd76191063b6a393f52d540805bc22" have entirely different histories.

3 changed files with 7 additions and 26 deletions

@ -8,7 +8,7 @@ export enum DiscordChannels {
backendLogs = "1296524935237468250",
}
const client = new Client({
const DiscordBot = new Client({
intents: [],
presence: {
status: "online",
@ -23,17 +23,16 @@ const client = new Client({
},
});
client.once("ready", () => {
DiscordBot.once("ready", () => {
console.log("Discord bot ready!");
});
export async function initDiscordBot() {
export function initDiscordBot() {
console.log("Initializing discord bot...");
client.once("ready", async () => {
await client.initApplicationCommands();
MetadataStorage.instance.build().then(async () => {
await DiscordBot.login(Config.discordBotToken!).then();
});
await client.login(Config.discordBotToken!);
}
/**
@ -43,7 +42,7 @@ export async function initDiscordBot() {
* @param message the message to log
*/
export async function logToChannel(channelId: DiscordChannels, message: EmbedBuilder) {
const channel = await client.channels.fetch(channelId);
const channel = await DiscordBot.channels.fetch(channelId);
if (channel == undefined) {
throw new Error(`Channel "${channelId}" not found`);
}

@ -1,18 +0,0 @@
import { Discord, Slash } from "discordx";
import { CommandInteraction } from "discord.js";
import { PlayerService } from "../../service/player.service";
@Discord()
export class RefreshPlayerScoresCommand {
@Slash({
description: "Refreshes scores for all tracked players",
name: "refresh-player-scores",
defaultMemberPermissions: ["Administrator"],
})
hello(interaction: CommandInteraction) {
interaction.reply("Updating player scores...").then(async response => {
await PlayerService.refreshPlayerScores();
await response.edit("Done!");
});
}
}

@ -73,7 +73,7 @@ app.use(
);
app.use(
cron({
name: "player-scores-tracker-cron",
name: "scores-background-refresh",
pattern: "0 4 * * *", // Every day at 04:00
timezone: "Europe/London", // UTC time
protect: true,