pmcaptcha 忽略机器人消息 (#8)

This commit is contained in:
omg-xtao 2022-06-06 23:19:58 +08:00 committed by GitHub
parent 403d816a39
commit eb481e7118
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -72,7 +72,7 @@
}, },
{ {
"name": "pmcaptcha", "name": "pmcaptcha",
"version": "1.01", "version": "1.011",
"section": "chat", "section": "chat",
"maintainer": "cloudreflection", "maintainer": "cloudreflection",
"size": "9.33 kb", "size": "9.33 kb",

View File

@ -38,9 +38,9 @@ async def process_pm_captcha(client: Client, message: Message):
cid = message.chat.id cid = message.chat.id
data = sqlite.get("pmcaptcha", {}) data = sqlite.get("pmcaptcha", {})
if not captcha_success.check_id(cid) and sqlite.get("pmcaptcha." + str(cid)) is None: if not captcha_success.check_id(cid) and sqlite.get("pmcaptcha." + str(cid)) is None:
# 忽略联系人和服务消息 # 忽略联系人、服务消息、机器人消息
if message.from_user.is_contact or message.from_user.id == 777000: if message.from_user.is_contact or message.from_user.id == 777000 or message.chat.type == ChatType.BOT:
return captcha_success.add_id(cid) return
await client.read_chat_history(message.chat.id) await client.read_chat_history(message.chat.id)
if data.get("blacklist", "") and message.text is not None: if data.get("blacklist", "") and message.text is not None:
for i in data.get("blacklist", "").split(","): for i in data.get("blacklist", "").split(","):