From 46384b6782f0b73318f764bf02f24cdbcdd059c9 Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Fri, 11 Mar 2016 22:41:51 +0100 Subject: Use a set for storing reaction users A user can only add a specific reaction once per message, so we can store the users in a set instead of a list. --- wee_slack.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'wee_slack.py') diff --git a/wee_slack.py b/wee_slack.py index 1ee1fc8..121bd7c 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -938,12 +938,12 @@ class Message(object): found = False for r in self.message_json["reactions"]: if r["name"] == reaction: - r["users"].append(user) + r["users"].add(user) found = True if not found: - self.message_json["reactions"].append({u"name": reaction, u"users": [user]}) + self.message_json["reactions"].append({u"name": reaction, u"users": {user}}) else: - self.message_json["reactions"] = [{u"name": reaction, u"users": [user]}] + self.message_json["reactions"] = [{u"name": reaction, u"users": {user}}] def remove_reaction(self, reaction, user): if "reactions" in self.message_json: -- cgit