Debugging.py 文件源码

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

项目:CorpBot.py 作者: corpnewt 项目源码 文件源码
def heartbeat(self, ctx):
        """Write to the console and attempt to send a message (owner only)."""

        author  = ctx.message.author
        server  = ctx.message.server
        channel = ctx.message.channel

        try:
            owner = self.settings.serverDict['Owner']
        except KeyError:
            owner = None

        if owner == None:
            # No previous owner, let's set them
            msg = 'I cannot adjust debugging until I have an owner.'
            await self.bot.send_message(channel, msg)
            return
        if not author.id == owner:
            # Not the owner
            msg = 'You are not the *true* owner of me.  Only the rightful owner can change this setting.'
            await self.bot.send_message(channel, msg)
            return

        timeStamp = datetime.today().strftime("%Y-%m-%d %H.%M")
        print('Heartbeat tested at {}.'.format(timeStamp))
        # Message send
        message = await self.bot.send_message(ctx.message.channel, 'Heartbeat tested at {}.'.format(timeStamp))
        if message:
            print('Message:\n{}'.format(message))
        else:
            print('No message returned.')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号