node-event-bot/server/commands/listEvents.ts
mightypanders 9df18575fd
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
implement auto repeating events
2022-04-12 22:39:47 +02:00

36 lines
843 B
TypeScript

import { client } from '../..'
import { Command } from '../structures/command'
import { RunOptions } from '../types/commandTypes'
export default new Command({
name: 'list',
description: 'Lists upcoming events',
options: [
{
name: 'count',
description: 'The max amount of events to list',
type: 'INTEGER',
required: false,
minValue: 1,
maxValue: 100,
}
],
run: async (opt: RunOptions) => {
console.dir(opt)
const interactionGuild = opt.interaction.guild
const events = interactionGuild?.scheduledEvents.cache
let output = ''
if (!events?.values()) {
opt.interaction.followUp('No events to list')
return
}
const amount = 0
if (opt.interaction.options.get('count'))
for (const e of events.values()) {
output += e.toString()
output += `\n`
}
opt.interaction.followUp(output)
}
})