added Channel.MainUsername helper | simplified GetAllChats example

This commit is contained in:
Wizou 2023-01-07 13:22:40 +01:00
parent 750dbef33b
commit 014f563b89
3 changed files with 6 additions and 15 deletions

View file

@ -216,6 +216,7 @@ namespace TL
partial class Channel
{
public override bool IsActive => (flags & Flags.left) == 0;
public string MainUsername => username ?? usernames?.FirstOrDefault(u => u.flags.HasFlag(Username.Flags.active))?.username;
public override ChatPhoto Photo => photo;
public override bool IsBanned(ChatBannedRights.Flags flags = 0) => ((banned_rights?.flags ?? 0) & flags) != 0 || ((default_banned_rights?.flags ?? 0) & flags) != 0;
public override InputPeer ToInputPeer() => new InputPeerChannel(id, access_hash);