From e0b38beb7eb6f03290fb2f8061565330a64b0f53 Mon Sep 17 00:00:00 2001 From: nemesis Date: Tue, 11 Nov 2025 22:20:41 +0100 Subject: [PATCH] bot.client --> bot.api --- asmodee.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/asmodee.py b/asmodee.py index 6b62c8c..e2df1fd 100644 --- a/asmodee.py +++ b/asmodee.py @@ -76,8 +76,12 @@ else: print("Probleme de lecture de configuration asmodee.ini") # Create an instance of the MatrixBotAPI +config = botlib.Config() +config.encryption_enabled = True +config.emoji_verify = True +config.ignore_unverified_devices = False creds = botlib.Creds(SERVER, USERNAME, PASSWORD) -bot = botlib.Bot(creds) +bot = botlib.Bot(creds, config) # Chargement des données persistantes def horloge_read(): @@ -710,8 +714,8 @@ async def getNick(room, message): # Obtenir le DisplayName à partir du mxid. #except: # nick = room.user_name(sender) try: - nick = await bot.client.get_displayname(sender) - #members = await bot.client.api.get_room_members(room.room_id) + nick = await bot.api.get_displayname(sender) + #members = await bot.api.get_room_members(room.room_id) #for member in members: # if member['state_key'] == sender: # nick = member['content'].get('displayname') @@ -750,7 +754,7 @@ async def modo(room,message): # Definition d'un moderateur lmod = modos.get(room.room_id) except: lmod = [] - if (sender in admins or sender in lmod or sender == bot.client.user_id): + if (sender in admins or sender in lmod or sender == bot.api.whoami()): args = texte.split() args.pop(0) if (len(args) > 1 and args[0] == "add"): @@ -785,7 +789,7 @@ async def module(room,message): # Definition des modules d'un salon lmod = modos.get(room.room_id) except: lmod = [] - if (sender in admins or sender in lmod or sender == bot.client.user_id): + if (sender in admins or sender in lmod or sender == bot.api.whoami()): global modules args = texte.split() args.pop(0) @@ -1262,8 +1266,8 @@ async def bienvenue(room,message): # Affichage d'un message d'accueil aux nouvea if (modules[room.room_id, 'welcome']): sender = getUser(message) #nick = None - nick = await bot.client.get_displayname(message.state_key) - #members = await bot.client.api.get_room_members(room.room_id) + nick = await bot.api.get_displayname(message.state_key) + #members = await bot.api.get_room_members(room.room_id) #for member in members: # if member['state_key'] == message.state_key: # nick = member['content'].get('displayname') @@ -1352,8 +1356,8 @@ async def addquote(room,message): # enregistrer les citations mode reponses matr auteur = match.group(1) #nick = room.user_name(auteur) try: - nick = await bot.client.get_displayname(auteur) - # members = await bot.client.api.get_room_members(room.room_id) + nick = await bot.api.get_displayname(auteur) + # members = await bot.api.get_room_members(room.room_id) # for member in members: # if member['state_key'] == auteur: # nick = member['content'].get('displayname')