show bot status (#227)

This commit is contained in:
Max 2021-05-26 14:04:32 +06:00 committed by GitHub
parent f1d3294ac5
commit 7511565358
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 (