mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-19 16:33:36 +03:00
/about: Show link to GitHub profile if Discord member wasn't found
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
parent
d4ea62d419
commit
25dadf8894
2 changed files with 16 additions and 1 deletions
|
@ -88,7 +88,9 @@ public class AboutCommandGroup : CommandGroup
|
||||||
{
|
{
|
||||||
var guildMemberResult = await _guildApi.GetGuildMemberAsync(
|
var guildMemberResult = await _guildApi.GetGuildMemberAsync(
|
||||||
guildId, dev.Id, ct);
|
guildId, dev.Id, ct);
|
||||||
var tag = guildMemberResult.IsSuccess ? $"<@{dev.Id}>" : $"@{dev.Username}";
|
var tag = guildMemberResult.IsSuccess
|
||||||
|
? $"<@{dev.Id}>"
|
||||||
|
: MarkdownExtensions.Url($"@{dev.Username}", $"https://github.com/{dev.Username}");
|
||||||
|
|
||||||
builder.AppendBulletPointLine($"{tag} — {$"AboutDeveloper@{dev.Username}".Localized()}");
|
builder.AppendBulletPointLine($"{tag} — {$"AboutDeveloper@{dev.Username}".Localized()}");
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,4 +13,17 @@ public static class MarkdownExtensions
|
||||||
{
|
{
|
||||||
return $"- {text}";
|
return $"- {text}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Formats a string to use Markdown URL formatting.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The input text to format.</param>
|
||||||
|
/// <param name="url">The URL to use in formatting.</param>
|
||||||
|
/// <returns>
|
||||||
|
/// A markdown-formatted string with URL.
|
||||||
|
/// </returns>
|
||||||
|
public static string Url(string text, string url)
|
||||||
|
{
|
||||||
|
return $"[{text}]({url})";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue