import { guard, slash, slashSub } from '../rosepack.ts' import { STARBOARD_GUILD } from '../starboard.ts' const adminOnly = [ guard.guild({ message: 'this command only works in a server.' }), guard.userPermissions('MANAGE_GUILD', { message: 'you need manage server to do that.' }), guard((context) => context.interaction.guildID === STARBOARD_GUILD ? guard.allow() : guard.deny('the starboard is not configured for this server.')) ] export default slash({ name: 'starboard', description: 'manage the starboard and its full-history scan', subcommands: { status: slashSub({ description: 'show starboard settings and backfill progress', guards: adminOnly, async execute(context) { await context.defer({ ephemeral: true }) await context.reply(context.app.starboard.status()) } }), backfill: slashSub({ description: 'resume backfill, or rescan all history if the previous scan finished', guards: adminOnly, async execute(context) { await context.defer({ ephemeral: true }) const started = context.app.starboard.startBackfill() await context.reply(started ? 'full-history backfill started/resumed. use /starboard status to check progress.' : 'backfill is already running. use /starboard status to check progress.') } }) } })