mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-02 14:38:49 +00:00
fix: update validation in interactions
This commit is contained in:
1 parent
37546405e2
commit
5bc0239cdf
17 files changed
+162
-217
No files matched your search
@@ -1,5 +1,13 @@
|
||||
import config from 'config';
|
||||
import { EmbedBuilder, GuildMember, TextChannel, VoiceChannel } from 'discord.js';
|
||||
import {
|
||||
ChatInputCommandInteraction,
|
||||
EmbedBuilder,
|
||||
GuildMember,
|
||||
InteractionType,
|
||||
MessageComponentInteraction,
|
||||
TextChannel,
|
||||
VoiceChannel
|
||||
} from 'discord.js';
|
||||
|
||||
import loggerModule from '../../services/logger';
|
||||
import { EmbedOptions } from '../../types/configTypes';
|
||||
@@ -50,10 +58,13 @@ export const cannotSendMessageInChannel = async ({ interaction, executionId }: C
|
||||
|
||||
const channel = interaction.channel;
|
||||
|
||||
const interactionIdentifier =
|
||||
interaction.type === InteractionType.ApplicationCommand ? interaction.commandName : interaction.customId;
|
||||
|
||||
// only checks if channel is viewable, as bot will have permission to send interaction replies if channel is viewable
|
||||
if (channel instanceof TextChannel && !channel.viewable) {
|
||||
logger.info(
|
||||
`User tried to use command '${interaction.commandName}' but the bot had no permission to send reply in text channel.`
|
||||
`User tried to use interaction '${interactionIdentifier}' but the bot has permission to send reply in text channel.`
|
||||
);
|
||||
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user