Skip to main content

Random Choice Plugin

Return a random element from a list. Display a random quote, fact, emoji, or any other item from a predefined list.

Configurationโ€‹

The Random Choice plugin requires the following setting:

  • options: A list of elements from which the plugin will randomly select. Elements can be strings like quotes, facts, emojis, etc.
  • n: The number of elements to return. Default: 1.
  • with_replacement: Whether elements can be selected more than once. Only applies when n is greater than 1. Default: false.

Usageโ€‹

To use the Random Choice plugin, define a section in your doteki.toml file and provide a list of options. Here's a basic example:

doteki.toml
[sections.random_quote]
plugin = "random_choice"
options = [
"I came to realize, clearly, that mind is no other than mountains and rivers and the great wide earth, the sun and the moon and the stars. โ€” Dลgen Zenji",
"Haven is a distance, not a place. - Carissa's Wierd",
"This is my last message to you: in sorrow, seek happiness. - Fyodor Dostoevsky",
]

The plugin's output will be a randomly selected quote. For example:

This is my last message to you: in sorrow, seek happiness. - Fyodor Dostoevsky

Advanced usageโ€‹

Here's an example using n > 1 and replacement enabled:

doteki.toml
[sections.garden]
plugin = "random_choice"
options = [
"๐ŸŒฒ", "๐ŸŒณ", "๐ŸŒด", "๐ŸŒฑ", "๐Ÿƒ", "๐Ÿ‚", "๐ŸŒฟ",
"๐Ÿชป", "๐Ÿ„", "๐ŸŒท", "๐ŸŒป", "๐ŸŒบ", "๐ŸŽ‹", "โ˜˜๏ธ"
]
n = 10
with_replacement = true
preset = "glue"

The preset glue joins the selected items with no separator. One possible output:

๐ŸŒฒ๐ŸŒบโ˜˜๏ธ๐Ÿ„๐ŸŒฒ๐ŸŒด๐ŸŒบ๐ŸŽ‹๐Ÿ„๐ŸŒบ

Since with_replacement is true, the same emoji can appear more than once.