2021-05-28 13:52:37 +02:00
|
|
|
print("Chargement des extensions & librairie...", end = " ")
|
2020-11-29 11:39:41 +01:00
|
|
|
|
2021-05-28 14:13:14 +02:00
|
|
|
import discord
|
2021-06-07 23:55:19 +02:00
|
|
|
from os import environ
|
2021-05-28 14:03:34 +02:00
|
|
|
from discord_slash import SlashCommand
|
2020-11-29 11:39:41 +01:00
|
|
|
from discord.ext import commands
|
2021-06-03 12:21:00 +02:00
|
|
|
from utils.reminder import Reminder
|
2021-06-07 23:55:19 +02:00
|
|
|
customPrefix = environ['PREFIX']
|
2020-11-29 11:39:41 +01:00
|
|
|
|
2021-05-07 16:44:47 +02:00
|
|
|
client = commands.Bot(command_prefix = customPrefix, case_insensitive = True, intents = discord.Intents.all())
|
2021-05-29 12:50:55 +02:00
|
|
|
slash = SlashCommand(client, sync_commands = True)
|
2020-11-29 11:39:41 +01:00
|
|
|
|
2020-12-16 19:26:51 +01:00
|
|
|
client.load_extension("cogs.help")
|
|
|
|
client.load_extension("cogs.utils")
|
|
|
|
client.load_extension("cogs.internet")
|
|
|
|
client.load_extension("cogs.music")
|
|
|
|
client.load_extension("cogs.games")
|
|
|
|
client.load_extension("cogs.fun")
|
2021-05-15 20:07:49 +02:00
|
|
|
client.load_extension("cogs.school")
|
2021-06-07 00:02:34 +02:00
|
|
|
client.load_extension("cogs.citation")
|
2021-05-31 21:29:15 +02:00
|
|
|
client.load_extension("cogs.confreriedukassoulait") # you can remove this cogs, only for my private guild
|
2021-06-03 12:21:00 +02:00
|
|
|
Reminder().creationTable()
|
2021-05-28 13:52:37 +02:00
|
|
|
print("Terminé !")
|
2020-12-16 19:26:51 +01:00
|
|
|
|
2020-11-29 11:39:41 +01:00
|
|
|
@client.event
|
|
|
|
async def on_connect():
|
2021-05-28 13:52:37 +02:00
|
|
|
print(f"Connecté !")
|
2020-11-29 11:39:41 +01:00
|
|
|
|
|
|
|
@client.event
|
|
|
|
async def on_ready():
|
2021-05-07 16:48:40 +02:00
|
|
|
await client.change_presence(status = discord.Status.online, activity = discord.Activity(name = f"{customPrefix}help", type = discord.ActivityType.playing))
|
2020-11-29 11:39:41 +01:00
|
|
|
print("Bot prêt.")
|
|
|
|
|
|
|
|
@client.event
|
|
|
|
async def on_command_error(ctx, error):
|
2021-05-31 20:24:37 +02:00
|
|
|
if not ctx.invoked_with.startswith(customPrefix):
|
2020-11-29 11:39:41 +01:00
|
|
|
print(error)
|
2021-06-07 21:32:14 +02:00
|
|
|
if "discord.errors.NotFound" in str(error) == False:
|
|
|
|
await ctx.message.add_reaction(emoji = '❓')
|
2020-11-29 11:39:41 +01:00
|
|
|
|
|
|
|
@client.event
|
|
|
|
async def on_message(message):
|
|
|
|
await client.process_commands(message)
|
|
|
|
|
|
|
|
if message.author == client.user:
|
|
|
|
return
|
|
|
|
|
2021-05-31 20:26:57 +02:00
|
|
|
"""informations concernant le bot lorsqu'il est mentionner"""
|
2020-11-29 11:39:41 +01:00
|
|
|
if client.user.mention == message.content.replace("!",""):
|
|
|
|
ctx = await client.get_context(message)
|
|
|
|
prefix = await client.get_prefix(message)
|
|
|
|
await ctx.send(f">>> Coucou !\nMon préfix est `{prefix}` et ma commande d'aide est `{prefix}help`")
|
|
|
|
|
2021-05-28 13:52:37 +02:00
|
|
|
print("Connexion à Discord...", end = " ")
|
2021-06-07 23:55:19 +02:00
|
|
|
client.run(environ['TOKEN_DISCORD'])
|