Reorganize files to convert to python package
This commit is contained in:
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
17
main.py → its_matrix_bot/__init__.py
Normal file → Executable file
|
@ -1,11 +1,10 @@
|
||||||
import argparse
|
|
||||||
import datetime
|
import datetime
|
||||||
from nio.rooms import MatrixRoom
|
from nio.rooms import MatrixRoom
|
||||||
from nio.events.room_events import RoomMessage
|
from nio.events.room_events import RoomMessage
|
||||||
import simplematrixbotlib as botlib
|
import simplematrixbotlib as botlib
|
||||||
|
|
||||||
from its_api import ItSyndikatApi
|
from .its_api import ItSyndikatApi
|
||||||
from config import Config
|
from .config import Config
|
||||||
|
|
||||||
|
|
||||||
class ItSyndikatBot:
|
class ItSyndikatBot:
|
||||||
|
@ -77,15 +76,3 @@ class ItSyndikatBot:
|
||||||
async def spaceping(self, room: MatrixRoom, message: RoomMessage):
|
async def spaceping(self, room: MatrixRoom, message: RoomMessage):
|
||||||
await self.its_api.ping()
|
await self.its_api.ping()
|
||||||
await self.reply(room, message, "Hello Space!")
|
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))
|
|
14
its_matrix_bot/__main__.py
Normal file
14
its_matrix_bot/__main__.py
Normal 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))
|
|
@ -1,6 +1,6 @@
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
|
||||||
from config import Config
|
from .config import Config
|
||||||
|
|
||||||
class ItSyndikatApi:
|
class ItSyndikatApi:
|
||||||
base_url: str
|
base_url: str
|
Loading…
Reference in a new issue