mirror of
https://github.com/paul-nameless/tg
synced 2024-11-21 19:33:09 +00:00
show bot status (#227)
This commit is contained in:
parent
f1d3294ac5
commit
7511565358
1 changed files with 8 additions and 0 deletions
|
@ -704,6 +704,8 @@ class UserModel:
|
|||
def get_status(self, user_id: int) -> str:
|
||||
if user_id not in self.users:
|
||||
return ""
|
||||
if self.is_bot(user_id):
|
||||
return "bot"
|
||||
user_status = self.users[user_id]["status"]
|
||||
|
||||
try:
|
||||
|
@ -747,6 +749,12 @@ class UserModel:
|
|||
}
|
||||
return order.get(status, sys.maxsize)
|
||||
|
||||
def is_bot(self, user_id: int) -> bool:
|
||||
user = self.get_user(user_id)
|
||||
if user and user["type"]["@type"] == "userTypeBot":
|
||||
return True
|
||||
return False
|
||||
|
||||
def is_online(self, user_id: int) -> bool:
|
||||
user = self.get_user(user_id)
|
||||
if (
|
||||
|
|
Loading…
Reference in a new issue