-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathniotbot.py
36 lines (27 loc) · 1.03 KB
/
niotbot.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
import logging
from db import Base, engine
from discord.ext import commands
class NIoTBot(commands.Bot):
"""Norse IoT Bot; currently handles social media"""
APPROVERS_ROLE = "Social Media Approver"
def __init__(self, *args, **kwargs):
Base.metadata.create_all(engine)
self.initial_extensions = [
"modules.submission_manager",
"modules.publish_manager",
]
self.log = logging.getLogger("niot.bot")
super().__init__(*args, **kwargs)
async def setup_hook(self):
for ext in self.initial_extensions:
await self.load_extension(ext)
async def close(self):
"""Graceful shutdown"""
self.log.info("shutting down...")
await super().close()
# this needs to be manually updated if you want to add more channels
ALLOWED_CHANNELS = ["social-media"]
APPROVAL_EMOJI = "\N{WHITE HEAVY CHECK MARK}"
REJECTION_EMOJI = "\N{CROSS MARK}"
async def on_ready(self):
self.log.info('Logged on as "%s', self.user)