ActiveUsernames helpers

Github action telegram-api
This commit is contained in:
Wizou 2023-05-17 11:45:06 +02:00
parent 98f6a26b09
commit e8b0bb9245
2 changed files with 34 additions and 0 deletions

22
.github/workflows/telegram-api.yml vendored Normal file
View file

@ -0,0 +1,22 @@
name: 'Telegram API issues'
on:
issues:
types: [labeled]
permissions:
issues: write
jobs:
action:
runs-on: ubuntu-latest
steps:
- uses: dessant/support-requests@v3.0.0
with:
support-label: 'telegram api'
issue-comment: >
**Github Issues** should be used only for problems with the library itself.
Questions about Telegram API usage should be asked on **StackOverflow** so the whole community can help and benefit.
Click here to open a question: https://stackoverflow.com/questions/ask?tags=c%23+wtelegramclient+telegram-api
close-issue: true

View file

@ -169,6 +169,18 @@ namespace TL
/// <summary>An estimation of the number of days ago the user was last seen (Online=0, Recently=1, LastWeek=5, LastMonth=20, LongTimeAgo=150)</summary>
public TimeSpan LastSeenAgo => status?.LastSeenAgo ?? TimeSpan.FromDays(150);
public bool IsBot => (flags & Flags.bot) != 0;
public IEnumerable<string> ActiveUsernames
{
get
{
if (username != null)
yield return username;
if (usernames != null)
foreach (var un in usernames)
if (un.flags.HasFlag(Username.Flags.active))
yield return un.username;
}
}
}
/// <remarks>a <c>null</c> value means <a href="https://corefork.telegram.org/constructor/userStatusEmpty">userStatusEmpty</a> = last seen a long time ago, more than a month (or blocked/deleted users)</remarks>