richfromm / slack2discord

A Discord client that imports Slack-exported JSON chat history to Discord channel(s).
GNU General Public License v3.0
8 stars 3 forks source link

remove discord bot, using a discord client instead #4

Closed richfromm closed 2 years ago

richfromm commented 2 years ago

This is a major refactoring, originally mentioned in https://github.com/thomasloupe/Slackord/issues/8, that was one of the primary reasons for the hard fork.

Rather than having a bot which triggers a command to post the parsed Slack messages to a Discord channel when !slackord is typed in the channel, pass a channel id to the script and have the script directly post to that channel.

Eventually we will support fetching the channel id based on channel name, multiple channels per run, and channel renames from slack to discord, but that is all out of scope for here.

The code is no longer in a single script, but the parser (SlackParser) and client (DiscordClient) code are in separate modules moved down a level in the dir hierarchy into a slack2discord package. Note that these intentionally are not generic. They exist to facilitate exporting messages from slack and importing them into discord.

The template for the discord client (which is a subclass of discord.Client) was copied from https://github.com/Rapptz/discord.py/blob/master/examples/background_task_asyncio.py as of https://github.com/Rapptz/discord.py/commit/abeea73734938cf7ce34854070b3d95d89466a11

This PR also includes a minor bugfix to a formatting error in the message posted to discord in the root of the orphaned thread case, that was introduced in the previous PR.