A discord chat exporter, made in golang

Discord Chat exporter

⚠️ THIS PROJECT IS STILL UNDER DEVELOPMENT, NOT EVEN OUT AS A BETA ⚠️

This is a golang implemintation of a discord chat explorer i found a while back & can't find again

Features

  • Highly configurable
  • No need for dependencies
  • Multiple ways of exporting
  • Allows DM channels to be automatically pulled (without id)
  • Allows filters that aren't mutually exclusive
  • Golang superiority
  • Mass downloads from guild(s)
  • Bloatless

Config

This is configurated through env variables. You can do this either from command line or from the .env file:

  1. TOKEN="..." ID="..." ./
  2. (in .env):
const test = ""
TOKEN="..."
ID="..."

Here are all the available config options:

Value Accepted Values Description Default
IGNORE_ENV_FILE Boolean Type If true, it will not load the .env file. Does not work if it is in the .env file false
ENV_FILENAME Any string The location of the .env file ".env"
TOKEN User Token Type The user token that will be used to download the messages. For more info check faq!
ID_TYPE "USER", "CHANNEL", "GUILD" The type of the ID provided in the next line. If it is USER, it will be taken as a user id, and will pull DM conversations with them. If It's channel, it will download all the messages from that channel id. If type is GUILD, it will get all channels in the guild & export them. Most limits won't work if it's guild (except number of msgs) "CHANNEL"
ID Id Type The Id of the channel or user (specified in above line). Please note that there can be multiple ids here, separated by a space. They all have to be the same type though (think all USER, CHANNEL, or GUILD)
DOWNLOAD_MEDIA Boolean type If true, then it downloads all the media & attachments locally, otherwise it just links to it false
IGNORE_NSFW_CHANNEL Boolean type If true, then it will ignore all automatically fetched channels (ie. from guilds) false
USE_LIMIT_50 Boolean Type If true, it uses limit=50 rather than 100 for message downloading. This is the discord default, so it is technically safer for your account. false
EXPORT_TYPE "TEXT", "JSON", "HTML" The type to be exported as. For more info, check faq! ==TODO== "JSON"
EXPORT_LOCATION Any string The location where this will be exported to. This will create a folder under that name that contains the media (see DOWNLOAD_MEDIA), and the messages. This is templated, and you can use variables. Variables are wrapped in {{$}} (eg. {{$CHANNEL_ID}}), vars are CHANNEL_ID. "output/$CHANNEL_ID" (cross-platform)
EXPORT_HTML_THEME Any string The name of the theme to be used for discord. Pre made options are "light", "dark", "black". There is no guide on custom themes (yet), but look at premade themes "dark"
MSG_LIMIT_NUM any number, or "all" The number of messages to download. If it's "all", then it'll download all the messages "all"
EXPORT_JSON_TOOLS Boolean Type If true, it will export special tools in the json along with messages. {"messages": [Array of messages], "idToIndex": {"MessageId": Index (Number)}, byAuthor: {"AuthorId": [Array of Msg Ids (string)]}, "attachments": [], "attachment_byAuthor": {"AuthorId": IndexOfAttachment (Number)}}. If false, this will only output an array of messages. This is only taken into account if EXPORT_TYPE = "JSON" true
EXPORT_PLAIN_FORMAT Any string A template for how each msg is presented. vars are wrapped in {{$VAR_HERE}} (eg. {{$AUTHOR_ID}}). Available variables are: AUTHOR_NAME, AUTHOR_ID, TIMESTAMP (utc timestamp of the msg), IS_REPLY ("true" if it is replying to a msg), WAS_EDITED, CONTENT (note, in has it has an attachment or sticker CONTENT will be the id/url), HAS_ATTACHMENT, ATTACHMENT_URL (a "," seperated list of urls, which are also enclosed in "", ie. "testtest","testtest2", but w/ urls), IS_STICKER, STICKER_IDS (a "," separated list of sticker IDs). A newline will be added regardless of anything at the end of each entry string
BEFORE_ID nil, Id type Only export messages before this message id. Not mutually exclusive w/ AFTER_ID, however if this one is before AFTER_ID, it will throw errors nil
AFTER_ID nil, Id Type Only export messages after this message id. Not mutually exclusive w/ BEFORE_ID, however if this one is after BEFORE_ID, it will throw errors nil
BEFORE_TIME nil, Timestamp Only export messages before the given time period. Not mutually exclusive with anything, but could throw errors if it is after the AFTER_ID and AFTER_TIME nil
AFTER_TIME nil, Timestamp Only export messages before the given time period. Not mutually exclusive with anything, but could throw errors if it is after the BEFORE_ID and BEFORE_TIME nil

Hera are all the types mentioned:

Type Description Values
Boolean Yes or no Case insensitive, true: "true", "t", "yes", "y", "1". false: "false", "f", "yes", "y", "0"
User Token A user token Any string, that matches a user token reg (ie. starts w/ mfa.)
nil An empty config option. Has no value, or empty string Empty
Id A discord Id (snowflake?) A string of 18 digits
Timestamp A Epoch Unix Timestamp Epoch Unix Timestamp

Setup guide

There are several ways of setting this up. You can either build from source or use pre-built binaries found on the releases section.

Pre-Built

Download the binary from the releases section, with the correct operating system.

Build from source

  1. Clone this repo (git clone https://github.com/ShadiestGoat/DiscordChatExporter)
  2. Move into the directory cd DiscordChatExporter
  3. Install dependencies go get github.com/ShadiestGoat/DiscordChatExporter
  4. Build
    • Either build only for your operating system, go build (optionally use GOOS= + windows, linux or darwin)
    • Or build for all oses, sh ./build.sh

Usage Guide

  1. You need a user token (Why?). How to get one
  2. Set up your env (either .env or through command line) details
  3. Open terminal & navigate to the binary you got (use cd)
  4. Execute the binary.

Faq

Why a user token?

You have to use a user token, since bots are no longer allowed to download messages later than the last 2 weeks.

Discord TOS?

This is technically breaking the discord terms of service, as it is user botting.

However, so far, haven't been banned so make your own conclusions.

Similar Resources

Prometheus exporter for Chia node metrics

chia_exporter Prometheus metric collector for Chia nodes, using the local RPC API Building and Running With the Go compiler tools installed: go build

Sep 19, 2022

Nvidia GPU exporter for prometheus using nvidia-smi binary

Nvidia GPU exporter for prometheus using nvidia-smi binary

nvidia_gpu_exporter Nvidia GPU exporter for prometheus, using nvidia-smi binary to gather metrics. Introduction There are many Nvidia GPU exporters ou

Jan 5, 2023

HBase Exporter,fetch data from jmx for region-level data.

HBase Exporter Prometheus exporter for HBase which fetch data from hbase jmx, written in Go. You can even see region-level metrics. Installation and U

Nov 4, 2022

NVIDIA GPU metrics exporter for Prometheus leveraging DCGM

DCGM-Exporter This repository contains the DCGM-Exporter project. It exposes GPU metrics exporter for Prometheus leveraging NVIDIA DCGM. Documentation

Dec 27, 2022

Prometheus exporter for Amazon Elastic Container Service (ECS)

ecs_exporter 🚧 🚧 🚧 This repo is still work in progress and is subject to change. This repo contains a Prometheus exporter for Amazon Elastic Contai

Nov 27, 2022

Prometheus exporter for DeadMansSnitch

DeadMansSnitch Exporter Prometheus exporter for DeadMansSnitch information (snitches) Configuration Usage: deadmanssnitch-exporter [OPTIONS] Applic

Apr 6, 2022

A prometheus exporter for monitoring FIO nodeos nodes.

A prometheus exporter for monitoring FIO nodeos nodes.

fio-prometheus-exporter This is a simple prometheus exporter for FIO nodeos nodes. It can connect to multiple nodes to display a few critical statisti

Aug 19, 2022

Prometheus exporter for podman

Prometheus exporter for podman Exports the following metrics for each running container CPU Usage Memory Usage Netowrk Usage Block Usage Output Exampl

Jul 5, 2022

A Prometheus exporter which scrapes metrics from CloudLinux LVE Stats 2

A Prometheus exporter which scrapes metrics from CloudLinux LVE Stats 2

CloudLinux LVE Exporter for Prometheus LVE Exporter - A Prometheus exporter which scrapes metrics from CloudLinux LVE Stats 2 Help on flags: -h, --h

Nov 2, 2021
Comments
  • [SECURITY]: Add more headers

    [SECURITY]: Add more headers

    Adding some required headers could make the fetching behavior more "legit".

    It is known that discord use some headers for fingerprinting, and not providing those might flag an account (only a supposition but we are never too safe)

    Here's an example of a "safe" request https://gist.github.com/bytixo/4d70d5711add2685e2bbd36dc99b203c

    These headers are somewhat the same for all the requests.

    Note that the cookies are like a session, you instantiate a new cookie jar to your http.Client, make the request to https://discord.com and you are good to go

    Will try to write an implementation for this.

  • [BUG] Doesn't support discord's new length IDs

    [BUG] Doesn't support discord's new length IDs

    Before submitting this bug, please check the following:

    • [-] I have checked issues, and could not find a similar one
    • [-] I am on the latest version of DiscordChat exporter
    • [-] I have read the relevant wiki pages

    Describe the bug

    Cuts off the last character of Discord IDs, keeping them at 18 digits in length. This only applies to new Discord IDs, 17 and 18 digit ones still work fine

    To Reproduce

    Steps to reproduce the behavior:

    1. Find a channel with an ID that is 19 digits in length, or make a new channel
    2. Run the exporter on that channel
    3. Watch as it cuts off one digit

    Expected behavior Script should still accept 19 digit IDs instead of cutting off the last digit

    Screenshots

    image image

    Desktop (please complete the following information):

    • OS: Windows 10 22H2
Json-log-exporter - A Nginx log parser exporter for prometheus metrics

json-log-exporter A Nginx log parser exporter for prometheus metrics. Installati

Jan 5, 2022
Amplitude-exporter - Amplitude charts to prometheus exporter PoC

Amplitude exporter Amplitude charts to prometheus exporter PoC. Work in progress

May 26, 2022
Vulnerability-exporter - A Prometheus Exporter for managing vulnerabilities in kubernetes by using trivy
Vulnerability-exporter - A Prometheus Exporter for managing vulnerabilities in kubernetes by using trivy

Kubernetes Vulnerability Exporter A Prometheus Exporter for managing vulnerabili

Dec 4, 2022
Netstat exporter - Prometheus exporter for exposing reserved ports and it's mapped process

Netstat exporter Prometheus exporter for exposing reserved ports and it's mapped

Feb 3, 2022
Github billing exporter - Billing exporter for GitHub organizations

GitHub billing exporter Forked From: https://github.com/borisputerka/github_bill

Nov 2, 2022
Chat - Console mode chat done in Go, PHP and MySQL

Chat modo consola hecho en GO y PHP(https://github.com/RicardoValladares/AJAX) G

Nov 10, 2022
exporter for Aliyun CloudMonitor. Written in Golang.

Aliyun CloudMonitor Exporter exporter for Aliyun CloudMonitor. Written in Golang. inspired by aliyun-exporter Develop cd aliyun-exporter make tidy Bui

Dec 12, 2022
A Prometheus exporter, written in Golang, for Magento 2

Magento 2 Prometheus Exporter A Prometheus exporter, written in Golang, for Magento 2. Philosophy It might be abnormal to start with the "philosophy"

May 3, 2022
Goatmo - Dht22 prometheus exporter written in golang

description Prometheus exporter for the DHT22 written in go. usage In order to a

Aug 8, 2022
📡 Prometheus exporter that exposes metrics from SpaceX Starlink Dish
📡  Prometheus exporter that exposes metrics from SpaceX Starlink Dish

Starlink Prometheus Exporter A Starlink exporter for Prometheus. Not affiliated with or acting on behalf of Starlink(™) ?? Starlink Monitoring System

Dec 19, 2022