commands.py 文件源码

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

项目:Turbo 作者: jaydenkieran 项目源码 文件源码
def c_eval(self, message, server, channel, author, stmt, args):
        """
        Evaluates Python code

        {prefix}eval <code>

        If the result is a coroutine, it will be awaited
        """
        stmt = ' '.join([stmt, *args])
        try:
            result = eval(stmt)
            if inspect.isawaitable(result):
                result = await result
        except Exception as e:
            exc = traceback.format_exc().splitlines()
            result = exc[-1]
        log.debug("Evaluated: {} - Result was: {}".format(stmt, result))
        return Response("```xl\n--- In ---\n{}\n--- Out ---\n{}\n```".format(stmt, result))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号