Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 尝试修复start错误 (fix #57) #58

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions user_handlers/chat_start.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from telegram.ext import CommandHandler
import telegram.error

from database import Chat, DBSession
from utils import check_control_permission, is_userbot_mode, read_userbot_admin_id

Expand Down Expand Up @@ -37,8 +39,16 @@ def start(update, context):
# 正常模式直接在对应群聊中使用命令
chat_id = update.effective_chat.id
chat_title = update.message.chat.title
chat_member = context.bot.get_chat_member(
chat_id=chat_id, user_id=from_user_id)

# 对成员过多的群组非管理员可能无法读取成员信息
try:
chat_member = context.bot.get_chat_member(
chat_id=chat_id, user_id=from_user_id)
except telegram.error.BadRequest:
context.bot.send_message(chat_id=update.effective_chat.id,
text='读取群成员信息出错 (Telegram对大群的限制), 授予管理员后再试')
return

# Check control permission
if check_control_permission(from_user_id) is True:
pass
Expand Down
Loading