import type { Gatekeeper } from "@itsmapleleaf/gatekeeper" ; import { buttonComponent } from "@itsmapleleaf/gatekeeper" ; import { wait } from "../wait" ; export default function defineCommands ( gatekeeper ) { gatekeeper . addSlashCommand ( { name : "defer" , description : "test deferring" , async run ( context ) { context . defer ( ) ; await wait ( 4000 ) ; context . reply ( ( ) => buttonComponent ( { label : "" , emoji : "🍪" , style : "SECONDARY" , onClick : async ( context ) => { context . defer ( ) ; await wait ( 4000 ) ; context . ephemeralReply ( ( ) => `thanks for waiting, here's your cookie! 🍪` ) ; } , } ) ) ; } , } ) ; }