Merge pull request #158 from Pentacene/master

AutoReplySticker v1.20 新增手动设置白名单及对某人白名单
This commit is contained in:
Pentacene 2021-05-11 13:36:58 +08:00 committed by GitHub
commit 13d58dd826
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 7 deletions

View File

@ -70,7 +70,7 @@ async def ars_help(message: Message) -> None:
'之后使用 `-ars set` 贴纸包id 贴纸包hash 自动删除时间 第i张贴纸 第j张贴纸 ...\n' '之后使用 `-ars set` 贴纸包id 贴纸包hash 自动删除时间 第i张贴纸 第j张贴纸 ...\n'
'比如 `-ars set 000 001 10 0 1 2 3` 的意义为\n' '比如 `-ars set 000 001 10 0 1 2 3` 的意义为\n'
'设置贴纸包id为000, hash为001, 自动回复10秒后删除, 随机从第0, 1, 2, 3张贴纸中选择一张自动回复\n\n' '设置贴纸包id为000, hash为001, 自动回复10秒后删除, 随机从第0, 1, 2, 3张贴纸中选择一张自动回复\n\n'
'如果您想要在某个群内设置自动回复白名单,请在该群中回复`-ars w`' '如果您想要对某个群或某个人禁用自动回复,请在该群中回复`-ars w` 或使用`-ars w <数字>` 进行设置. 该数字可通过-id命令查询'
'如有使用问题,请前往 [这里](https://t.me/PagerMaid_Modify) 请求帮助') '如有使用问题,请前往 [这里](https://t.me/PagerMaid_Modify) 请求帮助')
await message.delete() await message.delete()
@ -87,8 +87,17 @@ async def ars_whitelist(message: Message) -> None:
white_list = ['0'] white_list = ['0']
set_state('whitelist', white_list) set_state('whitelist', white_list)
_white = config['whitelist'] _white = config['whitelist']
if len(message.parameter) == 1:
_white.append(chat_id) 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: try:
_white.remove('0') _white.remove('0')
except: except:
@ -209,8 +218,13 @@ async def process_message(context):
except: except:
return return
if str(context.chat_id) in _whitelist: try:
return 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): if (reply and reply_user_id == me.id):
stickers = await context.client( stickers = await context.client(

View File

@ -362,10 +362,10 @@
}, },
{ {
"name": "autoreplysticker", "name": "autoreplysticker",
"version": "1.12", "version": "1.20",
"section": "chat", "section": "chat",
"maintainer": "Pentacene", "maintainer": "Pentacene",
"size": "8.3 kb", "size": "12 kb",
"supported": true, "supported": true,
"des-short": "自动回复sticker", "des-short": "自动回复sticker",
"des": "-ars" "des": "-ars"