diff options
author | diSabler <dissy@ya.ru> | 2020-08-03 14:19:39 +0300 |
---|---|---|
committer | diSabler <dissy@ya.ru> | 2020-08-03 14:19:39 +0300 |
commit | 1ae2a8e285da9ca0c11541862229b260e3daa8d7 (patch) | |
tree | d6bb8fa791128aa9bb4a89bbfc3f78faf5ac0fab /kernel.py | |
parent | a718abd0ba590d408bea83ae1ae0e8b5fa7ea382 (diff) |
add: more than one bot`s owner
Diffstat (limited to 'kernel.py')
-rwxr-xr-x | kernel.py | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -250,6 +250,13 @@ def get_config_int(_config, _section, _name): except:
return -1
+# Get integer array of values from config
+def get_config_int_array(_config, _section, _name):
+ try:
+ return [int(t) for t in _config.get(_section, _name).split() if t]
+ except:
+ return [-1]
+
# Get binary value from config
# True == 1, '1', 'yes', 'true'
# False == all else
@@ -439,7 +446,7 @@ def check_updates(): pprint(json.dumps(msg_in, indent=2, separators=(',', ': ')), 'magenta')
continue
- IS_OWNER = msg_in['message']['from'].get('id', '') == OWNER_ID
+ IS_OWNER = msg_in['message']['from'].get('id', '') in OWNER_ID
CMD = msg_in['message'].get('text', '').strip()
splitter = '<%s>' % random.randint(0, 2 ** 32)
CMD = CMD.replace(BOT_NAME, splitter)
@@ -681,7 +688,7 @@ DEBUG_LOG = get_config_bin(CONFIG, CONFIG_DEBUG, 'logging') DEBUG_CONSOLE = get_config_bin(CONFIG, CONFIG_DEBUG, 'console')
DEBUG_JSON = get_config_bin(CONFIG, CONFIG_DEBUG, 'json')
HALT_ON_EXCEPTION = get_config_bin(CONFIG, CONFIG_DEBUG, 'halt_on_exception')
-OWNER_ID = get_config_int(CONFIG, CONFIG_OWNER, 'id')
+OWNER_ID = get_config_int_array(CONFIG, CONFIG_OWNER, 'id')
API_URL = TELEGRAM_API_URL % CONFIG_API_TOKEN + '/%s'
|