-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__main__.py
50 lines (37 loc) · 1.02 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
import asyncio
import os
import sys
from discord import Intents
from bot import Harmony
from config import TOKEN
os.environ["JISHAKU_NO_UNDERSCORE"] = "True"
initial_extensions = [
"jishaku",
"cogs.infrastructure",
"cogs.developer",
"cogs.miscellaneous",
"cogs.anime",
"cogs.information",
"cogs.moderation",
"cogs.fun",
"cogs.logging",
]
intents = Intents.default()
intents.message_content = True
bot = Harmony(intents=intents, initial_extensions=initial_extensions)
async def run() -> None:
print("Starting bot")
await bot.start(TOKEN)
if __name__ == "__main__":
if sys.platform == "win32":
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
try:
loop.run_until_complete(run())
except KeyboardInterrupt:
if hasattr(bot, "log"):
bot.log.critical("KeyboardInterrupt: Closing")
except Exception:
asyncio.run(bot.close())
raise