-
Notifications
You must be signed in to change notification settings - Fork 1
feat: tournaments #94
base: main
Are you sure you want to change the base?
Conversation
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): |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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 ^^ |
There was a problem hiding this 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
*rate |
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: