added room commands, started room communication scheduler
This commit is contained in:
parent
3c71a07f6c
commit
3e30365c90
4 changed files with 35 additions and 11 deletions
BIN
.fdb_spider_interface.py.swp
Normal file
BIN
.fdb_spider_interface.py.swp
Normal file
Binary file not shown.
|
@ -5,13 +5,14 @@ import json
|
|||
import requests
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read('/root/fdb-spider-interface/config.ini')
|
||||
config.read('config.ini')
|
||||
|
||||
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']
|
||||
spider_directory = config['Spider']['spider_directory']
|
||||
|
||||
# here comes the functions to talk to gpt
|
||||
|
||||
|
@ -47,15 +48,10 @@ if __name__ == '__main__':
|
|||
n = 0
|
||||
|
||||
import time
|
||||
import datetime
|
||||
from datetime import timedelta
|
||||
while True:
|
||||
time.sleep(4)
|
||||
import schedule
|
||||
|
||||
def getroomdata():
|
||||
|
||||
# get all the rooms
|
||||
import os
|
||||
|
||||
room_list = []
|
||||
rooms = os.listdir('rooms')
|
||||
for room in rooms:
|
||||
|
@ -65,9 +61,19 @@ if __name__ == '__main__':
|
|||
|
||||
room_file_list = room_file_raw.split('§%§%')
|
||||
room_list.append([room[:-3], room_file_list[0], room_file_list[1], room_file_list[2]])
|
||||
|
||||
return room_list
|
||||
|
||||
#print(room_list)
|
||||
|
||||
|
||||
|
||||
import datetime
|
||||
from datetime import timedelta
|
||||
while True:
|
||||
time.sleep(4)
|
||||
|
||||
|
||||
|
||||
|
||||
n += 1
|
||||
print(n)
|
||||
|
@ -126,6 +132,20 @@ if __name__ == '__main__':
|
|||
|
||||
|
||||
if user_input_list[0] == 'printrooms':
|
||||
# get all the rooms
|
||||
import os
|
||||
|
||||
room_list = []
|
||||
rooms = os.listdir('rooms')
|
||||
for room in rooms:
|
||||
room_file = open('rooms/' + room, 'r')
|
||||
room_file_raw = room_file.read()
|
||||
room_file.close()
|
||||
|
||||
room_file_list = room_file_raw.split('§%§%')
|
||||
room_list.append([room[:-3], room_file_list[0], room_file_list[1], room_file_list[2]])
|
||||
|
||||
#print(room_list)
|
||||
answer = str(room_list)
|
||||
|
||||
|
||||
|
@ -157,7 +177,7 @@ if __name__ == '__main__':
|
|||
members=[latest_message_user_username],
|
||||
read_only=True)
|
||||
|
||||
# The logic here is that a new room with the same name gets overwritten
|
||||
|
||||
new_room_id = new_room['channel']['_id']
|
||||
room_file = open('rooms/' + new_room_id + '.txt', 'w')
|
||||
room_file.write( room_name + '§%§%' + databases + '§%§%' + filters)
|
||||
|
@ -170,6 +190,9 @@ if __name__ == '__main__':
|
|||
|
||||
# here comes the code interacting with the spiders output json
|
||||
|
||||
|
||||
|
||||
|
||||
#answer = 'the up to date entries are: oi Oi Oi!'
|
||||
|
||||
api.send_message(answer, room_id)
|
||||
|
|
|
@ -1 +1 @@
|
|||
printrooms§%§%6DQP8M4wYhgWroAx7
|
||||
printrooms§%§%P6rQGgS9u7RqZM2iz
|
|
@ -3,4 +3,5 @@ charset-normalizer==3.2.0
|
|||
idna==3.4
|
||||
requests==2.31.0
|
||||
rocket-python==1.3.4
|
||||
schedule==1.2.1
|
||||
urllib3==2.0.4
|
||||
|
|
Loading…
Reference in a new issue