diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2016-03-05 12:33:42 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2016-03-05 15:46:58 +0100 |
commit | d88987c7ae62ca07e511fbce15f1704058594da2 (patch) | |
tree | 686b553a50012f84a92ee6694b80f26c44c43c18 /wee_slack.py | |
parent | daef79b51bb9ddc298646e294e3d95f86e6c4dbe (diff) | |
download | wee-slack-d88987c7ae62ca07e511fbce15f1704058594da2.tar.gz |
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.
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 4 |
1 files changed, 1 insertions, 3 deletions
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 |