-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
40 lines (29 loc) · 1.06 KB
/
main.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
import os
import discord
from discord.ext import commands
import asyncio
from cogwatch import Watcher
from dotenv import load_dotenv
load_dotenv()
intents = discord.Intents.all()
intents.message_content = True
class CarlBot(discord.Bot):
def __init__(self):
super().__init__(intents=intents)
async def on_ready(self):
print("Ready.")
async def on_application_command_error(self, ctx: discord.ApplicationContext, exception: discord.DiscordException):
print(exception)
if isinstance(exception, commands.CommandOnCooldown):
await ctx.respond("You're on cooldown")
if isinstance(exception, commands.MaxConcurrencyReached):
await ctx.respond("Max concurrency reached on command")
if isinstance(exception, commands.CommandInvokeError):
await ctx.respond(exception.original)
async def main():
bot = CarlBot()
watcher = Watcher(bot, "cogs/", preload=True)
await watcher.start()
await bot.start(os.getenv("BOT_TOKEN"))
if __name__ == "__main__":
asyncio.run(main())