Browse Source

added name2id, added name functionality to first function addtags

master
alpcentaur 9 months ago
parent
commit
4b86dfee7a
1 changed files with 26 additions and 1 deletions
  1. +26
    -1
      fdb_spider_interface.py

+ 26
- 1
fdb_spider_interface.py View File

@ -34,6 +34,30 @@ URI = f'http://{HOST}/api/v1/chat'
if __name__ == '__main__': if __name__ == '__main__':
def name2id(name):
# 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[:-4], room_file_list[0], room_file_list[1], room_file_list[2], room_file_list[3]])
outputid = 'NONE'
for roo in room_list:
if roo[1] == name:
outputid = roo[0]
return outputid
api = RocketChatAPI(settings={'username': botname, 'password': botpassword, 'domain': server_url}) api = RocketChatAPI(settings={'username': botname, 'password': botpassword, 'domain': server_url})
@ -342,7 +366,8 @@ if __name__ == '__main__':
if user_input_list[0] == 'addtags': if user_input_list[0] == 'addtags':
try: try:
room_id_add_tags = user_input_list[1]
room_name_add_tags = user_input_list[1]
room_id_add_tags = name2id(room_name_add_tags)
except: except:
room_id_add_tags = 'NONE' room_id_add_tags = 'NONE'
try: try:

Loading…
Cancel
Save