Skip to content
This repository has been archived by the owner on Jul 28, 2022. It is now read-only.

feat: tournaments #94

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

KnutZuidema
Copy link

@KnutZuidema KnutZuidema commented Nov 2, 2020

I've started an implementation which currently supports creating a tournament and
letting people enter teams via adding reactions.
For the tournament itself and for each team a voice and text channel is created
with a corresponding role to restrict visibility.
Cleanup of these resources is handled upon removing reactions or, for the tournament
itself, removing the embed.

#resolves #90

TODO:

  • registration deadline
  • automatically creating a tournament schedule based on the teams

this adds 3 new database models used for managing tournaments.
The tournament model contains a number of team models who then contain a number of member models
let's users create tournaments and join teams. Text and voice channels are created for the tournament and each team with only members being able to view the channels
self.bot: discord.Client = bot

@commands.command()
async def tournament(self, ctx, role: discord.Role, team_size: int, team_count: int, period: int = 15):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check if {team_count} is an even number or better if it fits the {team_count} structure?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some validation should be added, for sure. Currently you could simply put team_size at 0 and nobody can create a team 😂
An even number would be easier if all tournaments will only consist of 1v1 matches, however I think it would be interesting to also support automatic group creation with a round-robin match schedule or something similar.

However, for a first test it might be easier to force an even number.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me

@@ -0,0 +1,20 @@
import discord
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can create a sub dir for utils, because I have planned such a structure for the rework as well. So we can differentiate the utils for different extensions

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the point of a util package to include common utility functions? If they are only useful for a single extension, then there would be no need for a separate file. I might be missing the point of your suggestion :D

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point I only those functions useful for the tournament function. But we can keep it like this and I but my helper functions in here too. My thought in the first place was that we might have overhead because of imports for functions we do not need e.g when an extension is not even loaded

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @KnutZuidema there. It makes more sense to have a utility file for including common utility functions.

@Rec0gnice
Copy link
Contributor

There are a lot of calls to the discord API, but I cannot find a solution to reduce it either. Maybe we have to convince Discord to expand your raid limit ^^

Copy link
Contributor

@TitusKirch TitusKirch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will test it on Thursday if necessary, but otherwise it seems good

@TitusKirch TitusKirch self-requested a review November 2, 2020 17:48
@TitusKirch
Copy link
Contributor

There are a lot of calls to the discord API, but I cannot find a solution to reduce it either. Maybe we have to convince Discord to expand your raid limit ^^

*rate

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tournament creation
3 participants