-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
68 lines (49 loc) · 1.72 KB
/
Copy pathmain.py
File metadata and controls
68 lines (49 loc) · 1.72 KB
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
"""
File: main.py
Author: ZackDaQuack
Last Edited: 11/27/2024
Info:
Fires up the bot and loads cog modules. (with a nice amount of lines)
"""
import time
import discord
from discord.ext import commands
import configparser
from modules.duckLog import logger
from colorama import Fore, Style
def run_bot():
config = configparser.ConfigParser()
config.read("config.ini")
intents = discord.Intents.all()
bot = commands.Bot(command_prefix="duck!", intents=intents)
@bot.event
async def on_ready():
print()
logger.info("[MAIN] Quack! Bot is online.")
cogs = ["duckAI", "utility", "credits", "quests", "status", "settings"]
for cog in cogs:
try:
bot.load_extension(f"cogs.{cog}")
print(f"{Fore.LIGHTBLUE_EX}[MAIN] Loaded cog: {cog}{Style.RESET_ALL}")
except Exception as e:
logger.error(f"[MAIN] Failed to load cog {cog}: {e}")
try:
bot.run(config.get("KEYS", "discord"))
except discord.LoginFailure as e:
logger.critical(f"[MAIN] Login Failure: {e}")
return
except Exception as e:
logger.error(f"[MAIN] An unexpected error occurred: {e}")
if __name__ == "__main__":
print(fr"""{Fore.LIGHTYELLOW_EX}
______ _ ______ _ _____
| _ \ | | | ___ \ | | |____ |
| | | |_ _ ___| | _| |_/ / ___ | |___ __ / /
| | | | | | |/ __| |/ / ___ \/ _ \| __\ \ / / \ \\
| |/ /| |_| | (__| <| |_/ / (_) | |_ \ V /.___/ /
|___/ \__,_|\___|_|\_\____/ \___/ \__| \_/ \____/
by {Fore.LIGHTGREEN_EX}MotoCite{Style.RESET_ALL}
""")
while True:
run_bot()
time.sleep(60)