From eebcbf80cf4482616c4eae91c5f22e5636a169b1 Mon Sep 17 00:00:00 2001 From: Levent YALCIN Date: Mon, 2 Jun 2014 00:45:57 +0300 Subject: [PATCH] identation fixed and slack settings matched with settings not user profile model --- notification/notifier/slack.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/notification/notifier/slack.py b/notification/notifier/slack.py index b1e2a57..584d868 100644 --- a/notification/notifier/slack.py +++ b/notification/notifier/slack.py @@ -1,10 +1,14 @@ from slacker import Slacker class SlackNotifier: - def notify(self, notification): - slack = Slacker(notification.user_to_notify.profile.slack_apikey) - response = slack.chat.post_message(notification.user_to_notify.profile.slack_channel, notification.message) - if not response.error: - print "Slack message sent" - else: - print "Failed to send Slack message" + + def __init__(self, config): + self.__config = config + + def notify(self, notification): + slack = Slacker(self.__config['apikey']) + response = slack.chat.post_message(self.__config['channel'], notification.message) + if not response.error: + print "Slack message sent" + else: + print "Failed to send Slack message"