1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-19 16:33:36 +03:00

Minor fixups

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2023-07-05 23:48:11 +05:00
parent 3b3e313959
commit 654e740457
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF
4 changed files with 17 additions and 21 deletions

View file

@ -19,13 +19,14 @@ namespace Boyfriend.Commands;
/// Handles the command to show information about this bot: /about
/// </summary>
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" };
/// <summary>
/// A slash command that shows information about this bot.
/// </summary>
@ -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);

View file

@ -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<Snowflake>(messages.Count);

View file

@ -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);

View file

@ -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;