Skip to content
This repository was archived by the owner on May 11, 2024. It is now read-only.

Repository files navigation

@vexera/cache

Discord State Cache written in Typescript.


@vexera/cache is a library for processing Discord state events and updating an external cache accordingly.

Usage

constcache=newCache({
redis,caches: {channels: newMongoDB.ChannelCache(db.collection('channels')),guilds: newMongoDB.GuildCache(db.collection('guilds')),members: newMongoDB.MemberCache(db.collection('members')),users: newMongoDB.UserCache(db.collection('users')),voiceStates: newMongoDB.VoiceStateCache(db.collection('voiceStates')),},send(shardID,event){shards.get(shardID).send(event);}});shards.on('event',(shardID,event)=>{cache.receive({ ...event,shard_id: shardID});});

See a larger, real example

Usage Notes

  • All events should be sent with a shard_id field, an integer of the shard id that the event came from.
  • A IDENTIFYING event should be sent when the shard has started identifying with the Discord gateway.

About

Discord State Cache

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages