mirror of
				https://github.com/PC-Admin/matrix-moderation-tool.git
				synced 2025-10-31 18:20:30 -04:00 
			
		
		
		
	you say defect, i say feature. script won't interactively take variables anymore. fixes #3
This commit is contained in:
		
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1 +1,2 @@ | |||||||
| hardcoded_variables.py | hardcoded_variables.py | ||||||
|  | __pycache__ | ||||||
										
											Binary file not shown.
										
									
								
							| @@ -1,6 +1,14 @@ | |||||||
|  |  | ||||||
| #!/bin/env python3 | #!/bin/env python3 | ||||||
|  |  | ||||||
|  | import os | ||||||
| import json | import json | ||||||
|  |  | ||||||
|  | # Check if ./hardcoded_variables.py file exists | ||||||
|  | if not os.path.exists("./hardcoded_variables.py"): | ||||||
|  | 	print("ERROR: The file './hardcoded_variables.py' does not exist. It must be configured before using this script.") | ||||||
|  | 	exit() | ||||||
|  |  | ||||||
| import user_commands | import user_commands | ||||||
| import room_commands | import room_commands | ||||||
| import server_commands | import server_commands | ||||||
| @@ -8,24 +16,31 @@ import ipinfo_commands | |||||||
| import rdlist_commands | import rdlist_commands | ||||||
| import report_commands | import report_commands | ||||||
| import bot_commands | import bot_commands | ||||||
|  |  | ||||||
|  | # Importing the module only after verifying its existence | ||||||
| import hardcoded_variables | import hardcoded_variables | ||||||
|  |  | ||||||
| # check if homeserver url is hard coded, if not set it | # If it does exist... check if the variables are configured: | ||||||
|  |  | ||||||
|  | # check if homeserver url is the default | ||||||
|  |  | ||||||
| if hardcoded_variables.homeserver_url == "matrix.example.org": | if hardcoded_variables.homeserver_url == "matrix.example.org": | ||||||
| 	homeserver_url = input("homeserver_url not configured; What is the URL of your server? Eg: matrix.example.org ") | 	print("ERROR: homeserver_url not configured, please configure your './hardcoded_variables.py' file!") | ||||||
|  | 	exit() | ||||||
|  |  | ||||||
| # check if base url is hard coded, if not set it | # check if base url is the default | ||||||
|  |  | ||||||
| if hardcoded_variables.base_url == "example.org": | if hardcoded_variables.base_url == "example.org": | ||||||
| 	base_url = input("base_url not configured; What is the URL of your server? Eg: example.org ") | 	print("ERROR: base_url not configured, please configure your './hardcoded_variables.py' file!") | ||||||
|  | 	exit() | ||||||
|  |  | ||||||
| # check if access token is hard coded, if not set it | # check if access token is the default | ||||||
|  |  | ||||||
| length_access_token = len(hardcoded_variables.access_token) | length_access_token = len(hardcoded_variables.access_token) | ||||||
|  |  | ||||||
| if length_access_token == 0: | if length_access_token == 0: | ||||||
| 	access_token = input("access_token not configured; Please enter access token for server admin account: ") | 	print("ERROR: access_token not configured, please configure your './hardcoded_variables.py' file!") | ||||||
|  | 	exit() | ||||||
|  |  | ||||||
| # loop menu for various moderation actions | # loop menu for various moderation actions | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user