From 6ee8ad036a7e278c993b83a2b238d213a8569bc6 Mon Sep 17 00:00:00 2001 From: SoftwareX Plus <119097812+softwarexplus@users.noreply.github.com> Date: Thu, 7 Dec 2023 15:22:08 +0600 Subject: [PATCH 1/4] Remove outdated documentation from command-file-setup.mdx --- apps/docs/pages/docs/command-file-setup.mdx | 27 +++++++++++++-------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/apps/docs/pages/docs/command-file-setup.mdx b/apps/docs/pages/docs/command-file-setup.mdx index 6513f3fe..4770aa03 100644 --- a/apps/docs/pages/docs/command-file-setup.mdx +++ b/apps/docs/pages/docs/command-file-setup.mdx @@ -83,16 +83,18 @@ Here's an example `content` command which replies with the content of the target ```js filename="commands/misc/content.js" copy - const { CommandType } = require('commandkit'); - + const { ApplicationCommandType } = require("discord.js"); + module.exports = { data: { name: 'content', - type: CommandType.Message, + type: ApplicationCommandType.Message, }, run: ({ interaction, client, handler }) => { - interaction.reply(`The message is: ${interaction.targetMessage.content}`); + if (interaction.isMessageContextMenuCommand()) { + interaction.reply(`The message is: ${interaction.targetMessage}`); + } }, options: { @@ -107,15 +109,17 @@ Here's an example `content` command which replies with the content of the target ```js filename="commands/misc/content.js" copy - import { CommandType } from 'commandkit'; + import { ApplicationCommandType } from "discord.js"; export const data = { name: 'content', - type: CommandType.Message, + type: ApplicationCommandType.Message, } export function run({ interaction, client, handler }) { - interaction.reply(`The message is: ${interaction.targetMessage}`); + if (interaction.isMessageContextMenuCommand()) { + interaction.reply(`The message is: ${interaction.targetMessage}`); + } } export const options = { @@ -129,15 +133,18 @@ Here's an example `content` command which replies with the content of the target ```ts filename="commands/misc/content.ts" copy - import { CommandType, type CommandData, type ContextMenuCommandProps, type CommandOptions } from 'commandkit'; + import { type CommandData, type ContextMenuCommandProps, type CommandOptions } from 'commandkit'; + import { ApplicationCommandType } from "discord.js"; export const data: CommandData = { name: 'content', - type: CommandType.Message, + type: ApplicationCommandType.Message, } export function run({ interaction, client, handler }: ContextMenuCommandProps) { - interaction.reply(`The message is: ${interaction.targetMessage}`); + if (interaction.isMessageContextMenuCommand()) { + interaction.reply(`The message is: ${interaction.targetMessage}`); + } } export const options: CommandOptions = { From 76c441aa9fbe3cf7fa7b47b90b0dffe6af15dcdb Mon Sep 17 00:00:00 2001 From: SoftwareX Plus <119097812+softwarexplus@users.noreply.github.com> Date: Thu, 7 Dec 2023 15:25:46 +0600 Subject: [PATCH 2/4] Update command-file-setup.mdx --- apps/docs/pages/docs/command-file-setup.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/docs/pages/docs/command-file-setup.mdx b/apps/docs/pages/docs/command-file-setup.mdx index 4770aa03..dad9af40 100644 --- a/apps/docs/pages/docs/command-file-setup.mdx +++ b/apps/docs/pages/docs/command-file-setup.mdx @@ -133,7 +133,7 @@ Here's an example `content` command which replies with the content of the target ```ts filename="commands/misc/content.ts" copy - import { type CommandData, type ContextMenuCommandProps, type CommandOptions } from 'commandkit'; + import { type CommandData, type ContextMenuCommandProps, type CommandOptions } from "commandkit"; import { ApplicationCommandType } from "discord.js"; export const data: CommandData = { From 4c23dfa8929064e999e1b31920ff0d73ba2f7907 Mon Sep 17 00:00:00 2001 From: SoftwareX Plus <119097812+softwarexplus@users.noreply.github.com> Date: Sun, 10 Dec 2023 11:32:49 +0600 Subject: [PATCH 3/4] fix: remove unnecessary if statement. --- apps/docs/pages/docs/command-file-setup.mdx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/apps/docs/pages/docs/command-file-setup.mdx b/apps/docs/pages/docs/command-file-setup.mdx index dad9af40..ae3577cb 100644 --- a/apps/docs/pages/docs/command-file-setup.mdx +++ b/apps/docs/pages/docs/command-file-setup.mdx @@ -92,9 +92,7 @@ Here's an example `content` command which replies with the content of the target }, run: ({ interaction, client, handler }) => { - if (interaction.isMessageContextMenuCommand()) { - interaction.reply(`The message is: ${interaction.targetMessage}`); - } + interaction.reply(`The message is: ${interaction.targetMessage}`); }, options: { @@ -117,9 +115,7 @@ Here's an example `content` command which replies with the content of the target } export function run({ interaction, client, handler }) { - if (interaction.isMessageContextMenuCommand()) { - interaction.reply(`The message is: ${interaction.targetMessage}`); - } + interaction.reply(`The message is: ${interaction.targetMessage}`); } export const options = { @@ -142,9 +138,7 @@ Here's an example `content` command which replies with the content of the target } export function run({ interaction, client, handler }: ContextMenuCommandProps) { - if (interaction.isMessageContextMenuCommand()) { - interaction.reply(`The message is: ${interaction.targetMessage}`); - } + interaction.reply(`The message is: ${interaction.targetMessage}`); } export const options: CommandOptions = { From 0914d5251b62be72ee14c83d4f9ef7a5dff5081f Mon Sep 17 00:00:00 2001 From: SoftwareX Plus <119097812+softwarexplus@users.noreply.github.com> Date: Sun, 10 Dec 2023 13:07:34 +0600 Subject: [PATCH 4/4] Update command-file-setup.mdx --- apps/docs/pages/docs/command-file-setup.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/docs/pages/docs/command-file-setup.mdx b/apps/docs/pages/docs/command-file-setup.mdx index ae3577cb..0262dc9d 100644 --- a/apps/docs/pages/docs/command-file-setup.mdx +++ b/apps/docs/pages/docs/command-file-setup.mdx @@ -92,7 +92,7 @@ Here's an example `content` command which replies with the content of the target }, run: ({ interaction, client, handler }) => { - interaction.reply(`The message is: ${interaction.targetMessage}`); + interaction.reply(`The message is: ${interaction.targetMessage.content}`); }, options: { @@ -115,7 +115,7 @@ Here's an example `content` command which replies with the content of the target } export function run({ interaction, client, handler }) { - interaction.reply(`The message is: ${interaction.targetMessage}`); + interaction.reply(`The message is: ${interaction.targetMessage.content}`); } export const options = { @@ -138,7 +138,7 @@ Here's an example `content` command which replies with the content of the target } export function run({ interaction, client, handler }: ContextMenuCommandProps) { - interaction.reply(`The message is: ${interaction.targetMessage}`); + interaction.reply(`The message is: ${interaction.targetMessage.content}`); } export const options: CommandOptions = {