2022-02-21 07:10:57 +00:00
|
|
|
import os
|
2022-02-21 20:53:53 +00:00
|
|
|
|
2022-02-21 07:10:57 +00:00
|
|
|
import hikari
|
|
|
|
import lightbulb
|
|
|
|
import miru
|
|
|
|
|
|
|
|
import config as c
|
|
|
|
|
|
|
|
|
|
|
|
# Unix optimizations
|
|
|
|
# https://github.com/hikari-py/hikari#uvloop
|
2022-02-21 20:53:53 +00:00
|
|
|
if os.name != "nt":
|
2022-02-21 07:10:57 +00:00
|
|
|
import uvloop
|
2022-02-21 20:53:53 +00:00
|
|
|
|
2022-02-21 07:10:57 +00:00
|
|
|
uvloop.install()
|
|
|
|
|
2022-02-23 04:16:02 +00:00
|
|
|
bot = lightbulb.BotApp(
|
|
|
|
token=c.config["token"],
|
|
|
|
default_enabled_guilds=c.config["guilds"],
|
|
|
|
help_slash_command=True,
|
|
|
|
)
|
2022-02-21 07:10:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
@bot.listen(lightbulb.CommandErrorEvent)
|
|
|
|
async def on_error(event):
|
|
|
|
await bot.application.owner.send(c.error(event))
|
|
|
|
|
|
|
|
try:
|
|
|
|
await event.context.respond(c.ERROR)
|
|
|
|
except:
|
2022-02-21 19:38:38 +00:00
|
|
|
await event.context.interaction.edit_initial_response(c.ERROR, components=None)
|
2022-02-21 07:10:57 +00:00
|
|
|
|
|
|
|
raise event.exception
|
|
|
|
|
|
|
|
|
|
|
|
miru.load(bot)
|
2022-02-21 20:53:53 +00:00
|
|
|
bot.load_extensions_from("tools", "commands")
|
2022-02-23 06:18:54 +00:00
|
|
|
bot.run(activity=hikari.Activity(name=c.config["activity"], type=c.ACTIVITY) if c.config["activity"] else None)
|