Removed legacy, fixed some bugs, improved spoilers #6
@ -1,3 +1,4 @@
|
|||||||
|
from traceback import print_exc
|
||||||
from app import app, isAnAdmin
|
from app import app, isAnAdmin
|
||||||
import asyncio
|
import asyncio
|
||||||
from pyrogram import filters
|
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.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.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]):
|
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:
|
try:
|
||||||
await msg.forward(configGet("users", "groups"), disable_notification=True)
|
logWrite("Forwarding spoiler to admin's group")
|
||||||
except:
|
await msg.copy(configGet("admin", "groups"), disable_notification=True)
|
||||||
pass
|
except Exception as exp:
|
||||||
|
logWrite(f"Could not forward spoiler to admin's group due to '{exp}': {print_exc()}")
|
||||||
return
|
return
|
||||||
if configGet("remove_application_time") > 0:
|
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")
|
logWrite(f"User {msg.from_user.id} requested application in destination group, removing in {configGet('remove_application_time')} minutes")
|
||||||
|
Reference in New Issue
Block a user