gchar.games.dispatch¶
get_character¶
-
gchar.games.dispatch.
get_character
(name: str, allow_fuzzy: bool = False, fuzzy_threshold: int = 80, contains_extra: bool = True, **kwargs) → Optional[gchar.games.base.character.Character][source]¶ Get a character that matches the given name.
- Parameters:
name (str) – The character name.
allow_fuzzy (bool) – Whether to allow fuzzy matching of character names.
fuzzy_threshold (int) – The threshold for fuzzy matching.
contains_extra (bool) – Whether to include extra characters.
kwargs – Additional arguments for character retrieval.
- Returns:
The matching character, or None if not found.
- Return type:
Optional[Character]
- Examples::
>>> from gchar.games import get_character >>> >>> get_character('amiya') <Character R001 - 阿米娅/amiya/アーミヤ, female, 5*****> >>> get_character('surtr') <Character R111 - 史尔特尔/surtr/スルト, female, 6******> >>> get_character('dusk') <Character NM02 - 夕/dusk/シー, female, 6******> >>> get_character('yae_miko') <Character 八重神子/yae_miko/八重神子/やえみこ, female, 5*****, weapon: Weapon.CATALYST, element: Element.ELECTRO>
list_character¶
-
gchar.games.dispatch.
list_character
(name: str, limit: Optional[int] = None, allow_fuzzy: bool = False, fuzzy_threshold: int = 80, **kwargs) → List[gchar.games.base.character.Character][source]¶ List characters that match the given name.
- Parameters:
name (str) – The character name.
limit (Optional[int]) – The maximum number of characters to return.
allow_fuzzy (bool) – Whether to allow fuzzy matching of character names.
fuzzy_threshold (int) – The threshold for fuzzy matching.
kwargs – Additional arguments for character retrieval.
- Returns:
The list of matching characters.
- Return type:
List[Character]
register_game¶
list_available_game_names¶
-
gchar.games.dispatch.
list_available_game_names
() → List[str][source]¶ Get a list of available game names.
- Returns:
The list of game names.
- Return type:
List[str]
- Examples::
>>> from gchar.games import list_available_game_names >>> >>> list_available_game_names() ['arknights', 'azurlane', 'bluearchive', 'fgo', 'genshin', 'girlsfrontline', 'neuralcloud', 'nikke', 'pathtonowhere', 'starrail']
get_character_class¶
-
gchar.games.dispatch.
get_character_class
(game_name: str) → Type[gchar.games.base.character.Character][source]¶ Get the character class for a given game name.
- Parameters:
game_name (str) – The name of the game.
- Returns:
The character class.
- Return type:
Type[Character]
- Raises:
KeyError – If the game is not found.