Activities
This module contains activites that the bot can perform.
- class bobbot.activities.Activity(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
Enum
Valid activities for the bot.
- CHESS = 'chess'
- EAT = 'eat'
- HANGMAN = 'hangman'
- LEAGUE = 'league'
- SCHOOL = 'school'
- SHOWER = 'shower'
- SLEEP = 'sleep'
- bobbot.activities.configure_chess(elo: int, against_computer: bool) None [source]
Configures the chess activity.
- Parameters:
elo – Bob’s elo rating. Should be in [200, 1600].
against_computer – Whether Bob is playing against the computer or a user.
- bobbot.activities.configure_hangman(new_theme: str, timed: bool = False, new_hint_prompt: str | None = None, new_only_hint: bool = True, helpfulness_mult: float = 1.0, time_per_answer: int = 30) None [source]
Configures the hangman game.
- bobbot.activities.configure_school(duration: float, task: str | None = None) None [source]
Configures the length of the school day.
- async bobbot.activities.get_activity_status() str [source]
Returns a readable version of the current activity status directed at Bob.
- async bobbot.activities.hangman_on_message(message: str) str | None [source]
Handles a message during a hangman game.
- async bobbot.activities.spectate_activity() list[str] | Path | None [source]
Returns a path to an image or list of messages for the current activity (if available).
- async bobbot.activities.start_activity(activity: Activity, cmd_handler: Callable) bool [source]
Starts the given activity.
- Parameters:
activity – The activity to start.
cmd_handler – The callback to send commands directed at Bob. The callback should be an async function that accepts exactly one string argument. If the activity fails to start, it will be called with the reason. Otherwise, it will be called the activity goes on and important things happen. Optionally, it can have a second boolean argument, which specifies when a response from the user is expected. If True, the returned string from the callback is used as the response.
- Returns:
Whether the activity successfully began running.