Skip to content
This repository was archived by the owner on May 15, 2021. It is now read-only.

Commit

Permalink
upstreams
Browse files Browse the repository at this point in the history
  • Loading branch information
rking32 authored and code-rgb committed Nov 29, 2020
1 parent 8170cdf commit 12bf750
Show file tree
Hide file tree
Showing 5 changed files with 296 additions and 571 deletions.
1 change: 1 addition & 0 deletions userge/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class Config:
HU_STRING_SESSION = os.environ.get("HU_STRING_SESSION", None)
OWNER_ID = tuple(filter(lambda x: x, map(int, os.environ.get("OWNER_ID", "0").split())))
LOG_CHANNEL_ID = int(os.environ.get("LOG_CHANNEL_ID"))
AUTH_CHATS = OWNER_ID + (LOG_CHANNEL_ID,)
DB_URI = os.environ.get("DATABASE_URL")
LANG = os.environ.get("PREFERRED_LANGUAGE")
DOWN_PATH = os.environ.get("DOWN_PATH")
Expand Down
2 changes: 1 addition & 1 deletion userge/core/methods/messages/edit_message_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async def edit_message_text(self, # pylint: disable=arguments-differ
Raises:
RPCError: In case of a Telegram RPC error.
"""
if text and chat_id != Config.LOG_CHANNEL_ID:
if text and chat_id not in Config.AUTH_CHATS:
text = secure_text(str(text))
msg = await super().edit_message_text(chat_id=chat_id,
message_id=message_id,
Expand Down
2 changes: 1 addition & 1 deletion userge/core/methods/messages/send_as_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async def send_as_file(self,
Returns:
On success, the sent Message is returned.
"""
if text and chat_id != Config.LOG_CHANNEL_ID:
if text and chat_id not in Config.AUTH_CHATS:
text = secure_text(str(text))
async with aiofiles.open(filename, "w+", encoding="utf8") as out_file:
await out_file.write(text)
Expand Down
2 changes: 1 addition & 1 deletion userge/core/methods/messages/send_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ async def send_message(self, # pylint: disable=arguments-differ
Returns:
:obj:`Message`: On success, the sent text message or True is returned.
"""
if text and chat_id != Config.LOG_CHANNEL_ID:
if text and chat_id not in Config.AUTH_CHATS:
text = secure_text(str(text))
msg = await super().send_message(chat_id=chat_id,
text=text,
Expand Down
Loading

0 comments on commit 12bf750

Please sign in to comment.