This repository has been archived by the owner on Nov 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
app.py
68 lines (56 loc) · 2.24 KB
/
app.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# -*- coding: utf-8 -*-
'''
MIT License
Copyright (c) 2021 Deepak Raj
Bot-Name:- Cybel
Github:- https://github.com/codePerfectPlus/Cybel
Invite-Link:-
https://top.gg/bot/832137823309004800/invite
'''
import asyncio
from termcolor import colored
import discord
from discord.ext import commands
import argparse
from src.utils import logging
from src.utils import DISCORD_TOKEN
arg = argparse.ArgumentParser()
arg.add_argument("-d", "--debug", help="Debug mode", action="store_true")
args = arg.parse_args()
intents = discord.Intents.all()
intents.members = True
bot = commands.Bot(command_prefix='!',
intents=intents,
case_insensitive=True,
description='''Cybel - A Powerfull, Advanced, and Open Source Discord Bot.\nGithub:- [CodePerfectPlus](https://github.com/codeperfectoplus)\nDeveloper: [Deepak Raj](https://www.linkedin.com/in/deepak-raj-35887386/)\nContact Email:- [email protected]''')
cog_dict = {
'Other Commands': 'src.cogs.otherCommands',
'Auto Commands': 'src.cogs.autoCommands',
'Admin Commands': 'src.cogs.adminCommands',
'API Based Commands': 'src.cogs.apiBasedCommands',
'Moderation Commands': 'src.cogs.moderationCommands',
'NSFW Commands': 'src.cogs.nsfwCommands',
'Fun Commands': 'src.cogs.funCommands',
'Utility Commands': 'src.cogs.utilityCommands',
# FIXME: add music commands in future update
'Music Commands': 'src.cogs.musicCommands',
'Owner Commands': 'src.cogs.ownerCommands',
'Testing Commands': 'src.cogs.testingCommands',
'Error Handler': 'src.cogs.errorHandler',
}
async def load_cogs(cog_dict: dict):
""" Function for loading cogs using dictionary """
try:
for key, value in cog_dict.items():
print(colored(f"Loading {key}...", "green"))
await bot.load_extension(value)
except Exception as e:
print(colored(f"Error while loading cogs: {e}", "red"))
logging.error('{} - {}'.format(type(e).__name__, e))
if __name__ == '__main__':
try:
asyncio.run(load_cogs(cog_dict=cog_dict))
bot.run(DISCORD_TOKEN,
log_level=logging.DEBUG if args.debug else logging.INFO)
except Exception as e:
logging.error('Error while running bot: {}'.format(e))