mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
20 lines
462 B
C#
20 lines
462 B
C#
using System;
|
|
using Telegram.Bot.Types;
|
|
using Telegram.Bot.Types.Enums;
|
|
|
|
namespace Kruzya.TelegramBot.Core.Extensions;
|
|
|
|
public static class ChatExtension
|
|
{
|
|
public static string ToLog(this Chat chat)
|
|
{
|
|
var title = chat.Type switch
|
|
{
|
|
ChatType.Private => $"{chat.FirstName} {chat.LastName}".Trim(),
|
|
_ => chat.Title
|
|
};
|
|
|
|
|
|
return $"{title} (ID: {chat.Id}, Username: {chat.Username ?? "N/A"})";
|
|
}
|
|
} |