get rid of defaults, hardcode stuff instead, also use os.chdir into config dir
This commit is contained in:
parent
acc390ef11
commit
9eeabd8ae9
4 changed files with 7 additions and 17 deletions
|
@ -4,7 +4,6 @@ import sys
|
|||
|
||||
import aiocron
|
||||
import telethon
|
||||
import pgbotlib.defaults
|
||||
import pgbotlib.response
|
||||
import pgbotlib.misc
|
||||
import pytz
|
||||
|
@ -16,8 +15,8 @@ class Cron:
|
|||
config: dict,
|
||||
client: telethon.TelegramClient,
|
||||
responder: pgbotlib.response.Responder) -> None:
|
||||
schedule_conf = config.get('schedule', pgbotlib.defaults.SCHEDULE)
|
||||
local_tz = config.get('timezone', pgbotlib.defaults.TZ)
|
||||
schedule_conf = config.get('schedule', 'sched.yml')
|
||||
local_tz = config.get('timezone', 'UTC')
|
||||
try:
|
||||
self.tz = pytz.timezone(local_tz)
|
||||
except pytz.exceptions.UnknownTimeZoneError as e:
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
''' module defaults '''
|
||||
|
||||
CONFDIR = '/etc/pgbot'
|
||||
CONFIG = CONFDIR + '/pgbot.yml'
|
||||
TOKENS = CONFDIR + '/tokens.yml'
|
||||
SCHEDULE = CONFDIR + '/sched.yml'
|
||||
TZ = 'UTC'
|
|
@ -4,7 +4,6 @@ import telethon
|
|||
import yaml
|
||||
import pgbotlib.api
|
||||
import pgbotlib.dbstuff
|
||||
import pgbotlib.defaults
|
||||
import pgbotlib.misc
|
||||
|
||||
|
||||
|
@ -31,9 +30,7 @@ class Responder:
|
|||
self.enabled = True
|
||||
self.apiregex = re.compile(r'^\{(\w+)\}(.+)?$')
|
||||
self.namegen = pgbotlib.misc.NameGenerator(config, db_connection)
|
||||
self.tokens = get_tokens(
|
||||
config.get('response_tokens', pgbotlib.defaults.TOKENS)
|
||||
)
|
||||
self.tokens = get_tokens(config.get('response_tokens', 'tokens.yml'))
|
||||
self.chats = config['chats']
|
||||
self.api = pgbotlib.api.ApiWrapper(self.tokens, db_connection)
|
||||
self.db_connection = db_connection
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue