diff options
author | Ryan Huber <rhuber@gmail.com> | 2015-02-12 08:32:38 -0800 |
---|---|---|
committer | Ryan Huber <rhuber@gmail.com> | 2015-02-12 08:32:38 -0800 |
commit | 0bdb09e299a082c316457b5216969a2723f021aa (patch) | |
tree | 061df1b342d5c2282ecf36ab7b28c113033e5463 | |
parent | dad3c514c0eb9a3b7020756bf7d3635a1d165701 (diff) | |
download | wee-slack-0bdb09e299a082c316457b5216969a2723f021aa.tar.gz |
only update nicklist if channel buffer exists
-rw-r--r-- | wee_slack.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/wee_slack.py b/wee_slack.py index fc3a633..a0d346d 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -395,17 +395,18 @@ class Channel(SlackThing): self.channel_buffer = None def update_nicklist(self): - w.buffer_set(self.channel_buffer, "nicklist", "1") - w.nicklist_remove_all(self.channel_buffer) - try: - for user in self.members: - user = self.server.users.find(user) - if user.presence == 'away': - w.nicklist_add_nick(self.channel_buffer, "", user.name, user.color_name, " ", "", 1) - else: - w.nicklist_add_nick(self.channel_buffer, "", user.name, user.color_name, "+", "", 1) - except: - print "DEBUG: {} {}".format(self.identifier,self.name) + if self.channel_buffer: + w.buffer_set(self.channel_buffer, "nicklist", "1") + w.nicklist_remove_all(self.channel_buffer) + try: + for user in self.members: + user = self.server.users.find(user) + if user.presence == 'away': + w.nicklist_add_nick(self.channel_buffer, "", user.name, user.color_name, " ", "", 1) + else: + w.nicklist_add_nick(self.channel_buffer, "", user.name, user.color_name, "+", "", 1) + except: + print "DEBUG: {} {}".format(self.identifier,self.name) def fullname(self): return "{}.{}".format(self.server.domain, self.name) |