-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
42 lines (34 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
import discord, traceback
from discord.ext import commands
from utilities.config import Authorization
from utilities.context import Context
class DiscordBot(commands.Bot):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.cogs_loaded = False
async def get_context(self, message, *, cls = Context):
return await super().get_context(message, cls = cls)
bot = DiscordBot(
command_prefix = Authorization.prefix,
case_insensitive = True,
activity = discord.Game(name = Authorization.status),
intents = discord.Intents.all()
)
cogs = [
"example"
]
bot.remove_command("help")
@bot.event
async def on_ready():
if not bot.cogs_loaded:
await load_cogs()
print("Bot Connected")
async def load_cogs():
for cog in cogs:
try:
await bot.load_extension(f"cogs.{cog}")
except Exception as error:
print(f"Error loading [ {cog} ]")
traceback.print_exception(type(error), error, error.__traceback__)
bot.cogs_loaded = True
bot.run(Authorization.token, reconnect = True)