From 8fce99a006ad44a02f78d3ae255ab699facdf973 Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Wed, 26 Jun 2019 21:35:18 -0400 Subject: [PATCH] default user references now look towards AppriseAsset.app_id() (#132) --- apprise/plugins/NotifyFlock.py | 5 +---- apprise/plugins/NotifyMatrix.py | 5 +---- apprise/plugins/NotifySlack.py | 7 ++----- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/apprise/plugins/NotifyFlock.py b/apprise/plugins/NotifyFlock.py index 96ea52b4..b3e65672 100644 --- a/apprise/plugins/NotifyFlock.py +++ b/apprise/plugins/NotifyFlock.py @@ -55,9 +55,6 @@ FLOCK_HTTP_ERROR_MAP = { 401: 'Unauthorized - Invalid Token.', } -# Default User -FLOCK_DEFAULT_USER = 'apprise' - # Used to detect a channel/user IS_CHANNEL_RE = re.compile(r'^(#|g:)(?P[A-Z0-9_]{12})$', re.I) IS_USER_RE = re.compile(r'^(@|u:)?(?P[A-Z0-9_]{12})$', re.I) @@ -223,7 +220,7 @@ class NotifyFlock(NotifyBase): 'token': self.token, 'flockml': body, 'sendAs': { - 'name': FLOCK_DEFAULT_USER if not self.user else self.user, + 'name': self.app_id if not self.user else self.user, # A Profile Image is only configured if we're configured to # allow it 'profileImage': None if not self.include_image diff --git a/apprise/plugins/NotifyMatrix.py b/apprise/plugins/NotifyMatrix.py index d81b1c96..a5579e53 100644 --- a/apprise/plugins/NotifyMatrix.py +++ b/apprise/plugins/NotifyMatrix.py @@ -62,9 +62,6 @@ IS_ROOM_ID = re.compile( r'^\s*(!|!|%21)(?P[a-z0-9-]+)((:|%3A)' r'(?P[a-z0-9.-]+))?\s*$', re.I) -# Default User -SLACK_DEFAULT_USER = 'apprise' - class MatrixWebhookMode(object): # Webhook Mode is disabled @@ -360,7 +357,7 @@ class NotifyMatrix(NotifyBase): # prepare JSON Object payload = { - 'username': self.user if self.user else SLACK_DEFAULT_USER, + 'username': self.user if self.user else self.app_id, # Use Markdown language 'mrkdwn': (self.notify_format == NotifyFormat.MARKDOWN), 'attachments': [{ diff --git a/apprise/plugins/NotifySlack.py b/apprise/plugins/NotifySlack.py index 690952ef..17a7ebbc 100644 --- a/apprise/plugins/NotifySlack.py +++ b/apprise/plugins/NotifySlack.py @@ -60,9 +60,6 @@ VALIDATE_TOKEN_B = re.compile(r'[A-Z0-9]{9}') # /........./........./CCCCCCCCCCCCCCCCCCCCCCCC VALIDATE_TOKEN_C = re.compile(r'[A-Za-z0-9]{24}') -# Default User -SLACK_DEFAULT_USER = 'apprise' - # Extend HTTP Error Messages SLACK_HTTP_ERROR_MAP = { 401: 'Unauthorized - Invalid Token.', @@ -228,7 +225,7 @@ class NotifySlack(NotifyBase): if not self.user: self.logger.warning( - 'No user was specified; using %s.' % SLACK_DEFAULT_USER) + 'No user was specified; using "%s".' % self.app_id) # Build list of channels self.channels = parse_list(targets) @@ -287,7 +284,7 @@ class NotifySlack(NotifyBase): # prepare JSON Object payload = { - 'username': self.user if self.user else SLACK_DEFAULT_USER, + 'username': self.user if self.user else self.app_id, # Use Markdown language 'mrkdwn': (self.notify_format == NotifyFormat.MARKDOWN), 'attachments': [{