Remove ts-ignore and fix usage reason

This commit is contained in:
Christer Warén 2023-06-08 00:48:03 +03:00
parent 6de5e69dc0
commit 64f53c38d7
2 changed files with 12 additions and 11 deletions

View File

@ -1,17 +1,18 @@
import { Interaction, PermissionFlagsBits } from "discord.js";
import { ChannelType, Interaction, PermissionFlagsBits } from "discord.js";
import RadioClient from "../../Client";
export default function interactionCreate(client: RadioClient, interaction: Interaction) {
if(!(interaction.isButton()) && !(interaction.isChatInputCommand()) && !(interaction.isStringSelectMenu())) return;
//@ts-ignore
if(interaction.channel?.type != ChannelType.DM){
const permissions = interaction.channel?.permissionsFor(interaction.client.user);
if (!permissions.has(PermissionFlagsBits.ViewChannel)) return;
if (!permissions?.has(PermissionFlagsBits.ViewChannel)) return;
if (!permissions.has(PermissionFlagsBits.EmbedLinks)) return interaction.reply({
if (!permissions?.has(PermissionFlagsBits.EmbedLinks)) return interaction.reply({
content: client.messages.emojis["error"] + client.messages.noPermsEmbed,
ephemeral: true
});
}
if(interaction.isChatInputCommand()){
const commandName = interaction.commandName;

View File

@ -1,4 +1,4 @@
import { ButtonInteraction, ChatInputCommandInteraction, StringSelectMenuInteraction } from "discord.js";
import { ButtonInteraction, ChatInputCommandInteraction, GuildMember, StringSelectMenuInteraction } from "discord.js";
import RadioClient from "../../Client";
import { command } from "../commands";
@ -21,8 +21,8 @@ export default function check(client: RadioClient, interaction: ButtonInteractio
});
return false;
}
//@ts-ignore
if (interaction.member.voice.channel !== radio.voiceChannel) {
if (interaction.member instanceof GuildMember && interaction.member?.voice.channel !== radio.voiceChannel) {
interaction.reply({
content: client.messages.emojis["error"] + client.messages.wrongVoiceChannel,
ephemeral: true