🐛 Unused try dto from try join in play command

This commit is contained in:
Manuel Ruwe 2022-12-17 22:18:31 +01:00
parent f9a376495b
commit a31928ab15
2 changed files with 18 additions and 7 deletions

View File

@ -23,7 +23,6 @@ import { DefaultJellyfinColor } from '../types/colors';
import { DiscordMessageService } from '../clients/discord/discord.message.service';
import { createAudioResource } from '@discordjs/voice';
import { formatDuration, intervalToDuration } from 'date-fns';
import { DiscordVoiceService } from '../clients/discord/discord.voice.service';
import { JellyfinStreamBuilderService } from '../clients/jellyfin/jellyfin.stream.builder.service';
@ -161,12 +160,24 @@ export class PlayItemCommand
const artists = item.Artists.join(', ');
const guildMember = interaction.member as GuildMember;
const bitrate = guildMember.voice.channel.bitrate;
const tryResult =
this.discordVoiceService.tryJoinChannelAndEstablishVoiceConnection(
guildMember,
);
if (!tryResult.success) {
const replyOptions = tryResult.reply as InteractionReplyOptions;
await interaction.update({
embeds: replyOptions.embeds,
content: undefined,
components: [],
});
return;
}
const bitrate = guildMember.voice.channel.bitrate;
const stream = await this.jellyfinStreamBuilder.buildStreamUrl(
item.Id,
bitrate,

View File

@ -4,13 +4,13 @@ import {
Command,
DiscordCommand,
InjectDiscordClient,
UsePipes,
UsePipes
} from '@discord-nestjs/core';
import {
Client,
CommandInteraction,
InteractionReplyOptions,
Status,
Status
} from 'discord.js';
import { formatDuration, intervalToDuration } from 'date-fns';