allow custom prefix in message

This commit is contained in:
mcinj 2022-05-10 13:03:34 -04:00
parent 1d6d5da86e
commit ca3425e964
4 changed files with 6 additions and 3 deletions

View file

@ -48,6 +48,7 @@ class ConfigReader(ConfigParser):
'wishlist.max_time_left': f"{randint(180,500)}"
},
'NOTIFICATIONS': {
'notification.prefix': '',
'pushover.enabled': 'false',
'pushover.token': '',
'pushover.user_key': '',

View file

@ -11,11 +11,11 @@ logger = log.get_logger(__name__)
class Notification:
def __init__(self):
def __init__(self, message_prefix):
self.pushover = False
self.pushover_token = None
self.pushover_user_key = None
self.message_prefix = "SG-bot: "
self.message_prefix = f"{message_prefix}: "
def send_won(self, message):
self.__send('won', message)

View file

@ -25,7 +25,7 @@ def run():
config.read(file_name)
notification = Notification()
notification = Notification(config['NOTIFICATIONS'].get('notification.prefix'))
pushover_enabled = config['NOTIFICATIONS'].getboolean('pushover.enabled')
pushover_token = config['NOTIFICATIONS'].get('pushover.token')
pushover_user_key = config['NOTIFICATIONS'].get('pushover.user_key')