From 950642728b02babdf8e05a4e25a649ad52705ca6 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 11 Jul 2020 02:21:58 +0200 Subject: [PATCH] Fix readme --- README.md | 52 +++++++++++++++----------------- royalpack/commands/brawlhalla.py | 7 +++-- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 3984eb38..2840acf7 100644 --- a/README.md +++ b/README.md @@ -17,33 +17,6 @@ Imgur.token = "1234567890abcde" # A Steam Web API key (https://steamcommunity.com/dev/apikey) Steam.web_api_key = "123567890ABCDEF123567890ABCDEF12" -# Should Royalnet automatically update the Dota ranks of all users? -Dota.updater.enabled = false - -# How many seconds should there be between two Dota updates? -Dota.updater.delay = 86400 - -# Should Royalnet automatically update the League of Legends ranks of all users? -Lol.updater.enabled = false - -# How many seconds should there be between two League of Legends updates? -Lol.updater.delay = 86400 - -# A League of Legends API token (https://developer.riotgames.com/) -Lol.token = "RGAPI-aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" - -# The region where your players are located -Lol.region = "euw1" - -# Should Royalnet automatically update the Brawlhalla ranks of all users? -Brawlhalla.updater.enabled = false - -# How many seconds should there be between two League of Legends updates? -Brawlhalla.updater.delay = 86400 - -# A Brawlhalla API key (https://dev.brawlhalla.com/) -Brawlhalla.api_key = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - # The Peertube instance you want to use for new video notifications Peertube.instance_url = "https://pt.steffo.eu" @@ -62,4 +35,29 @@ Play.max_song_duration = 7230 # The Telegram channel where matchmaking messages should be sent in Matchmaking.mm_chat_id = -1001204402796 +[Packs."royalpack"."dota".updater] +enabled = true +period = 86400 +delay = 1 +target = -1001153723135 + +[Packs."royalpack"."brawlhalla"] +token = "1234567890ABCDEFGHJKLMNOPQRST" + +[Packs."royalpack"."brawlhalla".updater] +enabled = true +period = 86400 +delay = 1 +target = -1001153723135 + +[Packs."royalpack"."leagueoflegends"] +token = "RGAPI-AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA" +region = "euw1" + +[Packs."royalpack"."leagueoflegends".updater] +enabled = true +period = 86400 +delay = 1 +target = -1001153723135 + ``` \ No newline at end of file diff --git a/royalpack/commands/brawlhalla.py b/royalpack/commands/brawlhalla.py index f775aeb7..b09d02a7 100644 --- a/royalpack/commands/brawlhalla.py +++ b/royalpack/commands/brawlhalla.py @@ -25,6 +25,9 @@ class BrawlhallaCommand(LinkerCommand): syntax: str = "" + def token(self): + return self.config['Brawlhalla']['token'] + async def get_updatables_of_user(self, session, user: rbt.User) -> List[Brawlhalla]: return user.steam @@ -42,7 +45,7 @@ class BrawlhallaCommand(LinkerCommand): bh: Brawlhalla = obj.brawlhalla if bh is None: log.debug(f"Checking if player has an account...") - async with hcs.get(f"https://api.brawlhalla.com/search?steamid={obj.steamid.as_64}&api_key={self.config['Brawlhalla']['api_key']}") as response: + async with hcs.get(f"https://api.brawlhalla.com/search?steamid={obj.steamid.as_64}&api_key={self.token()}") as response: if response.status != 200: raise ExternalError(f"Brawlhalla API /search returned {response.status}!") j = await response.json() @@ -57,7 +60,7 @@ class BrawlhallaCommand(LinkerCommand): session.add(bh) session.flush() - async with hcs.get(f"https://api.brawlhalla.com/player/{bh.brawlhalla_id}/ranked?api_key={self.config['Brawlhalla']['api_key']}") as response: + async with hcs.get(f"https://api.brawlhalla.com/player/{bh.brawlhalla_id}/ranked?api_key={self.token()}") as response: if response.status != 200: raise ExternalError(f"Brawlhalla API /ranked returned {response.status}!") j = await response.json()