diff --git a/cogs/cog_admin.py b/cogs/cog_admin.py new file mode 100644 index 0000000..8b5b94d --- /dev/null +++ b/cogs/cog_admin.py @@ -0,0 +1,16 @@ +import discord +from discord import app_commands +from discord.app_commands import Choice +from discord.ext import commands + +from classes.my_cog import MyCog + + +class Admin(MyCog): + def __init__(self, bot): + super().__init__(bot) + self.bot = bot + + +async def setup(bot): + await bot.add_cog(Admin(bot)) diff --git a/cogs/cog_fun.py b/cogs/cog_fun.py index 34a0362..274be3a 100644 --- a/cogs/cog_fun.py +++ b/cogs/cog_fun.py @@ -1,4 +1,5 @@ import discord +import random from discord import app_commands from discord.app_commands import Choice from discord.ext import commands @@ -13,13 +14,22 @@ class Fun(MyCog): @app_commands.command(name="chuchoter") async def chuchoter(self, interaction: discord.Interaction, channel: discord.TextChannel, message: str): - """ Chuchote à Staticky un message qu'il partagera """ + """ + 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: - await channel.send(f"*Quelqu'un m'a chuchoter :*\n>>> {message}") + 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: - await interaction.response.send_message(f"Le message n'a pas pu être envoyé...", 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): diff --git a/main.py b/main.py index 43e54f2..1d5ce15 100644 --- a/main.py +++ b/main.py @@ -13,7 +13,9 @@ load_dotenv() class MyClient(commands.Bot): def __init__(self): - super().__init__(intents=discord.Intents.none(), command_prefix="!") + intents = discord.Intents.none() + intents.guilds = True + super().__init__(intents=intents, command_prefix=".") self.MY_GUILD = discord.Object(id=getenv("GUILD_ID")) @@ -30,6 +32,7 @@ class MyClient(commands.Bot): async def on_ready(self): print(f'Logged in as {self.user} (ID: {self.user.id})') + print(f"Discord version : {discord.__version__}") print('------')