Skip to content

Instantly share code, notes, and snippets.

@PiotrCzapla
Last active February 22, 2018 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PiotrCzapla/5be38688bb13d2df6d80c799d7b71398 to your computer and use it in GitHub Desktop.
Save PiotrCzapla/5be38688bb13d2df6d80c799d7b71398 to your computer and use it in GitHub Desktop.
Import Discord Messages to Slack

How To

First you have to download your messages in json format, this bookmarklet works like a charm: https://dht.chylex.com/ You will end up with file like this:

{
  "meta": {
    "users": {}
    .....
  },
  "data": {
    "377219647788941312": {
      "416188803078815744": {
        "u": 0,
        "t": 1519297543068,
        "m": "a first message of 0"
      },
      .....

Then convert the json file to a csv recognized by slack. It should looks like this:

"1519297543068","channel", "marcin","a first message of 0"

You can use the script below. It converts only first conversation / channel though:

infile="discord.json" # Change me to your discord file
outfile="discord-slack.csv" 

import json
import os

with open(infile,"rt") as f;
   l = json.load(f)

mess = list(list(l["data"].values())[0].values())
data = [(m["t"], "discord-archive", m["u"], m["m"] + " "+str(m.get("a",""))) for m in mess ]
with open(outfile,'wt') as out:
    csv_out=csv.writer(out)
    csv_out.writerows(data)   

Then go to Slack https://< your org>.slack.com/services/import select CSV/Text File, upload the file and start importing. Btw The import takes ages. In my case 5k messages took over an hour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment