-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
60 lines (46 loc) · 1.32 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
48
49
50
51
52
53
54
55
56
57
58
59
60
import os
import database
import discord
from discord.utils import get
from discord.ext import commands
from discord.ext.commands import Bot
# start the discord client
client = discord.Client()
# quickstart the firestore database
#db = database.initdb()
# bot prefix, for eg h!hello
bot = commands.Bot(command_prefix='h!')
@bot.command()
@commands.has_role('Core')
async def load(ctx, extension):
'''
Role Specific : Core only
Loads a module in /cogs directory
'''
await ctx.send(f"Loaded cog: {extension}")
bot.load_extension(f'cogs.{extension}')
@bot.command()
@commands.has_role('Core')
async def unload(ctx, extension):
'''
Role Specific : Core only
Unloads a module in /cogs directory
'''
await ctx.send(f"Unloaded cog: {extension}")
bot.unload_extension(f'cogs.{extension}')
@bot.command()
@commands.has_role('Core')
async def reload(ctx, extension):
'''
Role Specific : Core only
Reloads a module in /cogs directory
'''
await ctx.send(f"Reloaded cog: {extension}")
bot.unload_extension(f'cogs.{extension}')
bot.load_extension(f'cogs.{extension}')
for filename in os.listdir("cogs"):
if filename.endswith('.py'):
bot.load_extension(f'cogs.{filename[:-3]}')
with open("token.txt", "r") as f:
token = f.readline().split('\n')[0]
bot.run(token)