Skip to content

Commit c1c7676

Browse files
committed
Add private option for trend command
1 parent 349305d commit c1c7676

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

src/commands/activity/trend.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ComponentType, InteractionContextType, SlashCommandBuilder, StringSelectMenuBuilder } from "discord.js";
1+
import { ComponentType, InteractionContextType, MessageFlags, SlashCommandBuilder, StringSelectMenuBuilder } from "discord.js";
22
import type { Command } from "../../models/command";
33
import { LocaleHelper } from "../../utils/locale-helper";
44
import { getTrend } from "../../database/bee-database";
@@ -45,9 +45,17 @@ const TrendCommand: Command = {
4545
.setRequired(true)
4646
.setMinLength(3)
4747
.setMaxLength(50)
48+
)
49+
.addBooleanOption((option) =>
50+
option
51+
.setName("private")
52+
.setNameLocalizations(translations.options!.private!.localizedNames)
53+
.setDescription("Whether to display the trend privately.")
54+
.setDescriptionLocalizations(translations.options!.private!.localizedDescriptions)
55+
.setRequired(false)
4856
),
4957
async execute(interaction) {
50-
await interaction.deferReply();
58+
await interaction.deferReply({flags: interaction.options.getBoolean("private") ? MessageFlags.Ephemeral : undefined});
5159

5260
const guildId = interaction.guildId!;
5361
const term = interaction.options.getString("term", true);

src/locales/en-US.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
"term": {
1212
"name": "term",
1313
"description": "The word or expression to search for."
14+
},
15+
"private": {
16+
"name": "private",
17+
"description": "Whether to display the trend privately."
1418
}
1519
},
1620
"responses": {

src/locales/fr.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
"term": {
1212
"name": "terme",
1313
"description": "Le mot ou l'expression à rechercher."
14+
},
15+
"private": {
16+
"name": "private",
17+
"description": "Afficher la tendance en privé."
1418
}
1519
},
1620
"responses": {

0 commit comments

Comments
 (0)