-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
51 lines (36 loc) · 1.31 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
from resources import load_env
import argparse
import os
import discord
from discord.ext import commands
from resources.utils import logger
intents = discord.Intents.all()
bot = commands.Bot(command_prefix="^", intents=intents)
@bot.event
async def on_ready():
try:
bot.load_extension("resources.commands.generate")
bot.load_extension("resources.commands.transform")
bot.load_extension("resources.commands.swapface")
bot.load_extension("resources.commands.upscale")
bot.load_extension("resources.commands.help")
logger.logs(f"Extensions loaded")
except Exception as e:
logger.error(f"Something went wrong while loading extensions:\n{e}")
await bot.sync_commands()
logger.logs(f"Logged in as {bot.user}")
@bot.command()
@commands.is_owner()
async def sync_commands(ctx):
await bot.sync_commands()
await ctx.reply("Commands are synced!")
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("-e", "--env", choices=["dev", "prod"], default="dev")
args = parser.parse_args()
match args.env:
case "prod":
discord_token = os.getenv("DISCORD_PROD")
case _:
discord_token = os.getenv("DISCORD")
bot.run(discord_token)