mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-20 00:43:36 +03:00
Redesign /about
This commit is contained in:
parent
e907930623
commit
7d0918a319
5 changed files with 45 additions and 28 deletions
|
@ -528,15 +528,15 @@
|
|||
<data name="AboutTitleDevelopers" xml:space="preserve">
|
||||
<value>Developers:</value>
|
||||
</data>
|
||||
<data name="AboutTitleWiki" xml:space="preserve">
|
||||
<value>Boyfriend's Wiki Page:</value>
|
||||
</data>
|
||||
<data name="AboutTitleRepository" xml:space="preserve">
|
||||
<value>Boyfriend's Repository</value>
|
||||
</data>
|
||||
<data name="AboutBot" xml:space="preserve">
|
||||
<value>About Boyfriend</value>
|
||||
</data>
|
||||
<data name="AboutDeveloper@mctaylors" xml:space="preserve">
|
||||
<value>logo and embed designer, Boyfriend's Wiki creator</value>
|
||||
</data>
|
||||
<value>developer & designer, Boyfriend's Wiki creator</value>
|
||||
</data>
|
||||
<data name="AboutDeveloper@Octol1ttle" xml:space="preserve">
|
||||
<value>main developer</value>
|
||||
</data>
|
||||
|
|
|
@ -528,9 +528,9 @@
|
|||
<data name="AboutTitleDevelopers" xml:space="preserve">
|
||||
<value>Разработчики:</value>
|
||||
</data>
|
||||
<data name="AboutTitleWiki" xml:space="preserve">
|
||||
<value>Страница Boyfriend's Wiki:</value>
|
||||
</data>
|
||||
<data name="AboutTitleRepository" xml:space="preserve">
|
||||
<value>Репозиторий Boyfriend</value>
|
||||
</data>
|
||||
<data name="AboutBot" xml:space="preserve">
|
||||
<value>О Boyfriend</value>
|
||||
</data>
|
||||
|
@ -541,8 +541,8 @@
|
|||
<value>основной разработчик</value>
|
||||
</data>
|
||||
<data name="AboutDeveloper@mctaylors" xml:space="preserve">
|
||||
<value>дизайнер лого и эмбедов, создатель Boyfriend's Wiki</value>
|
||||
</data>
|
||||
<value>разработчик и дизайнер, создатель Boyfriend's Wiki</value>
|
||||
</data>
|
||||
<data name="ReminderCreated" xml:space="preserve">
|
||||
<value>Напоминание для {0} создано</value>
|
||||
</data>
|
||||
|
|
|
@ -528,15 +528,15 @@
|
|||
<data name="AboutTitleDevelopers" xml:space="preserve">
|
||||
<value>девелоперы:</value>
|
||||
</data>
|
||||
<data name="AboutTitleWiki" xml:space="preserve">
|
||||
<value>страничка Boyfriend's Wiki:</value>
|
||||
</data>
|
||||
<data name="AboutTitleRepository" xml:space="preserve">
|
||||
<value>репа Boyfriend (тык)</value>
|
||||
</data>
|
||||
<data name="AboutBot" xml:space="preserve">
|
||||
<value>немного о Boyfriend</value>
|
||||
</data>
|
||||
<data name="AboutDeveloper@mctaylors" xml:space="preserve">
|
||||
<value>скучный лого/эмбед дизайнер создавший Boyfriend's Wiki</value>
|
||||
</data>
|
||||
<value>скучный девелопер + дизайнер создавший Boyfriend's Wiki</value>
|
||||
</data>
|
||||
<data name="AboutDeveloper@neroduckale" xml:space="preserve">
|
||||
<value>ВАЖНЫЙ соучастник кодинг-стримов @Octol1ttle</value>
|
||||
</data>
|
||||
|
|
|
@ -12,7 +12,7 @@ using Remora.Discord.Commands.Conditions;
|
|||
using Remora.Discord.Commands.Contexts;
|
||||
using Remora.Discord.Commands.Feedback.Services;
|
||||
using Remora.Discord.Extensions.Embeds;
|
||||
using Remora.Discord.Extensions.Formatting;
|
||||
using Remora.Rest.Core;
|
||||
using Remora.Results;
|
||||
|
||||
namespace Boyfriend.Commands;
|
||||
|
@ -23,20 +23,31 @@ namespace Boyfriend.Commands;
|
|||
[UsedImplicitly]
|
||||
public class AboutCommandGroup : CommandGroup
|
||||
{
|
||||
private static readonly string[] Developers = { "Octol1ttle", "mctaylors", "neroduckale" };
|
||||
private static readonly string[] Developers =
|
||||
{ "Octol1ttle", "mctaylors", "neroduckale" };
|
||||
|
||||
private static readonly List<ulong> DevelopersIds =
|
||||
new() { 504343489664909322, 326642240229474304, 474943797063843851 };
|
||||
|
||||
private static readonly List<Snowflake> DevelopersSnowflakes =
|
||||
DevelopersIds.ConvertAll(r => r.ToSnowflake());
|
||||
|
||||
private readonly ICommandContext _context;
|
||||
private readonly FeedbackService _feedback;
|
||||
private readonly GuildDataService _guildData;
|
||||
private readonly IDiscordRestUserAPI _userApi;
|
||||
private readonly IDiscordRestGuildAPI _guildApi;
|
||||
|
||||
public AboutCommandGroup(
|
||||
ICommandContext context, GuildDataService guildData,
|
||||
FeedbackService feedback, IDiscordRestUserAPI userApi)
|
||||
FeedbackService feedback, IDiscordRestUserAPI userApi,
|
||||
IDiscordRestGuildAPI guildApi)
|
||||
{
|
||||
_context = context;
|
||||
_guildData = guildData;
|
||||
_feedback = feedback;
|
||||
_userApi = userApi;
|
||||
_guildApi = guildApi;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -66,20 +77,26 @@ public class AboutCommandGroup : CommandGroup
|
|||
var cfg = await _guildData.GetSettings(guildId, CancellationToken);
|
||||
Messages.Culture = GuildSettings.Language.Get(cfg);
|
||||
|
||||
return await SendAboutBotAsync(currentUser, CancellationToken);
|
||||
return await SendAboutBotAsync(currentUser, guildId, CancellationToken);
|
||||
}
|
||||
|
||||
private async Task<Result> SendAboutBotAsync(IUser currentUser, CancellationToken ct = default)
|
||||
private async Task<Result> SendAboutBotAsync(IUser currentUser, Snowflake guildId, CancellationToken ct = default)
|
||||
{
|
||||
var builder = new StringBuilder().AppendLine(Markdown.Bold(Messages.AboutTitleDevelopers));
|
||||
foreach (var dev in Developers)
|
||||
var builder = new StringBuilder().Append("### ").AppendLine(Messages.AboutTitleDevelopers);
|
||||
for (var i = 0; i < Developers.Length; i++)
|
||||
{
|
||||
builder.AppendLine($"@{dev} — {$"AboutDeveloper@{dev}".Localized()}");
|
||||
var tag = $"@{Developers[i]}";
|
||||
var guildMemberResult = await _guildApi.GetGuildMemberAsync(guildId, DevelopersSnowflakes[i], ct);
|
||||
if (guildMemberResult.IsSuccess)
|
||||
{
|
||||
tag = $"<@{DevelopersIds[i]}>";
|
||||
}
|
||||
|
||||
builder.AppendLine($"- {tag} — {$"AboutDeveloper@{Developers[i]}".Localized()}");
|
||||
}
|
||||
|
||||
builder.AppendLine()
|
||||
.AppendLine(Markdown.Bold(Messages.AboutTitleWiki))
|
||||
.AppendLine("https://github.com/LabsDevelopment/Boyfriend/wiki");
|
||||
builder.Append("### [").Append(Messages.AboutTitleRepository)
|
||||
.Append("](https://github.com/LabsDevelopment/Boyfriend)");
|
||||
|
||||
var embed = new EmbedBuilder().WithSmallTitle(Messages.AboutBot, currentUser)
|
||||
.WithDescription(builder.ToString())
|
||||
|
|
4
src/Messages.Designer.cs
generated
4
src/Messages.Designer.cs
generated
|
@ -876,9 +876,9 @@ namespace Boyfriend {
|
|||
}
|
||||
}
|
||||
|
||||
internal static string AboutTitleWiki {
|
||||
internal static string AboutTitleRepository {
|
||||
get {
|
||||
return ResourceManager.GetString("AboutTitleWiki", resourceCulture);
|
||||
return ResourceManager.GetString("AboutTitleRepository", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue