Core interface for Hikari’s configuration dataclasses.

Module Contents#

class hikari.api.config.CacheComponents[source]#

Bases: hikari.internal.enums.Flag

Flags to control the cache components.


Fully enables the cache.


Enables the DM channel IDs cache.


Enables the emojis cache.


Enables the guild cache.


Enables the guild channels cache.


Enables the guild stickers cache.


Enables the guild threads cache.


Enables the invites cache.


Enables the me cache.


Enables the members cache.


Enables the messages cache.

NONE = 0[source]#

Disables the cache.


Enables the presences cache.


Enables the roles cache.


Enables the voice states cache.

class hikari.api.config.CacheSettings[source]#

Bases: abc.ABC

Settings to control the cache.

abstract property components: CacheComponents[source]#

Cache components to use.

abstract property only_my_member: bool[source]#

Reduce the members cache to only the bot itself.

Useful when only the bot member is required (eg. permission checks). This will have no effect if the members cache is not enabled.

Defaults to False.

class hikari.api.config.HTTPSettings[source]#

Bases: abc.ABC

Settings to control HTTP clients.

abstract property max_redirects: int | None[source]#

Behavior for handling redirect HTTP responses.

If a int, allow following redirects from 3xx HTTP responses for up to this many redirects. Exceeding this value will raise an exception.

If None, then disallow any redirects.

The default is to disallow this behavior for security reasons.

Generally, it is safer to keep this disabled. You may find a case in the future where you need to enable this if Discord change their URL without warning.


This will only apply to the REST API. WebSockets remain unaffected by any value set here.

abstract property ssl: ssl.SSLContext[source]#

SSL context to use.

This may be assigned a bool or an ssl.SSLContext object.

If assigned to True, a default SSL context is generated by this class that will enforce SSL verification. This is then stored in this field.

If False, then a default SSL context is generated by this class that will NOT enforce SSL verification. This is then stored in this field.

If an instance of ssl.SSLContext, then this context will be used.


Setting a custom value here may have security implications, or may result in the application being unable to connect to Discord at all.


Disabling SSL verification is almost always unadvised. This is because your application will no longer check whether you are connecting to Discord, or to some third party spoof designed to steal personal credentials such as your application token.

There may be cases where SSL certificates do not get updated, and in this case, you may find that disabling this explicitly allows you to work around any issues that are occurring, but you should immediately seek a better solution where possible if any form of personal security is in your interest.

class hikari.api.config.ProxySettings[source]#

Bases: abc.ABC

Settings for configuring an HTTP-based proxy.

abstract property trust_env: bool[source]#

Toggle whether to look for a netrc file or environment variables.

If True, and no url is given on this object, then HTTP_PROXY and HTTPS_PROXY will be used from the environment variables, or a netrc file may be read to determine credentials.

If False, then this information is instead ignored.

abstract property url: None | str[source]#

Proxy URL to use.

If this is None then no explicit proxy is being used.