From 8ba1a2fe56b70e4858f372610a3babdc65981321 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Sun, 2 Apr 2023 22:22:37 +0200 Subject: [PATCH] set matrix device_name --- matrix_pygmalion_bot/core.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/matrix_pygmalion_bot/core.py b/matrix_pygmalion_bot/core.py index d7135a2..1205315 100644 --- a/matrix_pygmalion_bot/core.py +++ b/matrix_pygmalion_bot/core.py @@ -189,10 +189,11 @@ class Callbacks(object): class ChatBot(object): """Main chatbot""" - def __init__(self, homeserver, user_id, password): + def __init__(self, homeserver, user_id, password, device_name="matrix-nio"): self.homeserver = homeserver self.user_id = user_id self.password = password + self.device_name = device_name self.runpod_api_key = None @@ -352,7 +353,11 @@ async def main() -> None: homeserver = config[section]['url'] user_id = config[section]['username'] password = config[section]['password'] - bot = ChatBot(homeserver, user_id, password) + if config.has_option(section, 'device_name'): + device_name = config[section]['device_name'] + else: + device_name = "matrix-nio" + bot = ChatBot(homeserver, user_id, password, device_name) bot.character_init(botname, config[section]['persona'], config[section]['scenario'], config[section]['greeting']) if config.has_option(section, 'owner'): bot.owner = config[section]['owner']