pmcaptcha 减少数据库占用 (#13)

This commit is contained in:
cloudreflection 2022-06-08 08:40:07 +08:00 committed by GitHub
parent acd3e7a1ef
commit c1655b32a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -72,10 +72,10 @@
}, },
{ {
"name": "pmcaptcha", "name": "pmcaptcha",
"version": "1.11", "version": "1.12",
"section": "chat", "section": "chat",
"maintainer": "cloudreflection", "maintainer": "cloudreflection",
"size": "12.6 kb", "size": "12.7 kb",
"supported": true, "supported": true,
"des-short": "简单的私聊人机验证", "des-short": "简单的私聊人机验证",
"des": "简单的私聊人机验证,支持自定义关键词黑名单,通过后欢迎语,验证超时时间,禁止陌生人私聊" "des": "简单的私聊人机验证,支持自定义关键词黑名单,通过后欢迎语,验证超时时间,禁止陌生人私聊"

View File

@ -1,6 +1,6 @@
# pmcaptcha - a pagermaid-pyro plugin by cloudreflection # pmcaptcha - a pagermaid-pyro plugin by cloudreflection
# https://t.me/cloudreflection_channel/268 # https://t.me/cloudreflection_channel/268
# ver 2022/06/07 # ver 2022/06/08
from pyrogram import Client from pyrogram import Client
from pyrogram.enums.chat_type import ChatType from pyrogram.enums.chat_type import ChatType
@ -20,6 +20,8 @@ captcha_success = Sub("pmcaptcha.success")
@listener(is_plugin=False, incoming=False, outgoing=True, ignore_edited=True, privates_only=True) @listener(is_plugin=False, incoming=False, outgoing=True, ignore_edited=True, privates_only=True)
async def process_pm_captcha_self(_: Client, message: Message): async def process_pm_captcha_self(_: Client, message: Message):
if message.chat.id == 777000 or message.chat.type == ChatType.BOT:
return
cid = message.chat.id cid = message.chat.id
if message.text: if message.text:
try: try:
@ -179,7 +181,8 @@ async def pm_captcha(client: Client, message: Message):
'\n此功能会放行联系人和白名单(已通过验证)用户') '\n此功能会放行联系人和白名单(已通过验证)用户')
elif message.parameter[0] == 'stats': elif message.parameter[0] == 'stats':
t = str(data.get('banned',0)+data.get('pass',0)) t = str(data.get('banned',0)+data.get('pass',0))
await message.edit('自上次重置起,已进行验证 '+str(data.get('pass',0)+data.get('pass',0))+'\n其中,通过验证 '+str(data.get('pass',0))+' 次,拦截 '+str(data.get('banned',0))+'') await message.edit('自上次重置起,已进行验证 '+str(data.get('pass',0)+data.get('banned',0))+
'\n其中,通过验证 '+str(data.get('pass',0))+' 次,拦截 '+str(data.get('banned',0))+'')
elif message.chat.type != ChatType.PRIVATE: elif message.chat.type != ChatType.PRIVATE:
await message.edit('请在私聊时使用此命令或添加id参数执行') await message.edit('请在私聊时使用此命令或添加id参数执行')
await asyncio.sleep(3) await asyncio.sleep(3)