Reorganize files to convert to python package

This commit is contained in:
Xiretza 2022-03-27 19:23:42 +02:00
parent b18f6a4091
commit 421fc9b98a
4 changed files with 17 additions and 16 deletions

17
main.py → its_matrix_bot/__init__.py Normal file → Executable file
View file

@ -1,11 +1,10 @@
import argparse
import datetime
from nio.rooms import MatrixRoom
from nio.events.room_events import RoomMessage
import simplematrixbotlib as botlib
from its_api import ItSyndikatApi
from config import Config
from .its_api import ItSyndikatApi
from .config import Config
class ItSyndikatBot:
@ -77,15 +76,3 @@ class ItSyndikatBot:
async def spaceping(self, room: MatrixRoom, message: RoomMessage):
await self.its_api.ping()
await self.reply(room, message, "Hello Space!")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="IT-Syndikat matrix bot")
parser.add_argument(
"-c", "--config",
help="path to the config file",
)
args = parser.parse_args()
ItSyndikatBot(Config(args.config))

View file

@ -0,0 +1,14 @@
import argparse
from . import ItSyndikatBot
from .config import Config
parser = argparse.ArgumentParser(description="IT-Syndikat matrix bot")
parser.add_argument(
"-c", "--config",
help="path to the config file",
)
args = parser.parse_args()
ItSyndikatBot(Config(args.config))

View file

@ -1,6 +1,6 @@
import aiohttp
from config import Config
from .config import Config
class ItSyndikatApi:
base_url: str