-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
28 lines (22 loc) · 830 Bytes
/
bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import discord
from discord.ext import commands
import env # Importer le token depuis env.py
from category import duplicate_category, duplicate_category_only
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
@bot.event
async def on_ready():
print(f'Logged in as {bot.user}')
# Gestionnaire d'erreurs global
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CheckFailure):
await ctx.send("You do not have the necessary permissions to use this command.")
else:
# Vous pouvez gérer d'autres types d'erreurs ici
await ctx.send(f"An error occurred: {error}")
# Ajouter les commandes
bot.add_command(duplicate_category)
bot.add_command(duplicate_category_only)
bot.run(env.DISCORD_TOKEN)