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({
|
buildMessage({
|
||||||
title,
|
title,
|
||||||
description,
|
description,
|
||||||
|
authorUrl,
|
||||||
mixin = (builder) => builder,
|
mixin = (builder) => builder,
|
||||||
}: {
|
}: {
|
||||||
title: string;
|
title: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
|
authorUrl?: string;
|
||||||
mixin?: (embedBuilder: EmbedBuilder) => EmbedBuilder;
|
mixin?: (embedBuilder: EmbedBuilder) => EmbedBuilder;
|
||||||
}): APIEmbed {
|
}): APIEmbed {
|
||||||
const date = formatRFC7231(new Date());
|
const date = formatRFC7231(new Date());
|
||||||
@ -48,6 +50,7 @@ export class DiscordMessageService {
|
|||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: title,
|
name: title,
|
||||||
iconURL: Constants.Design.Icons.JellyfinLogo,
|
iconURL: Constants.Design.Icons.JellyfinLogo,
|
||||||
|
url: authorUrl,
|
||||||
})
|
})
|
||||||
.setFooter({
|
.setFooter({
|
||||||
text: `${date}`,
|
text: `${date}`,
|
||||||
|
@ -2,16 +2,17 @@ import { Injectable } from '@nestjs/common';
|
|||||||
import { JellyfinService } from './jellyfin.service';
|
import { JellyfinService } from './jellyfin.service';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
BaseItemDto,
|
|
||||||
BaseItemKind,
|
BaseItemKind,
|
||||||
SearchHint,
|
SearchHint,
|
||||||
SearchHintResult,
|
|
||||||
} from '@jellyfin/sdk/lib/generated-client/models';
|
} from '@jellyfin/sdk/lib/generated-client/models';
|
||||||
import { getItemsApi } from '@jellyfin/sdk/lib/utils/api/items-api';
|
import { getItemsApi } from '@jellyfin/sdk/lib/utils/api/items-api';
|
||||||
import { getPlaylistsApi } from '@jellyfin/sdk/lib/utils/api/playlists-api';
|
import { getPlaylistsApi } from '@jellyfin/sdk/lib/utils/api/playlists-api';
|
||||||
import { getSearchApi } from '@jellyfin/sdk/lib/utils/api/search-api';
|
import { getSearchApi } from '@jellyfin/sdk/lib/utils/api/search-api';
|
||||||
import { Logger } from '@nestjs/common/services';
|
import { Logger } from '@nestjs/common/services';
|
||||||
import { JellyfinAudioPlaylist, JellyfinMusicAlbum } from '../../models/jellyfinAudioItems';
|
import {
|
||||||
|
JellyfinAudioPlaylist,
|
||||||
|
JellyfinMusicAlbum,
|
||||||
|
} from '../../models/jellyfinAudioItems';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class JellyfinSearchService {
|
export class JellyfinSearchService {
|
||||||
|
@ -17,18 +17,12 @@ export class HelpCommand implements DiscordCommand {
|
|||||||
return {
|
return {
|
||||||
embeds: [
|
embeds: [
|
||||||
this.discordMessageService.buildMessage({
|
this.discordMessageService.buildMessage({
|
||||||
title: 'a',
|
title: 'Jellyfin Discord Bot',
|
||||||
description:
|
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.',
|
'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) {
|
mixin(embedBuilder) {
|
||||||
return embedBuilder
|
return embedBuilder.addFields([
|
||||||
.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',
|
name: 'Report an issue',
|
||||||
value:
|
value:
|
||||||
|
@ -28,7 +28,6 @@ import {
|
|||||||
searchResultAsJellyfinAudio,
|
searchResultAsJellyfinAudio,
|
||||||
} from '../models/jellyfinAudioItems';
|
} from '../models/jellyfinAudioItems';
|
||||||
import { PlaybackService } from '../playback/playback.service';
|
import { PlaybackService } from '../playback/playback.service';
|
||||||
import { Constants } from '../utils/constants';
|
|
||||||
|
|
||||||
@Command({
|
@Command({
|
||||||
name: 'play',
|
name: 'play',
|
||||||
@ -99,7 +98,7 @@ export class PlayItemCommand
|
|||||||
|
|
||||||
const selectOptions: { label: string; value: string; emoji?: string }[] =
|
const selectOptions: { label: string; value: string; emoji?: string }[] =
|
||||||
firstItems.map((item) => ({
|
firstItems.map((item) => ({
|
||||||
label: item.prettyPrint(dto.search),
|
label: item.prettyPrint(dto.search).replace(/\*/g, ''),
|
||||||
value: item.getValueId(),
|
value: item.getValueId(),
|
||||||
emoji: item.getEmoji(),
|
emoji: item.getEmoji(),
|
||||||
}));
|
}));
|
||||||
@ -107,14 +106,8 @@ export class PlayItemCommand
|
|||||||
return {
|
return {
|
||||||
embeds: [
|
embeds: [
|
||||||
this.discordMessageService.buildMessage({
|
this.discordMessageService.buildMessage({
|
||||||
title: 'a',
|
title: 'Jellyfin Search Results',
|
||||||
description: description,
|
description: description,
|
||||||
mixin(embedBuilder) {
|
|
||||||
return embedBuilder.setAuthor({
|
|
||||||
name: 'Jellyfin Search Results',
|
|
||||||
iconURL: Constants.Design.Icons.JellyfinLogo,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
components: [
|
components: [
|
||||||
|
Loading…
Reference in New Issue
Block a user