Added a debug command for the voice shards
This commit is contained in:
parent
f8cb681480
commit
d9976dfd87
1 changed files with 28 additions and 0 deletions
|
@ -320,6 +320,34 @@ class Music:
|
||||||
pass
|
pass
|
||||||
await self.bot.delete_message(message)
|
await self.bot.delete_message(message)
|
||||||
|
|
||||||
|
@commands.command(pass_context=True)
|
||||||
|
@commands.check(utils.is_owner)
|
||||||
|
async def vdebug(self, ctx, *, code : str):
|
||||||
|
"""Evaluates code."""
|
||||||
|
code = code.strip('` ')
|
||||||
|
python = '```py\n{}\n```'
|
||||||
|
result = None
|
||||||
|
|
||||||
|
env = {
|
||||||
|
'bot': self.bot,
|
||||||
|
'ctx': ctx,
|
||||||
|
'message': ctx.message,
|
||||||
|
'server': ctx.message.server,
|
||||||
|
'channel': ctx.message.channel,
|
||||||
|
'author': ctx.message.author
|
||||||
|
}
|
||||||
|
|
||||||
|
env.update(globals())
|
||||||
|
|
||||||
|
try:
|
||||||
|
result = eval(code, env)
|
||||||
|
if inspect.isawaitable(result):
|
||||||
|
result = await result
|
||||||
|
except Exception as e:
|
||||||
|
await self.bot.say(python.format(type(e).__name__ + ': ' + str(e)))
|
||||||
|
return
|
||||||
|
|
||||||
|
await self.bot.say(python.format(result))
|
||||||
|
|
||||||
@commands.command(pass_context=True, no_pm=True)
|
@commands.command(pass_context=True, no_pm=True)
|
||||||
@utils.custom_perms(send_messages=True)
|
@utils.custom_perms(send_messages=True)
|
||||||
|
|
Loading…
Reference in a new issue