Skip to content

Commit

Permalink
feat: Enhanced Char / Word Count Command
Browse files Browse the repository at this point in the history
  • Loading branch information
bmonish committed May 21, 2024
1 parent 30fdf59 commit 28a0ba1
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/commands/char.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CacheType, Interaction } from "discord.js";
import { CacheType, EmbedBuilder, Interaction } from "discord.js";

const COUNT = "COUNT";

Expand Down Expand Up @@ -36,9 +36,18 @@ export const charCommand = {
const charCount = text.length;
const wordCount = text.split(" ").length;

await interaction.reply(
`Character count: ${charCount}\nWord count: ${wordCount}`
);
const embed = new EmbedBuilder()
.setTitle("Count")
.setDescription("Character and word count")
.setColor("Blue");

embed.addFields([
{ name: "Input", value: text },
{ name: "Char Count", value: `${charCount}`, inline: true },
{ name: "Word Count", value: `${wordCount}`, inline: true },
]);

await interaction.reply({ embeds: [embed] });
break;
}
}
Expand Down

0 comments on commit 28a0ba1

Please sign in to comment.