mirror of
https://github.com/informaticker/discord-jellyfin-bot.git
synced 2024-11-23 18:21:55 +01:00
🎨 Code review
This commit is contained in:
parent
152e603742
commit
fa9f32fe4a
@ -35,10 +35,12 @@ export class DiscordMessageService {
|
||||
buildMessage({
|
||||
title,
|
||||
description,
|
||||
authorUrl,
|
||||
mixin = (builder) => builder,
|
||||
}: {
|
||||
title: string;
|
||||
description?: string;
|
||||
authorUrl?: string;
|
||||
mixin?: (embedBuilder: EmbedBuilder) => EmbedBuilder;
|
||||
}): APIEmbed {
|
||||
const date = formatRFC7231(new Date());
|
||||
@ -48,6 +50,7 @@ export class DiscordMessageService {
|
||||
.setAuthor({
|
||||
name: title,
|
||||
iconURL: Constants.Design.Icons.JellyfinLogo,
|
||||
url: authorUrl,
|
||||
})
|
||||
.setFooter({
|
||||
text: `${date}`,
|
||||
|
@ -2,16 +2,17 @@ import { Injectable } from '@nestjs/common';
|
||||
import { JellyfinService } from './jellyfin.service';
|
||||
|
||||
import {
|
||||
BaseItemDto,
|
||||
BaseItemKind,
|
||||
SearchHint,
|
||||
SearchHintResult,
|
||||
} from '@jellyfin/sdk/lib/generated-client/models';
|
||||
import { getItemsApi } from '@jellyfin/sdk/lib/utils/api/items-api';
|
||||
import { getPlaylistsApi } from '@jellyfin/sdk/lib/utils/api/playlists-api';
|
||||
import { getSearchApi } from '@jellyfin/sdk/lib/utils/api/search-api';
|
||||
import { Logger } from '@nestjs/common/services';
|
||||
import { JellyfinAudioPlaylist, JellyfinMusicAlbum } from '../../models/jellyfinAudioItems';
|
||||
import {
|
||||
JellyfinAudioPlaylist,
|
||||
JellyfinMusicAlbum,
|
||||
} from '../../models/jellyfinAudioItems';
|
||||
|
||||
@Injectable()
|
||||
export class JellyfinSearchService {
|
||||
|
@ -17,31 +17,25 @@ export class HelpCommand implements DiscordCommand {
|
||||
return {
|
||||
embeds: [
|
||||
this.discordMessageService.buildMessage({
|
||||
title: 'a',
|
||||
title: 'Jellyfin Discord Bot',
|
||||
description:
|
||||
'Jellyfin Discord Bot is an open source and self-hosted Discord bot, that integrates with your Jellyfin Media server and enables you to playback music from your libraries. You can use the Discord Slash Commands to invoke bot commands.',
|
||||
authorUrl: 'https://github.com/manuel-rw/jellyfin-discord-music-bot',
|
||||
mixin(embedBuilder) {
|
||||
return embedBuilder
|
||||
.setAuthor({
|
||||
name: 'Jellyfin Discord Bot',
|
||||
iconURL:
|
||||
'https://github.com/walkxcode/dashboard-icons/blob/main/png/jellyfin.png?raw=true',
|
||||
url: 'https://github.com/manuel-rw/jellyfin-discord-music-bot',
|
||||
})
|
||||
.addFields([
|
||||
{
|
||||
name: 'Report an issue',
|
||||
value:
|
||||
'https://github.com/manuel-rw/jellyfin-discord-music-bot/issues/new/choose',
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: 'Source code',
|
||||
value:
|
||||
'https://github.com/manuel-rw/jellyfin-discord-music-bot',
|
||||
inline: true,
|
||||
},
|
||||
]);
|
||||
return embedBuilder.addFields([
|
||||
{
|
||||
name: 'Report an issue',
|
||||
value:
|
||||
'https://github.com/manuel-rw/jellyfin-discord-music-bot/issues/new/choose',
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: 'Source code',
|
||||
value:
|
||||
'https://github.com/manuel-rw/jellyfin-discord-music-bot',
|
||||
inline: true,
|
||||
},
|
||||
]);
|
||||
},
|
||||
}),
|
||||
],
|
||||
|
@ -28,7 +28,6 @@ import {
|
||||
searchResultAsJellyfinAudio,
|
||||
} from '../models/jellyfinAudioItems';
|
||||
import { PlaybackService } from '../playback/playback.service';
|
||||
import { Constants } from '../utils/constants';
|
||||
|
||||
@Command({
|
||||
name: 'play',
|
||||
@ -99,7 +98,7 @@ export class PlayItemCommand
|
||||
|
||||
const selectOptions: { label: string; value: string; emoji?: string }[] =
|
||||
firstItems.map((item) => ({
|
||||
label: item.prettyPrint(dto.search),
|
||||
label: item.prettyPrint(dto.search).replace(/\*/g, ''),
|
||||
value: item.getValueId(),
|
||||
emoji: item.getEmoji(),
|
||||
}));
|
||||
@ -107,14 +106,8 @@ export class PlayItemCommand
|
||||
return {
|
||||
embeds: [
|
||||
this.discordMessageService.buildMessage({
|
||||
title: 'a',
|
||||
title: 'Jellyfin Search Results',
|
||||
description: description,
|
||||
mixin(embedBuilder) {
|
||||
return embedBuilder.setAuthor({
|
||||
name: 'Jellyfin Search Results',
|
||||
iconURL: Constants.Design.Icons.JellyfinLogo,
|
||||
});
|
||||
},
|
||||
}),
|
||||
],
|
||||
components: [
|
||||
|
Loading…
Reference in New Issue
Block a user