Skip to content

Extension: faq

Ersatz edited this page Mar 8, 2023 · 3 revisions

faq

Allows frequently asked questions (FAQ) to be registered and queried.

Options

  • database: DatabaseOptions: The database configuration. This must be set explicitly, as it otherwise defaults to an in-memory cache that does not persist data.
  • allow_prefix: bool = True: Whether to allow FAQ queries using a shortcut prefix pattern.
  • allow_match: bool = True: Whether to allow FAQ queries using an inline match pattern.
  • match_cap: int = 3: The maximum number of FAQs returned by an inline match.
  • query_cap: int = 10: The maximum number of FAQs that can be searched for in one command.

Commands

User commands

These commands are available to all regular users.

faq <query>

Show a frequently asked question (FAQ).

faqs

Manage FAQs.

faqs search <query>

Search through FAQs.

This will list up to query_cap matching FAQs by searching through their keys, aliases, and tags.

faqs details <name>

Show the details of a FAQ.

Note that name must match exactly with either the FAQ's key or one of its aliases.

Administrator commands

These commands are available to administrators of the guild.

Note that a FAQ key is effectively a human-readable ID, and a name is either the key or an alias. All FAQ keys must be unique within the guild.

faqs add <key> <content>

Adds a FAQ with the given content directly. The original message link will point to the message that invoke this command.

faqs add <key> <message_link>

Adds a FAQ with content extracted from the message at message_link. The original message link will be set to message_link.

faqs remove <name>

Removes the FAQ, after prompting for confirmation.

faqs modify content <name> <content>

Sets the FAQ's content.

faqs modify link <name> <message_link>

Sets the FAQ's original message link.

faqs modify aliases <name> [aliases...]

Sets the FAQ's aliases. (Whitespace-delimited; use quotes " to escape.)

faqs modify tags <name> [tags...]

Sets the FAQ's tags. (Whitespace-delimited; use quotes " to escape.)

faqs options prefix show|set|clear <prefix>

Shows/sets/clears the guild's FAQ shortcut prefix pattern. This allows FAQs to be queried with the shorthand <prefix><query>. For example: the prefix \?(\w+) will cause the message ?foo to return the FAQ foo.

faqs options match show|set|clear <match>

Shows/sets/clears the guild's FAQ inline match pattern (regex). If set, every message will be scanned for FAQ queries using the match pattern and up to match_cap resulting FAQs will be returned. Empty queries will be silently ignored.

Clone this wiki locally