-
Notifications
You must be signed in to change notification settings - Fork 2
/
owner.py
53 lines (43 loc) · 1.57 KB
/
owner.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
from discord.ext import commands
class OwnerCog:
def __init__(self, bot):
self.bot = bot
def isowner(ctx):
return ctx.message.author.id == "103246784519741440"
@commands.command(name='load', hidden=True)
@commands.check(isowner)
async def cog_load(self, ctx, *, cog: str):
""""Command which loads a module"""
try:
self.bot.load_extension(cog)
except Exception as e:
await self.bot.say(f'**`ERROR:`** {type(e).__name__} - {e}')
else:
await self.bot.say('**`SUCCESS`**')
@commands.command(name='unload', hidden=True)
@commands.check(isowner)
async def cog_unload(self, ctx, *, cog: str):
"""Command which Unloads a module."""
try:
self.bot.unload_extension(cog)
except Exception as e:
await self.bot.say(f'**`ERROR:`** {type(e).__name__} - {e}')
else:
await self.bot.say('**`SUCCESS`**')
@commands.command(name='reload', hidden=True)
@commands.check(isowner)
async def cog_reload(self, ctx, *, cog: str):
"""Command which Reloads a Module."""
try:
self.bot.unload_extension(cog)
self.bot.load_extension(cog)
except Exception as e:
await self.bot.say(f'**`ERROR:`** {type(e).__name__} - {e}')
else:
await self.bot.say('**`SUCCESS`**')
@commands.command(name='quit', hidden=True)
@commands.check(isowner)
async def bot_quit(self):
await self.bot.logout()
def setup(bot):
bot.add_cog(OwnerCog(bot))