-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
71 lines (58 loc) · 1.71 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import discord
from discord.ext import commands
from dotenv import load_dotenv
from colorama import Fore
import os
load_dotenv()
TOKEN = os.getenv("TOKEN")
intents = discord.Intents.all()
bot = discord.Bot(intents=intents)
# Colors
RED = 0x990000
GREEN = 0x013220
print(Fore.GREEN + "============================" + Fore.RESET)
for filename in os.listdir("./cogs"):
if filename.endswith(".py"):
bot.load_extension(f"cogs.{filename[:-3]}")
print(f"Loaded {filename[:-3]}")
@bot.event
async def on_ready():
print(f"Using: {bot.user}")
print(f"I Am on {len(bot.guilds)} Server(s)")
print(Fore.GREEN + "============================" + Fore.RESET)
# Cog management
@bot.slash_command()
async def unload(ctx, cog):
if ctx.author.id == 1114012186877120643:
try:
cog = "cogs." + cog
bot.unload_extension(cog)
await ctx.respond(f"Unloaded {cog}")
except Exception as e:
await ctx.respond(e)
else:
await ctx.respond("No")
@bot.slash_command()
async def load(ctx, cog):
if ctx.author.id == 1114012186877120643:
try:
cog = "cogs." + cog
bot.load_extension(cog)
await ctx.respond(f"Loaded {cog}")
except Exception as e:
await ctx.respond(e)
else:
await ctx.respond("No")
@bot.slash_command()
async def reload(ctx, cog):
if ctx.author.id == 1114012186877120643:
try:
cog = "cogs." + cog
bot.unload_extension(cog)
bot.load_extension(cog)
await ctx.respond(f"Reloaded {cog}")
except Exception as e:
await ctx.respond(e)
else:
await ctx.respond("No")
bot.run(TOKEN)