Skip to content

Commit

Permalink
chore: heroku team deploy added
Browse files Browse the repository at this point in the history
Enhancements:

- Improve code readability by adjusting string formatting and removing unnecessary mode arguments in async file operations.

CI:

- Update the deployment workflow to include an optional Heroku Team Name input, allowing for more flexible deployment configurations.

---------

Co-authored-by: Mehedi Hasan Shojib <[email protected]>
Co-authored-by: Manjot Singh <[email protected]>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 16, 2024
1 parent 0d011f9 commit 6db1e96
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
HEROKU_EMAIL:
description: "Heroku email address"
required: true
HK_TEAM_NAME:
description: "Heroku Team Name"
required: false
BOT_TOKEN:
description: "Telegram bot token"
required: true
Expand Down Expand Up @@ -42,6 +45,7 @@ jobs:
heroku_api_key: ${{inputs.HEROKU_API_KEY}}
heroku_app_name: ${{inputs.HEROKU_APP_NAME}}
heroku_email: ${{inputs.HEROKU_EMAIL}}
team: ${{ inputs.HK_TEAM_NAME != '' && format('team={0}', inputs.HK_TEAM_NAME) || '' }}
usedocker: true
docker_heroku_process_type: web
stack: "container"
Expand Down
2 changes: 1 addition & 1 deletion bot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ async def aeon_callback(_, query):
return await query.answer(text="This message not your's!", show_alert=True)
if data[2] == "logdisplay":
await query.answer()
async with aiopen("log.txt", "r") as f:
async with aiopen("log.txt") as f:
log_file_lines = (await f.read()).splitlines()

def parseline(line):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"teraboxlink.com",
"freeterabox.com",
"1024terabox.com",
"teraboxshare.com"
"teraboxshare.com",
],
"filewish": [
"filelions.co",
Expand Down
2 changes: 1 addition & 1 deletion bot/helper/mirror_leech_utils/rclone_utils/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ async def get_path(self, itype=""):

async def list_remotes(self):
config = ConfigParser()
async with aiopen(self.config_path, "r") as f:
async with aiopen(self.config_path) as f:
contents = await f.read()
config.read_string(contents)
if config.has_section("combine"):
Expand Down
2 changes: 1 addition & 1 deletion bot/helper/mirror_leech_utils/rclone_utils/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def __getUpdatedCommand(config_path, source, destination, rc_flags, method):
@staticmethod
async def __get_remote_options(config_path, remote):
config = ConfigParser()
async with aiopen(config_path, "r") as f:
async with aiopen(config_path) as f:
contents = await f.read()
config.read_string(contents)
options = config.options(remote)
Expand Down
8 changes: 5 additions & 3 deletions bot/helper/mirror_leech_utils/status_utils/qbit_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class QbittorrentStatus:
def __init__(self, listener, seeding=False, queued=False):
self.__client = xnox_client
self.__listener = listener
self.__info = get_download(self.__client, f'{self.__listener.uid}')
self.__info = get_download(self.__client, f"{self.__listener.uid}")
self.queued = queued
self.seeding = seeding
self.message = listener.message
Expand Down Expand Up @@ -93,7 +93,7 @@ def gid(self):
def hash(self):
self.__update()
return self.__info.hash

def client(self):
return self.__client

Expand All @@ -118,7 +118,9 @@ async def cancel_download(self):
torrent_hashes=self.__info.hash,
delete_files=True,
)
await sync_to_async(self.__client.torrents_delete_tags, tags=self.__info.tags)
await sync_to_async(
self.__client.torrents_delete_tags, tags=self.__info.tags
)
async with qb_listener_lock:
if self.__info.tags in QbTorrents:
del QbTorrents[self.__info.tags]
Expand Down

0 comments on commit 6db1e96

Please sign in to comment.