This commit is contained in:
Adrien.Malingrey
2026-02-09 10:11:19 +01:00
parent c82364cdb5
commit 9d4080b42f
2 changed files with 3 additions and 6 deletions

View File

@@ -5,4 +5,5 @@ SYSTEMD_LOGGING=False
matrix_home_server="https://matrix.agent.ministere_example.tchap.gouv.fr"
matrix_bot_username="jean.quidam@ministere_example.gouv.fr"
matrix_bot_password="test"
join_on_invite=True
#https_proxy=http://adresse.du.proxy:port/

View File

@@ -27,14 +27,14 @@ async def repond(room: MatrixRoom, message: Event, matrix_client: MatrixClient):
# ne répond qu'en message direct ou dans un salon s'il est interpellé avec @identifiant.du.bot dans le corps du message
if len(room.users) > 2 and not (message.formatted_body and matrix_client.user_id in message.formatted_body):
raise EventNotConcerned
reponse = parle()
# il envoie l'information qu'il est en train d'écrire
await matrix_client.room_typing(room.room_id)
await asyncio.sleep(len(reponse) / 50)
# il envoie le message
await matrix_client.room_typing(room.room_id, typing_state=False)
await matrix_client.send_html_message(room.room_id, reponse, "m.notice")
await matrix_client.send_html_message(room.room_id, reponse)
tchap_bot = MatrixBot(
@@ -46,10 +46,6 @@ tchap_bot = MatrixBot(
ssl=True
)
tchap_bot.matrix_client.matrix_config.encryption_enabled = True
tchap_bot.matrix_client.matrix_config.ignore_unverified_devices = True
tchap_bot.matrix_client.matrix_config.join_on_invite = True
tchap_bot.callbacks.register_on_message_event(repond)
tchap_bot.run()