2023-03-31 14:09:06 +02:00
|
|
|
import discord # discord.py
|
2022-12-16 12:50:52 +01:00
|
|
|
from discord import Intents
|
2023-07-15 12:20:38 +02:00
|
|
|
import src.cogs as cogs
|
|
|
|
|
from src.config import debug, discord_token
|
2023-03-31 14:09:06 +02:00
|
|
|
|
|
|
|
|
# add the message content intent to the bot, aka discord.Intents.default() and discord.Intents.message_content
|
2022-12-16 12:50:52 +01:00
|
|
|
intents = discord.Intents.default()
|
|
|
|
|
intents.message_content = True
|
2023-03-31 14:09:06 +02:00
|
|
|
bot = discord.Bot(intents=intents, help_command=None) # create the bot
|
2022-12-08 22:21:53 +01:00
|
|
|
bot.add_cog(cogs.Setup(bot))
|
|
|
|
|
bot.add_cog(cogs.Settings(bot))
|
|
|
|
|
bot.add_cog(cogs.Help(bot))
|
|
|
|
|
bot.add_cog(cogs.Chat(bot))
|
|
|
|
|
bot.add_cog(cogs.ManageChat(bot))
|
2023-02-02 21:44:40 +01:00
|
|
|
bot.add_cog(cogs.Moderation(bot))
|
|
|
|
|
|
2023-03-31 14:09:06 +02:00
|
|
|
|
|
|
|
|
# set the bot's watching status to watcing your messages to answer you
|
2022-12-16 12:50:52 +01:00
|
|
|
@bot.event
|
|
|
|
|
async def on_ready():
|
2023-03-31 14:09:06 +02:00
|
|
|
await bot.change_presence(
|
|
|
|
|
activity=discord.Activity(
|
2023-07-19 19:51:05 +02:00
|
|
|
type=discord.ActivityType.watching, name=f"{len(bot.guilds)} servers"
|
2023-03-31 14:09:06 +02:00
|
|
|
)
|
|
|
|
|
)
|
2023-03-09 16:49:42 +01:00
|
|
|
debug("Bot is ready")
|
|
|
|
|
|
2023-03-31 14:09:06 +02:00
|
|
|
|
2023-07-19 19:51:05 +02:00
|
|
|
@bot.event
|
|
|
|
|
async def on_guild_join(guild):
|
|
|
|
|
await bot.change_presence(
|
|
|
|
|
activity=discord.Activity(
|
|
|
|
|
type=discord.ActivityType.watching, name=f"{len(bot.guilds)} servers"
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2023-03-09 16:49:42 +01:00
|
|
|
@bot.event
|
|
|
|
|
async def on_application_command_error(ctx, error):
|
|
|
|
|
debug(error)
|
2023-03-31 14:09:06 +02:00
|
|
|
await ctx.respond(error, ephemeral=True)
|
2023-07-16 21:18:30 +02:00
|
|
|
|
|
|
|
|
|
2023-07-18 17:51:13 +02:00
|
|
|
bot.run(discord_token) # run the bot
|