PagerMaid_Plugins/antisticker.py

39 lines
913 B
Python
Raw Permalink Normal View History

""" Auto-delete sticker when someone reply """
2022-01-18 08:47:20 +00:00
from pagermaid import user_id, version
from pagermaid.listener import listener
@listener(incoming=True, ignore_edited=True)
async def auto_remove_sticker(context):
""" Event handler to remove stickers. """
2021-08-23 13:17:33 +00:00
try:
reply = await context.get_reply_message()
except:
return
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:
2021-08-22 07:11:25 +00:00
try:
if context.sender.bot:
return
except AttributeError:
pass
else:
return
if reply_user_id == user_id:
try:
await reply.delete()
except:
pass