Skip to content

Commit 79658ed

Browse files
committed
hiding private queries on whether i'm a validator or not
1 parent 97f8127 commit 79658ed

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

tooling/sparta/src/commands/addValidator.ts

Lines changed: 7 additions & 3 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 { ValidatorService } from "../services/validator-service.js";
37
import { ChainInfoService } from "../services/chaininfo-service.js";
48

@@ -40,11 +44,11 @@ export default {
4044
if (!address.match(/^0x[a-fA-F0-9]{40}$/)) {
4145
return interaction.reply({
4246
content: "Please provide a valid Ethereum address.",
43-
ephemeral: true,
47+
flags: MessageFlags.Ephemeral,
4448
});
4549
}
4650

47-
await interaction.deferReply();
51+
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
4852

4953
if (interaction.options.getSubcommand() === "add") {
5054
try {

tooling/sparta/src/index.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,14 @@ client.once("ready", () => {
3939
client.on("interactionCreate", async (interaction: Interaction) => {
4040
if (!interaction.isChatInputCommand()) return;
4141

42-
// Determine which channel to use based on environment
43-
const targetChannelId =
44-
ENVIRONMENT === "production" ? PRODUCTION_CHANNEL_ID : DEV_CHANNEL_ID;
45-
46-
// Check if the command is in the correct channel
47-
if (interaction.channelId !== targetChannelId) {
48-
const channelName =
49-
ENVIRONMENT === "production"
50-
? PRODUCTION_CHANNEL_NAME
51-
: DEV_CHANNEL_NAME;
52-
return interaction.reply({
53-
content: `This command can only be used in the ${channelName} channel.`,
54-
flags: MessageFlags.Ephemeral,
55-
});
42+
if (
43+
ENVIRONMENT === "development" &&
44+
interaction.channelId === PRODUCTION_CHANNEL_ID
45+
) {
46+
console.log(
47+
"Can't use this command in production if ENVIRONMENT is set to development"
48+
);
49+
return;
5650
}
5751

5852
const command = client.commands.get(interaction.commandName);

0 commit comments

Comments
 (0)