Initial commit: bot Discord Vicy V1.8
This commit is contained in:
commit
56958c5832
70 changed files with 8469 additions and 0 deletions
49
commandes/restranscription_staff.py
Normal file
49
commandes/restranscription_staff.py
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
import discord
|
||||
from discord.ext import commands
|
||||
from discord import app_commands
|
||||
|
||||
class RestranscriptionStaff(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_message(self, message):
|
||||
# Ignorer les messages du bot lui-même
|
||||
if message.author == self.bot.user:
|
||||
return
|
||||
|
||||
# Ignorer les messages d'autres bots
|
||||
if message.author.bot:
|
||||
return
|
||||
|
||||
# Réceptionner les MPs
|
||||
if isinstance(message.channel, discord.DMChannel):
|
||||
channel_reception = self.bot.get_channel(1277951933105049601) # Remplacez par votre ID de salon
|
||||
|
||||
embed = discord.Embed(description=message.content,
|
||||
color=discord.Color.blue())
|
||||
embed.set_author(name=message.author.name,
|
||||
icon_url=message.author.avatar.url
|
||||
if message.author.avatar else None)
|
||||
|
||||
await channel_reception.send(embed=embed)
|
||||
|
||||
# Traiter les autres commandes si nécessaire
|
||||
await self.bot.process_commands(message)
|
||||
|
||||
# Exemple de commande slash avec gestion des erreurs
|
||||
@app_commands.command()
|
||||
async def message_tous(self, interaction: discord.Interaction):
|
||||
await interaction.response.send_message("Commande test!")
|
||||
|
||||
@message_tous.error
|
||||
async def message_tous_error(self, interaction: discord.Interaction,
|
||||
error: app_commands.AppCommandError):
|
||||
if isinstance(error, app_commands.MissingPermissions):
|
||||
await interaction.response.send_message(
|
||||
"Vous n'avez pas la permission d'utiliser cette commande.",
|
||||
ephemeral=True)
|
||||
|
||||
# Fonction de configuration pour ajouter le cog au bot
|
||||
async def setup(bot):
|
||||
await bot.add_cog(RestranscriptionStaff(bot))
|
||||
Loading…
Add table
Add a link
Reference in a new issue