Skip to content

Commit 325ba93

Browse files
committed
🌟 feat: Add buildCommandString function to format command strings
1 parent ee65b16 commit 325ba93

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/util/commands.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Client } from 'discord.js';
1+
import type { ChatInputCommandInteraction, Client } from 'discord.js';
22
import type { Command } from '../commands/types.js';
33

44
export const createCommand = (command: Command): Command => {
@@ -25,3 +25,8 @@ export const registerCommands = async (
2525
console.error('Error registering commands:', error);
2626
}
2727
};
28+
29+
export const buildCommandString = (interaction: ChatInputCommandInteraction): string => {
30+
const commandName = interaction.commandName;
31+
return `/${commandName} ${interaction.options.data.map((option) => `${option.name}:${option.value}`).join(' ')}`;
32+
};

0 commit comments

Comments
 (0)