refactor urlbot plugin structure and code style

This commit is contained in:
Thorsten S
2015-11-20 21:07:48 +01:00
parent 6b11dbd2e2
commit 1082d968e6
8 changed files with 571 additions and 579 deletions

View File

@@ -1,12 +1,6 @@
#!/usr/bin/python3
import time, sys
try:
log
except NameError:
import logging
log = logging.getLogger()
import time
if '__main__' == __name__:
print('''this is a config file, which is not meant to be executed''')
@@ -17,7 +11,7 @@ config = {
'password': 'FIXME',
'rooms': ['FIXME'],
'src-url': 'FIXME',
'src-url': 'http://aero2k.de/t/repos/urlbot.git',
'bot_user': 'native-urlbot',
'bot_owner': 'FIXME',
@@ -56,12 +50,16 @@ config = {
'dsa_watcher_interval': 15 * 60
}
def conf(val):
import logging
logger = logging.getLogger(__name__)
if val in list(config.keys()):
return config[val]
log.warn('conf(): unknown key ' + str(val))
logger.warn('conf(): unknown key ' + str(val))
return None
def set_conf(key, val):
config[key] = val
return None