mirror of
https://github.com/kirameki-cafe/Yumi.git
synced 2026-09-13 18:59:19 +00:00
Add user voice channel checks
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Message, CommandInteraction, Interaction, VoiceChannel, TextChannel } from "discord.js";
|
||||
import { getEmotes, makeSuccessEmbed, makeProcessingEmbed, sendMessage, sendMessageOrInteractionResponse, makeInfoEmbed } from "../../utils/DiscordMessage";
|
||||
import { getEmotes, makeSuccessEmbed, makeErrorEmbed, sendMessage, sendMessageOrInteractionResponse, makeInfoEmbed } from "../../utils/DiscordMessage";
|
||||
import DiscordProvider from "../../providers/Discord";
|
||||
import Users from "../../services/Users"
|
||||
import Environment from "../../providers/Environment";
|
||||
@@ -25,6 +25,12 @@ const EMBEDS = {
|
||||
description: `Now playing: ${queue.track[0].title}\n\nUpcoming song: ${queue.track[1].title}\n\nThere are ${Object.keys(queue).length} songs in the queue!`,
|
||||
user: (data instanceof Interaction) ? data.user : data.author
|
||||
});
|
||||
},
|
||||
NO_MUSIC_PLAYING: (data: Message | Interaction) => {
|
||||
return makeErrorEmbed({
|
||||
title: `There are no music playing`,
|
||||
user: (data instanceof Interaction) ? data.user : data.author
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,12 +59,11 @@ export default class QueueCommand {
|
||||
if(!data.guildId) return;
|
||||
if(!(data.channel instanceof TextChannel)) return;
|
||||
|
||||
const channel: any = isMessage ? data.member.voice.channel : DiscordProvider.client.guilds.cache.get((data as Interaction).guildId!)!.members.cache.get((data as Interaction).user.id)?.voice.channel;
|
||||
if(!channel) return;
|
||||
|
||||
//const channel: any = isMessage ? data.member.voice.channel : DiscordProvider.client.guilds.cache.get((data as Interaction).guildId!)!.members.cache.get((data as Interaction).user.id)?.voice.channel;
|
||||
//if(!channel) return;
|
||||
|
||||
const instance = DiscordMusicPlayer.getGuildInstance(data.guildId);
|
||||
if(!instance) return;
|
||||
if(!instance) return await sendMessageOrInteractionResponse(data, { embeds: [EMBEDS.NO_MUSIC_PLAYING(data)] });
|
||||
|
||||
await sendMessageOrInteractionResponse(data, { embeds:[EMBEDS.QUEUE(data, instance.queue)] });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user