mirror of
https://github.com/Paillat-dev/Botator.git
synced 2026-01-01 16:56:20 +00:00
✨ feat(server.ts): add support for process.env.PORT environment variable to be able to run app on a configurable port 🐛 fix(main.py): remove duplicate cog addition in main.py ✨ feat(main.py): add cogs.Help(bot) to the list of cogs in main.py 🐛 fix(main.py): remove redundant import statements in main.py ✨ feat(main.py): add on_guild_remove event handler in main.py ✨ feat(main.py): add on_guild_join event handler in main.py ✨ feat(main.py): add support for discord.Intents in main.py ✨ feat(main.py): add intents.message_content = True in main.py ✨ feat(main.py): add intents.default() in main.py ✨ feat(main.py): add discord.Bot(intents=intents, help_command=None) in main.py ✨ feat(main.py): add import statements in main.py ✨ feat(main.py): add from src.config import debug, discord_token in main.py ✨ feat(main.py): add import discord in main.py ✨ feat(main.py): add import src.config in main.py ✨ feat(main.py): add import src.cogs in main.py ✨ feat(main.py): add import src.cogs.chat in main.py ✨ feat(main.py): add import src.cogs.manage_chat in main.py ✨ feat(main.py): add import src.cogs.moderation in main.py ✨ feat(main.py): add import src.cogs.channelSetup in main.py ✨ feat(main.py): add import src.cogs.help in main.py ✨ feat(main.py): add import src.cogs.Chat in main.py ✨ feat(main.py): add import src.cogs.ManageChat in main.py ✨ feat(main.py): add import src.cogs.Moderation in main.py ✨ feat(main.py): add import src.cogs.ChannelSetup in main.py ✨ feat(main.py): add import src.cogs.Help in main.py ✨ feat(main.py): add import src.cogs.chat in main.py ✨ feat(main.py): add import src.cogs.manage_chat in main.py ✨ feat(main.py): add import src.cogs.moderation in main.py ✨ feat(main.py): add
53 lines
1.4 KiB
Python
53 lines
1.4 KiB
Python
import discord # discord.py
|
|
from discord import Intents
|
|
import src.cogs as cogs
|
|
from src.config import debug, discord_token
|
|
|
|
# add the message content intent to the bot, aka discord.Intents.default() and discord.Intents.message_content
|
|
intents = discord.Intents.default()
|
|
intents.message_content = True
|
|
bot = discord.Bot(intents=intents, help_command=None) # create the bot
|
|
bot.add_cog(cogs.Chat(bot))
|
|
bot.add_cog(cogs.ManageChat(bot))
|
|
bot.add_cog(cogs.Moderation(bot))
|
|
bot.add_cog(cogs.ChannelSetup(bot))
|
|
bot.add_cog(cogs.Help(bot))
|
|
|
|
|
|
# set the bot's watching status to watcing your messages to answer you
|
|
@bot.event
|
|
async def on_ready():
|
|
await bot.change_presence(
|
|
activity=discord.Activity(
|
|
type=discord.ActivityType.watching, name=f"{len(bot.guilds)} servers"
|
|
)
|
|
)
|
|
debug("Bot is ready")
|
|
|
|
|
|
@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"
|
|
)
|
|
)
|
|
|
|
|
|
@bot.event
|
|
async def on_guild_remove(guild):
|
|
await bot.change_presence(
|
|
activity=discord.Activity(
|
|
type=discord.ActivityType.watching, name=f"{len(bot.guilds)} servers"
|
|
)
|
|
)
|
|
|
|
|
|
@bot.event
|
|
async def on_application_command_error(ctx, error: discord.DiscordException):
|
|
await ctx.respond(error, ephemeral=True)
|
|
raise error
|
|
|
|
|
|
bot.run(discord_token) # run the bot
|