Skip to content

Transporting Discord messages from one server to another.

Notifications You must be signed in to change notification settings

DevItC/discord-transporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

discord-transporter

Transporting Discord messages from one server to another.

Installation

DISCLAIMER. The following instructions are for a Ubuntu 16.04 LTS machine. The program can run on other distros, but you may have to make slight modifications to the installation procedure to make that happen. Personally I would recommend going with Ubuntu 16.04 LTS, as that is the OS the program was built and tested upon.

STEP 1. Execute the setup.sh script. All this script does is install the required software packages and download the chromedriver and geckodriver executables.

STEP 2. Only if the machine is a server. Execute the vnc.sh script to install tightvnc and xfce desktop environment.

STEP 3. Open Discord using a browser and login manually to the INSERVER Discord server account, i.e. the Discord server from where the messages need to be scraped. You need to do this only once from the machine where this program will be run, to whitelist the machine's IP in Discord. Use VNC to do this step if you're installing the program on a VPS.

Configuring Credentials and Message Flow

You need to edit and configure two YAML files, one containing login credentials, another containing the message flow. Before that, you'll also need to do some groundwork as described below.

Understanding Discord URLs

From the URL of any Discord channel, we can get the server ID and channel ID. The format of the URL is,

https://discordapp.com/channels/SERVER_ID/CHANNEL_ID

Creating Webhooks

The program uses webhooks to post messages to your discord channels. For every discord channel you want to post message to, you have to create a webhook for that. Check out this article for understaning how to create a webhook for your channel.

The program will be needing the URLs of the webhooks, so note them down while you're creating them.

Configuring the Credentials YAML

The format of the file should be like the following.

INSERVER:
  USERNAME: DISCORD_USERNAME
  PASSWORD: DISCORD_PASSWORD
  ID: SERVER_ID

Here the credentials and server ID should be of the INSERVER, i.e. the Discord server from where the messages need to be scraped.

Configuring the Message Flow YAML

message_flow:
  - in: [CHANNEL1_ID, CHANNEL2_ID, CHANNEL3_ID]
    out: WEBHOOK1_URL
  - in: [CHANNEL4_ID]
    out: WEBHOOK2_URL

truncated_words:
  - secretive phrase
  - something offensive

According the above sample YAML, the program will copy messages from channels with IDs CHANNEL1_ID, CHANNEL2_ID and CHANNEL3_ID, and then paste them into the channel with webhook URL WEBHOOK1_URL. It will also copy messages from CHANNEL4_ID channel and paste them into channel with WEBHOOK2_URL webhook.

While transporting the messages, it will censor and omit the phrases "secretive phrase" and "something offensive".

Running

$ python3 bot.py -h
usage: bot.py [-h] [-c CREDS] [-f FLOW] [-b {firefox,chrome}]

optional arguments:
  -h, --help            show this help message and exit
  -c CREDS, --creds CREDS
                        Credentials YAML file. Check README for details.
  -f FLOW, --flow FLOW  Message Flow YAML file. Check README for details.
  -b {firefox,chrome}, --browser {firefox,chrome}
                        Whether to use Firefox or Chrome for scraping.

So considering the credentials and message flow YAML files are saved as creds.yaml and message-flow.yaml respectively, and that we want to use firefox as the scraper, the command we'd use to run the program is the following.

$ python3 bot.py -c creds.yaml -f message-flow.yaml -b firefox

About

Transporting Discord messages from one server to another.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published