-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.py
53 lines (39 loc) · 1.12 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
51
52
53
import logging
import traceback
import disnake
from disnake.ext import commands
from calypso import Calypso, config, db, errors, gamedata
COGS = (
"calypso.cogs.weather",
"calypso.cogs.admin",
"calypso.cogs.onboarding",
"calypso.cogs.encounters",
"calypso.cogs.cgoals",
"calypso.cogs.ai",
"calypso.cogs.utils",
"calypso.cogs.msglog",
)
logging.basicConfig(level=logging.INFO)
intents = disnake.Intents.all()
bot = Calypso(
command_prefix=commands.when_mentioned,
intents=intents,
sync_commands_debug=True,
)
# === listeners ===
@bot.event
async def on_ready():
print(f"Logged in as {bot.user} ({bot.user.id})")
@bot.event
async def on_slash_command_error(inter, error):
if isinstance(error, commands.CommandInvokeError):
error = error.original
await inter.send(f"Error: {error!s}", ephemeral=True)
if not isinstance(error, errors.CalypsoError):
traceback.print_exception(error)
for cog in COGS:
bot.load_extension(cog)
if __name__ == "__main__":
gamedata.GamedataRepository.reload()
bot.loop.create_task(db.init_db())
bot.run(config.TOKEN)