The begining
This commit is contained in:
commit
dee311e709
71 changed files with 8349 additions and 0 deletions
28
commandes/sendbotmessages.py
Executable file
28
commandes/sendbotmessages.py
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
import discord
|
||||
from discord import app_commands
|
||||
from discord.ext import commands
|
||||
|
||||
class SentBotMessages(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
@app_commands.command(name="sentbotmessages", description="Le bot envoie un message dans un salon choisi.")
|
||||
@app_commands.describe(
|
||||
message="Le message à envoyer",
|
||||
salon="Le salon où envoyer le message"
|
||||
)
|
||||
async def sentbotmessages(self, interaction: discord.Interaction, message: str, salon: discord.TextChannel):
|
||||
# Vérifie si l'utilisateur est admin
|
||||
if not interaction.user.guild_permissions.administrator:
|
||||
await interaction.response.send_message("⛔ Tu n'as pas la permission d'utiliser cette commande.", ephemeral=True)
|
||||
return
|
||||
|
||||
try:
|
||||
await salon.send(message)
|
||||
await interaction.response.send_message(f"✅ Message envoyé dans {salon.mention}.", ephemeral=True)
|
||||
except Exception as e:
|
||||
await interaction.response.send_message(f"❌ Une erreur est survenue : {e}", ephemeral=True)
|
||||
|
||||
async def setup(bot):
|
||||
await bot.add_cog(SentBotMessages(bot))
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue