From d88987c7ae62ca07e511fbce15f1704058594da2 Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Sat, 5 Mar 2016 12:33:42 +0100 Subject: Move channel assignment out of if blocks No point in having this inside each of the if blocks. It was also used outside of the if which triggered an error if none if the ifs passed. --- wee_slack.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'wee_slack.py') diff --git a/wee_slack.py b/wee_slack.py index 8251cf1..7613769 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -324,20 +324,18 @@ class SlackServer(object): #w.prnt("", "%s\t%s" % (user, message)) def buffer_input_cb(b, buffer, data): + channel = channels.find(buffer) reaction = re.match("(\d*)(\+|-):(.*):", data) if not reaction and not data.startswith('s/'): - channel = channels.find(buffer) channel.send_message(data) #channel.buffer_prnt(channel.server.nick, data) elif reaction: - channel = channels.find(buffer) if reaction.group(2) == "+": channel.send_add_reaction(int(reaction.group(1) or 1), reaction.group(3)) elif reaction.group(2) == "-": channel.send_remove_reaction(int(reaction.group(1) or 1), reaction.group(3)) elif data.count('/') == 3: old, new = data.split('/')[1:3] - channel = channels.find(buffer) channel.change_previous_message(old.decode("utf-8"), new.decode("utf-8")) channel.mark_read(True) return w.WEECHAT_RC_ERROR -- cgit