Debugging.py 文件源码

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

项目:CorpBot.py 作者: corpnewt 项目源码 文件源码
def oncommandcompletion(self, command, ctx):
        if self.debug:
            # We're Debugging
            timeStamp = datetime.today().strftime("%Y-%m-%d %H.%M")
            msg = '{}{}:\n"{}"\nCompleted at {}\nBy {}\nOn {}'.format(ctx.prefix, command, ctx.message.content, timeStamp, ctx.message.author.name, ctx.message.server.name)
            if os.path.exists('debug.txt'):
                # Exists - let's append
                msg = "\n\n" + msg
                msg = msg.encode("utf-8")
                with open("debug.txt", "ab") as myfile:
                    myfile.write(msg)
            else:
                msg = msg.encode("utf-8")
                with open("debug.txt", "wb") as myfile:
                    myfile.write(msg)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号