From 3ed17c726d0fb49644d6c940db217934816cf809 Mon Sep 17 00:00:00 2001 From: Szymon Uglis Date: Wed, 30 Oct 2024 17:29:18 +0100 Subject: [PATCH] Reformat code --- lib/src/commands/jellyfin.dart | 31 +++++++++++++++++-------------- lib/src/util/jellyfin.dart | 6 +----- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/lib/src/commands/jellyfin.dart b/lib/src/commands/jellyfin.dart index 24e1a0d..73b821e 100644 --- a/lib/src/commands/jellyfin.dart +++ b/lib/src/commands/jellyfin.dart @@ -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().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() + .getJellyfinDefaultConfig(context.guild?.id ?? context.user.id); + if (config == null) { + return context.respond(MessageBuilder(content: 'Invalid jellyfin config')); + } - final client = Injector.appInstance.get().createJellyfinClientAnonymous(config); + final client = Injector.appInstance.get().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( diff --git a/lib/src/util/jellyfin.dart b/lib/src/util/jellyfin.dart index 2c4ba3d..904edbd 100644 --- a/lib/src/util/jellyfin.dart +++ b/lib/src/util/jellyfin.dart @@ -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, ); }