fileCache

fun fileCache(path: Path = getDefaultCachePath(), block: ReceiverConsumer<FileApplicationCommandsCacheConfigBuilder> = ReceiverConsumer.noop())(source)

Configures a file-based cache for application commands, which helps avoid request to Discord as commands do not need to be updated most of the time.

This is the default cache strategy, however, if you use a database I'd recommend using databaseCache, as it would be more resilient to write issues.

Cache path

The default cache folder is at:

  • Windows: %AppData%/BotCommands

  • Unix: /var/tmp/BotCommands

Each application has a folder inside it, meaning you can safely share this folder with other applications.

Docker

If your app runs in a container, you will need to change the path to a volume (recommended) or a bind-mount, you can alternatively use databaseCache with a separate PostgreSQL service.

Parameters

path

The folder in which to save application commands

See also