-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
32 lines (25 loc) · 875 Bytes
/
bot.py
File metadata and controls
32 lines (25 loc) · 875 Bytes
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
import os, discord
from dotenv import load_dotenv
from discord.ext import commands
load_dotenv()
bot = commands.Bot(command_prefix='!')
@bot.command(hidden=True)
async def load(ctx, extension):
bot.load_extension(f'cogs.{extension}')
await ctx.message.delete()
@bot.command(hidden=True)
async def unload(ctx, extension):
bot.unload_extension(f'cogs.{extension}')
await ctx.message.delete()
@bot.command(hidden=True)
async def reload(ctx, extension):
bot.unload_extension(f'cogs.{extension}')
bot.load_extension(f'cogs.{extension}')
await ctx.message.delete()
@bot.event
async def on_ready():
print(f'{bot.user} has connected to Discord!')
for filename in os.listdir('./DiscordKarmaBot/cogs'):
if filename.endswith('.py'):
bot.load_extension(f'cogs.{filename[:-3]}')
bot.run(os.getenv("TOKEN"))