Initial commit

This commit is contained in:
Macintxsh 2024-04-07 15:14:01 +03:00
parent 351d2f6db7
commit ac2a148a71
Signed by: mctaylors
GPG key ID: 7181BEBE676903C1
14 changed files with 77 additions and 278 deletions

View file

@ -2,7 +2,7 @@
public static class BuildInfo
{
public const string RepositoryUrl = "https://github.com/TeamOctolings/Octobot";
public const string RepositoryUrl = "https://git.mctaylors.ru/TeamInklings/OctobotStealth";
public const string IssuesUrl = $"{RepositoryUrl}/issues";

View file

@ -27,10 +27,14 @@ namespace Octobot.Commands;
[UsedImplicitly]
public class AboutCommandGroup : CommandGroup
{
private static readonly (string Username, Snowflake Id)[] Developers =
private static readonly (string Username, Snowflake Id)[] TeamInklings =
[
("mctaylors", new Snowflake(326642240229474304))
];
private static readonly (string Username, Snowflake Id)[] TeamOctolings =
[
("Octol1ttle", new Snowflake(504343489664909322)),
("mctaylors", new Snowflake(326642240229474304)),
("neroduckale", new Snowflake(474943797063843851))
];
@ -61,7 +65,7 @@ public class AboutCommandGroup : CommandGroup
[Command("about")]
[DiscordDefaultDMPermission(false)]
[RequireContext(ChannelContext.Guild)]
[Description("Shows Octobot's developers")]
[Description("Shows Octobot Stealth's developers")]
[UsedImplicitly]
public async Task<Result> ExecuteAboutAsync()
{
@ -84,8 +88,22 @@ public class AboutCommandGroup : CommandGroup
private async Task<Result> SendAboutBotAsync(IUser bot, Snowflake guildId, CancellationToken ct = default)
{
var builder = new StringBuilder().Append("### ").AppendLine(Messages.AboutTitleDevelopers);
foreach (var dev in Developers)
var builder = new StringBuilder().Append("### ").AppendLine(Messages.AboutTitleDevelopers)
.AppendLine(Markdown.Bold(Markdown.Hyperlink("TeamInklings", "https://git.mctaylors.ru/TeamInklings")));
foreach (var dev in TeamInklings)
{
var guildMemberResult = await _guildApi.GetGuildMemberAsync(
guildId, dev.Id, ct);
var tag = guildMemberResult.IsSuccess
? $"<@{dev.Id}>"
: Markdown.Hyperlink($"@{dev.Username}", $"https://git.mctaylors.ru/{dev.Username}");
builder.Append(tag).Append(' ');
}
builder.AppendLine().AppendDoubleLine(Markdown.Bold(
Markdown.Hyperlink("TeamOctolings", "https://github.com/TeamOctolings")));
foreach (var dev in TeamOctolings)
{
var guildMemberResult = await _guildApi.GetGuildMemberAsync(
guildId, dev.Id, ct);
@ -93,14 +111,14 @@ public class AboutCommandGroup : CommandGroup
? $"<@{dev.Id}>"
: Markdown.Hyperlink($"@{dev.Username}", $"https://github.com/{dev.Username}");
builder.AppendBulletPointLine($"{tag} — {$"AboutDeveloper@{dev.Username}".Localized()}");
builder.Append(tag).Append(' ');
}
var embed = new EmbedBuilder()
.WithSmallTitle(string.Format(Messages.AboutBot, bot.Username), bot)
.WithDescription(builder.ToString())
.WithColour(ColorsList.Cyan)
.WithImageUrl("https://raw.githubusercontent.com/TeamOctolings/Octobot/master/docs/octobot-banner.png")
.WithImageUrl("https://git.mctaylors.ru/TeamInklings/OctobotStealth/media/branch/stealth/docs/octobot-banner.png")
.WithFooter(string.Format(Messages.Version, BuildInfo.Version))
.Build();
@ -122,10 +140,10 @@ public class AboutCommandGroup : CommandGroup
ButtonComponentStyle.Link,
BuildInfo.IsDirty
? Messages.ButtonDirty
: Messages.ButtonReportIssue,
: Messages.ButtonReportIssueDisabled,
new PartialEmoji(Name: "\u26a0\ufe0f"), // 'WARNING SIGN' (U+26A0)
URL: BuildInfo.IssuesUrl,
IsDisabled: BuildInfo.IsDirty
IsDisabled: true
);
return await _feedback.SendContextualEmbedResultAsync(embed,

View file

@ -72,10 +72,10 @@ public class ErrorLoggingPostExecutionEvent : IPostExecutionEvent
ButtonComponentStyle.Link,
BuildInfo.IsDirty
? Messages.ButtonDirty
: Messages.ButtonReportIssue,
: Messages.ButtonReportIssueDisabled,
new PartialEmoji(Name: "\u26a0\ufe0f"), // 'WARNING SIGN' (U+26A0)
URL: BuildInfo.IssuesUrl,
IsDisabled: BuildInfo.IsDirty
IsDisabled: true
);
return ResultExtensions.FromError(await _feedback.SendContextualEmbedResultAsync(embed,

View file

@ -59,4 +59,18 @@ public static class StringBuilderExtensions
{
return builder.Append(" - ").AppendLine(value);
}
/// <summary>
/// Appends the input string with two default line terminators
/// to the end of specified <see cref="StringBuilder" /> object.
/// </summary>
/// <param name="builder">The <see cref="StringBuilder" /> object.</param>
/// <param name="value">The string to append with two default line terminators.</param>
/// <returns>
/// The builder with the appended string with two default line terminators at the end.
/// </returns>
public static StringBuilder AppendDoubleLine(this StringBuilder builder, string? value)
{
return builder.AppendLine().AppendLine(value);
}
}

View file

@ -642,24 +642,6 @@ namespace Octobot {
}
}
internal static string AboutDeveloper_mctaylors {
get {
return ResourceManager.GetString("AboutDeveloper@mctaylors", resourceCulture);
}
}
internal static string AboutDeveloper_Octol1ttle {
get {
return ResourceManager.GetString("AboutDeveloper@Octol1ttle", resourceCulture);
}
}
internal static string AboutDeveloper_neroduckale {
get {
return ResourceManager.GetString("AboutDeveloper@neroduckale", resourceCulture);
}
}
internal static string ReminderCreated {
get {
return ResourceManager.GetString("ReminderCreated", resourceCulture);
@ -1216,5 +1198,13 @@ namespace Octobot {
return ResourceManager.GetString("ButtonOpenWiki", resourceCulture);
}
}
internal static string ButtonReportIssueDisabled
{
get
{
return ResourceManager.GetString("ButtonReportIssueDisabled", resourceCulture);
}
}
}
}

View file

@ -113,10 +113,10 @@ public class GuildLoadedResponder : IResponder<IGuildCreate>
ButtonComponentStyle.Link,
BuildInfo.IsDirty
? Messages.ButtonDirty
: Messages.ButtonReportIssue,
: Messages.ButtonReportIssueDisabled,
new PartialEmoji(Name: "\u26a0\ufe0f"), // 'WARNING SIGN' (U+26A0)
URL: BuildInfo.IssuesUrl,
IsDisabled: BuildInfo.IsDirty
IsDisabled: true
);
return await _channelApi.CreateMessageWithEmbedResultAsync(channel, embedResult: errorEmbed,