1
0
Fork 0
mirror of https://github.com/myned/watcher.git synced 2024-11-01 12:22:38 +00:00
watcher/run.py
Giulio Romano 7481105860 ?run.py [ fixed install to Client based on version of Hikari Miru 4.0.0 ]
Based on:

Jan 18
@hypergonial hypergonial
 v4.0.0
 87cfae8
v4.0.0 - REST Bot support
2024-05-24 16:33:37 +02:00

40 lines
1 KiB
Python

import os
import hikari
import lightbulb
import miru
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()
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)
# 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
miru.Client(bot)
tasks.load(bot)
bot.load_extensions_from("commands", "tasks")
bot.run(activity=hikari.Activity(name=c.config["activity"], type=c.ACTIVITY) if c.config["activity"] else None)