Giter VIP home page Giter VIP logo

slack-to-discord's Introduction

slack-to-discord

This tool takes a Slack export file and imports it into a Discord server

Demonstration

Capabilities

  • Imports complete message history (tested with an import of just over 10,000 messages).
  • Handles private channels (if they're included in your Slack export).
  • Handles images and other files (falls back to linking to the files hosted by Slack if they're too big to upload).
  • Preserves the original names and avatars of the Slack users
  • Preserves emojis and reactions to messages. Custom emojis will also work, but need to be manually added to Discord before importing (any -s in the emoji names will need to changed to _s)
  • Preserves threaded conversations.
  • Preserves pinned messages.
  • Day boundaries between messages are marked by a --------YYYY-MM-DD-------- message and each message is prefixed by the time it was sent.
  • Messages that are too long for Discord (>2000 characters) are split up and sent as multiple smaller messages.

Limitations

  • Messages will be timestamped by Discord as the time they were imported, not as the time they were originally sent. This is worked around by adding a timestamp to the text of each message.
  • No private messages will be imported
  • Reactions to messages will be shown in a custom embed, not as normal reactions
  • No embeds from Slack (can contain images, buttons, etc) will be preserved.
  • File uploads will be done in two messages. The first is the message content, the second is a message containing the title of the uploaded file and attaching it.

General recommendations

The program will read all messages from the Slack export and use a bot to post them in a Discord server. It's recommended to start with a completely clean server before importing history. As the script can only post messages, not rewrite history, any previous content will be buried by the imported data. It's also a good idea to make sure everything worked properly before inviting other users.

Private channels (if you can manage to export them from Slack) will be created such that only the bot and server administrators can access them. After the import completes and you invite your users, you will need to manually change the roles/permissions to give everyone access to the correct channels.

If something goes wrong with the import, you can delete all the created channels to quickly remove the history. At this point, you can either fix the issue yourself and re-run the export (please contribute your fixes back to the project!), or open an issue on the project.

Instructions

  1. Export your data from Slack via https://my.slack.com/services/export
  2. Create a Discord bot (see https://discordpy.readthedocs.io/en/latest/discord.html) with the following permissions:
    • Manage Channels - to create the imported channels and change the topics of them
    • Manage Webhooks - to allow the bot to fake the usernames and avatars of Slack users
    • Send Messages
    • Create Public Threads
    • Send Messages in Threads
    • Embed Links - to add reactions to messages (see 'Limitations' section)
    • Attach Files
    • Manage Messages - to pin messages [optional]
  3. Install slack-to-discord using pip (pip install slack-to-discord)
  4. Run slack-to-discord --zipfile <slack export zip> --guild <server name> --token <bot token> (check slack-to-discord --help for other options).
  5. Wait. The program will exit once the import is finished. Due to Discord rate limits, the import process will take a while (speed was roughly 50 messages/min for me)
  6. Inspect the imported history.
  7. Invite your users.

slack-to-discord's People

Contributors

bguscott avatar maur1th avatar pr0ps avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

slack-to-discord's Issues

After installation, script fails on import attempt

slack-to-discord --zipfile XXX --guild YYY --token ZZZ
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/bin/slack-to-discord", line 5, in <module>
    from slack_to_discord.__main__ import main
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/slack_to_discord/__main__.py", line 5, in <module>
    from discord.utils import setup_logging
ImportError: cannot import name 'setup_logging'

TypeError: Client.__init__() missing 1 required keyword-only argument: 'intents'

Hello,

First of all, great project! However, when I try to run slack-to-discord --zipfile <slack export zip> --guild <guild name> --token <bot token> I receive an error when trying to connect to Discord.

Issue:

When I try to execute the latest commit (42410d4c1e5492d4f30b9998af4ee6390f1c7d81 - I have not tried any other commits) I receive the following error:

Extracting zipfile...Done!
Logging the bot into Discord...Traceback (most recent call last):
  File "C:\Users\REDACTED\AppData\Local\Programs\Python\Python310\Scripts\slack-to-discord-script.py", line 33, in <module>
    sys.exit(load_entry_point('slack-to-discord==0.0.1', 'console_scripts', 'slack-to-discord')())
  File "C:\Users\REDACTED\AppData\Local\Programs\Python\Python310\lib\site-packages\slack_to_discord.py", line 472, in main
    client = MyClient(
  File "C:\Users\REDACTED\AppData\Local\Programs\Python\Python310\lib\site-packages\slack_to_discord.py", line 351, in __init__
    super().__init__(*args, **kwargs)
TypeError: Client.__init__() missing 1 required keyword-only argument: 'intents'

What I have done:

  1. Created a discord bot and added to my server per the instructions in the README:
    image
  2. Installed the latest commit via pip on my Windows 11 machine
  3. Tried enabling all Privileged Gateway Intents (makes no difference):
    image

Clearly identify what `guild` is

Great script, thanks for creating it!

It took me a while to figure out what a guild was, and what my argument to --guild should be. It wasn't even clear if guilds were a Slack or Discord concept. After some brief online searches, it turns out a "guild" is just Discord's official name for what absolutely everyone around me calls a "server". So since my new Discord community is eGliders, I used -- guild eGliders in the CLI.

It would be helpful if the README.md were a little clearer on this point, as I don't imagine I'm the only person who has never heard of a Discord guild before.

Failed to finish import - KeyError 'mode'

I've been trying to get the importer working, but have kept running into the following error:

CRITICAL slack_to_discord.importer Failed to finish import!
Traceback (most recent call last):
  File "/home/cu/.local/lib/python3.8/site-packages/slack_to_discord/importer.py", line 404, in on_ready
    await self._run_import(g)
  File "/home/cu/.local/lib/python3.8/site-packages/slack_to_discord/importer.py", line 472, in _run_import
    for msg in slack_channel_messages(self._data_dir, chan_name, self._users, emoji_map, pins):
  File "/home/cu/.local/lib/python3.8/site-packages/slack_to_discord/importer.py", line 228, in slack_channel_messages
    files = [x for x in files if x["mode"] != "tombstone" and x.get("url_private")]
  File "/home/cu/.local/lib/python3.8/site-packages/slack_to_discord/importer.py", line 228, in <listcomp>
    files = [x for x in files if x["mode"] != "tombstone" and x.get("url_private")]
KeyError: 'mode'
2023-03-20 12:12:05 INFO     slack_to_discord.importer Bot logging out
/usr/lib/python3/dist-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.15) or chardet (3.0.4) doesn't match a supported version!
  warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
Traceback (most recent call last):
  File "/home/cu/.local/bin/slack-to-discord", line 8, in <module>
    sys.exit(main())
  File "/home/cu/.local/lib/python3.8/site-packages/slack_to_discord/__main__.py", line 27, in main
    run_import(
  File "/home/cu/.local/lib/python3.8/site-packages/slack_to_discord/importer.py", line 561, in run_import
    raise client._exception
  File "/home/cu/.local/lib/python3.8/site-packages/slack_to_discord/importer.py", line 404, in on_ready
    await self._run_import(g)
  File "/home/cu/.local/lib/python3.8/site-packages/slack_to_discord/importer.py", line 472, in _run_import
    for msg in slack_channel_messages(self._data_dir, chan_name, self._users, emoji_map, pins):
  File "/home/cu/.local/lib/python3.8/site-packages/slack_to_discord/importer.py", line 228, in slack_channel_messages
    files = [x for x in files if x["mode"] != "tombstone" and x.get("url_private")]
  File "/home/cu/.local/lib/python3.8/site-packages/slack_to_discord/importer.py", line 228, in <listcomp>
    files = [x for x in files if x["mode"] != "tombstone" and x.get("url_private")]
KeyError: 'mode'

I'm not able to make the most sense of it myself, but I have checked both urllib3 and chardet are up-to-date (1.26.15 and 3.0.4 respectively). I'm running on WSL, since I've had separate issues getting Windows to recognise slack-to-discord after pip install-ing it

As an extra test step, I cloned the latest version of the repository locally and attempted to run the command directs (i.e. python3 __main__.py --zipfile <file> --guild <guild> --token <token> when in /slack-to-discord/slack_to_discord/), and received the same error

FileNotFoundError users.json

On Python 3.11 / macOS 13.5.2, getting the following error:

File "/Users/jtauber/.local/share/virtualenvs/slack-to-discord-PJmOEO33/lib/python3.11/site-packages/slack_to_discord/importer.py", line 79, in slack_usermap
    with open(os.path.join(d, "users.json"), "rb") as fp:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/84/8xqd623s1yv722tvxk7vg5km0000gn/T/tmp_22k3ie9/users.json'

Issue importing

Seeing the following issue and can't seem to sort it:

2022-09-23 12:00:36 INFO     slack_to_discord Extracting Slack export zip
2022-09-23 12:00:36 INFO     slack_to_discord Logging the bot into Discord
2022-09-23 12:00:36 WARNING  discord.client PyNaCl is not installed, voice will NOT be supported
2022-09-23 12:00:36 INFO     discord.client logging in using static token
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 1089, in create_connection
    transport, protocol = await self._create_connection_transport(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 1119, in _create_connection_transport
    await waiter
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/sslproto.py", line 534, in data_received
    ssldata, appdata = self._sslpipe.feed_ssldata(data)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/sslproto.py", line 188, in feed_ssldata
    self._sslobj.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 975, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/bin/slack-to-discord", line 8, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/slack_to_discord.py", line 540, in main
    run_import(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/slack_to_discord.py", line 520, in run_import
    client.run(token, reconnect=False, log_handler=None)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/client.py", line 828, in run
    asyncio.run(runner())
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/client.py", line 817, in runner
    await self.start(token, reconnect=reconnect)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/client.py", line 745, in start
    await self.login(token)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/client.py", line 580, in login
    data = await self.http.static_login(token)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/http.py", line 801, in static_login
    data = await self.request(Route('GET', '/users/@me'))
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/http.py", line 624, in request
    async with self.__session.request(method, url, **kwargs) as response:
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/client.py", line 1141, in __aenter__
    self._resp = await self._coro
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/client.py", line 536, in _request
    conn = await self._connector.connect(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 540, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 901, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
    raise last_exc
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 982, in _wrap_create_connection
    raise ClientConnectorCertificateError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')]

Import failed with missing key

Error message:

Traceback (most recent call last):
  File "/usr/local/bin/slack-to-discord", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.11/site-packages/slack_to_discord/__main__.py", line 27, in main
    run_import(
  File "/usr/local/lib/python3.11/site-packages/slack_to_discord/importer.py", line 566, in run_import
    raise client._exception
  File "/usr/local/lib/python3.11/site-packages/slack_to_discord/importer.py", line 409, in on_ready
    await self._run_import(g)
  File "/usr/local/lib/python3.11/site-packages/slack_to_discord/importer.py", line 477, in _run_import
    for msg in slack_channel_messages(self._data_dir, chan_name, self._users, emoji_map, pins):
  File "/usr/local/lib/python3.11/site-packages/slack_to_discord/importer.py", line 172, in slack_channel_messages
    for d in sorted(data, key=lambda x: x["ts"]):
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/slack_to_discord/importer.py", line 172, in <lambda>
    for d in sorted(data, key=lambda x: x["ts"]):
                                        ~^^^^^^
KeyError: 'ts'

Cannot install on macos 11.6 with Python 3.6.8

When following the instructions on the README, namely pip3 install slack-to-discord, I get this error from pip:

WARNING: Ignoring invalid distribution -umpy (/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages)
WARNING: Ignoring invalid distribution -umpy (/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages)
Collecting slack-to-discord
  Using cached slack_to_discord-1.1.4-py3-none-any.whl (16 kB)
Collecting urllib3<2.0.0,>=1.26.12
  Downloading urllib3-1.26.16-py2.py3-none-any.whl (143 kB)
     |████████████████████████████████| 143 kB 3.9 MB/s
Collecting slack-to-discord
  Using cached slack_to_discord-1.1.3-py3-none-any.whl (16 kB)
  Using cached slack_to_discord-1.1.2-py3-none-any.whl (16 kB)
  Using cached slack_to_discord-1.1.1-py3-none-any.whl (13 kB)
  Using cached slack_to_discord-1.1.0-py3-none-any.whl (13 kB)
  Using cached slack_to_discord-1.0.1-py3-none-any.whl (10 kB)
  Using cached slack_to_discord-1.0.0-py3-none-any.whl (10 kB)
ERROR: Cannot install slack-to-discord==1.0.0, slack-to-discord==1.0.1, slack-to-discord==1.1.0, slack-to-discord==1.1.1, slack-to-discord==1.1.2, slack-to-discord==1.1.3 and slack-to-discord==1.1.4 because these package versions have conflicting dependencies.

The conflict is caused by:
    slack-to-discord 1.1.4 depends on discord.py<3.0.0 and >=2.0.0
    slack-to-discord 1.1.3 depends on discord.py<3.0.0 and >=2.0.0
    slack-to-discord 1.1.2 depends on discord.py<3.0.0 and >=2.0.0
    slack-to-discord 1.1.1 depends on discord.py<3.0.0 and >=2.0.0
    slack-to-discord 1.1.0 depends on discord.py<3.0.0 and >=2.0.0
    slack-to-discord 1.0.1 depends on discord.py<3.0.0 and >=2.0.0
    slack-to-discord 1.0.0 depends on discord.py<3.0.0 and >=2.0.0

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies
WARNING: Ignoring invalid distribution -umpy (/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages)
WARNING: Ignoring invalid distribution -umpy (/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages)

When attempting to install from the GH clone, pip3 install, I get this:

WARNING: Ignoring invalid distribution -umpy (/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages)
WARNING: Ignoring invalid distribution -umpy (/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages)
Processing /Users/oubiwann/lab/lfe/slack-to-discord
  Preparing metadata (setup.py) ... done
ERROR: Could not find a version that satisfies the requirement discord.py<3.0.0,>=2.0.0 (from slack-to-discord) (from versions: 0.1.0, 0.2.0, 0.2.1, 0.3.0, 0.3.1, 0.4.0, 0.4.1, 0.5.0, 0.5.1, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.7.0, 0.8.0, 0.9.0, 0.9.1, 0.9.2, 0.10.0, 0.11.0, 0.12.0, 0.13.0, 0.14.0, 0.14.1, 0.14.2, 0.14.3, 0.15.0, 0.15.1, 0.16.0, 0.16.1, 0.16.2, 0.16.3, 0.16.4, 0.16.5, 0.16.6, 0.16.7, 0.16.8, 0.16.9, 0.16.10, 0.16.11, 0.16.12, 1.0.0, 1.0.1, 1.1.0, 1.1.1, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.4.0, 1.4.1, 1.4.2, 1.5.0, 1.5.1, 1.6.0, 1.7.0, 1.7.1, 1.7.2, 1.7.3)
ERROR: No matching distribution found for discord.py<3.0.0,>=2.0.0
WARNING: Ignoring invalid distribution -umpy (/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages)
WARNING: Ignoring invalid distribution -umpy (/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages)

Is it possible to change the author of the message?

One limitation is that currently the authorship of the new message belongs to the bot.

image

Can the author of the message be made to be the same as the original Slack message? And if so, do you plan to do it in an upcoming version?

I'm asking because as it's a third person message (a bot) I can't edit it on Discord even though I'm the person who wrote it on Slack.

I guess it's not possible to change the bot icon and replace it in Discord with the original author's icon, right?
Thanks in advance

Message formatting is lost when splitting large messages

When importing a large formatted message like a code block, the message splitter doesn't terminate and resume formatting on each resulting message so the format is lost, i.e. something like:

long code block 1/2

long code block 2/2

Gets converted into:

```
long code block 1/2


long code block 2/2
```

Problem with the Guild

Hello. I'm using the py script to do an export to Slack, but it gives me an error right at the last step

Exception: Guild 'number_of_mi_server' not accessible to the bot. Available guild(s): 'name_of_my_server'

The bot is registered in Discord before that process.
The problem is that I actually pass the server ID value to it, but it says it doesn't exist and returns the server name. But that name also corresponds to that ID.
problem_slack_discord

Unable to handle private channels out of the box

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
    }
}
]

Shard ID None heartbeat blocked

Thanks for your work on this! I've tried a few slack to discord tools and this is the only one I could actually get working.

I got part way through an import, then it stalled and I started getting this (repeats every 10 seconds):

2022-10-08 09:31:45 WARNING discord.gateway Shard ID None heartbeat blocked for more than 35830 seconds. Loop thread traceback (most recent call last): File "/Users/benishs/opt/anaconda3/bin/slack-to-discord", line 8, in <module> sys.exit(main()) File "/Users/benishs/opt/anaconda3/lib/python3.8/site-packages/slack_to_discord.py", line 584, in main run_import( File "/Users/benishs/opt/anaconda3/lib/python3.8/site-packages/slack_to_discord.py", line 563, in run_import client.run(token, reconnect=False, log_handler=None) File "/Users/benishs/opt/anaconda3/lib/python3.8/site-packages/discord/client.py", line 828, in run asyncio.run(runner()) File "/Users/benishs/opt/anaconda3/lib/python3.8/asyncio/runners.py", line 43, in run return loop.run_until_complete(main) File "/Users/benishs/opt/anaconda3/lib/python3.8/asyncio/base_events.py", line 603, in run_until_complete self.run_forever() File "/Users/benishs/opt/anaconda3/lib/python3.8/asyncio/base_events.py", line 570, in run_forever self._run_once() File "/Users/benishs/opt/anaconda3/lib/python3.8/asyncio/base_events.py", line 1859, in _run_once handle._run() File "/Users/benishs/opt/anaconda3/lib/python3.8/asyncio/events.py", line 81, in _run self._context.run(self._callback, *self._args) File "/Users/benishs/opt/anaconda3/lib/python3.8/site-packages/discord/client.py", line 409, in _run_event await coro(*args, **kwargs) File "/Users/benishs/opt/anaconda3/lib/python3.8/site-packages/slack_to_discord.py", line 420, in on_ready await self._run_import(g) File "/Users/benishs/opt/anaconda3/lib/python3.8/site-packages/slack_to_discord.py", line 518, in _run_import sent = await self._send_slack_msg(ch_send, msg) File "/Users/benishs/opt/anaconda3/lib/python3.8/site-packages/slack_to_discord.py", line 442, in _send_slack_msg for attempt in file_upload_attempts(data): File "/Users/benishs/opt/anaconda3/lib/python3.8/site-packages/slack_to_discord.py", line 368, in file_upload_attempts fp=io.BytesIO(urllib.request.urlopen(url).read()), File "/Users/benishs/opt/anaconda3/lib/python3.8/urllib/request.py", line 222, in urlopen return opener.open(url, data, timeout) File "/Users/benishs/opt/anaconda3/lib/python3.8/urllib/request.py", line 525, in open response = self._open(req, data) File "/Users/benishs/opt/anaconda3/lib/python3.8/urllib/request.py", line 542, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "/Users/benishs/opt/anaconda3/lib/python3.8/urllib/request.py", line 502, in _call_chain result = func(*args) File "/Users/benishs/opt/anaconda3/lib/python3.8/urllib/request.py", line 1393, in https_open return self.do_open(http.client.HTTPSConnection, req, File "/Users/benishs/opt/anaconda3/lib/python3.8/urllib/request.py", line 1354, in do_open r = h.getresponse() File "/Users/benishs/opt/anaconda3/lib/python3.8/http/client.py", line 1332, in getresponse response.begin() File "/Users/benishs/opt/anaconda3/lib/python3.8/http/client.py", line 303, in begin version, status, reason = self._read_status() File "/Users/benishs/opt/anaconda3/lib/python3.8/http/client.py", line 264, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") File "/Users/benishs/opt/anaconda3/lib/python3.8/socket.py", line 669, in readinto return self._sock.recv_into(b) File "/Users/benishs/opt/anaconda3/lib/python3.8/ssl.py", line 1241, in recv_into return self.read(nbytes, buffer) File "/Users/benishs/opt/anaconda3/lib/python3.8/ssl.py", line 1099, in read return self._sslobj.read(len, buffer)

Is there anything I can do to make it recover and continue the import? (It's still going, at the moment.)

If I re-run slack-to-discord will it ignore the channels / messages it has already imported, or do I need to start over? When I first tried to run slack-to-discord I attempted to remove some unneeded channel directories from the Slack export archive (unzipped, removed some directories, re-zipped), but slack-to-discord wouldn't start – an error about not finding the Users file. It would only work with the original exported .zip from Slack. So removing the already imported channels from that export doesn't seem to be an option.

Anything I can do to prevent this from happening again next time I run it?

Thanks,

Scott

Maximum number of active threads reached

I got this error yesterday after importing a bunch of channels & messages – I tried again today and it imported some messages, but didn't even get through an entire channel before it happened again:

2022-10-09 11:26:01 CRITICAL slack_to_discord Failed to finish import! Traceback (most recent call last): File "/Users/benishs/opt/anaconda3/lib/python3.8/site-packages/slack_to_discord.py", line 420, in on_ready await self._run_import(g) File "/Users/benishs/opt/anaconda3/lib/python3.8/site-packages/slack_to_discord.py", line 525, in _run_import thread = await sent.create_thread(name=thread_name) File "/Users/benishs/opt/anaconda3/lib/python3.8/site-packages/discord/message.py", line 1208, in create_thread data = await self._state.http.start_thread_with_message( File "/Users/benishs/opt/anaconda3/lib/python3.8/site-packages/discord/http.py", line 744, in request raise HTTPException(response, data) discord.errors.HTTPException: 400 Bad Request (error code: 160006): Maximum number of active threads reached

Any ideas?

Thanks,

Scott

Properly handle threads

Now that Discord supports threads the script should use them instead of prepending message from Slack threads with a >>>>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.