Searchable Quotes

Description

Remember some words from a quote, but don’t remember what number it was? Search your quotes! These quote commands support a few extra ways to retrieve quotes, including search terms, phrases, position from the end of the list, as well as keeping the old reliable methods of retrieving quotes by their number, or randomly.

You can also chose between using Streamer.bot’s built in stable quote Ids, which don’t change if you delete a quote in the middle of the list, or a sequential quote numbering mode, which automatically fill the gaps in quote numbers that removed quotes would otherwise leave behind.

Requires Streamer.bot 1.0.0+ for the new quote Sub-Actions and methods.

Import File

searchable_quotes_1-3-0.sb (15.9 KB)

Installation

In Streamer.bot click the Import button in the top menu. Drag the .sb file into the Import String field.

Configuration

Quote Numbering Modes

There are two options for quote numbering, “Stable” and “Sequential” The default is “Stable”

Stable Quote Numbering

This mode is the default, and directly maps to the ID in Services > Quotes.
The advantage of this is that if you delete quote #3, quote #4 does not change, however, quote #3 remains a nonexistent quote unless you manually re-index your quotes.

You can manually re-index your quotes via the context menu in Services > Quotes.

Sequential Quote Numbering

Since there is no way to automatically re-index quotes, you can optionally switch to the Sequential numbering mode to emulate this behaviour.
In this mode, when you delete quote #3, quote #4 immediately moves up to take its place, avoiding any gaps between quote numbers. This transformation is non-destructive, and switching back to “Stable” numbering mode will revert to using their original quote ID

You can switch between quote numbering modes at any point by testing the “Test” trigger in the Setup and Code action or by running !quoteMode as the broadcaster.

Show Images

image

Responses

If you would like to change the text or behaviour of any of the error cases, it is handled in via the cases in Quote Display’s Sub-Actions:

Show Details


Some alternative groups are already provided, simply change which ones are enabled. Otherwise replace them with whatever you’d like.

Some variables will be set depending on what the search outcome was, and can be used in the output messages.

Show Variables
Variable Name Contains Available in Outcomes
%quoteDisplayNumber% The quote’s display number
(Accurate for both modes)
Success
QuoteIdOutOfRange (Last Quote #)
NegativeQuoteIdOutOfRange (First Quote #)
%selectedQuoteId% The ID of the returned quote Success
%firstQuoteId% The ID of the first quote Always
%lastQuoteId% The ID of the last quote Always
%quoteCount% The total number of quotes Always

Commands

The following commands are not case sensitive, capitalization is for clarity.

Command Description
!quote term Get a random quote that contains “term”
!quote term1 term2 Get a random quote with all terms
Especially useful if you saved quotes with a user attributed
!quote "search phrase" Treats quoted text as a single search term
Can be combined with regular terms
e.g. !quote "the answer" douglas
!quote -1 Returns the last quote, (-2 for the second to last, etc.)
!quote 3 Gets quote number 3 (obeying quote numbering mode)
!quote Gets random quote
!quoteDel 42
!delQuote 42
Deletes quote number 42 (obeying quote numbering mode)
!addQuote quote text
!quoteAdd quote text
Adds new quote
!quoteMode Displays current quote numbering mode
!quoteMode stable Sets current quote numbering mode to “Stable”
!quoteMode sequential Sets current quote numbering mode to “Sequential”

Default Command Permissions

Quote Display commands can be run by anyone
Quote Add and Quote Delete commands can be run by moderators
Quote Numbering Mode commands can be run only by broadcaster

Testing Phase Log

Version 1.2.1

  • changed Action and Command group names from Quotes to Searchable Quotes

Version 1.3.0

  • Added FileWrittenTime metadata check on quotes.dat file in order to detect a manual re-index

Absolutely outstanding. thank you for this gift.

1 Like