implement auto repeating events
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
mightypanders
2022-04-12 22:39:47 +02:00
parent 10bc4ae5df
commit 9df18575fd
10 changed files with 211 additions and 10 deletions

View File

@ -6,7 +6,7 @@ import { config } from "../configuration";
export class ExtendedClient extends Client {
private eventFilePath = `${__dirname}/../events`
private commandFilePath = `${__dirname}/../commands`
private commands: Collection<string, CommandType> = new Collection()
public commands: Collection<string, CommandType> = new Collection()
public constructor() {
super({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_SCHEDULED_EVENTS] })
}
@ -50,7 +50,7 @@ export class ExtendedClient extends Client {
slashCommands.push(command)
}
this.on("ready", (client: Client) => {
console.log(`Ready processing ${client}`)
console.log(`Ready processing ${JSON.stringify(client)}`)
console.log(`SlashCommands: ${JSON.stringify(slashCommands)}`)
const guilds = client.guilds.cache
this.registerCommands(slashCommands, guilds)

View File

@ -0,0 +1,8 @@
import { ClientEvents } from "discord.js";
export class Event<Key extends keyof ClientEvents>{
constructor(
public event: Key,
public run: (...args: ClientEvents[Key]) => any
) { }
}