diff --git a/Commands/AboutCommandGroup.cs b/Commands/AboutCommandGroup.cs index 752fb93..37a971a 100644 --- a/Commands/AboutCommandGroup.cs +++ b/Commands/AboutCommandGroup.cs @@ -19,13 +19,14 @@ namespace Boyfriend.Commands; /// Handles the command to show information about this bot: /about /// public class AboutCommandGroup : CommandGroup { - private readonly ICommandContext _context; - private readonly GuildDataService _dataService; - private readonly FeedbackService _feedbackService; - private readonly IDiscordRestUserAPI _userApi; + private static readonly string[] Developers = { "Octol1ttle", "mctaylors", "neroduckale" }; + private readonly ICommandContext _context; + private readonly GuildDataService _dataService; + private readonly FeedbackService _feedbackService; + private readonly IDiscordRestUserAPI _userApi; public AboutCommandGroup( - ICommandContext context, GuildDataService dataService, + ICommandContext context, GuildDataService dataService, FeedbackService feedbackService, IDiscordRestUserAPI userApi) { _context = context; _dataService = dataService; @@ -33,8 +34,6 @@ public class AboutCommandGroup : CommandGroup { _userApi = userApi; } - private static readonly string[] Developers = { "Octol1ttle", "mctaylors", "neroduckale" }; - /// /// A slash command that shows information about this bot. /// @@ -52,25 +51,22 @@ public class AboutCommandGroup : CommandGroup { if (!currentUserResult.IsDefined(out var currentUser)) return Result.FromError(currentUserResult); - var cfg = await _dataService.GetConfiguration(guildId.Value); + var cfg = await _dataService.GetConfiguration(guildId.Value, CancellationToken); Messages.Culture = cfg.GetCulture(); var builder = new StringBuilder().AppendLine(Markdown.Bold(Messages.AboutTitleDevelopers)); + foreach (var dev in Developers) + builder.AppendLine($"@{dev} — {$"AboutDeveloper@{dev}".Localized()}"); - foreach (var dev in Developers) { - builder.Append($"@{dev} — ") - .AppendLine($"AboutDeveloper@{dev}".Localized()); - } builder.AppendLine() - .AppendLine(Markdown.Bold(Messages.AboutTitleWiki)) - .AppendLine("https://github.com/TeamOctolings/Boyfriend/wiki"); - - var description = builder.ToString(); + .AppendLine(Markdown.Bold(Messages.AboutTitleWiki)) + .AppendLine("https://github.com/TeamOctolings/Boyfriend/wiki"); var embed = new EmbedBuilder().WithSmallTitle(Messages.AboutBot, currentUser) - .WithDescription(description) + .WithDescription(builder.ToString()) .WithColour(ColorsList.Cyan) - .WithImageUrl("https://media.discordapp.net/attachments/837385840946053181/1125009665592393738/boyfriend.png") + .WithImageUrl( + "https://media.discordapp.net/attachments/837385840946053181/1125009665592393738/boyfriend.png") .Build(); if (!embed.IsDefined(out var built)) return Result.FromError(embed); diff --git a/Commands/ClearCommandGroup.cs b/Commands/ClearCommandGroup.cs index c5a26c1..a0170ad 100644 --- a/Commands/ClearCommandGroup.cs +++ b/Commands/ClearCommandGroup.cs @@ -64,7 +64,7 @@ public class ClearCommandGroup : CommandGroup { if (!messagesResult.IsDefined(out var messages)) return Result.FromError(messagesResult); - var cfg = await _dataService.GetConfiguration(guildId.Value); + var cfg = await _dataService.GetConfiguration(guildId.Value, CancellationToken); Messages.Culture = cfg.GetCulture(); var idList = new List(messages.Count); diff --git a/Commands/KickCommandGroup.cs b/Commands/KickCommandGroup.cs index ccc326f..6df068f 100644 --- a/Commands/KickCommandGroup.cs +++ b/Commands/KickCommandGroup.cs @@ -71,7 +71,7 @@ public class KickCommandGroup : CommandGroup { if (!currentUserResult.IsDefined(out var currentUser)) return Result.FromError(currentUserResult); - var cfg = await _dataService.GetConfiguration(guildId.Value); + var cfg = await _dataService.GetConfiguration(guildId.Value, CancellationToken); Messages.Culture = cfg.GetCulture(); var memberResult = await _guildApi.GetGuildMemberAsync(guildId.Value, target.ID, CancellationToken); diff --git a/Commands/PingCommandGroup.cs b/Commands/PingCommandGroup.cs index 401d37f..5d79e03 100644 --- a/Commands/PingCommandGroup.cs +++ b/Commands/PingCommandGroup.cs @@ -53,7 +53,7 @@ public class PingCommandGroup : CommandGroup { if (!currentUserResult.IsDefined(out var currentUser)) return Result.FromError(currentUserResult); - var cfg = await _dataService.GetConfiguration(guildId.Value); + var cfg = await _dataService.GetConfiguration(guildId.Value, CancellationToken); Messages.Culture = cfg.GetCulture(); var latency = _client.Latency.TotalMilliseconds;