Using pyproject.toml to Configure Menus

General global settings within the library can be configured with a pyproject.toml file in your root directory.

Everything should be listed under a [dpymenus] header.

General

VariableTypeDefaultDescription
history-cache-limitint10Limit on the history cache. 0 disables.
hide-warningsboolFalseShows/hides library warnings in the console.
reply-as-defaultboolFalseEnables/disables the Discord reply feature.
button-delayfloat0.35Delay, in milliseconds, between adding buttons to a page.
timeoutint120Duration, in seconds, before a menu is timed out and closed.

Sessions

VariableTypeDefaultDescription
allow-session-restoreboolFalseEnables/disabled the session restore feature.
sessions-per-channelint1Limits sessions per channel.
sessions-per-guildint3Limits sessions per guild.
sessions-per-userint10Limits sessions per user.
session-timeoutint3600Duration, in seconds, before sessions are removed from the store.

Constants

VariableTypeDefault
constants-confirmList[str]['y', 'yes', 'ok', 'k', 'kk', 'ready', 'rdy', 'r', 'confirm', 'okay']
constants-denyList[str]['n', 'no', 'deny', 'negative', 'back', 'return']
constants-quit'List[str]['e', 'exit', 'q', 'quit', 'stop', 'x', 'cancel', 'c']
constants-buttonsList[str]['⏮️', '◀️', '⏹️', '▶️', '⏭️']

*See the **next page *for detailed information on constants.

Example File

[dpymenus]
history-cache-limit = 10
sessions-per-channel = 1
sessions-per-guild = 3
sessions-per-user = 10
session-timeout = 3600
allow-session-restore = false
hide-warnings = false
reply-as-default = false
button-delay = 0.35
timeout = 120
constants-confirm = ['yes', 'y']
constants-deny = ['no', 'n']
constants-quit = ['quit', 'q']
constants-buttons = ['⏮️', '⬅️️', '🛑', '➡️️', '⏭️']