mirror of
				https://gitlab.com/ddorn/tfjm-discord-bot.git
				synced 2025-10-31 00:59:51 +01:00 
			
		
		
		
	✨ case case_insensitive bot
This commit is contained in:
		| @@ -125,7 +125,7 @@ class DevCog(Cog, name="Dev tools"): | |||||||
|             await ctx.send(f":tada: L'extension **{name}** a bien été ajoutée !") |             await ctx.send(f":tada: L'extension **{name}** a bien été ajoutée !") | ||||||
|  |  | ||||||
|     # noinspection PyUnreachableCode |     # noinspection PyUnreachableCode | ||||||
|     @command(name="setup", hidden=True) |     @command(name="setup") | ||||||
|     @has_role(Role.DEV) |     @has_role(Role.DEV) | ||||||
|     async def setup_roles(self, ctx): |     async def setup_roles(self, ctx): | ||||||
|         """ |         """ | ||||||
| @@ -187,7 +187,7 @@ class DevCog(Cog, name="Dev tools"): | |||||||
|     @command(name="send") |     @command(name="send") | ||||||
|     @has_role(Role.DEV) |     @has_role(Role.DEV) | ||||||
|     async def send_cmd(self, ctx, *msg): |     async def send_cmd(self, ctx, *msg): | ||||||
|         """Envoie un message.""" |         """(dev) Envoie un message.""" | ||||||
|         await ctx.message.delete() |         await ctx.message.delete() | ||||||
|         await ctx.send(" ".join(msg)) |         await ctx.send(" ".join(msg)) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -398,7 +398,7 @@ class MiscCog(Cog, name="Divers"): | |||||||
|         with open(File.JOKES_V2, "w") as f: |         with open(File.JOKES_V2, "w") as f: | ||||||
|             yaml.safe_dump_all(jokes, f) |             yaml.safe_dump_all(jokes, f) | ||||||
|  |  | ||||||
|     @group(name="joke", invoke_without_command=True) |     @group(name="joke", invoke_without_command=True, case_insensitive=True) | ||||||
|     async def joke(self, ctx: Context): |     async def joke(self, ctx: Context): | ||||||
|  |  | ||||||
|         m: discord.Message = ctx.message |         m: discord.Message = ctx.message | ||||||
|   | |||||||
| @@ -115,7 +115,7 @@ class TeamsCog(Cog, name="Teams"): | |||||||
|  |  | ||||||
|         return f"{ctx.author.mention} à été ajouté comme spectateur dans à {tournoi}." |         return f"{ctx.author.mention} à été ajouté comme spectateur dans à {tournoi}." | ||||||
|  |  | ||||||
|     @group(name="team", invoke_without_command=True) |     @group(name="team", invoke_without_command=True, case_insensitive=True, hidden=True) | ||||||
|     async def team(self, ctx): |     async def team(self, ctx): | ||||||
|         """Groupe de commandes pour la gestion des équipes.""" |         """Groupe de commandes pour la gestion des équipes.""" | ||||||
|  |  | ||||||
|   | |||||||
| @@ -510,7 +510,7 @@ class TirageCog(Cog, name="Tirages"): | |||||||
|     @commands.command(name="dice-all", aliases=["da"]) |     @commands.command(name="dice-all", aliases=["da"]) | ||||||
|     @commands.has_role(Role.DEV) |     @commands.has_role(Role.DEV) | ||||||
|     async def dice_all_cmd(self, ctx, *teams): |     async def dice_all_cmd(self, ctx, *teams): | ||||||
|         """Lance un dé pour chaque equipe afin de tester les tirages.""" |         """(dev) Lance un dé pour chaque equipe afin de tester les tirages.""" | ||||||
|         channel = ctx.channel.id |         channel = ctx.channel.id | ||||||
|         if channel in self.tirages: |         if channel in self.tirages: | ||||||
|             for t in teams: |             for t in teams: | ||||||
| @@ -565,7 +565,13 @@ class TirageCog(Cog, name="Tirages"): | |||||||
|  |  | ||||||
|     # ---------- Commandes du groupe draw ----------- # |     # ---------- Commandes du groupe draw ----------- # | ||||||
|  |  | ||||||
|     @group(name="draw", aliases=["d", "tirage"], invoke_without_command=True) |     @group( | ||||||
|  |         name="draw", | ||||||
|  |         aliases=["d", "tirage"], | ||||||
|  |         invoke_without_command=True, | ||||||
|  |         case_insensitive=True, | ||||||
|  |         hidden=True, | ||||||
|  |     ) | ||||||
|     async def draw_group(self, ctx: Context) -> None: |     async def draw_group(self, ctx: Context) -> None: | ||||||
|         """Groupe de commandes pour les tirages.""" |         """Groupe de commandes pour les tirages.""" | ||||||
|  |  | ||||||
| @@ -633,26 +639,6 @@ class TirageCog(Cog, name="Tirages"): | |||||||
|         else: |         else: | ||||||
|             await ctx.send("Il n'y a pas de tirage en cours.") |             await ctx.send("Il n'y a pas de tirage en cours.") | ||||||
|  |  | ||||||
|     # |  | ||||||
|     # @draw_group.command(name="skip", aliases=["s"]) |  | ||||||
|     # @commands.has_role(Role.DEV) |  | ||||||
|     # async def draw_skip(self, ctx, *teams: discord.Role): |  | ||||||
|     #     """(dev) Passe certaines phases du tirage.""" |  | ||||||
|     #     channel = ctx.channel.id |  | ||||||
|     #     self.tirages[channel] = tirage = Tirage(ctx, channel, teams) |  | ||||||
|     # |  | ||||||
|     #     tirage.phase = TiragePhase(tirage, round=1) |  | ||||||
|     #     for i, team in enumerate(tirage.teams): |  | ||||||
|     #         team.tirage_order = [i + 1, i + 1] |  | ||||||
|     #         team.passage_order = [i + 1, i + 1] |  | ||||||
|     #         team.accepted_problems = [PROBLEMS[i], PROBLEMS[-i - 1]] |  | ||||||
|     #     tirage.teams[0].rejected = [{PROBLEMS[3]}, set(PROBLEMS[4:8])] |  | ||||||
|     #     tirage.teams[1].rejected = [{PROBLEMS[7]}, set()] |  | ||||||
|     # |  | ||||||
|     #     await ctx.send(f"Skipping to {tirage.phase.__class__.__name__}.") |  | ||||||
|     #     await tirage.phase.start(ctx) |  | ||||||
|     #     await tirage.update_phase(ctx) |  | ||||||
|  |  | ||||||
|     def get_tirages(self) -> Dict[int, BaseTirage]: |     def get_tirages(self) -> Dict[int, BaseTirage]: | ||||||
|         return DiscordTirage.load_all() |         return DiscordTirage.load_all() | ||||||
|  |  | ||||||
| @@ -706,7 +692,7 @@ class TirageCog(Cog, name="Tirages"): | |||||||
|     @commands.has_role(Role.DEV) |     @commands.has_role(Role.DEV) | ||||||
|     async def send_cmd(self, ctx, tirage_id: int, poule="A", round: int = 1): |     async def send_cmd(self, ctx, tirage_id: int, poule="A", round: int = 1): | ||||||
|         """ |         """ | ||||||
|         Envoie les poules sur tfjm.org |         (dev) Envoie les poules sur tfjm.org | ||||||
|  |  | ||||||
|         Exemple: |         Exemple: | ||||||
|             `!draw send 42 B 1` - Envoie la poule B1 du tirage n°42. |             `!draw send 42 B 1` - Envoie la poule B1 du tirage n°42. | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ tirages = {} | |||||||
|  |  | ||||||
|  |  | ||||||
| def start(): | def start(): | ||||||
|     bot = CustomBot(("! ", "!")) |     bot = CustomBot(("! ", "!"), case_insensitive=True) | ||||||
|  |  | ||||||
|     @bot.event |     @bot.event | ||||||
|     async def on_ready(): |     async def on_ready(): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user