|
|
@ -34,6 +34,30 @@ URI = f'http://{HOST}/api/v1/chat' |
|
|
|
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}) |
|
|
|
|
|
|
|
|
|
|
@ -342,7 +366,8 @@ if __name__ == '__main__': |
|
|
|
|
|
|
|
if user_input_list[0] == 'addtags': |
|
|
|
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: |
|
|
|
room_id_add_tags = 'NONE' |
|
|
|
try: |
|
|
|