bot6.py 文件源码

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

项目:simplebot 作者: korneevm 项目源码 文件源码
def check_cat(bot, update):
    update.message.reply_text("??????????? ????")
    photo_file = bot.getFile(update.message.photo[-1].file_id)
    filename = os.path.join('downloads', '{}.jpg'.format(photo_file.file_id))
    photo_file.download(filename)
    if img_has_cat(filename):
        update.message.reply_text("?? ???????? ???? ?????, ???????? ? ??????????.")
        new_filename = os.path.join('cats', '{}.jpg'.format(photo_file.file_id))
        os.rename(filename, new_filename)
    else:
        os.remove(filename)
        update.message.reply_text("???????, ????? ?? ??????????!")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号