Microservice bot
Plan of building a discord microservice bot, as described in Microservice Bots
๐ต Discord
๐ Gateway
๐ Use:
- Source of events
- Small set of actions
- Initial data
- guilds & their properties
๐ Connection
- type
- websocket (json/etf)
- decompress packages? โ zlib/zlib-stream
- how
- IDENTIFY โ new session
- if disconnected โ can RESUME
๐ Limitations
- max 1000x IDENTIFY per 24h (2000 over 100k servers)
- IDENTIFY 5s cooldown
โจ Sharding
= spreading load over pool of connections โ multiple gateway connections, each with subset of whole data
- recommended: 1000 servers/shard
๐ REST API
๐ Use
- execute actions (e.g. send msg)
๐ Limitations
- depend on route, dynamic
- โ use cache to store info
๐พ Cache
store as much info as possible to avoid API calls
e.g.
- users, serversโฆ