|
|
@ -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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import datetime |
|
|
|
from datetime import timedelta |
|
|
|
while True: |
|
|
|
time.sleep(4) |
|
|
|
|
|
|
|
#print(room_list) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) |
|
|
|