feat: init matrix bot code
This commit is contained in:
parent
1ef4efbc68
commit
b041aa0de8
5 changed files with 262 additions and 2 deletions
15
main.py
15
main.py
|
@ -2,6 +2,7 @@ import asyncio
|
|||
import logging
|
||||
import sys
|
||||
|
||||
import config
|
||||
from adapters.tg import TelegramAdapter
|
||||
|
||||
|
||||
|
@ -9,9 +10,19 @@ async def main():
|
|||
"""Main entry point"""
|
||||
logging.basicConfig(level=logging.DEBUG, stream=sys.stdout)
|
||||
|
||||
tasks = []
|
||||
# Initialize and start Telegram adapter
|
||||
tg_adapter = TelegramAdapter()
|
||||
await tg_adapter.start()
|
||||
if config.Config().get_config_value('start_telegram_bot', True):
|
||||
tg_adapter = TelegramAdapter()
|
||||
tasks.append(tg_adapter.start())
|
||||
if config.Config().get_config_value('also_start_matrix_bot', False):
|
||||
import adapters.matrix as matrix_bot
|
||||
# Initialize and start Matrix bot if configured
|
||||
tasks.append(matrix_bot.main())
|
||||
if tasks:
|
||||
await asyncio.gather(*tasks, return_exceptions=True)
|
||||
else:
|
||||
logging.error("No bot is configured to start. Please check your configuration.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue