Tournaments¶
API Reference¶
Base¶
Tournament¶
- class tournaments.objects.Tournament(bot: redbot.core.bot.Red, guild: discord.guild.Guild, config: redbot.core.config.Config, custom_config: str, name: str, game: str, url: str, id: str, limit: Optional[int], status: str, tournament_start: datetime.datetime, bot_prefix: str, cog_version: str, data: dict)[source]¶
Bases:
object
Represents a tournament in a guild.
This object is created as soon as the tournament is setup, and destroyed only once it ends.
The config is loaded inside and will not be updated unless reloaded.
This contains all of the methods useful for the tournament, a list of
Participant
and a list ofMatch
, and adiscord.ext.tasks.Loop
task updating the infos from the bracket.This contains the base structure, but no interface with a bracket, this has to be implemented later by inheriting from this class and overwriting the abstract methods, allowing multiple providers to work with the same structure.
If you’re implementing this for a new provider, the following methods need to be implemented:
And set the following class vars with your other inherited objects for
Participant
andMatch
:See
challonge.py
for an example.- Parameters
bot (redbot.core.bot.Red) – The bot object
guild (discord.Guild) – The current guild for the tournament
config (redbot.core.Config) – The cog’s Config object
name (str) – Name of the tournament
game (str) – Name of the game
url (str) – Link of the bracket
id (str) – Internal ID for the tournament
limit (Optional[int]) – An optional limit of participants
status (str) – The status provided by the API
tournament_start (datetime.datetime) – Expected start time for this tournament. Planned events are based on this.
bot_prefix (str) – A prefix to use for displaying commands without context.
cog_version (str) – Current version of Tournaments
data (dict) – A dict with all the config required for the tournament (combines guild and game settings)
- bot¶
The bot object
- Type
- guild¶
The current guild for the tournament
- Type
- config¶
The cog’s Config object
- Type
redbot.core.Config
- tournament_start¶
Expected start time for this tournament. Planned events are based on this.
- Type
- tz¶
The timezone of the tournament. You need to use this when creating datetime objects.
from datetime import datetime now = datetime.now(tz=tournament.tz)
- Type
- participants¶
List of participants in the tournament
- Type
List[Participant]
- winner_categories¶
List of categories created for the winner bracket
- Type
List[discord.CategoryChannel]
- loser_categories¶
List of categories created for the loser bracket
- Type
List[discord.CategoryChannel]
- category¶
The category defined (our categories will be created below)
- Type
Optional[discord.CategoryChannel]
- announcements_channel¶
The channel for announcements
- Type
Optional[discord.TextChannel]
- checkin_channel¶
The channel for check-in
- Type
Optional[discord.TextChannel]
- queue_channel¶
The channel for match queue
- Type
Optional[discord.TextChannel]
- register_channel¶
The channel for registrations
- Type
Optional[discord.TextChannel]
- scores_channel¶
The channel for score setting
- Type
Optional[discord.TextChannel]
- stream_channel¶
The channel for announcing matches on stream
- Type
Optional[discord.TextChannel]
- to_channel¶
The channel for tournament organizers. Send warnings there.
- Type
discord.TextChanne]
- vip_register_channel¶
A channel where registrations are always open
- Type
Optional[discord.TextChannel]
- participant_role¶
The role given to participants
- Type
- streamer_role¶
Role giving access to stream commands
- Type
Optional[discord.Role]
- to_role¶
Role giving access to T.O. commands
- Type
Optional[discord.Role]
- register_start¶
When we should open the registrations automatically
- Type
Optional[datetime.datetime]
- register_second_start¶
When we should open the registrations a second time automatically
- Type
Optional[datetime.datetime]
- register_stop¶
When we should close the registrations automatically
- Type
Optional[datetime.datetime]
- checkin_start¶
When we should open the checkin automatically
- Type
Optional[datetime.datetime]
- checkin_stop¶
When we should close the checkin automatically
- Type
Optional[datetime.datetime]
- ruleset_channel¶
Channel for the rules
- Type
Optional[discord.TextChannel]
- game_role¶
Role targeted at players for this game. Basically we use that role when opening the registrations, for opening the channel and pinging.
- Type
Optional[discord.Role]
- phase¶
Something very important! Used for knowing what is the current phase of the tournament. It is also used by commands to know if it is allowed to run.
Can be the following values:
"pending"
: Tournament just setup, nothing open yet"register"
: Registrations or check-in started and are not finished"awaiting"
: Registrations and check-in done, awaiting upload and start"ongoing"
: Tournament is started and ongoing"finished"
: Tournament done. Should be immediatly deleted unless there’s an issue
- Type
- register_phase¶
Defines the current status of registration.
Can be the following values:
"manual"
: No start date setup, waiting for manual start"pending"
: Start date setup, awaiting automatic start"ongoing"
: Registrations active"onhold"
: Registrations started and ended once, but awaiting a second start"done"
: Registrations ended
- Type
- checkin_phase¶
Defines the current status of check-in.
Can be the following values:
"manual"
: No start date setup, waiting for manual start"pending"
: Start date setup, awaiting automatic start"ongoing"
: Check-in active"onhold"
: Check-in started and ended once, but awaiting a second start"done"
: Check-in ended
- Type
- register_message¶
The pinned message in the registrations channel
- Type
Optional[discord.Message]
- checkin_reminders¶
A list of reminders to send for the check-in. Contains tuples of two items: when to send the reminder (minutes before check-in end date), and if the bot should DM members. This is calculated on check-in start.
- lock¶
A lock acquired when the tournament is being refreshed by the loop task, to prevent commands like win or dq from being run at the same time.
New since beta 13: The lock is also acquired with the
[p]in
command to prevent too many concurrent tasks, breaking the limit.- Type
- task¶
The task for the
loop_task
function (discord.ext.tasks.Loop
object)- Type
- task_errors¶
Number of errors that occured within the loop task. If it reaches 5, task is cancelled.
- Type
- matches_to_announce¶
A list of strings to announce in the defined queue channel. This is done to prevent sending too many messages at once and hitting ratelimits, so we wrap messages together.
- Type
List[str]
- participant_object¶
alias of
tournaments.objects.base.Participant
- match_object¶
alias of
tournaments.objects.base.Match
- classmethod await from_saved_data(bot: redbot.core.bot.Red, guild: discord.guild.Guild, config: redbot.core.config.Config, cog_version: str, data: dict, config_data: dict)[source]¶
Loads a tournament from Config.
Due to Python’s weird behaviour, this method must be reimplemented and simply called back without changes.
- await save()[source]¶
Saves data with Config. This is done with the loop task during a tournament but must be called while it’s not ongoing.
- property allowed_roles¶
Return a list of roles that should have access to the temporary channels.
- next_scheduled_event() Tuple[str, datetime.timedelta] [source]¶
Returns the next scheduled event (register/checkin/None) with the corresponding timedelta
- await warn_bracket_change(*sets)[source]¶
Warn T.O.s of a bracket change.
- Parameters
*sets (str) – The list of affected sets.
- find_participant(*, player_id: Optional[str] = None, discord_id: Optional[int] = None, discord_name: Optional[str] = None) Tuple[int, tournaments.objects.base.Participant] [source]¶
Find a participant in the internal cache, and returns its object and position in the list.
You need to provide only one of the parameters.
- Parameters
player_id (Optional[str]) – Player’s ID on the bracket, as returned by
Participant.player_id
discord_id (Optional[int]) – Player’s Discord ID
discord_name (Optional[str], as returned by
discord.Member.id
) – Player’s full Discord name, as returned bystr(discord.Member)
- Returns
The index of the participant in the list (useful for deletion or deplacement) and its
Participant
object- Return type
Tuple[int, Participant]
- Raises
RuntimeError – No parameter was provided
- find_match(*, match_id: Optional[int] = None, match_set: Optional[int] = None, channel_id: Optional[int] = None) Tuple[int, tournaments.objects.base.Match] [source]¶
Find a match in the internal cache, and returns its object and position in the list.
You need to provide only one of the parameters.
- Parameters
match_id (Optional[int]) – Match’s ID on the bracket, as returned by
Match.id
match_set (Optional[int]) – Match’s number, or suggested play order, on the bracket, as returned by
Match.set
channel_id (Optional[id]) –
Discord channel’s ID, as returned by
discord.TextChannel.id
Warning
A match may not have a channel assigned
- Returns
The index of the match in the list (useful for deletion or deplacement) and its
Match
object- Return type
- Raises
RuntimeError – No parameter was provided
- find_streamer(*, channel: Optional[str] = None, discord_id: Optional[int] = None) Tuple[int, tournaments.objects.base.Streamer] [source]¶
Find a streamer in the internal cache, and returns its object and position in the list.
You need to provide only one of the parameters.
- Parameters
channel (Optional[str]) – The streamer’s channel, as returned by
Streamer.channel
(not full URL, only last part). Example for https://twitch.tv/dreekius, usechannel="dreekius"
.discord_id (Optional[int]) – Streamer’s Discord ID
- Returns
The index of the streamer in the list (useful for deletion or deplacement) and its
Streamer
object- Return type
- Raises
RuntimeError – No parameter was provided
- await end_registration()[source]¶
Close the registrations and save.
If the check-in is also done, participants will be seeded and uploaded.
- await start_check_in()[source]¶
Open the check-in and save.
This will also calculate and fill the
checkin_reminders
list.
- await call_check_in(with_dm: bool = False)[source]¶
Pings participants that have not checked in yet.
Only works with a check-in channel setup and a stop time.
- await end_checkin()[source]¶
Close the check-in, unregister unchecked members (attempts to DM) and save.
If the registrations are also done, participants will be seeded and uploaded.
- await register_participant(member: discord.member.Member, send_dm: bool = True)[source]¶
Register a new participant to the tournament (add role) and save.
If the check-in has started, participant will be pre-checked.
If there is a limit of participants, the auto-stop setting for registrations is enabled and the limit is reached, registrations will be closed.
The
Participant
object is not returned and directly added to the list.- Parameters
member (discord.Member) – The member to register. They must be in the server.
send_dm (bool) – If the bot should DM the new participant for their registrations. Defaults to
True
.
- await unregister_participant(member: discord.member.Member, send_dm: bool = True)[source]¶
Remove a participant.
If the player is uploaded on the bracket, they will also be removed from there. If the tournament has started, member will be disqualified instead.
This removes roles and DMs the participant.
- Parameters
member (discord.Member) – The member to disqualify
- Raises
KeyError – The member is not registered
- await seed_participants(remove_unchecked: bool = False)[source]¶
Seed the participants if ranking info is configured.
Warning
If an exception occurs, the list of participants will be rolled back to its previous state, then the error propagates.
- await send_start_messages()[source]¶
Send the required messages when starting the tournament.
Depending on the configured channels, announcements will be sent in:
The announcements channel
The scores channel
The queue channel
- await announce_sets()[source]¶
Wraps the messages stored in
matches_to_announce
and sends them in thequeue_channel
.
- await launch_sets()[source]¶
Launch pending matches, creating a channel and marking the match as ongoing.
This only launches 20 matches max.
This is wrapped inside
asyncio.gather
, so errors will not propagate.
- await launch_streams()[source]¶
Launch the streams (call the next matches in the streamer’s queue).
You must call
update_streamer_list
first.
- await check_for_channel_timeout()[source]¶
Look through the ongoing/finished matches and compare durations to see if AFK check or channel deletion is required, and proceed.
- await check_for_too_long_matches()[source]¶
Look through the ongoing matches and verifies the duration. Warn if necessary.
- loop_task¶
A
discord.ext.tasks.Loop
object, started with the tournament’s start and running each 15 seconds.Does the required background stuff, such as updating the matches list, launch new matches, update streamers, check for AFK…
Running this will acquire our
lock
.See the documentation on a Loop object for more details.
Warning
Use
start_loop_task
for starting the task, notLoop.start
.- Raises
asyncio.TimeoutError – Running the task took more than 30 seconds
- await cancel_timeouts()[source]¶
Sometimes relaunching the bot after too long will result in a lot of DQs due to AFK checks, so this function will cancel all AFK checks for the matches that are going to have players DQed.
- await start_loop_task()[source]¶
Starts the internal loop task.
This will check for possible leftovers and cancel any previous task matching our name within the current asyncio loop. We do not want duplicated tasks, as this will result in the worst nightmare (RIP DashDances #36 and Super Smash Bronol #46).
Then we try to prevent abusive disqualifications with
cancel_timeouts
. Oh and we also set a contextual locale for i18n, seeredbot.core.i18n.set_contextual_locales_from_guild
.Finally, the task is started and given the name “Tournament {tournamet_id}”
- stop_loop_task()[source]¶
Stops the loop task. This is preferred over
discord.ext.tasks.Loop.cancel
.
- await _get_all_rounds() List[int] [source]¶
Return a list of all rounds in the bracket. This is used to determine the top 8.
This is a new method because our Match class will not be created without players, so we add this new method which only fetch what we need.
- Returns
The list of rounds.
- Return type
List[int]
- await _update_participants_list()[source]¶
Updates the internal list of participants, checking for changes such as:
Player DQ/removal
New player added (pre game)
Warning
A name change on remote is considered as a player removal + addition. If the name doesn’t match any member, they will be rejected.
- await _update_match_list()[source]¶
Updates the internal list of changes, checking for changes such as:
Score set manually
Score modified (if there are ongoing/finished sets beyond this match in the bracket, they will be reset)
Match reset (the set will be relaunched, ongoing/finished sets beyond this match in the bracket will be reset)
- await start()[source]¶
Starts the tournament.
- Raises
RuntimeError – The tournament is already started.
- await stop()[source]¶
Stops the tournament.
- Raises
RuntimeError – The tournament is already stopped or not started.
- await add_participant(name: str, seed: Optional[int] = None)[source]¶
Adds a participant to the tournament.
- await add_participants(participants: Optional[List[tournaments.objects.base.Participant]] = None, force: bool = False) int [source]¶
Adds a list of participants to the tournament, ordered as you want them to be seeded. The participants will have their
Participant.player_id
updated as needed.- Parameters
participants (Optional[List[Participant]]) – The list of participants. The first element will be seeded 1. If not provided, will use the instance’s
participants
attribute instead.force (bool) –
If you want the bot to override the previous list of participants on the bracket. Defaults to
False
.If set to
True
: All manually added participants and seeding will be lost, and the new list will be exactly the same as what’s provided. All player IDs will be modified.If set to
False
: The bot will calllist_participants
and remove all elements from the list where the player ID is already inside the upstream list. Then we bulk add what’s remaining, without clearing the rest.Participants are still seeded, but at the end, separated from the rest.
- Returns
How many members were appended to the list. Can be useful for knowing if the bot appended participants or if it was an initial upload (or forced).
- Return type
- Raises
RuntimeError – The list of participants provided was empty, or there was nothing new to upload.
- await destroy_player(player_id: str)[source]¶
Destroys a player. This is the same call as Player.destroy, but only the player ID is needed. Useful for unavailable discord member.
- Parameters
player_id (str) – The player to remove.
- await list_participants() List[tournaments.objects.base.Participant] [source]¶
Returns the list of participants from the tournament host.
- Returns
The list of participants.
- Return type
List[str]
- await list_matches() List[tournaments.objects.base.Match] [source]¶
Returns the list of matches from the tournament host.
- Returns
The list of matches.
- Return type
List[str]
Participant¶
- class tournaments.objects.Participant(member: discord.member.Member, tournament: tournaments.objects.base.Tournament)[source]¶
Bases:
discord.member.Member
Defines a participant in the tournament.
This inherits from
discord.Member
and adds the necessary additional methods.If you’re implementing this for a new provider, the following methods need to be implemented:
- Parameters
member (discord.Member) – The member participating to the tournament
tournament (Tournament) – The current tournament
- member¶
The member participating to the tournament
- Type
- tournament¶
The current tournament
- Type
- await check(send_dm: bool = True)[source]¶
Checks the member in.
In addition to changing the
checked_in
attribute, it also DMs the member and saves the config.
- property player_id¶
Returns an identifier for the player, specific to the bracket.
This should be overwritten.
Match¶
- class tournaments.objects.Match(tournament: tournaments.objects.base.Tournament, round: int, set: str, id: int, underway: bool, player1: tournaments.objects.base.Participant, player2: tournaments.objects.base.Participant)[source]¶
Bases:
object
Defines a match in the tournament, with two players facing each other.
This should only be created when convenient, aka when a match needs to be started. Matches with no players yet or finished are not builded.
If you’re implementing this for a new provider, the following methods need to be implemented:
unmark_as_underway
(unused for now)
- Parameters
tournament (Tournament) – The match’s tournament.
round (str) – The round of this match in the bracket (e.g. 1 for first round of winner bracket, -1 for first round of loser bracket).
set (str) – The number of the match. Challonge calls this the suggested play order (goes from 1 to N, the number of matches in the bracket).
id (int) – A unique identifier for the API
underway (bool) – If the match is underway (provided by API)
player1 (Participant) – The first player of this match.
player2 (Participant) – The second player of this match.
- tournament¶
The match’s tournament.
- Type
- round¶
The round of this match in the bracket (e.g. 1 for first round of winner bracket, -1 for first round of loser bracket).
- Type
- set¶
The number of the match. Challonge calls this the suggested play order (goes from 1 to N, the number of matches in the bracket).
- Type
- player1¶
The first player of this match.
- Type
- player2¶
The second player of this match.
- Type
- channel¶
The channel for this match. May be
None
if the match hasn’t started yet, or if it couldn’t be created and is therefore in DM.- Type
Optional[discord.TextChannel]
- end_time¶
End time of this match, or time of the latest message.
None
if it hasn’t started or ended yet. This is updated as soon as a message is sent in the channel. Used for knowing when to delete the channel (5 min after last message).- Type
Optional[datetime]
- status¶
Defines the current state of the match.
"pending"
: Waiting to be launched (no channel or stream pending)"ongoing"
: Match started"finished"
: Score set, awaiting channel deletion
- Type
- warned¶
Defines if there was a warn for duration.
None
if no warn was sent,datetime.datetime
if there was one first warn sent (correspond to the time when it was send, we rely on that to know when to send the second warn), and finallyTrue
when the second warn is sent (to the T.O.s).- Type
Optional[Union[datetime, bool]]
- on_hold¶
True
if the match is not started but on hold, awaiting something (most likely inside a stream queue, waiting for its turn)- Type
- checked_dq¶
If we performed AFK checks. Setting this to
True
is possible and will disable further AFK checks for this match.- Type
- property duration: Optional[datetime.timedelta]¶
Returns the duration of this match, or
None
if it hasn’t started.
- await start_stream()[source]¶
Send a pending set, awaiting for its turn, on stream. Only call this if there’s a streamer.
- await stream_queue_add()[source]¶
Modify the status of an ongoing match to tell that it is now on stream.
This is called when a streamer adds an ongoing match to its queue, then the following things are done:
AFK checks are cancelled
If the match is the first one in the stream queue: Nothing is cancelled, we just ping the players with the stream informations.
If the match is not the first one in the stream queue: We mark the match as not underway, change the status to pending, and tell the players.
- await cancel_stream()[source]¶
Call if the stream is cancelled (streamer left of match removed from queue).
A message will be sent, telling players to start playing, and AFK checks will be re-enabled.
- await create_channel(category: discord.channel.CategoryChannel, *allowed_roles: list) discord.channel.TextChannel [source]¶
Creates a channel for the match and returns its object.
- Returns
The created text channel
- Return type
- await launch(*, category: Optional[discord.channel.CategoryChannel] = None, restart: bool = False, allowed_roles: List[discord.role.Role] = [])[source]¶
Launches the set.
This does the following:
Try to create a text channel with permissions for the two players and the given roles
Send a DM to both members
Mark the set as ongoing
- Parameters
category (Optional[discord.CategoryChannel]) – The category where to put the channel. If this is not provided, one will be found. If you’re launching multiple sets at once with asyncio.gather, use this to prevent seeing one category per channel
restart (bool) – If the match is restarted.
allowed_roles (List[discord.Role]) – A list of roles with read_messages permission in the text channel.
- await relaunch()[source]¶
This is called in case of a match reset (usually from remote).
We inform the players they need to play their set again, eventually re-use their old channel if it still exists.
- await check_inactive()[source]¶
Checks for inactive players (reads
Participant.spoke
only), and DQ them if required.Warning
This doesn’t check durations and assumes it’s been done already.
Will set
checked_dq
toTrue
.
- await warn_to_length()[source]¶
Warn T.O.s because of the duration of this match. Also tell the players
- await end(player1_score: int, player2_score: int, upload: bool = True)[source]¶
Set the score and end the match.
The winner is determined by comparing the two scores (defaults to player 1 if equal).
- await force_end()[source]¶
Called when a set is cancelled (remove bracket modifications or reset).
The channel is deleted, a DM is sent, and the instance will most likely be deleted soon after.
- await disqualify(player: Union[tournaments.objects.base.Participant, int])[source]¶
Called when a player in the set is destroyed.
There is no API call, just messages sent to the players.
- player: Union[Participant, int]
The disqualified player. Provide an
int
if the member left.
- await forfeit(player: tournaments.objects.base.Participant)[source]¶
Called when a player in the set forfeits this match.
This doesn’t always mean that the player quits the tournament, as they may continue in the loser bracket.
Sets a score of -1 0
- Parameters
player (Participant) – The player that forfeits.
- cancel()[source]¶
Mark a match as finished (updated
status
andend_time
+ callsParticipant.reset
)
- await set_scores(player1_score: int, player2_score: int, winner: Optional[tournaments.objects.base.Participant] = None)[source]¶
Set the score for the set.
- Parameters
player1_score (int) – The score of the first player.
player2_score (int) – The score of the second player.
winner (Optional[Participant]) – The winner of the set. If not provided, the player with the highest score will be selected.
Streamer¶
- class tournaments.objects.Streamer(tournament: tournaments.objects.base.Tournament, member: discord.member.Member, channel: str, respect_order: bool = False)[source]¶
Bases:
object
Represents a streamer in the tournament. Will be assigned to matches. Does not necessarily exists on remote depending on the provider.
There is no API call in this class for now.
- Parameters
tournament (Tournament) – The current tournament
member (discord.Member) – The streamer on Discord. Must be in the tournament’s guild.
channel (str) – The streamer’s channel. Must only be the last part of the URL, not full. (e.g. for https://twitch.tv/el_laggron use
channel="el laggron"
)
- tournament¶
The current tournament
- Type
- member¶
The streamer on Discord. Must be in the tournament’s guild.
- Type
- channel¶
The streamer’s channel. Must only be the last part of the URL, not full. (e.g. for https://twitch.tv/el_laggron use
channel="el laggron"
)- Type
- matches¶
The list of matches in the streamer’s queue. Can be
Match
if it exists (both players available, on hold) orint
, representing the set.
- set_room(room_id: str, code: Optional[str] = None)[source]¶
Set streamer’s room info (specific to Smash Bros.)
- await check_integrity(sets: int, *, add: bool = False)[source]¶
Verify if the list of sets provided is valid before adding them to the list.
- Parameters
- Returns
A dictionnary of the errors that occured (set -> translated error msg). If this is empty, it’s all good.
- Return type
- insert_match(set: int, *, set2: Optional[int] = None, position: Optional[int] = None)[source]¶
Insert a match in the list. The match must already exist in the list.
Provide either
set2
orposition
as keyword argument.- Parameters
set (int) – The set you want to move. Only
int
type, notMatch
.set2 (int) – The set you want to use to define the position. Only
int
type, notMatch
.position (int) –
The new position in the list. 0 = first ; 1 = second …
Providing a number out of bounds will move the item at the limit, it’s just Python’s magic. (eg: -5 moves to first place)
- Raises
KeyError – The given set was not found
RuntimeError – Neither
set2
orposition
was provided.
- await end()[source]¶
Cancels all streams for the streamer’s queue, telling the players.
Basically calls
Match.cancel_stream
for existing matches.
Challonge API¶
- class tournaments.objects.ChallongeTournament(bot: redbot.core.bot.Red, guild: discord.guild.Guild, config: redbot.core.config.Config, custom_config: str, name: str, game: str, url: str, id: str, limit: Optional[int], status: str, tournament_start: datetime.datetime, bot_prefix: str, cog_version: str, data: dict)[source]¶
Bases:
tournaments.objects.base.Tournament
- classmethod build_from_api(bot: redbot.core.bot.Red, guild: discord.guild.Guild, config: redbot.core.config.Config, custom_config: str, prefix: str, cog_version: str, data: dict, config_data: dict)[source]¶
Builds a new Tournament from Challonge raw data.
- Parameters
bot (redbot.core.bot.Red) – The bot object
guild (discord.Guild) – The current guild for the tournament
config (redbot.core.Config) – The cog’s Config object
prefix (str) – A prefix to use for displaying commands without context.
cog_version (str) – Current version of Tournaments
data (dict) – Data as provided by the API.
config_data (dict) – A dict with all the config required for the tournament (combines guild and game settings)
- class tournaments.objects.ChallongeParticipant(member: discord.member.Member, tournament: tournaments.objects.base.Tournament)[source]¶
Bases:
tournaments.objects.base.Participant
- classmethod build_from_api(tournament: tournaments.objects.base.Tournament, data: dict)[source]¶
Builds a new member from Challonge raw data.
- Parameters
tournament (Tournament) – The current tournament
data (dict) – Data as provided by the API.
- property player_id¶
Challonge player ID.
- class tournaments.objects.ChallongeMatch(tournament: tournaments.objects.base.Tournament, round: int, set: str, id: int, underway: bool, player1: tournaments.objects.base.Participant, player2: tournaments.objects.base.Participant)[source]¶
Bases:
tournaments.objects.base.Match
- classmethod await build_from_api(tournament: tournaments.objects.base.Tournament, data: dict)[source]¶
Builds a new member from Challonge raw data.
This will also disqualify participants from the match not found in the server.
- Parameters
tournament (Tournament) – The current tournament
data (dict) – Data as provided by the API.