Added a saferestart command, temporarily commenting out the part that actually restarts, for testing
This commit is contained in:
parent
050e668450
commit
2fb38350da
1 changed files with 14 additions and 1 deletions
|
@ -19,6 +19,19 @@ class Owner:
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
|
@commands.command(pass_context=True)
|
||||||
|
@commands.check(checks.is_owner)
|
||||||
|
async def saferestart(self, ctx):
|
||||||
|
"""This commands is used to check if there is anything playing in any servers at the moment
|
||||||
|
If there is, I'll tell you not to restart, if not I'll just go ahead and restart"""
|
||||||
|
voice_states = self.bot.get_cog('Music').voice_states
|
||||||
|
for server_id, state in voice_states.items():
|
||||||
|
if state.is_playing:
|
||||||
|
server = self.bot.get_server(server_id)
|
||||||
|
await self.bot.say("Sorry, it's not safe to restart. I am currently playing a song on the {} server".format(server.name))
|
||||||
|
return
|
||||||
|
#ctx.invoke(self.bot.commands.get('restart'))
|
||||||
|
|
||||||
@commands.command(pass_context=True)
|
@commands.command(pass_context=True)
|
||||||
@commands.check(checks.is_owner)
|
@commands.check(checks.is_owner)
|
||||||
async def restart(self, ctx):
|
async def restart(self, ctx):
|
||||||
|
|
Loading…
Reference in a new issue