mirror of
https://github.com/PC-Admin/matrix-moderation-tool.git
synced 2024-12-19 07:00:27 -05:00
add function to return rdlist tags associated with a room
This commit is contained in:
parent
b0b812f3af
commit
ad87420546
@ -62,6 +62,7 @@ while pass_token == False:
|
||||
print("#### rdlist ####\t\t\t\t\t\t74) Send test incident reports to yourself.")
|
||||
print("50) Block all rooms with specific rdlist tags.")
|
||||
print("51) Block all rooms with recommended rdlist tags.")
|
||||
print("52) Get rdlist tags for a room.")
|
||||
print("\n#### ipinfo.io ####")
|
||||
print("60) Analyse a users country of origin.")
|
||||
print("61) Analyse multiple users country of origin.")
|
||||
@ -158,6 +159,9 @@ while pass_token == False:
|
||||
rdlist_commands.block_all_rooms_with_rdlist_tags(False,'','','')
|
||||
elif menu_input == "51":
|
||||
rdlist_commands.block_recommended_rdlist_tags()
|
||||
elif menu_input == "52":
|
||||
rdlist_tags = rdlist_commands.get_rdlist_tags('')
|
||||
print(json.dumps(rdlist_tags, indent=4, sort_keys=True))
|
||||
elif menu_input == "60":
|
||||
ipinfo_commands.analyse_account_ip('')
|
||||
elif menu_input == "61":
|
||||
|
@ -77,6 +77,29 @@ def sync_rdlist():
|
||||
# # }
|
||||
# # }
|
||||
|
||||
# A function to return the rdlist tags associated with a room
|
||||
def get_rdlist_tags(preset_internal_ID):
|
||||
if preset_internal_ID == '':
|
||||
internal_ID = input("\nEnter the internal id of the room you wish to query (Example: !OLkDvaYjpNrvmwnwdj:matrix.org): ")
|
||||
elif preset_internal_ID != '':
|
||||
internal_ID = preset_internal_ID
|
||||
|
||||
# Git clone the rdlist repo to ./rdlist/
|
||||
sync_rdlist()
|
||||
|
||||
# Load the summaries JSON file
|
||||
summaries_path = os.path.join("rdlist", "dist", "summaries.json")
|
||||
with open(summaries_path, 'r') as file:
|
||||
data = json.load(file)
|
||||
|
||||
# Find the room with the given id and return its tags
|
||||
for item in data:
|
||||
if 'room' in item and 'room_id' in item['room'] and item['room']['room_id'] == internal_ID:
|
||||
if 'report_info' in item and 'tags' in item['report_info']:
|
||||
return item['report_info']['tags']
|
||||
|
||||
return None
|
||||
|
||||
def block_all_rooms_with_rdlist_tags(rdlist_use_recommended,preset_user_ID,preset_new_room_name,preset_message):
|
||||
# Git clone the rdlist repo to ./rdlist/
|
||||
sync_rdlist()
|
||||
|
Loading…
Reference in New Issue
Block a user