Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CacheKey ¶
type CacheKey uint32
func NewCacheKey ¶
func NewCacheKey() CacheKey
NewCacheKey generates a global cache key unique to each usage of the cache.
type UserClient ¶
type UserClient struct { *api.Client Cache CacheStore // contains filtered or unexported fields }
UserClient provides a small cache on top of common self-identifying endpoints.
func Client ¶
func Client(ctx context.Context) *UserClient
Client gets the Discord API client with the OAuth Bearer token from the cookies set after a redirection. The function requires the RequireOAuth middleware; it panics if the middleware is not used.
func (*UserClient) Guild ¶
Guild overrides the other method to fetch the list and manually search through it. This has to be done because Discord does not allow single guild ID lookup.
The method limits itself to 100 guilds. It also caches, making it thread unsafe.
func (*UserClient) Guilds ¶
func (c *UserClient) Guilds() ([]discord.Guild, error)
Guilds fetches a list of guilds. It is cached, and is therefore not thread-safe. It limits itself to 100 guilds.
func (*UserClient) InvalidateCache ¶
func (c *UserClient) InvalidateCache()
InvalidateCache invalidates the current cache.