Coder Social home page Coder Social logo

rocketprogrammer / patchcord Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dolfies/patchcord

0.0 0.0 0.0 2.09 MB

Implementation of Discord's backend. Improvement on https://gitlab.com/litecord/litecord.

License: GNU General Public License v3.0

JavaScript 0.02% Python 96.59% CSS 0.13% HTML 1.07% PLpgSQL 2.20%

patchcord's Introduction

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 and litecord serviced.

Other than implementing various features, Patchcord aims to integrate client functionality and various QoL improvements into Litecord for educational purposes.
Credits to Displunger.

Important Note

This project is for educational purposes and open-sourced so other cool people can observe and improve the project in collaboration with us. Our instance is private and at this time we are not providing selfhosting support.

Wait, two other Litecords?

The first version is litecord-reference, written in Python and used MongoDB as storage. It was rewritten into "litecord serviced" so that other developers could help writing it, defining a clear protocol between components (litebridge). Sadly, it didn't take off, so I (Luna), that wrote the other two, took a shot at writing it again. It works.

This is "Litecord" / "litecord". There are no rewrites planned (for now :>).

Project Goals

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

Caveats

  • Unit testing is incomplete.
  • Currently, there are no plans to support video in voice chats, or the Discord Store.
  • Many things are non-performant, deviate from the Discord API, are incomplete, etc.
  • Compatibility is preferred to accuracy. Because of this, many duplicate/deprecated fields exist in the API.

Implementation status, AKA "Does it work?"

The following "core features" are implemented to an useful degree in Litecord:

  • Guilds, Text Channels, Messages
  • Roles, Channel Overwrites, Emojis
  • Member Lists (from lazy guilds)

Tracking routes such as /api/science have dummy implementations.

Also consider that reimplementing the Discord API is a moving target, as Discord can implement new features at any time, for any reason. The following are not implemented, for example:

  • Threads
  • Auto moderation
  • Server boosts

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 solely 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.9+
  • PostgreSQL (tested using 9.6+), SQL knowledge is recommended.
  • gifsicle for GIF emoji and avatar handling
  • poetry

Optional requirement:

Download the code

$ git clone https://github.com/dolfies/patchcord.git && cd patchcord

Install packages

$ poetry install

Setting up the database

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

# Create the PostgreSQL database.
$ createdb litecord

Copy the config.example.py file and edit it to configure your instance ( postgres credentials, etc):

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

Then, you should run database migrations:

$ poetry run ./manage.py migrate

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).

$ poetry 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/v9/gateway endpoint. For basic websocket testing, a tool such as ws can be used.

After checking that it actually works, docs/operating.md continues on common operations for a Litecord instance.

Updating

Update the code and run any new database migrations:

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

Running tests

# Install tox:
$ pip install tox

# Run lints and tests:
$ tox

patchcord's People

Contributors

applebee1558 avatar bluenix2 avatar chiggy-playz avatar cloudrac3r avatar cynosphere avatar dolfies avatar gtsatsis avatar hampuskraft avatar jane0009 avatar lexisother avatar lun-4 avatar motiond3v avatar mstrodl avatar notnite avatar rocketprogrammer avatar slice avatar splatterxl avatar tilda avatar tttie avatar twilight-sparkle-irl avatar ui0ppk avatar uwueviee avatar whoturnedthelightson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.