antisticker 在贴纸被回复时自动删除贴纸防止被偷取

This commit is contained in:
xtaodada 2021-08-19 15:13:27 +08:00
parent 881349b277
commit fe0de27a63
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 43 additions and 2 deletions

31
antisticker.py Normal file
View File

@ -0,0 +1,31 @@
""" Auto-delete sticker when someone reply """
from pagermaid import user_id
from pagermaid.listener import listener
@listener(incoming=True, ignore_edited=True)
async def auto_remove_sticker(context):
""" Event handler to remove stickers. """
reply = await context.get_reply_message()
if reply:
if reply.sender:
reply_user_id = reply.sender.id
else:
return
if context.sticker:
return
if not reply.sticker:
return
if context.chat_id > 0:
return
if context.sender.bot:
return
else:
return
if reply_user_id == user_id:
try:
await reply.delete()
except:
pass

View File

@ -12,7 +12,7 @@
}, },
{ {
"name": "dme", "name": "dme",
"version": "1.12", "version": "1.121",
"section": "chat", "section": "chat",
"maintainer": "xtaodada", "maintainer": "xtaodada",
"size": "4.3 kb", "size": "4.3 kb",
@ -342,7 +342,7 @@
}, },
{ {
"name": "vip", "name": "vip",
"version": "0.6", "version": "0.61",
"section": "chat", "section": "chat",
"maintainer": "xtaodada", "maintainer": "xtaodada",
"size": "9.8 kb", "size": "9.8 kb",
@ -749,6 +749,16 @@
"supported": true, "supported": true,
"des-short": "在指定的时间后删除他人的消息。", "des-short": "在指定的时间后删除他人的消息。",
"des": "在指定的时间后删除所回复用户发送的消息。\n指令-autodel" "des": "在指定的时间后删除所回复用户发送的消息。\n指令-autodel"
},
{
"name": "antisticker",
"version": "1.0",
"section": "chat",
"maintainer": "xtaodada",
"size": "0.7 kb",
"supported": true,
"des-short": "在贴纸被回复时自动删除贴纸防止被偷取",
"des": "在贴纸被回复时自动删除贴纸防止被偷取。\n网速争霸 不保证成功率"
} }
] ]
} }