-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
46 lines (38 loc) · 1.22 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
import os
import traceback
import discord
from discord.ext import commands
from dotenv import load_dotenv
from utils import logsconfig
load_dotenv()
logger = logsconfig.logging.getLogger("bot")
intents = discord.Intents.all()
intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
guild_id = int(os.getenv('guildid'))
cogs = [
"admin",
"recentlyplayed",
"usercmds",
"registration",
"invites",
"activity"
]
@bot.event
async def on_ready():
logger.info("User: %s ID: %d", bot.user, bot.user.id)
#await utils.load_videocmds(bot)
for extension in cogs:
try:
await bot.load_extension("cogs." + extension)
except Exception:
logger.error("Failed to load extension %s", extension)
logger.error(traceback.print_exc())
try:
guildid = discord.Object(id=guild_id)
bot.tree.copy_global_to(guild=guildid)
synced = await bot.tree.sync(guild=guildid)
logger.info("Synced a Total of %d Commands", len(synced))
except Exception as e:
logger.info(f"Error loading Slash Commands \n{e}")
bot.run(os.getenv('TOKEN'), root_logger=True)