import type { Gatekeeper } from "@itsmapleleaf/gatekeeper" ; import { buttonComponent } from "@itsmapleleaf/gatekeeper" ; export default function defineCommands ( gatekeeper ) { gatekeeper . addSlashCommand ( { name : "callback-info" , description : "test component callback info" , run ( context ) { const clickCounts = new Map < string , number > ( ) ; context . reply ( ( ) => { const content = [ ... clickCounts ] . map ( ( [ userId , count ] ) => `<@!${ userId }> clicked ${ count } times` ) . join ( "\n" ) ; return [ content , buttonComponent ( { label : "click it you won't" , style : "SUCCESS" , onClick : ( event ) => { const count = clickCounts . get ( event . user . id ) ?? 0 ; clickCounts . set ( event . user . id , count + 1 ) ; } , } ) , ] ; } ) ; } , } ) ; }