Skip to content

Commit

Permalink
Merge pull request #20 from waocats/tombstone
Browse files Browse the repository at this point in the history
Ensure deleted files aren't added to messages
  • Loading branch information
richfromm authored Feb 6, 2023
2 parents 010615f + 3d5c3de commit 0cc585a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion slack2discord/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,17 @@ def parse_message(self, message, filename, channel_msgs_dict):

if 'files' in message:
for file in message['files']:
parsed_message.add_file(file)
if file.get('mode') == 'tombstone':
# File was deleted from Slack, just log this,
# don't bother mentioning this state in the Discord import.
if 'date_deleted' in file:
logger.warning("Attached file was deleted at"
f" {SlackParser.format_time(file['date_deleted'])}. Ignoring.")
else:
logger.warning(f"Attached file was deleted. Ignoring.")
else:
# Normal attached file case
parsed_message.add_file(file)

if 'replies' in message:
# this is the head of a thread
Expand Down

0 comments on commit 0cc585a

Please sign in to comment.