Data classes

For convenience, pyBotB provides some data classes that abstract away the basic data structures of BotB. These classes are returned by the BotB API functions.

Dataclasses representing available object types and related enums.

enum pybotb.types.BadgeLevel(value)

Enum for BotBr badge_levels values.

Member Type:

int

Valid values are as follows:

NOT_UNLOCKED = <BadgeLevel.NOT_UNLOCKED: 0>
REGULAR = <BadgeLevel.REGULAR: 1>
BRONZE = <BadgeLevel.BRONZE: 2>
SILVER = <BadgeLevel.SILVER: 3>
GOLD = <BadgeLevel.GOLD: 4>
class pybotb.types.BotBr(aura, aura_color, avatar_url, badge_levels, boons, botbr_class, class_icon, create_date_str, id, laston_date_str, level, name, palette_id, points, points_array, profile_url, _raw_payload=None)

Represents a BotBr.

Properties directly match API data, except where noted otherwise.

Parameters:
aura: str

String representing the aura PNG name for this BotBr; usually the BotBr ID zero- padded to 8 characters.

This is used to calculate the aura URL in BotBr.aura_url.

aura_color: str

Fallback color for the aura, as a hex value (#ffffff).

property aura_url: str

URL to the aura PNG; calculated from BotBr.aura.

This is a pyBotB-specific property.

avatar_url: str

URL to the BotBr’s current avatar.

badge_levels: Dict[str, BadgeLevel]

Dictionary where the key is the format name and the value is the badge level (i.e. regular, bronze, silver, gold); see BadgeLevel for possible values.

This lists unlocked badges, and is not to be confused with badge progress (badge progress points are what unlocks badges). Badge progress is not exposed through the official API and can only be fetched through the TODO method.

boons: float

Amount of boons that the BotBr currently has.

botbr_class: str

The BotBr’s class; i.e., the class that appears next to the level on-site. This class is derived from the highest points in the points array at level-up time.

In the BotB API, this field is named “class”; however, it is renamed here to avoid collisions with the class keyword used by Python.

class_icon: str

String containing HTML div representing the icon. This is BotB-specific and likely of not much use to implementations.

create_date_str: str

String representing the creation date of the BotBr’s account, in YYYY-MM-DD format, in the US East Coast timezone (same as all other dates on-site).

The creation date is also converted to a datetime for developer convenience; see BotBr.create_date.

property create_date: datetime

Account creation date as a datetime object.

For the raw string, see BotBr.create_date_str.

id: int

The BotBr’s ID.

laston_date_str: str

String representing the date on which the BotBr was last seen on the site, in YYYY-MM-DD format, in the US East Coast timezone (same as all other dates on- site).

The last-on date is also converted to a datetime for developer convenience; see BotBr.laston_date.

property laston_date: datetime

Last seen date as a datetime object.

For the raw string, see BotBr.laston_date_str.

level: int

The BotBr’s current level.

name: str

The BotBr’s username.

palette_id: int

The ID of the palette used by the BotBr.

points: int

The total amount of points amassed by the BotBr. (This number is always >= 0).

points_array: Dict[str, int]

Dictionary with class name as the key and the amount of points as the value. See https://battleofthebits.com/lyceum/View/BotBr%20Classes for an overview of classes.

Notes:

  • Some old BotBrs might have lowercase class points - these are counted separately.

  • There is also a bugged out empty point class, which is also counted separately (see https://battleofthebits.com/barracks/Profile/atropine/) - this might break if you do a boolean comparison against the class name!

  • Individual point counts may be negative numbers (e.g. latist points which are always below 0, but also e.g. -5 class points for having an entry with no votes) - however, these do not sum up into the score in the points variable.

profile_url: str

The URL to the BotBr’s profile.

classmethod from_payload(payload)

Convert a JSON payload (provided as a dict) into a BotBr object.

Parameters:

payload (dict) – Dictionary containing the JSON payload.

Return type:

Self

Returns:

The resulting BotBr object.

class pybotb.types.BotBrPoints(amount, botbr_id, id, type, _raw_payload=None)

Represents the point stats for a single BotBr, for a specific class.

Parameters:
amount: int

Amount of points of the given type.

botbr_id: int

ID of the BotBr who the points belong to.

id: int

ID of the BotBrPoints object.

type: str

The type/class name of the points.

classmethod from_payload(payload)

Convert a JSON payload (provided as a dict) into a BotBr object.

Parameters:

payload (dict) – Dictionary containing the JSON payload.

Return type:

Self

Returns:

The resulting BotBr object.

enum pybotb.types.Medium(value)

Enum for different medium types; not to be confused with formats.

The numerical values are pyBotB-specific; on the Entry, object, this value is derived from “medium_audio”, “medium_visual”, etc. properties of the API.

Member Type:

str

Valid values are as follows:

OTHER = <Medium.OTHER: 'other'>
AUDIO = <Medium.AUDIO: 'audio'>
VISUAL = <Medium.VISUAL: 'visual'>
class pybotb.types.Format(description, icon, icon_url, id, medium, maxfilesize, maxfilesize_human, point_class, title, token, _raw_payload=None)

Represents a format.

Parameters:
description: str

Short description of the format.

icon: str

The HTML representation of the icon, likely not of use to implementations.

icon_url: str

The direct URL to the icon for this format (with https://battleofthebits.com prefix).

id: int

ID of the format.

medium: Medium

Medium the format belongs to.

maxfilesize: int

Maximum file size in bytes.

maxfilesize_human: str

Maximum file size in a human-readable format,

point_class: str

Which class this format gives points of.

title: str

Title of the format.

token: str

Token of the format.

This is a short, lowercase identifier used in lieu of the identifier in many APIs.

classmethod from_payload(payload)

Convert a JSON payload (provided as a dict) into a Format object.

Parameters:

payload (dict) – Dictionary containing the JSON payload.

Return type:

Self

Returns:

The resulting Format object.

enum pybotb.types.BattlePeriod(value)

String enum containing battle period values.

Member Type:

str

Valid values are as follows:

WARMUP = <BattlePeriod.WARMUP: 'warmup'>
ENTRY = <BattlePeriod.ENTRY: 'entry'>
VOTE = <BattlePeriod.VOTE: 'vote'>
TALLY = <BattlePeriod.TALLY: 'tally'>
END = <BattlePeriod.END: 'end'>
class pybotb.types.Battle(id, title, url, profile_url, cover_art_url, botbr_id, hosts_names, type, entry_count, start_str, end_str, format_tokens, period=None, period_end_str=None, _raw_payload=None)

Represents a battle.

Parameters:
id: int

ID of the battle.

title: str

Title of the battle.

url: str

URL to the battle.

profile_url: str

URL to the entry list page of the battle.

cover_art_url: str

Full URL to the battle cover art (with https://battleofthebits.com prefix).

botbr_id: int

ID of the BotBr hosting this battle. In the case of battles with multiple hosts (some majors do this), this is set to 1 (TODO verify?).

hosts_names: str

String containing names of battle hosts, joined with a “ + “ sign.

type: int

The battle’s “type” attribute.

The value is set to 3 for XHBs; all other values are majors. Known non-XHB type values:

  • 0 and 1 are used for various majors

  • 2 was used for some “3xTheme Battle” majors and the “48 Hour Game Jam I” major

  • 4 was used for the “Doom” major

  • 25 was used for the “BotB Advent Calendar 2020” major

In any case, it is safe to assume that any type value other than 3 means it’s not an XHB.

property is_xhb: bool

Whether or not this battle is an X Hour Battle/minor battle.

Returns:

True if the battle is an XHB, False otherwise.

property is_major: bool

Whether or not this battle is a major battle.

Returns:

True if the battle is a major, False otherwise.

entry_count: int

Amount of entries submitted.

start_str: str

String representing the date and time at which the battle starts, in YYYY-MM-DD HH:MM:SS format, in the US East Coast timezone (same as all other dates on the site).

The start date is also converted to a datetime for developer convenience; see start.

property start: datetime

Last seen date as a datetime object.

For the raw string, see start_str.

end_str: str

String representing the date and time at which the battle ends, in YYYY-MM-DD HH:MM:SS format, in the US East Coast timezone (same as all other dates on the site).

If period is “vote”, this signifies the end of the voting period.

The end date is also converted to a datetime for developer convenience; see Battle.end.

property end: datetime

Date and time at which the battle ends.

If period is “vote”, this signifies the end of the voting period.

For the raw string, see end_str.

format_tokens: List[str]

List of format tokens for this battle. For XHBs, this will contain one item; for majors, there may be more formats.

period: Optional[BattlePeriod] = None

Current battle period. “warmup” for upcoming battles, “entry” for entry period, “vote” for voting period, “end” for end period.

Some endpoints (e.g. Battle objects in Entry.battle) do not return this value; in this case, use pybotb.botb.BotB.battle_load() to get the full battle info.

period_end_str: Optional[str] = None

String representing the date and time at which the battle ends, in YYYY-MM-DD HH:MM:SS format, in the US East Coast timezone (same as all other dates on the site).

For major battles, this signifies the “final results” datetime; for the current battle period’s end date, see period_end.

The end date is also converted to a datetime for developer convenience; see end.

property period_end: datetime | None

Date and time at which the current battle period ends.

If period is “vote”, this signifies the period_end of the voting period.

For the raw string, see period_end_str.

classmethod from_payload(payload)

Convert a JSON payload (provided as a dict) into a Battle object.

Parameters:

payload (dict) – Dictionary containing the JSON payload.

Return type:

Self

Returns:

The resulting Battle object.

class pybotb.types.EntryAuthor(aura, aura_color, avatar, avatar_from_time, botbr_class, class_icon, country_code, country_name, id, level, name, profile_url, _raw_payload=None)

Represents an entry author, as returned in the “authors” field of the entry API.

Parameters:
  • aura (str)

  • aura_color (str)

  • avatar (str)

  • avatar_from_time (str)

  • botbr_class (str)

  • class_icon (str)

  • country_code (str)

  • country_name (str)

  • id (int)

  • level (int)

  • name (str)

  • profile_url (str)

  • _raw_payload (dict | None)

aura: str

String representing the aura PNG name for this BotBr; usually the BotBr ID zero- padded to 8 characters.

This is used to calculate the aura URL in aura_url.

aura_color: str

Fallback color for the aura, as a hex value (#ffffff).

property aura_url: str

URL to the aura PNG; calculated from aura.

This is a pyBotB-specific property.

avatar: str

Relative URL to the BotBr’s current avatar (/disk/…)

avatar_from_time: str

Relative URL to the BotBr’s avatar at the time of the entry’s submission (/disk/…)

botbr_class: str

The BotBr’s class; i.e., the class that appears next to the level on-site. This class is derived from the highest points in the points array at level-up time.

In the BotB API, this field is named “class”; however, it is renamed here to avoid collisions with the class keyword used by Python.

class_icon: str

String containing HTML div representing the icon. This is BotB-specific and likely of not much use to implementations.

country_code: str

The country code of the author.

country_name: str

The country name of the author.

id: int

The author’s BotBr ID.

level: int

The author’s current level.

name: str

The author’s username.

profile_url: str

The full URL to the author’s BotB profile.

classmethod from_payload(payload)

Convert a JSON payload (provided as a dict) into an EntryAuthor object.

Parameters:

payload (dict) – Dictionary containing the JSON payload.

Return type:

Self

Returns:

The resulting EntryAuthor object.

class pybotb.types.Entry(authors, authors_display, botbr_id, botbr, battle_id, battle, datetime_str, datetime_display, donloads, donload_url, favs, format_token, format, gov, id, late, medium, plays, posts, q, title, thumbnail_url, votes, view_url, preview_url, length=0, profile_url=None, listen_url=None, play_url=None, youtube_url=None, rank=None, rank_suffix='', rank_display='', score=None, score_display='', trophy_display=None, _raw_payload=None)

Represents a battle entry.

Parameters:
authors: List[EntryAuthor]

List of authors for the entry.

authors_display: str

A string containing the names of all authors joined with a “ + “ symbol.

botbr_id: int

ID of the BotBr who submitted this entry.

botbr: BotBr

The BotBr who submitted this entry.

battle_id: int

ID of the battle this entry was submitted to.

battle: Battle

The battle this entry was submitted to.

datetime_str: str

String representing the submission date of this entry in YYYY-MM-DD HH:MM:SS format, in the US East Coast timezone (same as all other dates on the site).

The creation date is also converted to a datetime for developer convenience; see Entry.datetime.

property datetime: datetime

Account creation date as a datetime object.

For the raw string, see Entry.datetime_str.

datetime_display: str

The submission date in a human-readable format, as displayed on BotB.

Like the datetime string, this is stored in the US East Coast timezone; implementations will likely want to create their own string based on the Entry.datetime property.

donloads: int

Amount of downloads the entry has (note the deliberate typo).

property downloads: int

Longhand for “donloads”, for spelling convenience.

donload_url: str

Relative URL to the entry source file, for downloading (note the deliberate typo).

property download_url: str

Longhand for “donload_url”, for spelling convenience.

favs: int

Amount of favorites the entry has.

format_token: str

The token of the entry’s format. For a list, see TODO.

format: Format

The entry’s format.

gov: float

???

id: int

ID of the entry.

late: bool

Whether the entry is late or not.

medium: Medium

Medium of the entry; see Medium for possible values.

This is consolidated from “medium_*” variables (“medium_audio”, “medium_visual”, etc.)

plays: int

Amount of plays this entry has.

posts: int

Amount of comments (“posts”) under this entry.

q: int

???

title: str

The entry’s title.

thumbnail_url: str

Relative URL to the entry thumbnail; empty for entries without a thumbnail (i.e. non-visual entries).

votes: int

Amount of votes this entry got.

view_url: str

URL to the player for the entry.

Empty for deleted entries.

preview_url: str

Preview URL.

Empty for deleted entries.

length: float = 0

Length of the entry, in seconds.

Only present for audio entries.

profile_url: Optional[str] = None

URL to the entry’s page on the site.

Not present (None) for entries that have been removed from the site.

listen_url: Optional[str] = None

Relative player URL for the entry (“/player/Entry/{id}” format).

Present for audio and visual entries, except for some non-audio entries with archives or other filetypes. Also not present for non-rendered entries, and not present for entries that have been removed from the site.

play_url: Optional[str] = None

Direct URL to the source file of an audio entry.

None for non-audio entries. (The API returns False for non-audio entries; we turn it to None for API convenience.)

youtube_url: Optional[str] = None

YouTube URL for this entry, if any.

rank: Optional[int] = None

Rank of the entry.

Only present once the battle is over; returns None otherwise.

rank_suffix: str = ''

English plural suffix for the rank (e.g “st” for 1st, “nd” for 2nd, etc.)

If the battle is not over yet, this is an empty string.

rank_display: str = ''

HTML representation of rank; likely not of use to implementations.

If the battle is not over yet, this is “?/{entry count}”.

score: Optional[float] = None

Score of the entry.

Only present once the battle is over; returns None otherwise.

score_display: str = ''

HTML representation of score; likely not of use to implementations.

If the battle is not over yet, this is an empty string.

trophy_display: Optional[str] = None

HTML representation of trophies this entry has.

If the battle is not over yet, this is None. TODO: make a custom prop out of this

classmethod from_payload(payload)

Convert a JSON payload (provided as a dict) into an Entry object.

Parameters:

payload (dict) – Dictionary containing the JSON payload.

Return type:

Self

Returns:

The resulting Entry object.

class pybotb.types.Favorite(id, botbr_id, entry_id, much, _raw_payload=None)

A favorite on an entry.

Parameters:
id: int

ID of the favorite.

botbr_id: int

ID of the BotBr who favorited.

entry_id: int

ID of the favorited entry.

much: int

???

classmethod from_payload(payload)

Convert a JSON payload (provided as a dict) into a Favorite object.

Parameters:

payload (dict) – Dictionary containing the JSON payload.

Return type:

Self

Returns:

The resulting Favorite object.

enum pybotb.types.GroupID(value)

Forum group IDs.

Member Type:

int

Valid values are as follows:

BULLETINS = <GroupID.BULLETINS: 1>
NEWS = <GroupID.NEWS: 2>
INTERNAL = <GroupID.INTERNAL: 3>
ENTRIES = <GroupID.ENTRIES: 4>
BATTLES = <GroupID.BATTLES: 5>
PHOTOS = <GroupID.PHOTOS: 6>
UPDATE_LOG = <GroupID.UPDATE_LOG: 7>
N00B_S0Z = <GroupID.N00B_S0Z: 8>
MAIL = <GroupID.MAIL: 9>
BUG_REPORTS_AND_FEATURE_REQUESTS = <GroupID.BUG_REPORTS_AND_FEATURE_REQUESTS: 10>
SMEESH = <GroupID.SMEESH: 11>
PROJECT_DEV = <GroupID.PROJECT_DEV: 12>
BOTBRS = <GroupID.BOTBRS: 13>
LYCEUM = <GroupID.LYCEUM: 14>
class pybotb.types.GroupThread(id, group_id, title, first_post_timestamp_str, last_post_timestamp_str=None, _raw_payload=None)

A group thread - i.e. a thread in a forum group, containing posts.

Forum threads and BotBr/entry/battle comment threads are all group threads.

Parameters:
  • id (int)

  • group_id (GroupID)

  • title (str)

  • first_post_timestamp_str (str)

  • last_post_timestamp_str (str | None)

  • _raw_payload (dict | None)

id: int

ID of the group thread.

group_id: GroupID

ID of the forum group this thread belongs to; see :enum:.GroupID for possible values.

title: str

Title of the thread.

first_post_timestamp_str: str

Timestamp of the first post in the thread, in YYYY-MM-DD HH:MM:SS format, in the US East Coast timezone (same as all other dates on the site).

property first_post_timestamp: datetime

First post’s timestamp as a datetime object.

For the raw string, see first_post_timestamp_str.

last_post_timestamp_str: Optional[str] = None

Timestamp of the last post in the thread, in YYYY-MM-DD HH:MM:SS format, in the US East Coast timezone (same as all other dates on the site).

None if the thread only contains one post.

property last_post_timestamp: datetime | None

Last post’s timestamp as a datetime object.

None if the thread only contains one post.

For the raw string, see last_post_timestamp_str.

classmethod from_payload(payload)

Convert a JSON payload (provided as a dict) into a Favorite object.

Parameters:

payload (dict) – Dictionary containing the JSON payload.

Return type:

Self

Returns:

The resulting Favorite object.

class pybotb.types.LyceumArticle(id, title, profile_url, text_firki, text_stripped, views)

Represents an article on the Lyceum.

Parameters:
id: int

ID of the article.

title: str

Title of the article.

profile_url: str

URL of the article.

property url: str

Shorthand for :attr:.profile_url.

text_firki: str

The raw text of the article in Firki markup.

text_stripped: str

The raw text of the article, stripped of Firki markup.

views: int

Amount of views this article has.

classmethod from_payload(payload)

Convert a JSON payload (provided as a dict) into a PlaylistToEntry object.

Parameters:

payload (dict) – Dictionary containing the JSON payload.

Return type:

Self

Returns:

The resulting Favorite object.

class pybotb.types.Tag(id, entry_id, tag, _raw_payload=None)

A tag on an entry.

Parameters:
id: int

ID of the tag.

entry_id: int

ID of the entry this tag applies to.

tag: str

The tag applied to the entry.

classmethod from_payload(payload)

Convert a JSON payload (provided as a dict) into a Favorite object.

Parameters:

payload (dict) – Dictionary containing the JSON payload.

Return type:

Self

Returns:

The resulting Favorite object.

class pybotb.types.Palette(id, title, botbr_id, color1, color2, color3, color4, color5, _raw_payload=None)

Color palette.

Parameters:
id: int

ID of the palette.

title: str

Title of the palette.

property css_url

URL to the palette CSS.

This is a CSS file hosted on battleofthebits.com which contains a :root directive with the colors as CSS variables. Each color has its hex code stored in the –colorX variable, with the individual RGB components stored in –colorX_r, –colorX_g and –colorX_b for red, green and blue respectively.

This variable is derived from the ID.

botbr_id: int

ID of the BotBr who made the palette.

color1: str

Color 1 (text), in hex format without “#” prefix.

color2: str

Color 2 (link), in hex format without “#” prefix.

color3: str

Color 3 (button), in hex format without “#” prefix.

color4: str

Color 4 (box), in hex format without “#” prefix.

color5: str

Color 5 (bottom), in hex format without “#” prefix.

classmethod from_payload(payload)

Convert a JSON payload (provided as a dict) into a Palette object.

Parameters:

payload (dict) – Dictionary containing the JSON payload.

Return type:

Self

Returns:

The resulting Palette object.

class pybotb.types.Playlist(id, botbr_id, title, count, runtime, date_create_str, date_modify_str, description=None, thumbnail_id=None, _raw_payload=None)

A playlist containing entries.

Parameters:
  • id (int)

  • botbr_id (int)

  • title (str)

  • count (int)

  • runtime (int)

  • date_create_str (str)

  • date_modify_str (str)

  • description (str | None)

  • thumbnail_id (int | None)

  • _raw_payload (dict | None)

id: int

ID of the playlist.

botbr_id: int

ID of the BotBr who made the playlist.

title: str

Title of the playlist

count: int

Amount of entries in the playlist.

runtime: int

Total runtime (sum of lengths) of entries with lengths in this playlist, in seconds.

date_create_str: str

String representing the date on which the BotBr was last seen on the site, in YYYY-MM-DD format, in the US East Coast timezone (same as all other dates on- site).

The last-on date is also converted to a datetime for developer convenience; see date_create.

property date_create: datetime

Last seen date as a datetime object.

For the raw string, see date_create_str.

date_modify_str: str

String representing the date on which the BotBr was last seen on the site, in YYYY-MM-DD format, in the US East Coast timezone (same as all other dates on- site).

The last-on date is also converted to a datetime for developer convenience; see date_modify.

property date_modify: datetime

Last seen date as a datetime object.

For the raw string, see date_modify_str.

description: Optional[str] = None

Description of the playlist.

thumbnail_id: Optional[int] = None

ID of the entry used as the thumbnail, or None if none is set.

To get the Entry object for the thumbnail, use

BotBr.entry_load(playlist.thumbnail_id).

To get the URL of the thumbnail, get the :prop:.Entry.thumbnail_property property of the entry object fetched with the function above.

classmethod from_payload(payload)

Convert a JSON payload (provided as a dict) into a Playlist object.

Parameters:

payload (dict) – Dictionary containing the JSON payload.

Return type:

Self

Returns:

The resulting Playlist object.

class pybotb.types.PlaylistToEntry(playlist_id, entry_id)

Link between playlist and entry returned by the playlist_to_entry API.

Parameters:
  • playlist_id (int)

  • entry_id (int)

playlist_id: int

ID of the playlist

entry_id: int

ID of the entry

classmethod from_payload(payload)

Convert a JSON payload (provided as a dict) into a PlaylistToEntry object.

Parameters:

payload (dict) – Dictionary containing the JSON payload.

Return type:

Self

Returns:

The resulting Favorite object.

class pybotb.types.DailyStats(id, date_str, page_views, plays, donloads, ip_count, entry_count, botbr_count, user_count, post_count, economic_pool, avg_debit, bank_debit, bank_credit, total_points, _raw_payload=None)

A single entry in the BotB daily site stats table.

Note that statistics apply to the given date in the US East Coast timezone; if you want to get statistics for a date in your timezone, you will have to aggregate data from multiple days.

Parameters:
  • id (int)

  • date_str (str)

  • page_views (int)

  • plays (int)

  • donloads (int)

  • ip_count (int)

  • entry_count (int)

  • botbr_count (int)

  • user_count (int)

  • post_count (int)

  • economic_pool (int)

  • avg_debit (int)

  • bank_debit (int)

  • bank_credit (int)

  • total_points (int)

  • _raw_payload (dict | None)

id: int

ID of the daily stats table entry.

date_str: str

String representing the date of the statistic, in YYYY-MM-DD format, in the US East Coast timezone (same as all other dates on-site).

This date is also converted to a datetime for developer convenience; see date.

property date: datetime

Statistic date as a datetime object.

For the raw string, see date_str.

page_views: int

Total amount of page views.

plays: int

Total amount of entry plays.

donloads: int

Total amount of entry downloads (note the deliberate typo).

property downloads: int

Longhand for “donloads”, for spelling convenience.

ip_count: int

Amount of unique IPs visiting the site.

entry_count: int

Amount of entries submitted to the site.

botbr_count: int

Amount of BotBrs seen on the site.

user_count: int

Amount of users seen on the site; same as botbr_count.

post_count: int

Amount of group thread posts made on the site.

economic_pool: int

Total amount of boons owned by BotBrs, including the bank value, rounded to an integer.

avg_debit: int

Average amount of boons owned by BotBrs, rounded to an integer.

bank_debit: int

Current amount of boons held by the BotB Bank (BotB account), rounded to an integer.

bank_credit: int

How much boons the bank has given out to BotBrs.

total_points: int

Total points of all BotBrs on the site.

classmethod from_payload(payload)

Convert a JSON payload (provided as a dict) into a DailyStats object.

Parameters:

payload (dict) – Dictionary containing the JSON payload.

Return type:

Self

Returns:

The resulting DailyStats object.

class pybotb.types.BotBrStats(botbr_id, label, val, date_str, _raw_payload=None)

A single entry in the BotBr stats table.

Note that statistics apply to the given date in the US East Coast timezone; if you want to get statistics for a date in your timezone, you will have to aggregate data from multiple days.

Parameters:
botbr_id: int

ID of the BotBr the statistic applies to.

label: str

Label of the statistic.

“level” for level, “boons” for boon count, “a_light” for aura light points, “a_ack” for aura ack points, “a_dark” for aura dark points, class name for class point amount.

val: float

Value of the statistic.

date_str: str

String representing the date of the statistic, in YYYY-MM-DD format, in the US East Coast timezone (same as all other dates on-site).

This date is also converted to a datetime for developer convenience; see date.

property date: datetime

Statistic date as a datetime object.

For the raw string, see date_str.

classmethod from_payload(payload)

Convert a JSON payload (provided as a dict) into a BotBrStats object.

Parameters:

payload (dict) – Dictionary containing the JSON payload.

Return type:

Self

Returns:

The resulting BotBrStats object.