1
0
Fork 0
mirror of https://github.com/myned/watcher.git synced 2024-11-01 12:22:38 +00:00
watcher/run.py

35 lines
810 B
Python
Raw Normal View History

2022-06-09 01:59:15 +00:00
import os
import hikari
import lightbulb
2022-07-05 22:28:19 +00:00
import miru
2022-06-09 01:59:15 +00:00
from lightbulb.ext import tasks
import config as c
# Unix optimizations
# https://github.com/hikari-py/hikari#uvloop
if os.name != "nt":
import uvloop
uvloop.install()
bot = lightbulb.BotApp(token=c.config["token"], intents=hikari.Intents.ALL_GUILDS)
# Listener for global exceptions
@bot.listen(hikari.ExceptionEvent)
async def on_error(event):
exception = event.exception.__cause__ or event.exception
await (await bot.rest.fetch_application()).owner.send(f"```❗ {type(exception).__name__}: {exception}```")
raise event.exception
2023-01-04 17:46:45 +00:00
miru.install(bot)
2022-06-09 01:59:15 +00:00
tasks.load(bot)
2022-07-05 22:19:59 +00:00
bot.load_extensions_from("commands", "tasks")
2022-06-09 01:59:15 +00:00
bot.run(activity=hikari.Activity(name=c.config["activity"], type=c.ACTIVITY) if c.config["activity"] else None)