Add ChatManagement commands. Drop appsettings from version control.

This commit is contained in:
West14
2021-12-26 15:40:14 +02:00
parent 685caf52b7
commit 7b37e2f35d
7 changed files with 190 additions and 98 deletions
+8 -5
View File
@@ -5,17 +5,20 @@ namespace Kruzya.TelegramBot.Core.Extensions
{
public static class UserExtension
{
public static string ToHtml(this User user)
public static string ToHtml(this User user, bool byUsername = true)
{
var text = new StringBuilder();
text.Append($"<a href=\"tg://user?id={user.Id}\">");
if (!string.IsNullOrWhiteSpace(user.Username))
if (byUsername && !string.IsNullOrWhiteSpace(user.Username))
{
text.Append(user.Username);
}
else
{
text.Append($"{user.FirstName} {user.LastName}".Trim().HtmlEncode());
text.Append("</a>");
return text.ToString();
}
return text.Append("</a>").ToString();
}
}
}