evennia.help.manager¶
Custom manager for HelpEntry objects.
-
class
evennia.help.manager.
HelpEntryManager
(*args, **kwargs)[源代码]¶ 基类:
evennia.typeclasses.managers.TypedObjectManager
This HelpEntryManager implements methods for searching and manipulating HelpEntries directly from the database.
These methods will all return database objects (or QuerySets) directly.
Evennia-specific: find_topicmatch find_apropos find_topicsuggestions find_topics_with_category all_to_category search_help (equivalent to evennia.search_helpentry)
-
find_topicmatch
(topicstr, exact=False)[源代码]¶ Searches for matching topics or aliases based on player’s input.
- 参数
topcistr (str) – Help topic to search for.
exact (bool, optional) – Require exact match (non-case-sensitive). If False (default), match sub-parts of the string.
- 返回
matches (HelpEntries) – Query results.
-
find_apropos
(topicstr)[源代码]¶ Do a very loose search, returning all help entries containing the search criterion in their titles.
- 参数
topicstr (str) – Search criterion.
- 返回
matches (HelpEntries) – Query results.
-
find_topicsuggestions
(topicstr)[源代码]¶ Do a fuzzy match, preferably within the category of the current topic.
- 参数
topicstr (str) – Search criterion.
- 返回
matches (Helpentries) – Query results.
-
find_topics_with_category
(help_category)[源代码]¶ Search topics having a particular category.
- 参数
help_category (str) – Category query criterion.
- 返回
matches (HelpEntries) – Query results.
-
get_all_categories
()[源代码]¶ Return all defined category names with at least one topic in them.
- 返回
matches (list) –
- Unique list of category names across all
topics.
-
all_to_category
(default_category)[源代码]¶ Shifts all help entries in database to default_category. This action cannot be reverted. It is used primarily by the engine when importing a default help database, making sure this ends up in one easily separated category.
- 参数
default_category (str) – Category to move entries to.
-
search_help
(ostring, help_category=None)[源代码]¶ Retrieve a search entry object.
- 参数
ostring (str) – The help topic to look for.
category (str) – Limit the search to a particular help topic
- 返回
Queryset – An iterable with 0, 1 or more matches.
-
create_help
(key, entrytext, category='General', locks=None, aliases=None, tags=None)[源代码]¶ Create a static help entry in the help database. Note that Command help entries are dynamic and directly taken from the __doc__ entries of the command. The database-stored help entries are intended for more general help on the game, more extensive info, in-game setting information and so on.
- 参数
key (str) – The name of the help entry.
entrytext (str) – The body of te help entry
category (str, optional) – The help category of the entry.
locks (str, optional) – A lockstring to restrict access.
aliases (list of str, optional) – List of alternative (likely shorter) keynames.
tags (lst, optional) – List of tags or tuples (tag, category).
- 返回
help (HelpEntry) – A newly created help entry.
-