This commit is contained in:
parent
53e0ce007d
commit
90b0994524
@ -8,7 +8,7 @@ export enum DiscordChannels {
|
|||||||
backendLogs = "1296524935237468250",
|
backendLogs = "1296524935237468250",
|
||||||
}
|
}
|
||||||
|
|
||||||
const DiscordBot = new Client({
|
const client = new Client({
|
||||||
intents: [],
|
intents: [],
|
||||||
presence: {
|
presence: {
|
||||||
status: "online",
|
status: "online",
|
||||||
@ -23,16 +23,17 @@ const DiscordBot = new Client({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
DiscordBot.once("ready", () => {
|
client.once("ready", () => {
|
||||||
console.log("Discord bot ready!");
|
console.log("Discord bot ready!");
|
||||||
});
|
});
|
||||||
|
|
||||||
export function initDiscordBot() {
|
export async function initDiscordBot() {
|
||||||
console.log("Initializing discord bot...");
|
console.log("Initializing discord bot...");
|
||||||
|
|
||||||
MetadataStorage.instance.build().then(async () => {
|
client.once("ready", async () => {
|
||||||
await DiscordBot.login(Config.discordBotToken!).then();
|
await client.initApplicationCommands();
|
||||||
});
|
});
|
||||||
|
await client.login(Config.discordBotToken!);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,7 +43,7 @@ export function initDiscordBot() {
|
|||||||
* @param message the message to log
|
* @param message the message to log
|
||||||
*/
|
*/
|
||||||
export async function logToChannel(channelId: DiscordChannels, message: EmbedBuilder) {
|
export async function logToChannel(channelId: DiscordChannels, message: EmbedBuilder) {
|
||||||
const channel = await DiscordBot.channels.fetch(channelId);
|
const channel = await client.channels.fetch(channelId);
|
||||||
if (channel == undefined) {
|
if (channel == undefined) {
|
||||||
throw new Error(`Channel "${channelId}" not found`);
|
throw new Error(`Channel "${channelId}" not found`);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
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!");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user