https://github.com/cryptiklemur/gateway
https://github.com/cryptiklemur/gateway
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/cryptiklemur/gateway
- Owner: cryptiklemur
- Created: 2017-10-14T16:45:39.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-14T16:46:16.000Z (over 8 years ago)
- Last Synced: 2025-02-01T15:45:18.569Z (over 1 year ago)
- Language: Elixir
- Size: 23.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Gateway
This is the umbrella project containing Mee6's real-time Discord stuff. Events are broadcasted through redis's pubsub facility.
## Events
Each events are in the form
```json
{
"t": "EVENT_TYPE",
"d": "some data",
"g": 159962941502783488,
"s": [0, 256],
"ts": 1507970959017
}
```
- `t` is the event type (events types are listed below)
- `d` is the data sent with the events (generally an object)
- `g` is a guild snowflake id (optional)
- `s` is a [shard_id, shard_count] info (optional)
- `ts` is the timestamp when the event has been sent
Every guild related events listed bellow do not have a `s` parameter. The way the gateway is made, guilds don't know which shard they belong to.
Events are broadcasted to channels in the form `gateway.event.{event_type}` where `event_type` is actually what we call t here.
## Events List
### GUILD_JOIN
Guild Join Structure
Field
Type
Description
id
snowflake
Guild's id
name
string
Guild's name
icon
string
Icon hash
owner_id
snowflake
Owner's user id
roles
id_map
Map of discord roles
large
bool
Whether it's a large guild
unavailable
bool
Whether the guild is unavailable
channels
id_map
Map of discord channels
### GUILD_UPDATE
Same as Guild Join structure
### GUILD_LEAVE
Same as Guild Leave structure
### GUILD_MEMBER_UPDATE
Contains a Discord Member
### GUILD_MEMBER_JOIN
Contains a Discord member
### GUILD_MEMBER_UPDATE
Contains a list of Discord member
### GUILD_MEMBER_LEAVE
Contains a Discord member
### MESSAGE_CREATE
Guild Join Structure
Field
Type
Description
id
snowflake
Guild's id
name
string
Guild's name
icon
string
Icon hash
owner_id
snowflake
Owner's user id
roles
id_map
Map of discord roles
large
bool
Whether it's a large guild
unavailable
bool
Whether the guild is unavailable
channels
id_map
Map of discord channels
### COMMAND_EXECUTE
Same structure as Message Create with 2 addition fields:
- command_name `string`
- text `string`
For example if someone sends `!foo bar hello world` the command_name would be `!foo` and text would be `bar hello world`