Go to file
Luna 1bb2a46d9e checks: add only kwarg to filter allowed channels in route
- dm_channels: add channel_check usage
2019-02-08 18:40:21 -03:00
attachments add attachments folder with .gitkeep 2018-12-08 23:22:38 -03:00
images all: add guild icon support 2018-11-13 21:12:40 -03:00
litecord checks: add only kwarg to filter allowed channels in route 2019-02-08 18:40:21 -03:00
manage cmd.tests: add discrim to setup_tests 2019-02-05 19:23:39 -03:00
static index: fix typo and move to nodeinfo 2.1 url 2019-02-07 18:37:37 +00:00
tests all: update copyright year 2019-01-26 19:25:46 -03:00
.gitignore gitignore: add attachments folder 2018-12-08 23:23:08 -03:00
.gitlab-ci.yml .gitlab-ci.yml: add gifsicle to main apk add command 2018-11-21 20:08:19 -03:00
LICENSE LICENSE: make it gplv3-only 2018-12-06 19:02:03 -03:00
Pipfile embed.sanitizer: add fetch_metadata function 2018-12-05 02:42:00 -03:00
Pipfile.lock embed.sanitizer: add fetch_metadata function 2018-12-05 02:42:00 -03:00
README.md move the package installation step to before setting up DB and migrations 2019-02-01 20:55:21 +00:00
__init__.py all: add GPL header 2018-12-07 02:14:58 -03:00
config.ci.py config.{ci,example}.py: update copyright year 2019-01-26 19:28:51 -03:00
config.example.py config.{ci,example}.py: update copyright year 2019-01-26 19:28:51 -03:00
discord_endpoints.txt small fixes 2018-12-03 01:46:37 +01:00
ecosystem.config.js add ecosystem.config.js 2019-02-02 02:53:30 -03:00
manage.py all: update copyright year 2019-01-26 19:25:46 -03:00
nginx.conf nginx: add directives for .well-known and nodeinfo 2018-12-06 17:44:50 -03:00
requirements.txt Pipfile: add pyflakes 2018-11-12 18:11:04 -03:00
run.py add dm_channels blueprint 2019-02-08 18:20:26 -03:00
schema.sql Remove a stray comma which caused errors upon import 2019-01-26 14:00:24 +00:00
setup.py all: add GPL header 2018-12-07 02:14:58 -03:00
tox.ini tox.ini: use py3.7 due to pipfile requiring it 2018-12-02 19:49:12 -03:00

README.md

Litecord logo

Litecord is an open source, clean-room design reimplementation of Discord's HTTP API and Gateway in Python 3.

This project is a rewrite of litecord-reference.

Project Goals

  • Being able to unit test bots in an autonomous fashion.
  • Doing research and exploration on the Discord API.

Non-goals

  • Being used as a "self-hostable Discord alternative".

Caveats

  • Unit testing is incomplete.
  • Currently, there are no plans to support voice chat.
  • You must figure out how to connect to a Litecord instance. Litecord will not distribute official client code from Discord nor provide ways to modify the official client.

Liability

We (Litecord and contributors) are not liable for usage of this software, valid or invalid. If you intend to use this software as a "self-hostable Discord alternative", you are soely responsible for any legal action delivered by Discord if you are using their assets, intellectual property, etc.

All referenced material for implementation is based off of official Discord API documentation or third party libraries (such as Eris).

Installation

Requirements:

  • Python 3.7+
  • PostgreSQL (tested using 9.6+)
  • gifsicle for GIF emoji and avatar handling
  • pipenv

Download the code

$ git clone https://gitlab.com/litecord/litecord.git && cd litecord

Install packages

$ pipenv install --dev

Setting up the database

It's recommended to create a separate user for the litecord database.

# Create the PostgreSQL database.
$ createdb litecord

# Apply the base schema to the database.
$ psql -f schema.sql litecord

Then, you should run database migrations:

$ pipenv run ./manage.py migrate

Configuring

Copy the config.example.py file and edit it to configure your instance:

$ cp config.example.py config.py
$ $EDITOR config.py

Running

Hypercorn is used to run Litecord. By default, it will bind to 0.0.0.0:5000. This will expose your Litecord instance to the world. You can use the -b option to change it (e.g. -b 0.0.0.0:45000).

$ pipenv run hypercorn run:app

You can use --access-log - to output access logs to stdout.

It is recommended to run litecord behind NGINX. You can use the nginx.conf file at the root of the repository as a template.

Does it work?

You can check if your instance is running by performing an HTTP GET request on the /api/v6/gateway endpoint. For basic websocket testing, a tool such as ws can be used.

Updating

Update the code and run any new database migrations:

$ git pull
$ pipenv run ./manage.py migrate

Running tests

Running tests involves creating dummy users with known passwords. Because of this, you should never setup a testing environment in production.

# Setup any testing users:
$ pipenv run ./manage.py setup_tests

# Install tox:
$ pip install tox

# Run lints and tests:
$ tox