Skip to content

Commit

Permalink
🔥 Removed send_message and send_sticker input
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilbadyal committed Oct 21, 2023
1 parent cc322f8 commit 2a9a25a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 22 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.0.292'
rev: 'v0.1.1'
hooks:
- id: ruff
args:
- "--config=pyproject.toml"
- "--fix"

- repo: https://github.com/psf/black
rev: 23.9.1
rev: 23.10.0
hooks:
- id: black
args:
Expand Down Expand Up @@ -61,7 +61,7 @@ repos:


- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.0
rev: v1.6.1
hooks:
- id: mypy
args:
Expand Down
6 changes: 0 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ inputs:
ASSETS_PATTERN:
required: false
description: 'Regex for Asset name match'
SEND_MESSAGE:
required: false
description: 'Send Message'
SEND_STICKER:
required: false
description: 'Send Sticker'
MESSAGE:
required: false
description: 'Message to send'
Expand Down
6 changes: 2 additions & 4 deletions src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from environs import Env
from requests import Session

from src.constant import GITHUB_API_LATEST_RELEASE_URL, default_sticker
from src.constant import GITHUB_API_LATEST_RELEASE_URL

session = Session()

Expand All @@ -16,10 +16,8 @@ class UploaderConfig(object):
def __init__(self: Self, env: Env) -> None:
self.env = env
self.assets_pattern = env.str("INPUT_ASSETS_PATTERN", ".*")
self.send_message = bool(env.str("INPUT_SEND_MESSAGE", True))
self.send_sticker = bool(env.str("INPUT_SEND_STICKER", False))
self.message = env.str("INPUT_MESSAGE", None)
self.sticker_id = env.str("INPUT_STICKER_ID", default_sticker)
self.sticker_id = env.str("INPUT_STICKER_ID", None)
self.chat_id = env.int("INPUT_CHAT_ID")
self.api_id = env.str("INPUT_API_ID")
self.api_hash = env.str("INPUT_API_HASH")
Expand Down
17 changes: 8 additions & 9 deletions src/telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,17 @@ async def upload_latest(self: Self, folder: Any) -> None:
await self.__upload_to_tg(folder)

async def __send_sticker(self: Self) -> None:
if self.config.send_sticker:
if self.config.sticker_id:
await self.app.send_sticker(
chat_id=self.config.chat_id, sticker=self.config.sticker_id, disable_notification=True
)

async def __send_message(self: Self) -> None:
if self.config.send_message:
if self.config.message and self.config.message != "":
message = self.config.message
else:
message = f"""
New Release(s)🥳
if self.config.message:
message = self.config.message
else:
message = f"""
New Release(s)🥳
See Changelog [here]({self.downloader.changes})
"""
await self.app.send_message(chat_id=self.config.chat_id, text=message)
"""
await self.app.send_message(chat_id=self.config.chat_id, text=message)

0 comments on commit 2a9a25a

Please sign in to comment.