def loadstring(self, code, ctx):
"""Remote execute code from the Discord client or other sources for
debugging. This returns true if the code to execute runs completely
without error. This function returns a string with output.
Arguments:
code - the Python 3 code to run within self
"""
if ctx is None:
return "No context to run the code in!"
with closing(StringIO()) as log:
with redirect_stdout(log):
try:
exec(code)
# Screw your warnings, PyCharm!
except:
error = sys.exc_info()
for e in error:
print(e)
return log.getvalue()
评论列表
文章目录