-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
39 lines (32 loc) · 1.17 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
38
39
import sys
import logging
from discord import Intents, Activity, ActivityType
from tortoise import Tortoise
from discord.ext import commands
import config
from constants import SENTRY_ENV_NAME, TORTOISE_ORM
from app.utils import use_sentry
if __name__ == "__main__":
# initialize bot params
intents = Intents.default()
intents.members = True
activity = Activity(type=ActivityType.watching, name="Covalent POAP")
bot = commands.Bot(command_prefix="!covalent_poap.", help_command=None, intents=intents, activity=activity)
# init sentry SDK
use_sentry(
bot,
dsn=config.SENTRY_API_KEY,
environment=SENTRY_ENV_NAME,
integrations=[],
)
# setup logger
file_handler = logging.FileHandler(filename="covalent-poap.log")
stdout_handler = logging.StreamHandler(sys.stdout)
logging.basicConfig(
level=logging.getLevelName(config.LOG_LEVEL),
format="%(asctime)s %(levelname)s:%(message)s",
handlers=[file_handler if config.LOG_TO_FILE else stdout_handler],
)
bot.loop.run_until_complete(Tortoise.init(config=TORTOISE_ORM))
bot.load_extension("app.extensions.poap")
bot.run(config.TOKEN)