mirror of
https://github.com/informaticker/discord-jellyfin-bot.git
synced 2024-11-25 11:01:56 +01:00
53 lines
1.3 KiB
TypeScript
53 lines
1.3 KiB
TypeScript
|
import { TransformPipe } from '@discord-nestjs/common';
|
||
|
|
||
|
import {
|
||
|
Command,
|
||
|
DiscordTransformedCommand,
|
||
|
InjectDiscordClient,
|
||
|
TransformedCommandExecutionContext,
|
||
|
UsePipes,
|
||
|
} from '@discord-nestjs/core';
|
||
|
import { EmbedBuilder } from '@discordjs/builders';
|
||
|
import { Client, InteractionReplyOptions } from 'discord.js';
|
||
|
import { DefaultJellyfinColor } from 'src/types/colors';
|
||
|
|
||
|
@Command({
|
||
|
name: 'status',
|
||
|
description: 'Display the current status for troubleshooting',
|
||
|
})
|
||
|
@UsePipes(TransformPipe)
|
||
|
export class StatusCommand implements DiscordTransformedCommand<unknown> {
|
||
|
constructor(
|
||
|
@InjectDiscordClient()
|
||
|
private readonly client: Client,
|
||
|
) {}
|
||
|
|
||
|
handler(
|
||
|
dto: unknown,
|
||
|
executionContext: TransformedCommandExecutionContext<any>,
|
||
|
): InteractionReplyOptions {
|
||
|
const ping = this.client.ws.ping;
|
||
|
|
||
|
return {
|
||
|
embeds: [
|
||
|
new EmbedBuilder()
|
||
|
.setTitle('Online and ready')
|
||
|
.setColor(DefaultJellyfinColor)
|
||
|
.addFields([
|
||
|
{
|
||
|
name: 'Ping',
|
||
|
value: `${ping}ms`,
|
||
|
inline: true,
|
||
|
},
|
||
|
{
|
||
|
name: 'Source code',
|
||
|
value: 'https://github.com/manuel-rw/jellyfin-discord-music-bot',
|
||
|
inline: true,
|
||
|
},
|
||
|
])
|
||
|
.toJSON(),
|
||
|
],
|
||
|
};
|
||
|
}
|
||
|
}
|