Removed some useless code
This commit is contained in:
parent
06e9261107
commit
b555f12b48
1 changed files with 28 additions and 49 deletions
|
@ -24,10 +24,8 @@ class Owner:
|
||||||
@commands.check(checks.isOwner)
|
@commands.check(checks.isOwner)
|
||||||
async def restart(self, ctx):
|
async def restart(self, ctx):
|
||||||
"""Forces the bot to restart"""
|
"""Forces the bot to restart"""
|
||||||
if config.saveContent('restart_server', ctx.message.channel.id):
|
config.saveContent('restart_server', ctx.message.channel.id):
|
||||||
await self.bot.say("Restarting; see you in the next life {0}!".format(ctx.message.author.mention))
|
await self.bot.say("Restarting; see you in the next life {0}!".format(ctx.message.author.mention))
|
||||||
else:
|
|
||||||
await self.bot.say("I was unable to save this data")
|
|
||||||
python = sys.executable
|
python = sys.executable
|
||||||
os.execl(python, python, *sys.argv)
|
os.execl(python, python, *sys.argv)
|
||||||
|
|
||||||
|
@ -43,7 +41,7 @@ class Owner:
|
||||||
with open(local_path, "wb") as f:
|
with open(local_path, "wb") as f:
|
||||||
f.write(val)
|
f.write(val)
|
||||||
await self.bot.say(
|
await self.bot.say(
|
||||||
"Just saved a new doggo image! You now have {} doggo images!".format(len(glob.glob('doggo*'))))
|
"Just saved a new doggo image! I now have {} doggo images!".format(len(glob.glob('doggo*'))))
|
||||||
|
|
||||||
@commands.command(pass_context=True)
|
@commands.command(pass_context=True)
|
||||||
@commands.check(checks.isOwner)
|
@commands.check(checks.isOwner)
|
||||||
|
@ -51,19 +49,15 @@ class Owner:
|
||||||
"""Executes code"""
|
"""Executes code"""
|
||||||
match_single = getter.findall(ctx.message.content)
|
match_single = getter.findall(ctx.message.content)
|
||||||
match_multi = multi.findall(ctx.message.content)
|
match_multi = multi.findall(ctx.message.content)
|
||||||
if not match_single and not match_multi:
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
if not match_multi:
|
if not match_multi:
|
||||||
result = eval(match_single[0])
|
result = eval(match_single[0])
|
||||||
|
|
||||||
if inspect.isawaitable(result):
|
if inspect.isawaitable(result):
|
||||||
result = await result
|
result = await result
|
||||||
await self.bot.say("```{0}```".format(result))
|
await self.bot.say("```{0}```".format(result))
|
||||||
else:
|
elif match_single:
|
||||||
def r(v):
|
def r(v):
|
||||||
config.loop.create_task(self.bot.say("```{0}```".format(v)))
|
config.loop.create_task(self.bot.say("```{0}```".format(v)))
|
||||||
|
|
||||||
exec(match_multi[0])
|
exec(match_multi[0])
|
||||||
|
|
||||||
@commands.command(pass_context=True)
|
@commands.command(pass_context=True)
|
||||||
|
@ -89,9 +83,6 @@ class Owner:
|
||||||
"""Changes the bot's name"""
|
"""Changes the bot's name"""
|
||||||
await self.bot.edit_profile(username=newNick)
|
await self.bot.edit_profile(username=newNick)
|
||||||
await self.bot.say('Changed username to ' + newNick)
|
await self.bot.say('Changed username to ' + newNick)
|
||||||
# Restart the bot after this, as profile changes are not immediate
|
|
||||||
python = sys.executable
|
|
||||||
os.execl(python, python, *sys.argv)
|
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.check(checks.isOwner)
|
@commands.check(checks.isOwner)
|
||||||
|
@ -106,44 +97,32 @@ class Owner:
|
||||||
@commands.check(checks.isOwner)
|
@commands.check(checks.isOwner)
|
||||||
async def load(self, *, module: str):
|
async def load(self, *, module: str):
|
||||||
"""Loads a module"""
|
"""Loads a module"""
|
||||||
try:
|
|
||||||
module = module.lower()
|
module = module.lower()
|
||||||
if not module.startswith("cogs"):
|
if not module.startswith("cogs"):
|
||||||
module = "cogs.{}".format(module)
|
module = "cogs.{}".format(module)
|
||||||
self.bot.load_extension(module)
|
self.bot.load_extension(module)
|
||||||
await self.bot.say("I have just loaded the {} module".format(module))
|
await self.bot.say("I have just loaded the {} module".format(module))
|
||||||
except Exception as e:
|
|
||||||
fmt = 'An error occurred while processing this request: ```py\n{}: {}\n```'
|
|
||||||
await self.bot.say(fmt.format(type(e).__name__, e))
|
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.check(checks.isOwner)
|
@commands.check(checks.isOwner)
|
||||||
async def unload(self, *, module: str):
|
async def unload(self, *, module: str):
|
||||||
"""Unloads a module"""
|
"""Unloads a module"""
|
||||||
try:
|
|
||||||
module = module.lower()
|
module = module.lower()
|
||||||
if not module.startswith("cogs"):
|
if not module.startswith("cogs"):
|
||||||
module = "cogs.{}".format(module)
|
module = "cogs.{}".format(module)
|
||||||
self.bot.unload_extension(module)
|
self.bot.unload_extension(module)
|
||||||
await self.bot.say("I have just unloaded the {} module".format(module))
|
await self.bot.say("I have just unloaded the {} module".format(module))
|
||||||
except Exception as e:
|
|
||||||
fmt = 'An error occurred while processing this request: ```py\n{}: {}\n```'
|
|
||||||
await self.bot.say(fmt.format(type(e).__name__, e))
|
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.check(checks.isOwner)
|
@commands.check(checks.isOwner)
|
||||||
async def reload(self, *, module: str):
|
async def reload(self, *, module: str):
|
||||||
"""Reloads a module"""
|
"""Reloads a module"""
|
||||||
try:
|
|
||||||
module = module.lower()
|
module = module.lower()
|
||||||
if not module.startswith("cogs"):
|
if not module.startswith("cogs"):
|
||||||
module = "cogs.{}".format(module)
|
module = "cogs.{}".format(module)
|
||||||
self.bot.unload_extension(module)
|
self.bot.unload_extension(module)
|
||||||
self.bot.load_extension(module)
|
self.bot.load_extension(module)
|
||||||
await self.bot.say("I have just reloaded the {} module".format(module))
|
await self.bot.say("I have just reloaded the {} module".format(module))
|
||||||
except Exception as e:
|
|
||||||
fmt = 'An error occurred while processing this request: ```py\n{}: {}\n```'
|
|
||||||
await self.bot.say(fmt.format(type(e).__name__, e))
|
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
|
|
Loading…
Reference in a new issue