Skip to content

Commit

Permalink
Reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
l7ssha committed Oct 30, 2024
1 parent f05a4bb commit 3ed17c7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
31 changes: 17 additions & 14 deletions lib/src/commands/jellyfin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -514,23 +514,26 @@ final jellyfin = ChatGroup("jellyfin", "Jellyfin Testing Commands", checks: [
}),
),
ChatCommand(
"ping",
"Ping jellyfin server",
id('jellyfin-settings-ping', (ChatContext context, [@Description('Instance to use. Default selected if not provided') JellyfinConfig? config]) async {
config ??= await Injector.appInstance.get<JellyfinModuleV2>().getJellyfinDefaultConfig(context.guild?.id ?? context.user.id);
if (config == null) {
return context.respond(MessageBuilder(content: 'Invalid jellyfin config'));
}
"ping",
"Ping jellyfin server",
id('jellyfin-settings-ping', (ChatContext context,
[@Description('Instance to use. Default selected if not provided') JellyfinConfig? config]) async {
config ??= await Injector.appInstance
.get<JellyfinModuleV2>()
.getJellyfinDefaultConfig(context.guild?.id ?? context.user.id);
if (config == null) {
return context.respond(MessageBuilder(content: 'Invalid jellyfin config'));
}

final client = Injector.appInstance.get<JellyfinModuleV2>().createJellyfinClientAnonymous(config);
final client = Injector.appInstance.get<JellyfinModuleV2>().createJellyfinClientAnonymous(config);

final stopwatch = Stopwatch()..start();
await client.getPing();
final stopwatchResult = stopwatch.elapsedMilliseconds;
final stopwatch = Stopwatch()..start();
await client.getPing();
final stopwatchResult = stopwatch.elapsedMilliseconds;

return context.respond(MessageBuilder(content: 'Latency to jellyfin instance "${config.name}": ${stopwatchResult}ms'));
})
)
return context
.respond(MessageBuilder(content: 'Latency to jellyfin instance "${config.name}": ${stopwatchResult}ms'));
}))
]),
ChatGroup("util", "Util commands for jellyfin", children: [
ChatCommand(
Expand Down
6 changes: 1 addition & 5 deletions lib/src/util/jellyfin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,7 @@ EmbedBuilder? buildSessionEmbed(SessionInfo sessionInfo, AuthenticatedJellyfinCl
author: author,
thumbnail: EmbedThumbnailBuilder(url: client.getItemPrimaryImage(nowPlayingItem.albumId!)),
title: '${artist.name!} - ${nowPlayingItem.name} (Track ${nowPlayingItem.indexNumber})',
fields: [
EmbedFieldBuilder(
name: 'Album', value: '${nowPlayingItem.album}', isInline: false),
...fields
],
fields: [EmbedFieldBuilder(name: 'Album', value: '${nowPlayingItem.album}', isInline: false), ...fields],
footer: footer,
);
}
Expand Down

0 comments on commit 3ed17c7

Please sign in to comment.