pR0Ps / slack-to-discord

Import a Slack export into a Discord server
https://pypi.org/project/slack-to-discord/
76 stars 11 forks source link

Unable to handle private channels out of the box #5

Closed bguscott closed 2 years ago

bguscott commented 2 years ago

Issue

For slack exports that contain private channels, the file channels.json does not contain a pre-populated list of channel information like it does for public channels.

Workaround

Manually creating an entry for each channel and updating channels.json appears to work. For example, using the following template to create additional entries in channels.json as needed:

[
{
    "id": "",       # Can be pulled from the URL when visiting the channel within the browser (e.g., "CENHP1B6P")
    "name": "",     # Channel name
    "created": ,    # Channel creation timestamp in epoch format
    "creator": "",  # Channel created user in obfuscated format (e.g., "UEMYJ1186")
    "is_archived": false,
    "is_general": false,
    "members": [
        "",     # Channel members in obfuscated format (e.g., "UEMYJ1186")
        ""      # Additional channel members as needed in obfuscated format (e.g., "UEMYJ1186")
    ],
    "topic": {
        "value": "",    # Channel topic 
        "creator": "",  # User in obfuscated format (e.g., "UEMYJ1186")
        "last_set": # Epoch time
    },
    "purpose": {
        "value": "",    # Channel purpose 
        "creator": "",  # User in obfuscated format (e.g., "UEMYJ1186")
        "last_set": # Epoch time
    }
}
]
pR0Ps commented 2 years ago

Would you be able to send me a small sample of a redacted private Slack export? Either attaching here or emailing me directly is fine. I'd like to make this program automatically import private channels as well, but I haven't been able to get Slack to give me a private export to test against so everything related to private channels and such is just a guess at this point.

EDIT: From looking at Zulip's Slack importer, it seems like the only difference in how public and private channels are exported is that private channels are dumped into groups.json instead of channels.json. If so, this is a pretty easy fix. Does this look like the case in your export?

I've also pushed a commit to the testing/private-export branch that you can run against your export to see if it properly imports all your private channels.

bguscott commented 2 years ago

Guess I didn't look very hard, because that's exactly right :).

Taking a look at my groups.json file it contains all my private channels, and only the private channels. Schema is also the same except for the "is_general" key (it doesn't exist).

Happy to test any changes against my private export - it has around 25,000 messages.

bguscott commented 2 years ago

testing/private-export appears to be working. Looks like it can be merged and this issue closed.

pR0Ps commented 2 years ago

Should all be working as of the latest commit, thanks for testing it!