-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
39 lines (28 loc) · 967 Bytes
/
bot.py
File metadata and controls
39 lines (28 loc) · 967 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
33
34
35
36
37
38
39
import os
import discord
from discord.ext import commands
from discord.ext.commands import Context
from dotenv import load_dotenv, find_dotenv
load_dotenv(find_dotenv())
BOT_TOKEN = os.getenv("BOT_TOKEN")
client = commands.Bot(command_prefix='.')
@client.command()
@commands.has_role("Owner")
async def load(ctx: Context, extension):
client.load_extension(f'cogs.{extension}')
await ctx.send("Loaded Cog")
@client.command()
@commands.has_role("Owner")
async def unload(ctx: Context, extension):
client.unload_extension(f'cogs.{extension}')
await ctx.send("Unloaded Cog")
@client.command()
@commands.has_role("Owner")
async def reload(ctx: Context, extension):
client.unload_extension(f'cogs.{extension}')
client.load_extension(f'cogs.{extension}')
await ctx.send("Reloaded Cog")
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
client.load_extension(f'cogs.{filename[0:-3]}')
client.run(BOT_TOKEN)