Correction messages envoyés après défi terminé
This commit is contained in:
parent
dfac15796e
commit
f6ea33d51c
5
bot.py
5
bot.py
@ -263,7 +263,7 @@ class MainView(discord.ui.View):
|
||||
|
||||
async def terminer_defi(self, id_defi: int, user_id: int, interaction: discord.Interaction):
|
||||
await interaction.response.defer()
|
||||
await terminer(ctx, id_defi, user_id)
|
||||
await terminer(ctx, id_defi, user_id, interaction.channel)
|
||||
|
||||
for id_defi in defis:
|
||||
defi = next(defi for defi in DEFIS['capture'] if defi['id'] == id_defi)
|
||||
@ -298,7 +298,7 @@ async def afficher_main(ctx: commands.Context, mode: Literal['public', 'prive']
|
||||
|
||||
|
||||
@bot.command()
|
||||
async def terminer(ctx: commands.Context, id_defi: int, author_id: int | None = None):
|
||||
async def terminer(ctx: commands.Context, id_defi: int, author_id: int | None = None, channel: discord.abc.Messageable | None = None):
|
||||
if all(id_defi != defi['id'] for defi in DEFIS['capture']):
|
||||
raise commands.BadArgument(f"Erreur : Le défi {id_defi_1} n'existe pas")
|
||||
defi = next(defi for defi in DEFIS['capture'] if defi['id'] == id_defi)
|
||||
@ -320,6 +320,7 @@ async def terminer(ctx: commands.Context, id_defi: int, author_id: int | None =
|
||||
with DATA_FILE.open('w') as data_file:
|
||||
json.dump(data, data_file, indent=2)
|
||||
|
||||
channel = channel or ctx
|
||||
await ctx.send(f"Défi n°{id_defi} **{defi['nom']}** terminé ! Il est retiré de votre main.")
|
||||
colour = discord.Color.red() if equipe == "rouge" else discord.Color.green()
|
||||
embed = discord.Embed(title=nouveau_defi['nom'], description=nouveau_defi['description'], colour=colour)
|
||||
|
Loading…
x
Reference in New Issue
Block a user