Skip to content

Commit acaf1e0

Browse files
committed
refactor: improvements
1 parent 67cf4d3 commit acaf1e0

28 files changed

Lines changed: 237 additions & 151 deletions

File tree

apps/test-bot/src/app/commands/(developer)/+middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export function beforeExecute(ctx: MiddlewareContext) {
77
const user = ctx.isInteraction() ? ctx.interaction.user : ctx.message.author;
88

99
if (user.id !== '12345678901234567890') {
10-
if (ctx.isSlashCommand()) {
10+
if (ctx.isChatInputCommand()) {
1111
ctx.interaction.reply({
1212
content: 'You are not allowed to use this command.',
1313
flags: MessageFlags.Ephemeral,

apps/test-bot/src/app/commands/(developer)/reload.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { CommandData, SlashCommand } from 'commandkit';
1+
import { CommandData, ChatInputCommand } from 'commandkit';
22

33
export const command: CommandData = {
44
name: 'reload',
55
description: 'Reload commands, events, and middlewares.',
66
};
77

8-
export const chatInput: SlashCommand = async (ctx) => {
8+
export const chatInput: ChatInputCommand = async (ctx) => {
99
await ctx.interaction.deferReply({ ephemeral: true });
1010

1111
await ctx.commandkit.reloadCommands();

apps/test-bot/src/app/commands/(developer)/run-after.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { CommandData, afterCommand, SlashCommand } from 'commandkit';
1+
import { CommandData, after, ChatInputCommand } from 'commandkit';
22

33
export const command: CommandData = {
44
name: 'run-after',
55
description: 'This is a run-after command',
66
};
77

8-
export const chatInput: SlashCommand = async ({ interaction }) => {
9-
afterCommand((env) => {
8+
export const chatInput: ChatInputCommand = async ({ interaction }) => {
9+
after((env) => {
1010
console.log(
1111
`The command ${interaction.commandName} was executed successfully in ${env
1212
.getExecutionTime()

apps/test-bot/src/app/commands/(developer)/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {
22
type CommandData,
3-
type SlashCommand,
3+
type ChatInputCommand,
44
type MessageCommand,
55
Logger,
66
} from 'commandkit';
@@ -11,7 +11,7 @@ export const command: CommandData = {
1111
guilds: [process.env.DEV_GUILD_ID!],
1212
};
1313

14-
export const chatInput: SlashCommand = async (ctx) => {
14+
export const chatInput: ChatInputCommand = async (ctx) => {
1515
Logger.log('Running server command');
1616
await ctx.interaction.reply('Hello from server!');
1717
};

apps/test-bot/src/app/commands/(forward)/forward.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { CommandData, MessageCommand, SlashCommand } from 'commandkit';
1+
import { CommandData, MessageCommand, ChatInputCommand } from 'commandkit';
22

33
export const command: CommandData = {
44
name: 'forward',
55
description: 'Forwards this command to another command',
66
};
77

8-
export const chatInput: SlashCommand = async (ctx) => {
8+
export const chatInput: ChatInputCommand = async (ctx) => {
99
await ctx.forwardCommand('forwarded');
1010
};
1111

apps/test-bot/src/app/commands/(forward)/forwarded.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { CommandData, MessageCommand, SlashCommand } from 'commandkit';
1+
import { CommandData, MessageCommand, ChatInputCommand } from 'commandkit';
22

33
export const command: CommandData = {
44
name: 'forwarded',
55
description: 'Forwarded command response',
66
};
77

8-
export const chatInput: SlashCommand = async (ctx) => {
8+
export const chatInput: ChatInputCommand = async (ctx) => {
99
if (!ctx.forwarded) {
1010
return ctx.interaction.reply('This command was used directly');
1111
}

apps/test-bot/src/app/commands/(general)/cat.ts renamed to apps/test-bot/src/app/commands/(general)/(animal)/cat.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type {
22
CommandData,
3-
SlashCommand,
3+
ChatInputCommand,
44
MessageCommand,
55
MessageContextMenuCommand,
66
} from 'commandkit';
@@ -33,7 +33,7 @@ export const messageContextMenu: MessageContextMenuCommand = async (ctx) => {
3333
});
3434
};
3535

36-
export const chatInput: SlashCommand = async (ctx) => {
36+
export const chatInput: ChatInputCommand = async (ctx) => {
3737
await ctx.interaction.reply('Hello from cat!');
3838
};
3939

apps/test-bot/src/app/commands/(general)/dog.ts renamed to apps/test-bot/src/app/commands/(general)/(animal)/dog.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import type { CommandData, SlashCommand, MessageCommand } from 'commandkit';
1+
import type { CommandData, ChatInputCommand, MessageCommand } from 'commandkit';
22

33
export const command: CommandData = {
44
name: 'dog',
55
description: 'dog command',
66
};
77

8-
export const chatInput: SlashCommand = async (ctx) => {
8+
export const chatInput: ChatInputCommand = async (ctx) => {
99
await ctx.interaction.reply('Hello from dog command!');
1010
};
1111

apps/test-bot/src/app/commands/(general)/avatar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {
22
MessageCommandContext,
3-
SlashCommandContext,
3+
ChatInputCommandContext,
44
UserContextMenuCommandContext,
55
} from 'commandkit';
66
import { ApplicationCommandOptionType } from 'discord.js';
@@ -37,7 +37,7 @@ export async function userContextMenu(ctx: UserContextMenuCommandContext) {
3737
});
3838
}
3939

40-
export async function chatInput(ctx: SlashCommandContext) {
40+
export async function chatInput(ctx: ChatInputCommandContext) {
4141
const user = ctx.options.getUser('user') ?? ctx.interaction.user;
4242
const { t } = ctx.locale();
4343

apps/test-bot/src/app/commands/(general)/help.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CommandData, SlashCommand } from 'commandkit';
1+
import { CommandData, ChatInputCommand } from 'commandkit';
22

33
export const command: CommandData = {
44
name: 'help',
@@ -12,7 +12,7 @@ function $botVersion(): string {
1212
return require(path).version;
1313
}
1414

15-
export const chatInput: SlashCommand = async (ctx) => {
15+
export const chatInput: ChatInputCommand = async (ctx) => {
1616
const { interaction } = ctx;
1717
await interaction.deferReply();
1818

0 commit comments

Comments
 (0)