Skip to content

Commit a31fe9d

Browse files
committed
making chain info replies ephemeral
1 parent 052f194 commit a31fe9d

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

tooling/sparta/src/commands/addValidator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default {
3636
if (!address) {
3737
return interaction.reply({
3838
content: "Address is required.",
39-
ephemeral: true,
39+
flags: MessageFlags.Ephemeral,
4040
});
4141
}
4242

tooling/sparta/src/commands/getChainInfo.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { SlashCommandBuilder, ChatInputCommandInteraction } from "discord.js";
1+
import {
2+
SlashCommandBuilder,
3+
ChatInputCommandInteraction,
4+
MessageFlags,
5+
} from "discord.js";
26
import { ChainInfoService } from "../services/chaininfo-service.js";
37

48
export default {
@@ -7,7 +11,9 @@ export default {
711
.setDescription("Get chain info"),
812

913
execute: async (interaction: ChatInputCommandInteraction) => {
10-
await interaction.deferReply();
14+
await interaction.deferReply({
15+
flags: MessageFlags.Ephemeral,
16+
});
1117

1218
try {
1319
const {

tooling/sparta/src/index.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,11 @@ client.on("interactionCreate", async (interaction: Interaction) => {
3838
if (!interaction.isChatInputCommand()) return;
3939

4040
const { channelId } = interaction;
41-
if (ENVIRONMENT === "production" && channelId !== PROD_CHANNEL_ID) {
42-
await interaction.reply({
43-
content: "This command can only be used in the production channel",
44-
flags: MessageFlags.Ephemeral,
45-
});
46-
return;
47-
} else if (ENVIRONMENT === "development" && channelId !== DEV_CHANNEL_ID) {
48-
await interaction.reply({
49-
content: "This command can only be used in the development channel",
50-
flags: MessageFlags.Ephemeral,
51-
});
41+
if (
42+
(ENVIRONMENT === "production" && channelId !== PROD_CHANNEL_ID) ||
43+
(ENVIRONMENT === "development" && channelId !== DEV_CHANNEL_ID)
44+
) {
45+
console.log(`Ignoring interaction in channel ${channelId}`);
5246
return;
5347
}
5448

0 commit comments

Comments
 (0)