File tree Expand file tree Collapse file tree 3 files changed +23
-22
lines changed
apps/test-bot/src/app/commands/(general)
packages/commandkit/src/app/commands Expand file tree Collapse file tree 3 files changed +23
-22
lines changed Original file line number Diff line number Diff line change 11import { Logger , type MiddlewareContext , stopMiddlewares } from 'commandkit' ;
22
33export function beforeExecute ( ctx : MiddlewareContext ) {
4- Logger . info (
5- `Command-scoped middleware: ${ ctx . commandName } will be executed!` ,
6- ) ;
7-
8- // Logger.info(`Command-scoped middleware: ${ctx.commandName} will be stopped!`);
94 // Logger.info(
10- // 'None of the other beforeExecute middlewares are supposed to be executed' ,
5+ // `Command-scoped middleware: ${ctx.commandName} will be executed!` ,
116 // );
12- // stopMiddlewares();
7+
8+ Logger . info ( `Command-scoped middleware: ${ ctx . commandName } will be stopped!` ) ;
9+ Logger . info (
10+ 'None of the other beforeExecute middlewares are supposed to be executed' ,
11+ ) ;
12+ stopMiddlewares ( ) ;
1313}
1414
1515export function afterExecute ( ctx : MiddlewareContext ) {
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import {
1313 MessageCommandContext ,
1414 stopMiddlewares ,
1515 Logger ,
16+ after ,
1617} from 'commandkit' ;
1718
1819export const command : CommandData = {
@@ -101,6 +102,7 @@ export async function chatInput({
101102 message . edit ( { components : [ row ] } ) ;
102103 } ) ;
103104
104- Logger . debug ( 'calling stopMiddlewares' ) ;
105- stopMiddlewares ( ) ;
105+ after ( ( ) => {
106+ Logger . debug ( 'after called in ping' ) ;
107+ } ) ;
106108}
Original file line number Diff line number Diff line change 11import {
22 AutocompleteInteraction ,
3+ Awaitable ,
34 ChatInputCommandInteraction ,
4- MessageContextMenuCommandInteraction ,
5- Message ,
6- Locale ,
7- Interaction ,
8- UserContextMenuCommandInteraction ,
95 Client ,
10- Awaitable ,
116 Guild ,
7+ Interaction ,
8+ Locale ,
9+ Message ,
10+ MessageContextMenuCommandInteraction ,
1211 TextBasedChannel ,
12+ UserContextMenuCommandInteraction ,
1313} from 'discord.js' ;
1414import { CommandKit } from '../../commandkit' ;
15- import {
16- MessageCommandOptions ,
17- MessageCommandParser ,
18- } from './MessageCommandParser' ;
19- import { CommandKitEnvironment } from '../../context/environment' ;
2015import { GenericFunction , getContext } from '../../context/async-context' ;
21- import { stopMiddlewares , redirect } from '../interrupt/signals ' ;
16+ import { CommandKitEnvironment } from '../../context/environment ' ;
2217import {
2318 LoadedCommand ,
2419 ResolvableCommand ,
2520 RunCommand ,
2621} from '../handlers/AppCommandHandler' ;
27- import { CommandKitErrorCodes } from '../../utils/error-codes' ;
22+ import { redirect } from '../interrupt/signals' ;
23+ import {
24+ MessageCommandOptions ,
25+ MessageCommandParser ,
26+ } from './MessageCommandParser' ;
2827
2928/**
3029 * Enumeration of different command execution modes supported by CommandKit.
You can’t perform that action at this time.
0 commit comments