2021-08-19 07:13:27 +00:00
|
|
|
""" Auto-delete sticker when someone reply """
|
|
|
|
|
2022-01-18 08:47:20 +00:00
|
|
|
from pagermaid import user_id, version
|
2021-08-19 07:13:27 +00:00
|
|
|
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
|
2021-08-19 07:13:27 +00:00
|
|
|
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
|
2021-08-19 09:21:35 +00:00
|
|
|
if context.sender:
|
2021-08-22 07:11:25 +00:00
|
|
|
try:
|
|
|
|
if context.sender.bot:
|
|
|
|
return
|
|
|
|
except AttributeError:
|
|
|
|
pass
|
2021-08-19 07:13:27 +00:00
|
|
|
else:
|
|
|
|
return
|
|
|
|
|
|
|
|
if reply_user_id == user_id:
|
|
|
|
try:
|
|
|
|
await reply.delete()
|
|
|
|
except:
|
|
|
|
pass
|