[core] add extension to convert user into loggable string

This commit is contained in:
Andriy
2022-12-14 12:31:38 +02:00
parent 9a957af5ac
commit 2aa54c79d0
+7
View File
@@ -20,5 +20,12 @@ namespace Kruzya.TelegramBot.Core.Extensions
} }
return text.Append("</a>").ToString(); return text.Append("</a>").ToString();
} }
public static string ToLog(this User user)
{
var name = $"{user.FirstName} {user.LastName}".Trim();
return $"{name} (ID: {user.Id}, Username: {user.Username ?? "N/A"})";
}
} }
} }