diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2016-03-11 22:41:51 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2016-04-22 16:41:55 +0200 |
commit | 46384b6782f0b73318f764bf02f24cdbcdd059c9 (patch) | |
tree | d56dd4fd64125208137cf4e5257eb230a32a8cb6 /wee_slack.py | |
parent | bef6007e5450639f2a5f64e7fa6ce15db56d30c6 (diff) | |
download | wee-slack-46384b6782f0b73318f764bf02f24cdbcdd059c9.tar.gz |
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.
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 6 |
1 files changed, 3 insertions, 3 deletions
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: |