Sends messages on warning being revoked (#36)

This commit is contained in:
2023-04-03 15:47:17 +02:00
parent aef4dd091d
commit bd040af0cc
3 changed files with 15 additions and 1 deletions

View File

@@ -3,7 +3,7 @@ from app import app
from pyrogram import filters
from pyrogram.types import CallbackQuery
from pyrogram.client import Client
from modules.utils import locale
from modules.utils import configGet, locale
from modules.database import col_warnings
from bson import ObjectId
@@ -25,3 +25,9 @@ async def callback_query_warning_revoke(app: Client, clb: CallbackQuery):
text=locale("warning_revoked", "callback", locale=clb.from_user).format(),
show_alert=True,
)
await app.send_message(
configGet("admin", "groups"),
locale("warning_revoked_auto", "message").format(
warning["user"], warning["date"].strftime("%d.%m.%Y")
),
)

View File

@@ -224,6 +224,12 @@ if configGet("enabled", "features", "warnings") is True:
logWrite(
f'Revoked warning {str(warning["_id"])} of user {warning["user"]} because no active warnings for the last 90 days found.'
)
await app.send_message(
configGet("admin", "groups"),
locale("warning_revoked_auto", "message").format(
warning["user"], warning["date"].strftime("%d.%m.%Y")
),
)
# Register all bot commands