discord-gateway-client

command module
v0.0.0-...-b468efb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2019 License: MIT Imports: 15 Imported by: 0

README

ProjectHOLO Discord Gateway Client

Lightweight Golang Discord client that receives incoming events from the Discord gateway and sends them to a STOMP broker. Useful for creating distributed and highly-available bots for Discord.

Rolling restarts can be performed on worker code without affecting shard availability, and events can be balanced between all workers.

Events are serialized into the JSON format outlined below and passed over a STOMP connection to a message broker (such as ActiveMQ or RabbitMQ) to be processed by your own workers.

If you are looking for a compatible worker framework, this organization maintains https://github.com/project-holo/discord-worker-framework, which consumes the format that this project produces.

Usage
  1. Build it: go build -o discord-gateway-client
  2. discord-gateway-client --token "Bot TOKEN_HERE" --broker "stomp://login:passcode@host:port/host"
  3. If you'd prefer to use environment variables or would like shard configuration, check init() in discord-gateway-client.go
  4. If you want debug lines in console, set -d true or DEBUG=true
  5. Consume events from /events on the virtual host of the broker (unless you changed the destination)
Serialization Format (JSON)
{
  "type": "string" // event type (e.g. MESSAGE_CREATE)
  "shard_id": int, // shard ID
  "data": { ... } // event data, whatever is serialized from DiscordGo
}
Serializes the Following Events
  • READY
  • RESUMED
  • CHANNEL_CREATE
  • CHANNEL_UPDATE
  • CHANNEL_DELETE
  • GUILD_CREATE
  • GUILD_UPDATE
  • GUILD_DELETE
  • GUILD_BAN_ADD
  • GUILD_BAN_REMOVE
  • GUILD_EMOJIS_UPDATE
  • GUILD_INTEGRATIONS_UPDATE
  • GUILD_MEMBER_ADD
  • GUILD_MEMBER_REMOVE
  • GUILD_MEMBER_UPDATE
  • GUILD_MEMBERS_CHUNK
  • GUILD_ROLE_CREATE
  • GUILD_ROLE_UPDATE
  • GUILD_ROLE_DELETE
  • MESSAGE_CREATE
  • MESSAGE_UPDATE
  • MESSAGE_DELETE
  • MESSAGE_DELETE_BULK (Discord doesn't send this anymore)
  • PRESENCE_UPDATE
  • TYPING_START
  • USER_SETTINGS_UPDATE
  • USER_UPDATE
  • VOICE_STATE_UPDATE
  • VOICE_SERVER_UPDATE
License

A copy of the MIT license can be found in LICENSE.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL