-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
62 lines (52 loc) · 1.39 KB
/
main.py
File metadata and controls
62 lines (52 loc) · 1.39 KB
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
57
58
59
60
61
62
import discord
from discord.ext import commands
import asyncpg
from dotenv import load_dotenv
from os import getenv
import sys
import logging
import sqlite3
__version__ = "0.2.0"
logger = logging.getLogger(__name__)
if sys.platform != "win32":
import uvloop
uvloop.install()
else:
import asyncio
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
load_dotenv()
TOKEN = getenv("DISCORD_TOKEN")
bot = commands.Bot(command_prefix="p!", intents=discord.Intents.all(), allowed_mentions=discord.AllowedMentions.none())
bot.owner_ids = [
513102328828788757, # CoffeeLink
648168353453572117, # Pearoo
710839743222513715, # anchietae
451023384151851028, # xou
969269703082135612, # zypherift
1291498084185935920, # 4831c0
]
bot.connection = sqlite3.connect("polls.db")
bot.cursor = bot.connection.cursor()
bot.cursor.execute(
"""
CREATE TABLE IF NOT EXISTS polls (
poll_message_id INTEGER PRIMARY KEY,
poll_channel_id INTEGER NOT NULL,
log_message_id INTEGER NOT NULL
)
"""
)
@bot.event
async def on_ready():
logger.info(f"Logged in as {bot.user.display_name}")
async def setup_hook():
await bot.load_extension("log")
@bot.command()
async def reload(ctx):
if not ctx.author.id in bot.owner_ids:
return
await bot.reload_extension("log")
await ctx.send("Reloaded logging module")
bot.setup_hook = setup_hook
if __name__ == "__main__":
bot.run(TOKEN, root_logger=True)