Actualiser cogs/cog_fun.py

This commit is contained in:
Arthur 2023-12-17 19:58:31 +01:00
parent 3146d269c8
commit db0913f50b
1 changed files with 36 additions and 36 deletions

View File

@ -1,36 +1,36 @@
import discord
import random
from discord import app_commands
from discord.app_commands import Choice
from discord.ext import commands
from classes.my_cog import MyCog
class Fun(MyCog):
def __init__(self, bot):
super().__init__(bot)
self.bot = bot
@app_commands.command(name="chuchoter")
async def chuchoter(self, interaction: discord.Interaction, channel: discord.TextChannel, message: str):
"""
Chuchote à Staticky un message qu'il partagera (attention ne lui faites pas aveuglément confiance)
:param interaction: discord interaction
:param channel: Salon dans lequel le message sera partagé
:param message: Message à partagerE
"""
try:
to_send = f"**Quelqu'un m'a chuchoter :** \"{message}\""
if random.randint(1, 6) == 1:
to_send += f"\nJe balance, c'est {interaction.user.mention} !"
await channel.send(to_send)
await interaction.response.send_message(f"Message envoyé dans {channel.mention}\n>>> {message}",
ephemeral=True)
except Exception as e:
await interaction.response.send_message(f"Le message n'a pas pu être envoyé...\n`Erreur : {e}`",
ephemeral=True)
async def setup(bot):
await bot.add_cog(Fun(bot))
import discord
import random
from discord import app_commands
from discord.app_commands import Choice
from discord.ext import commands
from classes.my_cog import MyCog
class Fun(MyCog):
def __init__(self, bot):
super().__init__(bot)
self.bot = bot
@app_commands.command(name="chuchoter")
async def chuchoter(self, interaction: discord.Interaction, channel: discord.TextChannel, message: str):
"""
Chuchote à Staticky un message qu'il partagera (attention ne lui faites pas aveuglément confiance)
:param interaction: discord interaction
:param channel: Salon dans lequel le message sera partagé
:param message: Message à partagerE
"""
try:
to_send = f"**Quelqu'un m'a chuchoté :** \"{message}\""
if random.randint(1, 6) == 1:
to_send += f"\nJe balance, c'est {interaction.user.mention} !"
await channel.send(to_send)
await interaction.response.send_message(f"Message envoyé dans {channel.mention}\n>>> {message}",
ephemeral=True)
except Exception as e:
await interaction.response.send_message(f"Le message n'a pas pu être envoyé...\n`Erreur : {e}`",
ephemeral=True)
async def setup(bot):
await bot.add_cog(Fun(bot))