session.py 文件源码

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

项目:ifictionbot 作者: ykrivopalov 项目源码 文件源码
def on_message(self, msg):
        debug('GameDialog on_message')
        content_type = telepot.glance(msg)[0]
        if content_type != 'text':
            return

        text = msg['text']
        if text.startswith('/command'):
            text = text[9:]
        elif text.startswith('/c'):
            text = text[3:]

        if text.lower() in ['save', 'restore', 'quit', 'q']:
            await self._sender.sendMessage('This command currently unsupported',
                                           reply_markup=self._KEYBOARD)
            return DIALOG_GAME, {}
        elif text == self._RETURN:
            return DIALOG_MAIN, {}
        elif not text:
            return DIALOG_GAME, {}
        else:
            await self._game.command(text)
            return DIALOG_GAME, {}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号