File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { definePrecondition , useRuntimeEnv } from '../../src'
22
3- export default definePrecondition ( ( interaction ) => {
3+ export default definePrecondition ( async ( interaction ) => {
44 const env = useRuntimeEnv ( )
55 const authorId = interaction . member ?. user . id
66
77 if ( authorId && authorId !== env . ownerId ) {
8- interaction ? .reply ( 'You are not the owner of this bot!' )
8+ await interaction . reply ( 'You are not the owner of this bot!' )
99 return false
1010 }
1111 return true
Original file line number Diff line number Diff line change @@ -62,8 +62,9 @@ export const registerCommands = (harmonix: Harmonix) => {
6262 consola . warn ( `Precondition \`${ prc } \` not found.` )
6363 continue
6464 }
65- const result = ctx . call ( harmonix as RuntimeHarmonix , ( ) =>
66- precondition . callback ( interaction )
65+ const result = await ctx . call (
66+ harmonix as RuntimeHarmonix ,
67+ async ( ) => await precondition . callback ( interaction )
6768 )
6869
6970 if ( ! result ) return
@@ -89,8 +90,9 @@ export const registerContextMenu = (harmonix: Harmonix) => {
8990 consola . warn ( `Precondition \`${ prc } \` not found.` )
9091 continue
9192 }
92- const result = ctx . call ( harmonix as RuntimeHarmonix , ( ) =>
93- precondition . callback ( interaction )
93+ const result = await ctx . call (
94+ harmonix as RuntimeHarmonix ,
95+ async ( ) => await precondition . callback ( interaction )
9496 )
9597
9698 if ( ! result ) return
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ export type PreconditionCallback<
1212 interaction : T extends 'ChatInput'
1313 ? ChatInputCommandInteraction
1414 : MessageContextMenuCommandInteraction | UserContextMenuCommandInteraction
15- ) => boolean | void
15+ ) => Promise < boolean > | Promise < void > | boolean | void
1616
1717export interface DefinePrecondition {
1818 < T extends PreconditionType > (
You can’t perform that action at this time.
0 commit comments