From d56c29d095ccaf3dc3eedac883e22418d25567e2 Mon Sep 17 00:00:00 2001 From: alpcentaur Date: Wed, 29 Nov 2023 19:54:43 +0100 Subject: [PATCH] also added user_id of bot to config --- README.md | 5 +++++ config_example.ini | 1 + fdb_spider_interface.py | 11 ++++++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 22f2869..2f34aa9 100644 --- a/README.md +++ b/README.md @@ -35,3 +35,8 @@ From there, copy the room_id to config.ini ``` +For the bot_user_id run the commands +``` +myinfo = api.get_my_info() +print(myinfo) +``` diff --git a/config_example.ini b/config_example.ini index 5710420..22041aa 100644 --- a/config_example.ini +++ b/config_example.ini @@ -3,3 +3,4 @@ username = password = url = https://rocket.example.de room_id = +bot_user_id = diff --git a/fdb_spider_interface.py b/fdb_spider_interface.py index 45391d2..6390023 100644 --- a/fdb_spider_interface.py +++ b/fdb_spider_interface.py @@ -11,6 +11,7 @@ botname = config['Chat']['username'] botpassword = config['Chat']['password'] server_url = config['Chat']['URL'] room_id = config['Chat']['room_id'] +bot_user_id = config['Chat']['bot_user_id'] # here comes the functions to talk to gpt @@ -31,8 +32,11 @@ if __name__ == '__main__': api = RocketChatAPI(settings={'username': botname, 'password': botpassword, 'domain': server_url}) - #api.send_message('Ciao, I am the fdb-spider', room_id) + # api.send_message('Ciao, I am the fdb-spider', room_id) + # myinfo = api.get_my_info() + + print(myinfo) # rooms = api.get_private_rooms() # print(rooms) @@ -40,7 +44,7 @@ if __name__ == '__main__': # api.send_message('Ole', room_id) n = 0 - +''' import time import datetime from datetime import timedelta @@ -84,7 +88,7 @@ if __name__ == '__main__': new_message_list = new_message.split('§%§%') - if new_message_list[0] != latest_message and new_message_list[1] != latest_message_id and latest_message_user_id != 'bb8EfPXrviu9yB9Ja': + if new_message_list[0] != latest_message and new_message_list[1] != latest_message_id and latest_message_user_id != bot_user_id: new_message_file = open('new_message_file.txt', 'w') new_message_file.write(latest_message + '§%§%' + latest_message_id) @@ -102,3 +106,4 @@ if __name__ == '__main__': api.send_message('Ich bin wieder bereit für Konfigurationsinput : )', room_id) time.sleep(3) +'''