-
Notifications
You must be signed in to change notification settings - Fork 2
/
bot.py
executable file
·47 lines (39 loc) · 1.5 KB
/
bot.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
#!/usr/bin/python3
# Bot entry point
import discord
import os
from discord.ext import commands, tasks
import BotToken
from paths import cogs_path
from discord_slash import SlashCommand
from discord_slash.utils import manage_commands # Allows us to manage the command settings.
client = commands.Bot(command_prefix = '.')
slash = SlashCommand(client, sync_commands=True)
client.remove_command('help')
@client.command()
async def load(ctx, extension):
if(ctx.message.author.id == 570812427944329216):
client.load_extension(f'cogs.{extension}')
await ctx.channel.purge(limit = 1)
else:
await ctx.send("Bark off, I only take orders from my master. Woof.")
@client.command()
async def unload(ctx, extension):
if(ctx.message.author.id == 570812427944329216):
client.unload_extension(f'cogs.{extension}')
await ctx.channel.purge(limit = 1)
else:
await ctx.send("Bark off, I only take orders from my master. Woof.")
@client.command()
async def reload(ctx, extension):
if(ctx.message.author.id == 570812427944329216):
client.unload_extension(f'cogs.{extension}')
client.load_extension(f'cogs.{extension}')
await ctx.channel.purge(limit = 1)
else:
await ctx.send("Bark off, I only take orders from my master. Woof.")
for filename in os.listdir(cogs_path):
#for filename in os.listdir('./cogs'): ## windows
if filename.endswith('.py'):
client.load_extension(f'cogs.{filename[: -3]}')
client.run(BotToken.token_str)