-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
51 lines (36 loc) · 1.14 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
import json
import os
from discord.ext import commands
botOwner = 327205633319239681
def getPrefix(bot, message):
with open('miska.json', 'r') as f:
prefixes = json.load(f)
return prefixes[str(message.guild.id)]["prefix"]
bot = commands.Bot(command_prefix=getPrefix)
bot.remove_command('help')
@bot.command()
async def enable(ctx, extension):
if ctx.author.id == botOwner:
bot.load_extension(f'cogs.{extension}')
await ctx.message.delete()
print(f'Enabled {extension}')
@bot.command()
async def disable(ctx, extension):
if ctx.author.id == botOwner:
bot.unload_extension(f'cogs.{extension}')
await ctx.message.delete()
print(f'Disabled {extension}')
@bot.command()
async def reload(ctx, extension):
if ctx.author.id == botOwner:
bot.unload_extension(f'cogs.{extension}')
bot.load_extension(f'cogs.{extension}')
await ctx.message.delete()
print(f'Reloaded {extension}')
for f in os.listdir('./cogs'):
if f.endswith('.py'):
bot.load_extension(f'cogs.{f[:-3]}')
f = open('token.txt', 'r')
token = f.readlines()
f.close()
bot.run(token[0])