a
This commit is contained in:
parent
57f9604781
commit
0d500319c8
1 changed files with 3 additions and 3 deletions
|
@ -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_contexts(guilds=True,dms=True,private_channels=True)
|
||||||
@app_commands.allowed_installs(guilds=True,users=True)
|
@app_commands.allowed_installs(guilds=True,users=True)
|
||||||
async def say(interaction:discord.Interaction,id:str,message:str):
|
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")
|
print("ok9")
|
||||||
await interaction.response.send_message("Vous n'avez pas ce personnage",ephemeral=True)
|
await interaction.response.send_message("Vous n'avez pas ce personnage",ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -55,7 +55,7 @@ async def say(interaction:discord.Interaction,id:str,message:str):
|
||||||
await interaction.response.send_message("Message envoyé",ephemeral=True)
|
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("HELLOWORODL")
|
||||||
# print(userid,guildid,shortname,message,channel)
|
# 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))
|
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("ok2")
|
||||||
print(channel.guild)
|
print(channel.guild)
|
||||||
if channel.guild is None:
|
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
|
return
|
||||||
if discord.utils.get(await channel.webhooks(),name=short_name) is None:
|
if discord.utils.get(await channel.webhooks(),name=short_name) is None:
|
||||||
# print("ok3");
|
# print("ok3");
|
||||||
|
|
Loading…
Reference in a new issue