Skip to content

Commit

Permalink
Merge pull request Just-Some-Bots#1899 from TheerapakG/playground_imp…
Browse files Browse the repository at this point in the history
…rovedbg

Pass environment to eval/ exec in debug
  • Loading branch information
Jayden Bailey authored May 9, 2019
2 parents 00904c9 + 83b14d5 commit 633cfb3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions musicbot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2608,11 +2608,14 @@ async def cmd_debug(self, message, _player, *, data):

code = data.strip('` \n')

scope = globals().copy()
scope.update({'self': self})

try:
result = eval(code)
result = eval(code, scope)
except:
try:
exec(code)
exec(code, scope)
except Exception as e:
traceback.print_exc(chain=False)
return Response("{}: {}".format(type(e).__name__, e))
Expand Down

0 comments on commit 633cfb3

Please sign in to comment.