mirror of
https://github.com/gryf/slack-backup.git
synced 2025-12-17 11:30:25 +01:00
Fix for message comment.
If comment is sent by the user, different structure of the data is sent. First of all, the type of this message is "message", but it contain dictionary under 'comment' key, which can be confusing, which contain needed data (like user id). For this kind of messages, in case of lack of 'user' in main dict, dict['comment']['user'] will be used for getting user identifier, while dict['text'] remains as a message text.
This commit is contained in:
2
setup.py
2
setup.py
@@ -10,7 +10,7 @@ except ImportError:
|
|||||||
|
|
||||||
setup(name="slack-backup",
|
setup(name="slack-backup",
|
||||||
packages=["slack_backup"],
|
packages=["slack_backup"],
|
||||||
version="0.4.4",
|
version="0.4.5",
|
||||||
description="Make copy of slack converstaions",
|
description="Make copy of slack converstaions",
|
||||||
author="Roman Dobosz",
|
author="Roman Dobosz",
|
||||||
author_email="gryf73@gmail.com",
|
author_email="gryf73@gmail.com",
|
||||||
|
|||||||
@@ -147,8 +147,12 @@ class Client(object):
|
|||||||
Create message with corresponding possible metadata, like reactions,
|
Create message with corresponding possible metadata, like reactions,
|
||||||
files etc.
|
files etc.
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
user = self.q(o.User).\
|
user = self.q(o.User).\
|
||||||
filter(o.User.slackid == data['user']).one()
|
filter(o.User.slackid == data['user']).one()
|
||||||
|
except KeyError:
|
||||||
|
user = self.q(o.User).\
|
||||||
|
filter(o.User.slackid == data['comment']['user']).one()
|
||||||
|
|
||||||
if data['type'] == 'message' and not data['text'].strip():
|
if data['type'] == 'message' and not data['text'].strip():
|
||||||
logging.info("Skipping message from `%s' since it's empty",
|
logging.info("Skipping message from `%s' since it's empty",
|
||||||
|
|||||||
Reference in New Issue
Block a user