Microservice bot

Plan of building a discord microservice bot, as described in Microservice Bots

๐Ÿ”ต Discord

๐ŸŒ Gateway

gateway discord docs

๐Ÿ›  Use:
  • Source of events
  • Small set of actions
  • Initial data
    • guilds & their properties
๐Ÿ”— Connection
  • type
    • websocket (json/etf)
    • decompress packages? โ†’ zlib/zlib-stream
  • how
    1. IDENTIFY โ†’ new session
    2. 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โ€ฆ

๐Ÿ“ Architecture

Stack