image_reply.py 文件源码

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

项目:telegram_robot 作者: uts-magic-lab 项目源码 文件源码
def pub_received(self, bot, update):
        rospy.loginfo("Received: " + str(update))
        valid_necessary_words = ['what do you see',
                                 'picture',
                                 'camera']
        found_word = False
        for v in valid_necessary_words:
            if v in update.message.text.lower():
                img_file_path = self.get_image()
                update.message.reply_photo(photo=open(img_file_path, 'rb'),
                                           caption="This is what I see!")
                found_word = True
                break
        if not found_word:
            update.message.reply_text("Try any of: " +
                                      str(valid_necessary_words))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号