This commit is contained in:
GZod01 2024-12-15 17:20:10 +01:00
parent 57f9604781
commit 0d500319c8

View file

@ -47,7 +47,7 @@ async def on_message(message:discord.Message):
@app_commands.allowed_contexts(guilds=True,dms=True,private_channels=True)
@app_commands.allowed_installs(guilds=True,users=True)
async def say(interaction:discord.Interaction,id:str,message:str):
if not await say_message(interaction.user.id,(interaction.guild.id if interaction.guild is not None else -1),id,message,interaction.channel):
if not await say_message(interaction.user.id,(interaction.guild.id if interaction.guild is not None else -1),id,message,interaction.channel,interaction.response):
print("ok9")
await interaction.response.send_message("Vous n'avez pas ce personnage",ephemeral=True)
return
@ -55,7 +55,7 @@ async def say(interaction:discord.Interaction,id:str,message:str):
await interaction.response.send_message("Message envoyé",ephemeral=True)
async def say_message(userid:int, guildid:int, shortname:str, message:str,channel:discord.TextChannel):
async def say_message(userid:int, guildid:int, shortname:str, message:str,channel:discord.TextChannel,interaction_res:discord.InteractionResponse=None):
# print("HELLOWORODL")
# print(userid,guildid,shortname,message,channel)
res = await bot.db.execute("SELECT * FROM personnages WHERE uuid=? AND (guild_id=? OR guild_id IS NULL) AND nom_court=?",(userid,guildid,shortname))
@ -72,7 +72,7 @@ async def say_message(userid:int, guildid:int, shortname:str, message:str,channe
# print("ok2")
print(channel.guild)
if channel.guild is None:
await channel.send(f"**{full_name}({short_name})**: {message}")
await interaction_res.send_message(f"**{full_name}({short_name})**: {message}")
return
if discord.utils.get(await channel.webhooks(),name=short_name) is None:
# print("ok3");