aboutsummaryrefslogtreecommitdiffstats
path: root/dev/bot/__init__.py
blob: 6ee1ae47df7c09218dd067555ebb493f089c0f61 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import asyncio
import logging
import os
import sys

import pydis_core

if os.name == "nt":
    # Change the event loop policy on Windows to avoid exceptions on exit
    asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

# Some basic logging to get existing loggers to show
logging.getLogger().addHandler(logging.StreamHandler())
logging.getLogger().setLevel(logging.DEBUG)
logging.getLogger("discord").setLevel(logging.ERROR)


class Bot(pydis_core.BotBase):
    """Sample Bot implementation."""

    async def setup_hook(self) -> None:
        """Load extensions on startup."""
        await super().setup_hook()
        asyncio.create_task(self.load_extensions(sys.modules[__name__]))