Utils

class yarsaw.Utils
async format_joke(joke, format_as='{setup}\n{delivery}')

Support function for Client().get_joke(). Auto-format a joke. If its a single type of joke, it returns the joke itself. If its a two-part joke, it returns the setup and delivery, separated by a newline or a character you choose.

Parameters
  • joke (dict) – A dictionary containing the joke.

  • format_as (Optional[str]) – The format to use. Defaults to "{setup}\n{delivery}".

Returns

The formatted joke.

Return type

str

async generate_uid(chars=8, special_chars=False, letters=True)

Support function for Client().get_ai_response(). Generates a random string of characters to be used as a unique identifier for a user.

Parameters
  • chars (Optional[int]) – The number of characters to generate. Defaults to 8.

  • special_chars (Optional[bool]) – Whether or not to include special characters. Defaults to False.

  • letters (Optional[bool]) – Whether or not to include letters. Defaults to True.

Returns

The generated UID.

Return type

str

Pages

  • Welcome to YARSAW! - The main page of the documentation

  • Client - Explains how to use the client - the main class [Very Important]

  • Utils - Extra support functions for Client’s functions