char-slop/city-role-bot
discord auto role applicator bot for charlotte polycule city
git clone https://git.t4t.associates/char-slop/city-role-bot
a4093f0
main
1import { guard , slash , slashSub } from '../rosepack.ts' 2import { STARBOARD_GUILD } from '../starboard.ts' 3 4const adminOnly = [ 5guard . guild ({ message :'this command only works in a server.' }), 6guard . userPermissions ( 'MANAGE_GUILD' , { message :'you need manage server to do that.' }), 7guard (( context ) => context . interaction . guildID === STARBOARD_GUILD 8 ?guard . allow () 9 :guard . deny ( 'the starboard is not configured for this server.' )) 10] 11 12export default slash ({ 13name :'starboard' , 14description :'manage the starboard and its full-history scan' , 15subcommands :{ 16status :slashSub ({ 17description :'show starboard settings and backfill progress' , 18guards :adminOnly , 19async execute ( context ) { 20await context . defer ({ ephemeral :true }) 21await context . reply ( context . app . starboard . status ()) 22} 23}), 24backfill :slashSub ({ 25description :'resume backfill, or rescan all history if the previous scan finished' , 26guards :adminOnly , 27async execute ( context ) { 28await context . defer ({ ephemeral :true }) 29const started = context . app . starboard . startBackfill () 30await context . reply ( started 31 ?'full-history backfill started/resumed. use /starboard status to check progress.' 32 :'backfill is already running. use /starboard status to check progress.' ) 33} 34}) 35} 36})