From 433beacdb4b58499f906a6fe16eb4f888be9c8d1 Mon Sep 17 00:00:00 2001 From: Pentacene Date: Tue, 11 May 2021 13:19:53 +0800 Subject: [PATCH] =?UTF-8?q?AutoReplySticker=20v1.20=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=89=8B=E5=8A=A8=E8=AE=BE=E7=BD=AE=E7=99=BD=E5=90=8D=E5=8D=95?= =?UTF-8?q?=E5=8F=8A=E5=AF=B9=E6=9F=90=E4=BA=BA=E7=99=BD=E5=90=8D=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autoreplysticker.py | 24 +++++++++++++++++++----- list.json | 4 ++-- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/autoreplysticker.py b/autoreplysticker.py index 020877f..334670c 100644 --- a/autoreplysticker.py +++ b/autoreplysticker.py @@ -70,7 +70,7 @@ async def ars_help(message: Message) -> None: '之后使用 `-ars set` 贴纸包id 贴纸包hash 自动删除时间 第i张贴纸 第j张贴纸 ...\n' '比如 `-ars set 000 001 10 0 1 2 3` 的意义为\n' '设置贴纸包id为000, hash为001, 自动回复10秒后删除, 随机从第0, 1, 2, 3张贴纸中选择一张自动回复\n\n' - '如果您想要在某个群内设置自动回复白名单,请在该群中回复`-ars w`' + '如果您想要对某个群或某个人禁用自动回复,请在该群中回复`-ars w` 或使用`-ars w <数字>` 进行设置. 该数字可通过-id命令查询' '如有使用问题,请前往 [这里](https://t.me/PagerMaid_Modify) 请求帮助') await message.delete() @@ -87,8 +87,17 @@ async def ars_whitelist(message: Message) -> None: white_list = ['0'] set_state('whitelist', white_list) _white = config['whitelist'] - - _white.append(chat_id) + if len(message.parameter) == 1: + white_id = chat_id + else: + try: + white_id = str(message.parameter[1]) + except: + _noti = await message.edit('您输入的不是一个合理的数字') + await sleep(5) + await _noti.delete() + return + _white.append(white_id) try: _white.remove('0') except: @@ -209,8 +218,13 @@ async def process_message(context): except: return - if str(context.chat_id) in _whitelist: - return + try: + if str(context.chat_id) in _whitelist: + return + if str(context.sender.id) in _whitelist: + return + except: + pass if (reply and reply_user_id == me.id): stickers = await context.client( diff --git a/list.json b/list.json index 5c7a116..f24653e 100644 --- a/list.json +++ b/list.json @@ -362,10 +362,10 @@ }, { "name": "autoreplysticker", - "version": "1.12", + "version": "1.20", "section": "chat", "maintainer": "Pentacene", - "size": "8.3 kb", + "size": "12 kb", "supported": true, "des-short": "自动回复sticker", "des": "-ars"