Ajout de commentaires
This commit is contained in:
@@ -14,6 +14,7 @@ from tchap_bot.config import Config
|
||||
from markov import parle
|
||||
|
||||
|
||||
# Ajout du paramètre de configuration du proxy
|
||||
class ConfigProxy(Config):
|
||||
https_proxy: str = Field("", description="Proxy URL")
|
||||
|
||||
@@ -32,12 +33,14 @@ async def repond(room: MatrixRoom, message: Event, matrix_client: MatrixClient):
|
||||
# il ne va pas répondre à ses propres messages
|
||||
event_parser.do_not_accept_own_message()
|
||||
|
||||
# ne répond que s'il est interpellé dans le message avec @identifiant.du.bot
|
||||
if 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)
|
||||
# génération d'une phrase aléatoire
|
||||
reponse = parle()
|
||||
await asyncio.sleep(len(reponse) / 20)
|
||||
# il envoie le message
|
||||
await matrix_client.send_text_message(room.room_id, reponse, "m.notice")
|
||||
@@ -50,7 +53,6 @@ tchap_bot = MatrixBot(
|
||||
use_functions=True,
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user