clear error message for missing local_settings.py
This commit is contained in:
		| @@ -1,9 +1,26 @@ | ||||
| import os as _os | ||||
|  | ||||
| _MISSING_LOCAL_SETTINGS= """ | ||||
| =============== ERROR =============== | ||||
|  | ||||
|   Missing local configurations: | ||||
|   create: local_settings.py | ||||
|   with these settings: | ||||
|  | ||||
|   TOKEN= '<this_is_your_token_id>' # created using https://t.me/BotFather | ||||
|   BOT_PATH= '/path/of/your/repo/directory' # used for upstart command | ||||
|   LOG_PATH= '/path/where/you/place/logs' # used to save daily logs | ||||
|   BOT_EXEC_CMD= 'python /path/of/your/repo/directory/bot.py' # the command you use to launch the bot instance | ||||
|   SUPER_USERS= [<chat_id>] # this is the superuser, allowed to use special commands (upstart and logs) | ||||
|  | ||||
| ===================================== | ||||
| """ | ||||
|  | ||||
|  | ||||
| try: | ||||
|   from local_settings import TOKEN as _token | ||||
|   TOKEN= _token | ||||
| except: TOKEN= 'XXX' | ||||
| except: print(_MISSING_LOCAL_SETTINGS) | ||||
| try: | ||||
|   from local_settings import BOT_PATH as _bot_path | ||||
|   BOT_PATH= _os.path.expanduser(_bot_path) | ||||
| @@ -11,7 +28,7 @@ except: BOT_PATH= '' | ||||
| try: | ||||
|   from local_settings import LOG_PATH as _log_path | ||||
|   LOG_PATH= _os.path.expanduser(_log_path) | ||||
| except: LOG_PATH= '' | ||||
| except: LOG_PATH= '/tmp' | ||||
| try: | ||||
|   from local_settings import BOT_EXEC_CMD as _bot_exec_cmd | ||||
|   BOT_EXEC_CMD= _bot_exec_cmd | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 andrea
					andrea