Run black

This commit is contained in:
Xiretza 2022-03-27 19:35:40 +02:00
parent 421fc9b98a
commit 9987bb87db
3 changed files with 12 additions and 9 deletions

View file

@ -5,7 +5,8 @@ from .config import Config
parser = argparse.ArgumentParser(description="IT-Syndikat matrix bot")
parser.add_argument(
"-c", "--config",
"-c",
"--config",
help="path to the config file",
)

View file

@ -16,11 +16,11 @@ class Config:
config = toml.load(path)
self.command_prefix = config['app']['command_prefix']
self.command_prefix = config["app"]["command_prefix"]
matrix = config['matrix']
self.matrix_homeserver = matrix['homeserver']
self.matrix_username = matrix['username']
self.matrix_access_token = matrix['access_token']
matrix = config["matrix"]
self.matrix_homeserver = matrix["homeserver"]
self.matrix_username = matrix["username"]
self.matrix_access_token = matrix["access_token"]
self.spaceping_token = config['spaceping']['api_token']
self.spaceping_token = config["spaceping"]["api_token"]

View file

@ -2,6 +2,7 @@ import aiohttp
from .config import Config
class ItSyndikatApi:
base_url: str
config: Config
@ -15,10 +16,11 @@ class ItSyndikatApi:
async with session.get(self.base_url + "status.php") as response:
return await response.json()
async def ping(self):
params = {"apikey": self.config.spaceping_token}
async with aiohttp.ClientSession() as session:
async with session.post(self.base_url + "ping.php", params=params) as response:
async with session.post(
self.base_url + "ping.php", params=params
) as response:
await response.text()