Create Matrix and Telegram clients
This commit is contained in:
parent
9d3ff4f1a2
commit
4e32665882
1 changed files with 16 additions and 1 deletions
15
mirrortea
15
mirrortea
|
@ -5,8 +5,23 @@ import asyncio
|
||||||
import aiogram as telegram
|
import aiogram as telegram
|
||||||
import nio as matrix
|
import nio as matrix
|
||||||
|
|
||||||
|
MATRIX_HOMESERVER_URL = 'https://matrix.org'
|
||||||
|
MATRIX_FULL_USER_ID = '@fckidiots:matrix.org'
|
||||||
|
MATRIX_PASSWORD = '...'
|
||||||
|
TELEGRAM_BOT_TOKEN = '5890667880:...'
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
|
try:
|
||||||
|
matrix_client = \
|
||||||
|
matrix.AsyncClient(MATRIX_HOMESERVER_URL, MATRIX_FULL_USER_ID)
|
||||||
|
await matrix_client.login(MATRIX_PASSWORD)
|
||||||
|
|
||||||
|
telegram_client = telegram.Bot(token=TELEGRAM_BOT_TOKEN)
|
||||||
|
|
||||||
await asyncio.gather(matrix_loop(), telegram_loop())
|
await asyncio.gather(matrix_loop(), telegram_loop())
|
||||||
|
finally:
|
||||||
|
if matrix_client:
|
||||||
|
await matrix_client.close()
|
||||||
|
|
||||||
async def matrix_loop():
|
async def matrix_loop():
|
||||||
print(123)
|
print(123)
|
||||||
|
|
Loading…
Reference in a new issue