Browse Source

also added user_id of bot to config

master
alpcentaur 11 months ago
parent
commit
d56c29d095
3 changed files with 14 additions and 3 deletions
  1. +5
    -0
      README.md
  2. +1
    -0
      config_example.ini
  3. +8
    -3
      fdb_spider_interface.py

+ 5
- 0
README.md View File

@ -35,3 +35,8 @@ From there, copy the room_id to
config.ini config.ini
``` ```
For the bot_user_id run the commands
```
myinfo = api.get_my_info()
print(myinfo)
```

+ 1
- 0
config_example.ini View File

@ -3,3 +3,4 @@ username =
password = <bot-password> password = <bot-password>
url = https://rocket.example.de url = https://rocket.example.de
room_id = <room-id-of-private-room> room_id = <room-id-of-private-room>
bot_user_id = <id-of-bot>

+ 8
- 3
fdb_spider_interface.py View File

@ -11,6 +11,7 @@ botname = config['Chat']['username']
botpassword = config['Chat']['password'] botpassword = config['Chat']['password']
server_url = config['Chat']['URL'] server_url = config['Chat']['URL']
room_id = config['Chat']['room_id'] room_id = config['Chat']['room_id']
bot_user_id = config['Chat']['bot_user_id']
# here comes the functions to talk to gpt # 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 = 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() # rooms = api.get_private_rooms()
# print(rooms) # print(rooms)
@ -40,7 +44,7 @@ if __name__ == '__main__':
# api.send_message('Ole', room_id) # api.send_message('Ole', room_id)
n = 0 n = 0
'''
import time import time
import datetime import datetime
from datetime import timedelta from datetime import timedelta
@ -84,7 +88,7 @@ if __name__ == '__main__':
new_message_list = new_message.split('§%§%') 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 = open('new_message_file.txt', 'w')
new_message_file.write(latest_message + '§%§%' + latest_message_id) 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) api.send_message('Ich bin wieder bereit für Konfigurationsinput : )', room_id)
time.sleep(3) time.sleep(3)
'''

Loading…
Cancel
Save