-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbot.py
37 lines (28 loc) · 1.22 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
import os
from typing import Any
import aiohttp
import discord
from discord.ext import commands
GUILD = discord.Object(id=os.getenv("TEST_GUILD_ID"))
class WakscordBot(commands.AutoShardedBot):
def __init__(self):
super().__init__(
command_prefix="!",
intents=discord.Intents.default(),
allowed_mentions=discord.AllowedMentions.none(),
)
self.session: aiohttp.ClientSession = None
async def setup_hook(self):
await self.load_extension("commands.chat")
await self.load_extension("commands.etc")
await self.load_extension("commands.settings")
await self.load_extension("commands.speed_setup")
await self.load_extension("commands.subscribe")
self.tree.copy_global_to(guild=GUILD)
await self.tree.sync() # guild=GUILD)
async def on_error(self, event_method: str, /, *args: Any, **kwargs: Any) -> None:
print(event_method, args, kwargs)
return await super().on_error(event_method, *args, **kwargs)
async def on_command_error(self, context, exception) -> None:
print(context, exception)
return await super().on_command_error(context, exception)