@@ -83,16 +83,18 @@ Here's an example `content` command which replies with the content of the target
8383<Tabs items = { [' CommonJS' , ' ESM' , ' TypeScript' ]} >
8484 <Tabs.Tab >
8585 ``` js filename="commands/misc/content.js" copy
86- const { CommandType } = require (' commandkit ' );
87-
86+ const { ApplicationCommandType } = require (" discord.js " );
87+
8888 module .exports = {
8989 data: {
9090 name: ' content' ,
91- type: CommandType .Message ,
91+ type: ApplicationCommandType .Message ,
9292 },
9393
9494 run : ({ interaction, client, handler }) => {
95- interaction .reply (` The message is: ${ interaction .targetMessage .content } ` );
95+ if (interaction .isMessageContextMenuCommand ()) {
96+ interaction .reply (` The message is: ${ interaction .targetMessage } ` );
97+ }
9698 },
9799
98100 options: {
@@ -107,15 +109,17 @@ Here's an example `content` command which replies with the content of the target
107109 </Tabs.Tab >
108110 <Tabs.Tab >
109111 ``` js filename="commands/misc/content.js" copy
110- import { CommandType } from ' commandkit ' ;
112+ import { ApplicationCommandType } from " discord.js " ;
111113
112114 export const data = {
113115 name: ' content' ,
114- type: CommandType .Message ,
116+ type: ApplicationCommandType .Message ,
115117 }
116118
117119 export function run ({ interaction, client, handler }) {
118- interaction .reply (` The message is: ${ interaction .targetMessage } ` );
120+ if (interaction .isMessageContextMenuCommand ()) {
121+ interaction .reply (` The message is: ${ interaction .targetMessage } ` );
122+ }
119123 }
120124
121125 export const options = {
@@ -129,15 +133,18 @@ Here's an example `content` command which replies with the content of the target
129133 </Tabs.Tab >
130134 <Tabs.Tab >
131135 ``` ts filename="commands/misc/content.ts" copy
132- import { CommandType , type CommandData , type ContextMenuCommandProps , type CommandOptions } from ' commandkit' ;
136+ import { type CommandData , type ContextMenuCommandProps , type CommandOptions } from ' commandkit' ;
137+ import { ApplicationCommandType } from " discord.js" ;
133138
134139 export const data: CommandData = {
135140 name: ' content' ,
136- type: CommandType .Message ,
141+ type: ApplicationCommandType .Message ,
137142 }
138143
139144 export function run({ interaction , client , handler }: ContextMenuCommandProps ) {
140- interaction .reply (` The message is: ${interaction .targetMessage } ` );
145+ if (interaction .isMessageContextMenuCommand ()) {
146+ interaction .reply (` The message is: ${interaction .targetMessage } ` );
147+ }
141148 }
142149
143150 export const options: CommandOptions = {
0 commit comments