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

41 lines
1 KiB
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()
2023-03-16 08:07:51 +00:00
intents = (
hikari.Intents.GUILDS # limbo
| hikari.Intents.GUILD_MEMBERS # limbo
| hikari.Intents.GUILD_MESSAGES # activity
| hikari.Intents.GUILD_MESSAGE_TYPING # activity
| hikari.Intents.GUILD_VOICE_STATES # activity
)
bot = lightbulb.BotApp(token=c.config["token"], intents=intents)
2022-06-09 01:59:15 +00:00
# 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)