forked from danverstom/CMS-Web-Overlays
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
48 lines (40 loc) · 1.72 KB
/
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import discord
from discord.ext.commands import Bot
from discord_slash import SlashCommand
from discord_slash.utils import manage_commands
from utils.utils import *
from utils.config import *
import traceback
# Creating the bot object
intents = discord.Intents.all()
bot = Bot(command_prefix="-", intents=intents)
slash = SlashCommand(bot, sync_commands=SYNC_COMMANDS)
from commands.AdminCommands import AdminCommands
from commands.CardCommands import CardCommands
from commands.ScoreBarCommands import ScoreBarCommands
from commands.TitlePageCommands import TitlePageCommands
from commands.RosterCommands import RosterCommands
from commands.TeamWinCommands import TeamWinCommands
from commands.DraftCommands import DraftCommands
bot.add_cog(AdminCommands(bot, slash, bot_token))
bot.add_cog(CardCommands(bot))
bot.add_cog(ScoreBarCommands(bot))
bot.add_cog(TitlePageCommands(bot))
bot.add_cog(RosterCommands(bot))
bot.add_cog(TeamWinCommands(bot))
bot.add_cog(DraftCommands(bot))
@bot.event
async def on_ready():
print('Logged on as {0}!'.format(bot.user))
save_json_file("utils/command_names.json", [command for command in slash.commands])
@bot.event
async def on_slash_command_error(ctx, error):
print(''.join(traceback.format_exception(etype=type(error), value=error, tb=error.__traceback__)))
if get_debug_status():
desc = f"```{''.join(traceback.format_exception(etype=type(error), value=error, tb=error.__traceback__))}```"
desc += f"_command executed by {ctx.author.mention}_"
embed = discord.Embed(title=type(error).__name__, description=desc, colour=discord.Colour.red())
await ctx.send(embed=embed)
else:
await error_embed(ctx, f"`{type(error).__name__}: {error}`")
bot.run(bot_token)