Fixed forwarding spoilers to admin group

This commit is contained in:
Profitroll 2023-01-05 15:48:34 +01:00
parent 7939f8b65e
commit 02a6960391

View File

@ -1,3 +1,4 @@
from traceback import print_exc
from app import app, isAnAdmin
import asyncio
from pyrogram import filters
@ -133,10 +134,12 @@ async def message_in_group(app: Client, msg: Message):
if (msg.chat is not None) and (msg.via_bot is not None):
if (msg.via_bot.id == (await app.get_me()).id) and (msg.chat.id == configGet("users", "groups")):
if msg.text.startswith(locale("spoiler_described", "message").split()[0]) or msg.text.startswith(locale("spoiler_empty", "message").split()[0]):
logWrite(f"User {msg.from_user.id} sent spoiler to user's group")
try:
await msg.forward(configGet("users", "groups"), disable_notification=True)
except:
pass
logWrite("Forwarding spoiler to admin's group")
await msg.copy(configGet("admin", "groups"), disable_notification=True)
except Exception as exp:
logWrite(f"Could not forward spoiler to admin's group due to '{exp}': {print_exc()}")
return
if configGet("remove_application_time") > 0:
logWrite(f"User {msg.from_user.id} requested application in destination group, removing in {configGet('remove_application_time')} minutes")