nyx.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:nyx 作者: Cappycot 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号