server module#

class Formatter[source]#

Bases: Formatter

parse(format_string: str) Generator[tuple[str, str | None, str | None, None]][source]#
format_field(value: Callable, call_args: str) str[source]#
readline(file: str) str[source]#
load(loop: AbstractEventLoop)[source]#
add_cmd(name: str, *, aliases: list[str] = None, source: str = None, flag: str = None, burst: int = None, rate: float = None, output: str)[source]#
command(name: str, *aliases: str, flag: str = '', force_argcount: bool = False, burst: int = 1, rate: float = 3.0, twitch: bool = True, discord: bool = True)[source]#

This decorator builds TwitchCommand and DiscordCommand versions of commands while leaving the original functions untouched.

with_savefile(name: str, *aliases: str, optional_save: bool = False, **kwargs)[source]#

Decorator for commands that require a save.

slice_command(name: str, *aliases: str, **kwargs)[source]#
mt_command(name: str, *aliases: str, **kwargs)[source]#
class TwitchConn(*args, **kwargs)[source]#

Bases: Bot

async refresh_spotify_token()[source]#
async spotify_call()[source]#
async eventsub_setup()[source]#
async event_ready()[source]#

|coro|

Event called when the Bot has logged in and is ready.

Example#

@bot.event()
async def event_ready():
    print(f'Logged into Twitch | {bot.nick}')
async event_raw_usernotice(channel: Channel, tags: dict)[source]#

|coro|

Event called when a USERNOTICE is received from Twitch. Since USERNOTICE’s can be fairly complex and vary, the following sub-events are available:

event_usernotice_subscription() : Called when a USERNOTICE Subscription or Re-subscription event is received.

Tip

For more information on how to handle USERNOTICE’s visit: https://dev.twitch.tv/docs/irc/tags/#usernotice-twitch-tags

Parameters#

channel: Channel

Channel object relevant to the USERNOTICE event.

tagsdict

A dictionary with the relevant information associated with the USERNOTICE. This could vary depending on the event.

async event_subscription(user: Chatter, channel: Channel, total: int, consecutive: int | None, subtype: str)[source]#
async event_ritual(user: Chatter, channel: Channel, tags: dict)[source]#
async event_new_chatter(user: Chatter, channel: Channel, message: str)[source]#
async event_raid(user: Chatter, channel: Channel, viewer_count: int)[source]#
class AppClient(token: str, *, prefix: str | list | tuple | set | Callable | Coroutine, client_secret: str = None, initial_channels: list | tuple | Callable = None, heartbeat: float | None = 30.0, retain_cache: bool | None = True, **kwargs)[source]#

Bases: Bot

async event_token_expired()[source]#

|coro|

A special event called when the oauth token expires. This is a hook into the http system, it will call this when a call to the api fails due to a token expiry. This function should return either a new token, or None. Returning None will cause the client to attempt an automatic token generation.

Note

This event is a callback hook. It is not a dispatched event. Any errors raised will be passed to the event_error() event.

class EventSubBot(token: str, *, prefix: str | list | tuple | set | Callable | Coroutine, client_secret: str = None, initial_channels: list | tuple | Callable = None, heartbeat: float | None = 30.0, retain_cache: bool | None = True, **kwargs)[source]#

Bases: Bot

async event_eventsub_notification_stream_start(evt: StreamOnlineData)[source]#
async event_eventsub_notification_stream_end(evt: StreamOfflineData)[source]#
class DiscordConn(command_prefix: PrefixType[BotT], *, help_command: Optional[HelpCommand] = <default-help-command>, tree_cls: Type[app_commands.CommandTree[Any]] = <class 'discord.app_commands.tree.CommandTree'>, description: Optional[str] = None, intents: discord.Intents, **options: Any)[source]#

Bases: Bot

async on_message(message: Message)[source]#
dispatch(name, /, *args, **kwargs)[source]#
class Timer(name: str, interval: int, *, loop=None)[source]#

Bases: object

set_routine()[source]#
async before_ready()[source]#
async on_error(error: Exception)[source]#
start()[source]#
stop()[source]#
async timers_list(ctx: Context | Context)[source]#
async timer_cmd(ctx: Context | Context, action: str, name: str, *args: str)[source]#

Manipulate the timers. Syntax:

  • create <name> [interval]

    will create a new timer with the name and the given interval, if specified. It has no other effect.

  • add <name> <commands>

    will add all of the commands (space-separated) to the timer name - it does not start the timer. If it is running, it will seamlessly integrate the new command at the current point in the rotation.

  • remove <name> <commands>

    will remove all of the commands (space-separated) to the timer name - it does not stop or delete the timer.

  • delete <name> completely removes a timer and associated commands.

    This cannot be undone.

  • auto <name> [interval]

    creates a new timer with the given interval, if specified, and exactly one command name. It immediately starts it. This is basically used for single-command sponsored timers and the like. The internal timer name will start with auto_, followed by the command name, and can be edited normally afterwards. It will automatically delete itself when the stream ends.

  • status <name>

    outputs the commands and interval tied to this timer.

  • start <name>

    starts the given timer.

  • stop <name>

    stops the given timer.

  • interval <name> <interval>

    changes the interval of an existing timer. This will have some weird double-send glitch if editing the interval of a running timer, but is mostly fine otherwise.

async command_cmd(ctx: Context | Context, action: str, name: str, *args: str)[source]#

Syntax: command <action> <name> [+flag] <output>

class Quote(line: str, author: str | None, added_by: str, ts: datetime)[source]#

Bases: object

to_json()[source]#
async get_raw_quotes(req: Request)[source]#
async quote_stuff(ctx: Context | Context, arg: str = 'random', *rest)[source]#

Edit the quote database or pull a specific or random quote.

async setup_clips()[source]#
class Clip(data: Clip, added_by: str, tags: Iterable[str])[source]#

Bases: object

property cf_tags#
to_json()[source]#
async get_clip_info(url: str) Clip[source]#
async clip_cmd(ctx: Context | Context, arg: str = 'random', *rest: str)[source]#

Add a new clip or find a clip.

async bot_cmd(ctx: Context | Context)[source]#

Give general information on the bot itself.

async help_cmd(ctx: Context | Context, name: str = '')[source]#

Find help on the various commands in the bot.

async shoutout(ctx: Context | Context, name: str)[source]#

Give a shoutout to a fellow streamer.

async stream_title(ctx: Context | Context)[source]#

Display the current stream title.

async stream_uptime(ctx: Context | Context)[source]#

Display the stream uptime.

async start_prediction(ctx: Context, title: str, outcomes: list[str], duration: int)[source]#
async resolve_prediction(index: int)[source]#
async auto_resolve_pred(run: RunParser)[source]#
async handle_prediction(ctx: Context, type: str = 'info', *args: str)[source]#
async now_playing(ctx: Context | Context)[source]#

Return the currently-playing song on Spotify (if any).

async now_playing_client(req: Request)[source]#
async giveaway_handle(ctx: Context | Context, count: int = 1)[source]#

Manage a giveaway.

async giveaway_enter(ctx: Context | Context)[source]#

Enter into the current giveaway.

async card_info(ctx: Context | Context, *line: str, _cache={})[source]#
async mt_info(ctx: Context | Context, *line: str)[source]#
async card_with_art(ctx: Context | Context, *line: str)[source]#
async save_cache(ctx: Context | Context, save: Savefile, arg: str, *args: str)[source]#
async bluekey(ctx: Context | Context, save: Savefile)[source]#

Display what was skipped for the Sapphire key.

async cards_removed(ctx: Context | Context, save: Savefile)[source]#

Display which cards were removed.

async neowbonus(ctx: Context | Context, save: Savefile)[source]#

Display what the Neow bonus was.

async neow_skipped(ctx: Context | Context, save: Savefile)[source]#
async what_if_box(ctx: Context | Context, save: Savefile)[source]#

Tell us what the Pandora’s Box gave us.

async seed_cmd(ctx: Context | Context, save: Savefile)[source]#

Display the run’s current seed.

async is_seeded(ctx: Context | Context, save: Savefile)[source]#

Display whether the current run is seeded.

async run_playtime(ctx: Context | Context, save: Savefile)[source]#

Display the current playtime for the run.

async shop_removal_cost(ctx: Context | Context, save: Savefile)[source]#

Display the current shop removal cost.

async shop_prices(ctx: Context | Context, save: Savefile)[source]#

Display the current shop price ranges.

async campfire_heal(ctx: Context | Context, save: Savefile)[source]#

Display the current heal at campfires.

async nloth_traded(ctx: Context | Context, save: Savefile)[source]#

Display which relic was traded for N’loth’s Gift.

async event_likelihood(ctx: Context | Context, save: Savefile)[source]#

Display current event chances for the various possibilities in ? rooms.

async rare_card_chances(ctx: Context | Context, save: Savefile)[source]#

Display the current chance to see rare cards in rewards and shops.

async relic_info(ctx: Context | Context, save: Savefile, index: int = 0)[source]#

Display information about the current relics.

async relics_page2(ctx: Context | Context, save: Savefile)[source]#

Display the relics on page 2.

async seen_relic(ctx: Context | Context, save: Savefile, *relic: str)[source]#

Output whether a given relic has been seen.

async skipped_boss_relics(ctx: Context | Context, save: Savefile)[source]#

Display the boss relics that were taken and skipped.

async bottled_cards(ctx: Context | Context, save: Savefile)[source]#

List all bottled cards.

async modifiers(ctx: Context | Context, save: Savefile)[source]#

List all custom modifiers for the run.

async score(ctx: Context | Context, save: Savefile)[source]#

Display the current score of the run

async mt_clans(ctx: Context | Context, save: MonsterSave)[source]#
async mt_mutators(ctx: Context | Context, save: MonsterSave)[source]#
async mt_challenge(ctx: Context | Context, save: MonsterSave)[source]#
async mt_artifact(ctx: Context | Context, save: MonsterSave, index: int = 0)[source]#
async mt_pyre(ctx: Context | Context, save: MonsterSave)[source]#
async curses(ctx: Context | Context, save: CurrentRun)[source]#

Display the current run’s curses.

async items(ctx: Context | Context, save: CurrentRun)[source]#

Display the current run’s unequipped items.

async fairy_released(ctx: Context | Context)[source]#

Get the count of fairy that have been released after the Heart.

async get_last(ctx: Context | Context, arg1: str = '', arg2: str = '')[source]#

Get the last run/win/loss.

async get_last_run(ctx: Context | Context)[source]#

Get the last run.

async get_last_win(ctx: Context | Context)[source]#

Get the last win.

async get_last_loss(ctx: Context | Context)[source]#

Get the last loss.

async next_run(ctx: Context | Context)[source]#

Return which character is next in the rotation.

async wall_card(ctx: Context | Context)[source]#

Fetch the card in the wall for the ladder savefile.

async set_run_stats_by_date(ctx: Context | Context, date_string: str)[source]#

Update the default range for the run stats by date, this is separate from the all-time stats run cache.

async calculate_wins_cmd(ctx: Context | Context, date_string: str | None = None)[source]#

Display the cumulative number of wins for an optional date range.

async calculate_losses_cmd(ctx: Context | Context, date_string: str | None = None)[source]#

Display the cumulative number of losses for an optional date range.

async streak_display(ctx: Context | Context, new: str)[source]#

Change the !streak command display.

async calculate_streak_cmd(ctx: Context | Context)[source]#

Display Baalor’s current streak for Ascension 20 Heart kills.

async calculate_pb_cmd(ctx: Context | Context, date_string: str | None = None)[source]#

Display Baalor’s Personal Best streaks for Ascension 20 Heart kills for an optional date range.

async calculate_winrate_cmd(ctx: Context | Context, date_string: str | None = None)[source]#

Display the winrate for Baalor’s A20 Heart kills for an optional date range.

async unmastered(ctx: Context | Context, save: Savefile)[source]#
async mastered_stuff(ctx: Context | Context, *card: str)[source]#

Tell us whether a certain card or relic is mastered.

async current_mastery_check(ctx: Context | Context, save: Savefile)[source]#

Output what cards in the current run can be mastered if won.

async calipers(ctx: Context | Context, save: Savefile | None)[source]#
async active_mods(ctx: Context | Context, save: Savefile)[source]#
async active_mod_info(ctx: Context | Context, save: Savefile, *modname)[source]#
async commands_page(req: Request)[source]#
async individual_cmd(req: Request)[source]#
async check_token_validity(req: Request)[source]#
async get_new_token(req: Request)[source]#
async get_oauth_token()[source]#
async Twitch_startup()[source]#
async Twitch_cleanup()[source]#
async Discord_startup()[source]#
async Discord_cleanup()[source]#
async Youtube_startup()[source]#