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 1
1
import { Logger , type MiddlewareContext , stopMiddlewares } from 'commandkit' ;
2
2
3
3
export 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!`);
9
4
// Logger.info(
10
- // 'None of the other beforeExecute middlewares are supposed to be executed' ,
5
+ // `Command-scoped middleware: ${ctx.commandName} will be executed!` ,
11
6
// );
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 ( ) ;
13
13
}
14
14
15
15
export function afterExecute ( ctx : MiddlewareContext ) {
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import {
13
13
MessageCommandContext ,
14
14
stopMiddlewares ,
15
15
Logger ,
16
+ after ,
16
17
} from 'commandkit' ;
17
18
18
19
export const command : CommandData = {
@@ -101,6 +102,7 @@ export async function chatInput({
101
102
message . edit ( { components : [ row ] } ) ;
102
103
} ) ;
103
104
104
- Logger . debug ( 'calling stopMiddlewares' ) ;
105
- stopMiddlewares ( ) ;
105
+ after ( ( ) => {
106
+ Logger . debug ( 'after called in ping' ) ;
107
+ } ) ;
106
108
}
Original file line number Diff line number Diff line change 1
1
import {
2
2
AutocompleteInteraction ,
3
+ Awaitable ,
3
4
ChatInputCommandInteraction ,
4
- MessageContextMenuCommandInteraction ,
5
- Message ,
6
- Locale ,
7
- Interaction ,
8
- UserContextMenuCommandInteraction ,
9
5
Client ,
10
- Awaitable ,
11
6
Guild ,
7
+ Interaction ,
8
+ Locale ,
9
+ Message ,
10
+ MessageContextMenuCommandInteraction ,
12
11
TextBasedChannel ,
12
+ UserContextMenuCommandInteraction ,
13
13
} from 'discord.js' ;
14
14
import { CommandKit } from '../../commandkit' ;
15
- import {
16
- MessageCommandOptions ,
17
- MessageCommandParser ,
18
- } from './MessageCommandParser' ;
19
- import { CommandKitEnvironment } from '../../context/environment' ;
20
15
import { GenericFunction , getContext } from '../../context/async-context' ;
21
- import { stopMiddlewares , redirect } from '../interrupt/signals ' ;
16
+ import { CommandKitEnvironment } from '../../context/environment ' ;
22
17
import {
23
18
LoadedCommand ,
24
19
ResolvableCommand ,
25
20
RunCommand ,
26
21
} 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' ;
28
27
29
28
/**
30
29
* Enumeration of different command execution modes supported by CommandKit.
You can’t perform that action at this time.
0 commit comments