mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-12-23 01:13:17 +00:00
Remove ts-ignore and fix usage reason
This commit is contained in:
parent
6de5e69dc0
commit
64f53c38d7
@ -1,17 +1,18 @@
|
|||||||
import { Interaction, PermissionFlagsBits } from "discord.js";
|
import { ChannelType, Interaction, PermissionFlagsBits } from "discord.js";
|
||||||
import RadioClient from "../../Client";
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
export default function interactionCreate(client: RadioClient, interaction: Interaction) {
|
export default function interactionCreate(client: RadioClient, interaction: Interaction) {
|
||||||
if(!(interaction.isButton()) && !(interaction.isChatInputCommand()) && !(interaction.isStringSelectMenu())) return;
|
if(!(interaction.isButton()) && !(interaction.isChatInputCommand()) && !(interaction.isStringSelectMenu())) return;
|
||||||
|
|
||||||
//@ts-ignore
|
if(interaction.channel?.type != ChannelType.DM){
|
||||||
const permissions = interaction.channel?.permissionsFor(interaction.client.user);
|
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,
|
content: client.messages.emojis["error"] + client.messages.noPermsEmbed,
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if(interaction.isChatInputCommand()){
|
if(interaction.isChatInputCommand()){
|
||||||
const commandName = interaction.commandName;
|
const commandName = interaction.commandName;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { ButtonInteraction, ChatInputCommandInteraction, StringSelectMenuInteraction } from "discord.js";
|
import { ButtonInteraction, ChatInputCommandInteraction, GuildMember, StringSelectMenuInteraction } from "discord.js";
|
||||||
import RadioClient from "../../Client";
|
import RadioClient from "../../Client";
|
||||||
import { command } from "../commands";
|
import { command } from "../commands";
|
||||||
|
|
||||||
@ -21,8 +21,8 @@ export default function check(client: RadioClient, interaction: ButtonInteractio
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//@ts-ignore
|
|
||||||
if (interaction.member.voice.channel !== radio.voiceChannel) {
|
if (interaction.member instanceof GuildMember && interaction.member?.voice.channel !== radio.voiceChannel) {
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
content: client.messages.emojis["error"] + client.messages.wrongVoiceChannel,
|
content: client.messages.emojis["error"] + client.messages.wrongVoiceChannel,
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
|
Loading…
Reference in New Issue
Block a user