server module#
- 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.
- class TwitchConn(*args, **kwargs)[source]#
Bases:
Bot
- async event_ready()[source]#
-
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]#
-
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.
- channel:
- 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]#
-
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
- 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 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>
- async quote_stuff(ctx: Context | Context, arg: str = 'random', *rest)[source]#
Edit the quote database or pull a specific or random quote.
- async clip_cmd(ctx: Context | Context, arg: str = 'random', *rest: str)[source]#
Add a new clip or find a clip.
- async help_cmd(ctx: Context | Context, name: str = '')[source]#
Find help on the various commands in the bot.
- async now_playing(ctx: Context | Context)[source]#
Return the currently-playing song on Spotify (if any).
- 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 what_if_box(ctx: Context | Context, save: Savefile)[source]#
Tell us what the Pandora’s Box gave us.
- 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 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 modifiers(ctx: Context | Context, save: Savefile)[source]#
List all custom modifiers for 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 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 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 mastered_stuff(ctx: Context | Context, *card: str)[source]#
Tell us whether a certain card or relic is mastered.