Skip to content

Commit

Permalink
Merge pull request #58 from Taosky/fix_start
Browse files Browse the repository at this point in the history
fix: 尝试修复start错误 (fix #57)
  • Loading branch information
Taosky authored Mar 26, 2024
2 parents 0ce0663 + c765f32 commit bf23cd0
Showing 1 changed file with 12 additions and 2 deletions.
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

0 comments on commit bf23cd0

Please sign in to comment.