Skip to content

Commit

Permalink
feat(config): add logs_chat
Browse files Browse the repository at this point in the history
  • Loading branch information
HitaloM committed Aug 12, 2024
1 parent c69658f commit f0c9dc1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/korone/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"korone": {
"SUDOERS": [918317361],
"LOGS_CHAT": -100123456789,
"SENTRY_DSN": "",
"DEEPL_KEY": "",
"LASTFM_KEY": "",
Expand Down Expand Up @@ -77,5 +78,3 @@
TELEGRAM_URL: str = "https://t.me/PyKorone"

DOCS_URL: str = "https://pykorone.readthedocs.io"

LOGS_CHAT: int = -1001332080671
5 changes: 4 additions & 1 deletion src/korone/modules/logging/handlers/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
from hydrogram.types import InlineKeyboardMarkup, Message

from korone import constants
from korone.config import ConfigManager
from korone.decorators import router
from korone.handlers.abstract import MessageHandler
from korone.utils.logging import logger

LOGS_CHAT = ConfigManager().get("korone", "LOGS_CHAT")


class LogGroup(MessageHandler):
@router.message(filters.new_chat_members)
Expand Down Expand Up @@ -47,7 +50,7 @@ def build_log_text(message: Message) -> str:
async def log_group_addition(self, client: Client, message: Message) -> None:
try:
text = self.build_log_text(message)
await client.send_message(chat_id=constants.LOGS_CHAT, text=text)
await client.send_message(chat_id=LOGS_CHAT, text=text)
except BadRequest:
await logger.aexception("[LogGroup] Failed to send log message to logs chat.")

Expand Down

0 comments on commit f0c9dc1

Please sign in to comment.