generated from nhcarrigan/template
Add acknowledgment button to alt-text reminders - Fixes #2
This commit is contained in:
+15
-5
@@ -9,6 +9,7 @@ import { Client, GatewayIntentBits, Events, MessageFlags } from "discord.js";
|
||||
import { blocks } from "./config/blocks.js";
|
||||
import { checkAltText } from "./modules/checkAltText.js";
|
||||
import { instantiateServer } from "./server/serve.js";
|
||||
import { handleAckButton } from "./utils/buttonAck.js";
|
||||
import { logger } from "./utils/logger.js";
|
||||
|
||||
const client = new Client({
|
||||
@@ -35,13 +36,22 @@ client.on(Events.MessageCreate, (message) => {
|
||||
|
||||
client.on(Events.InteractionCreate, (interaction) => {
|
||||
void analytics.logGatewayEvent(Events.InteractionCreate, { ...interaction });
|
||||
if (!interaction.isChatInputCommand()) {
|
||||
if (!interaction.isChatInputCommand() && !interaction.isButton()) {
|
||||
return;
|
||||
}
|
||||
void interaction.reply({
|
||||
components: blocks,
|
||||
flags: MessageFlags.IsComponentsV2,
|
||||
});
|
||||
// Existing logic for slash commands
|
||||
if (interaction.isChatInputCommand()) {
|
||||
void interaction.reply({
|
||||
components: blocks,
|
||||
flags: MessageFlags.IsComponentsV2,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle button clicks
|
||||
if (interaction.isButton()) {
|
||||
void handleAckButton(interaction);
|
||||
}
|
||||
});
|
||||
|
||||
await client.login(process.env.BOT_TOKEN);
|
||||
|
||||
Reference in New Issue
Block a user