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

Use Octobot icon from CDN instead of Discord bot icon

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
Macintxsh 2023-12-18 01:42:04 +03:00
parent d4ea62d419
commit 4e0bc9b20c
Signed by: mctaylors
GPG key ID: 7181BEBE676903C1

View file

@ -36,18 +36,15 @@ public class AboutCommandGroup : CommandGroup
private readonly ICommandContext _context; private readonly ICommandContext _context;
private readonly IFeedbackService _feedback; private readonly IFeedbackService _feedback;
private readonly GuildDataService _guildData; private readonly GuildDataService _guildData;
private readonly IDiscordRestUserAPI _userApi;
private readonly IDiscordRestGuildAPI _guildApi; private readonly IDiscordRestGuildAPI _guildApi;
public AboutCommandGroup( public AboutCommandGroup(
ICommandContext context, GuildDataService guildData, ICommandContext context, GuildDataService guildData,
IFeedbackService feedback, IDiscordRestUserAPI userApi, IFeedbackService feedback, IDiscordRestGuildAPI guildApi)
IDiscordRestGuildAPI guildApi)
{ {
_context = context; _context = context;
_guildData = guildData; _guildData = guildData;
_feedback = feedback; _feedback = feedback;
_userApi = userApi;
_guildApi = guildApi; _guildApi = guildApi;
} }
@ -69,19 +66,13 @@ public class AboutCommandGroup : CommandGroup
return new ArgumentInvalidError(nameof(_context), "Unable to retrieve necessary IDs from command context"); return new ArgumentInvalidError(nameof(_context), "Unable to retrieve necessary IDs from command context");
} }
var botResult = await _userApi.GetCurrentUserAsync(CancellationToken);
if (!botResult.IsDefined(out var bot))
{
return Result.FromError(botResult);
}
var cfg = await _guildData.GetSettings(guildId, CancellationToken); var cfg = await _guildData.GetSettings(guildId, CancellationToken);
Messages.Culture = GuildSettings.Language.Get(cfg); Messages.Culture = GuildSettings.Language.Get(cfg);
return await SendAboutBotAsync(bot, guildId, CancellationToken); return await SendAboutBotAsync(guildId, CancellationToken);
} }
private async Task<Result> SendAboutBotAsync(IUser bot, Snowflake guildId, CancellationToken ct = default) private async Task<Result> SendAboutBotAsync(Snowflake guildId, CancellationToken ct = default)
{ {
var builder = new StringBuilder().Append("### ").AppendLine(Messages.AboutTitleDevelopers); var builder = new StringBuilder().Append("### ").AppendLine(Messages.AboutTitleDevelopers);
foreach (var dev in Developers) foreach (var dev in Developers)
@ -93,7 +84,8 @@ public class AboutCommandGroup : CommandGroup
builder.AppendBulletPointLine($"{tag} — {$"AboutDeveloper@{dev.Username}".Localized()}"); builder.AppendBulletPointLine($"{tag} — {$"AboutDeveloper@{dev.Username}".Localized()}");
} }
var embed = new EmbedBuilder().WithSmallTitle(Messages.AboutBot, bot) var embed = new EmbedBuilder()
.WithAuthor(Messages.AboutBot, "https://cdn.mctaylors.ru/octobot-icon.png")
.WithDescription(builder.ToString()) .WithDescription(builder.ToString())
.WithColour(ColorsList.Cyan) .WithColour(ColorsList.Cyan)
.WithImageUrl("https://cdn.mctaylors.ru/octobot-banner.png") .WithImageUrl("https://cdn.mctaylors.ru/octobot-banner.png")