Le channel par défaut est le channel de l'interaction

This commit is contained in:
Valentin Moguérou 2023-12-17 23:42:49 +01:00
parent db0913f50b
commit 4abc4e20b5
1 changed files with 4 additions and 1 deletions

View File

@ -13,7 +13,7 @@ class Fun(MyCog):
self.bot = bot self.bot = bot
@app_commands.command(name="chuchoter") @app_commands.command(name="chuchoter")
async def chuchoter(self, interaction: discord.Interaction, channel: discord.TextChannel, message: str): async def chuchoter(self, interaction: discord.Interaction, message: str, channel: discord.TextChannel=None):
""" """
Chuchote à Staticky un message qu'il partagera (attention ne lui faites pas aveuglément confiance) Chuchote à Staticky un message qu'il partagera (attention ne lui faites pas aveuglément confiance)
:param interaction: discord interaction :param interaction: discord interaction
@ -21,6 +21,9 @@ class Fun(MyCog):
:param message: Message à partagerE :param message: Message à partagerE
""" """
try: try:
if channel is None:
channel = interaction.channel
to_send = f"**Quelqu'un m'a chuchoté :** \"{message}\"" to_send = f"**Quelqu'un m'a chuchoté :** \"{message}\""
if random.randint(1, 6) == 1: if random.randint(1, 6) == 1:
to_send += f"\nJe balance, c'est {interaction.user.mention} !" to_send += f"\nJe balance, c'est {interaction.user.mention} !"