mirror of
https://github.com/paul-nameless/tg
synced 2024-11-22 03:43:19 +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:
|
def get_status(self, user_id: int) -> str:
|
||||||
if user_id not in self.users:
|
if user_id not in self.users:
|
||||||
return ""
|
return ""
|
||||||
|
if self.is_bot(user_id):
|
||||||
|
return "bot"
|
||||||
user_status = self.users[user_id]["status"]
|
user_status = self.users[user_id]["status"]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -747,6 +749,12 @@ class UserModel:
|
||||||
}
|
}
|
||||||
return order.get(status, sys.maxsize)
|
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:
|
def is_online(self, user_id: int) -> bool:
|
||||||
user = self.get_user(user_id)
|
user = self.get_user(user_id)
|
||||||
if (
|
if (
|
||||||
|
|
Loading…
Reference in a new issue