-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbot.py
More file actions
32 lines (23 loc) · 819 Bytes
/
bot.py
File metadata and controls
32 lines (23 loc) · 819 Bytes
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
#!/usr/bin/env python3
from discord.ext import commands
import discord
import config
class Bot(commands.Bot):
def __init__(self, intents: discord.Intents, **kwargs):
super().__init__(
command_prefix=commands.when_mentioned_or("?"), intents=intents, **kwargs
)
async def setup_hook(self):
for cog in config.cogs:
try:
await self.load_extension(f"cogs.{cog}")
except Exception as exc:
print(
f"Could not load extension {cog} due to {exc.__class__.__name__}: {exc}"
)
async def on_ready(self):
print(f"Logged on as {self.user} (ID: {self.user.id})")
intents = discord.Intents.default()
bot = Bot(intents=intents)
# write general commands here
bot.run(config.token)