diff --git a/config/config.ini.example b/config/config.ini.example index 90bd411..431952b 100644 --- a/config/config.ini.example +++ b/config/config.ini.example @@ -22,6 +22,8 @@ wishlist.max_entries = 10000 # time left in minutes of a giveaway for it to be considered wishlist.max_time_left = 300 [NOTIFICATIONS] +# a prefix for messages sent via notifications +notification.prefix = SG-Bot # if we should send notifications via pushover pushover.enabled = false # your specific pushover token diff --git a/src/ConfigReader.py b/src/ConfigReader.py index 305c6ec..3eec7ac 100644 --- a/src/ConfigReader.py +++ b/src/ConfigReader.py @@ -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': '', diff --git a/src/notification.py b/src/notification.py index 06a2035..1e51f45 100644 --- a/src/notification.py +++ b/src/notification.py @@ -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) diff --git a/src/run.py b/src/run.py index b5701e8..c5897e0 100644 --- a/src/run.py +++ b/src/run.py @@ -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')