New command and some fixes
- New command "chuchoter" fixed - New cog admin to add admin commands - guilds intents added
This commit is contained in:
parent
c4b81297be
commit
3146d269c8
|
@ -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))
|
|
@ -1,4 +1,5 @@
|
||||||
import discord
|
import discord
|
||||||
|
import random
|
||||||
from discord import app_commands
|
from discord import app_commands
|
||||||
from discord.app_commands import Choice
|
from discord.app_commands import Choice
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
@ -13,13 +14,22 @@ class Fun(MyCog):
|
||||||
|
|
||||||
@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, 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:
|
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}",
|
await interaction.response.send_message(f"Message envoyé dans {channel.mention}\n>>> {message}",
|
||||||
ephemeral=True)
|
ephemeral=True)
|
||||||
except:
|
except Exception as e:
|
||||||
await interaction.response.send_message(f"Le message n'a pas pu être envoyé...", ephemeral=True)
|
await interaction.response.send_message(f"Le message n'a pas pu être envoyé...\n`Erreur : {e}`",
|
||||||
|
ephemeral=True)
|
||||||
|
|
||||||
|
|
||||||
async def setup(bot):
|
async def setup(bot):
|
||||||
|
|
5
main.py
5
main.py
|
@ -13,7 +13,9 @@ load_dotenv()
|
||||||
|
|
||||||
class MyClient(commands.Bot):
|
class MyClient(commands.Bot):
|
||||||
def __init__(self):
|
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"))
|
self.MY_GUILD = discord.Object(id=getenv("GUILD_ID"))
|
||||||
|
|
||||||
|
@ -30,6 +32,7 @@ class MyClient(commands.Bot):
|
||||||
|
|
||||||
async def on_ready(self):
|
async def on_ready(self):
|
||||||
print(f'Logged in as {self.user} (ID: {self.user.id})')
|
print(f'Logged in as {self.user} (ID: {self.user.id})')
|
||||||
|
print(f"Discord version : {discord.__version__}")
|
||||||
print('------')
|
print('------')
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue