node-event-bot/server/commands/listEvents.ts

36 lines
843 B
TypeScript
Raw Normal View History

2022-04-12 22:39:47 +02:00
import { client } from '../..'
2022-03-09 12:29:42 +01:00
import { Command } from '../structures/command'
2022-04-12 22:39:47 +02:00
import { RunOptions } from '../types/commandTypes'
2022-03-09 12:29:42 +01:00
export default new Command({
name: 'list',
description: 'Lists upcoming events',
2022-04-12 22:39:47 +02:00
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)
2022-03-09 12:29:42 +01:00
}
})