Skip to content

Commit

Permalink
🍫The chore: initial
Browse files Browse the repository at this point in the history
  • Loading branch information
Aluerie committed Nov 23, 2023
1 parent ad7ce68 commit 4e38e8a
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 3 deletions.
3 changes: 2 additions & 1 deletion common/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ async def connect(self, _: Connection):
else:
try:
self.console_text = await self.callback()
log.info(self.console_text)
except Exception as exc:
if isinstance(exc, CustomException):
self.console_text = str(exc)
Expand All @@ -85,7 +86,7 @@ async def connect(self, _: Connection):
async def disconnect(self, _: Connection):
log.info("Finished task. The LCU API client have been closed!")

async def callback(self) -> str:
async def callback(self: AluConnector) -> str:
"""This function will be called on @ready event
It is supposed to be implemented by subclasses and do the script job.
Expand Down
2 changes: 1 addition & 1 deletion scripts/be_management/be_mass_disenchant.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class BEMassDisenchant(AluConnector):
The script will show the list of shards to disenchant and then you will be able to confirm/deny the procedure.
"""

async def callback(self) -> str:
async def callback(self: AluConnector) -> str:
r_summoner = await self.get("/lol-summoner/v1/current-summoner")
summoner_id: int = (await r_summoner.json())["summonerId"]

Expand Down
27 changes: 27 additions & 0 deletions scripts/the_chore/chore.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from __future__ import annotations

from common import AluConnector
from scripts.be_management import BEMassDisenchant
from scripts.utilities import CombineFragmentKeys

import logging

log = logging.getLogger(__name__)


class TheChore(AluConnector):
"""
This gathers all chores that I personally would love to do in just one click.
"""

async def callback(self: AluConnector) -> str:
r1 = await BEMassDisenchant.callback(self)
log.info(r1)
r2 = await CombineFragmentKeys.callback(self)
log.info(r2)

return "Chore is finished"


if __name__ == "__main__":
TheChore().start()
2 changes: 1 addition & 1 deletion scripts/utilities/combine_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class CombineFragmentKeys(AluConnector):
This script will try to combine all possible fragments, i.e. if you have 28 fragments - the script will combine 27 of those into 9 full keys.
"""

async def callback(self) -> str:
async def callback(self: AluConnector) -> str:
r_loot = await self.get("/lol-loot/v1/player-loot")
loot = await r_loot.json()

Expand Down
3 changes: 3 additions & 0 deletions the_chore.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CALL .\venv\Scripts\activate.bat
py the_chore.py
pause >nul
3 changes: 3 additions & 0 deletions the_chore.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from scripts.the_chore.chore import TheChore

TheChore().start()

0 comments on commit 4e38e8a

Please sign in to comment.