-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
56 lines (41 loc) · 1.15 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import logging
from typing import Any
import discord
from discord import Message
from discord.ext import commands
import config
logger = logging.getLogger(__name__)
discord.utils.setup_logging(level=logging.INFO)
cogs = [
'cogs.artifact',
'cogs.build_card',
# 'cogs.profile'
]
def get_prefix(bot: commands.Bot, message: Message):
return commands.when_mentioned_or(config.prefix)(bot, message)
class Bot(commands.Bot):
def __init__(self):
intents = discord.Intents.default()
intents.message_content = True
super().__init__(
command_prefix=get_prefix,
intents=intents
)
async def setup_hook(self):
for cog in cogs:
await self.load_extension(cog)
await self.tree.sync()
def run(
self,
token: str = config.token,
**kwargs: Any,
):
super().run(token, **kwargs)
async def on_ready(self):
logger.info('ready')
async def on_message(self, message: Message):
if message.author.bot:
return
await self.process_commands(message)
if __name__ == '__main__':
Bot().run(log_handler=None)