chore: misc
This commit is contained in:
@ -145,9 +145,18 @@ def show_statistics(bot: telebot.TeleBot, chat: telebot.types.Chat) -> None:
|
||||
try:
|
||||
chat_id = chat.id
|
||||
|
||||
# Get all chat members
|
||||
# Get all chat members (exclude bots where possible)
|
||||
try:
|
||||
members_count = bot.get_chat_member_count(chat_id)
|
||||
members_count_raw = bot.get_chat_member_count(chat_id)
|
||||
# Try to subtract all bots (including this bot) using admin list
|
||||
human_members = members_count_raw
|
||||
try:
|
||||
admins = bot.get_chat_administrators(chat_id)
|
||||
bots_in_admins = sum(1 for m in admins if getattr(m.user, "is_bot", False))
|
||||
human_members = max(members_count_raw - bots_in_admins, 0)
|
||||
except Exception:
|
||||
human_members = members_count_raw
|
||||
members_count = human_members
|
||||
except Exception:
|
||||
members_count = 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user