mirror of
https://github.com/informaticker/discord-jellyfin-bot.git
synced 2024-11-23 18:21:55 +01:00
🐛 Unused try dto from try join in play command
This commit is contained in:
parent
f9a376495b
commit
a31928ab15
@ -23,7 +23,6 @@ import { DefaultJellyfinColor } from '../types/colors';
|
|||||||
|
|
||||||
import { DiscordMessageService } from '../clients/discord/discord.message.service';
|
import { DiscordMessageService } from '../clients/discord/discord.message.service';
|
||||||
|
|
||||||
import { createAudioResource } from '@discordjs/voice';
|
|
||||||
import { formatDuration, intervalToDuration } from 'date-fns';
|
import { formatDuration, intervalToDuration } from 'date-fns';
|
||||||
import { DiscordVoiceService } from '../clients/discord/discord.voice.service';
|
import { DiscordVoiceService } from '../clients/discord/discord.voice.service';
|
||||||
import { JellyfinStreamBuilderService } from '../clients/jellyfin/jellyfin.stream.builder.service';
|
import { JellyfinStreamBuilderService } from '../clients/jellyfin/jellyfin.stream.builder.service';
|
||||||
@ -161,12 +160,24 @@ export class PlayItemCommand
|
|||||||
const artists = item.Artists.join(', ');
|
const artists = item.Artists.join(', ');
|
||||||
|
|
||||||
const guildMember = interaction.member as GuildMember;
|
const guildMember = interaction.member as GuildMember;
|
||||||
const bitrate = guildMember.voice.channel.bitrate;
|
|
||||||
|
|
||||||
|
const tryResult =
|
||||||
this.discordVoiceService.tryJoinChannelAndEstablishVoiceConnection(
|
this.discordVoiceService.tryJoinChannelAndEstablishVoiceConnection(
|
||||||
guildMember,
|
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(
|
const stream = await this.jellyfinStreamBuilder.buildStreamUrl(
|
||||||
item.Id,
|
item.Id,
|
||||||
bitrate,
|
bitrate,
|
||||||
|
@ -4,13 +4,13 @@ import {
|
|||||||
Command,
|
Command,
|
||||||
DiscordCommand,
|
DiscordCommand,
|
||||||
InjectDiscordClient,
|
InjectDiscordClient,
|
||||||
UsePipes,
|
UsePipes
|
||||||
} from '@discord-nestjs/core';
|
} from '@discord-nestjs/core';
|
||||||
import {
|
import {
|
||||||
Client,
|
Client,
|
||||||
CommandInteraction,
|
CommandInteraction,
|
||||||
InteractionReplyOptions,
|
InteractionReplyOptions,
|
||||||
Status,
|
Status
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
|
|
||||||
import { formatDuration, intervalToDuration } from 'date-fns';
|
import { formatDuration, intervalToDuration } from 'date-fns';
|
||||||
|
Loading…
Reference in New Issue
Block a user