simpler query response
This commit is contained in:
parent
56bb781791
commit
37416eca80
@ -6,7 +6,7 @@ import re
|
|||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
from discord import app_commands
|
from discord import Interaction, app_commands
|
||||||
from unidecode import unidecode
|
from unidecode import unidecode
|
||||||
|
|
||||||
import database
|
import database
|
||||||
@ -321,20 +321,19 @@ async def handle_message(message, client: discord.Client) -> bool:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
async def new_riddle(interaction, index: int) -> None:
|
async def new_riddle(interaction: Interaction, index: int) -> None:
|
||||||
if random.random() <= 0.03:
|
if random.random() <= 0.03:
|
||||||
await interaction.response.send_message("Non")
|
await interaction.response.send_message("Non")
|
||||||
else:
|
else:
|
||||||
riddle_state = new_riddle_state(index)
|
riddle_state = new_riddle_state(index)
|
||||||
await interaction.response.send_message("Nouvelle énigme !")
|
msg = await interaction.response.send_message(
|
||||||
msg = await interaction.channel.send(
|
|
||||||
format_riddle_message({**riddle_state, "index": index})
|
format_riddle_message({**riddle_state, "index": index})
|
||||||
)
|
)
|
||||||
database.save_active_riddle(
|
database.save_active_riddle(
|
||||||
channel_id=str(interaction.channel.id),
|
channel_id=str(interaction.channel.id),
|
||||||
riddle_index=index,
|
riddle_index=index,
|
||||||
nb_clues=-1,
|
nb_clues=-1,
|
||||||
message_id=msg.id,
|
message_id=msg.message_id,
|
||||||
solver_id=None
|
solver_id=None
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user