edit_poll.py 文件源码

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

项目:democracybot 作者: LiaungYip 项目源码 文件源码
def cmd_set_generic(bot: telegram.Bot, update: telegram.Update, field_name: str,
                    cmd_name: str, example: str):
    if generic_checks(bot, update, cmd_name, example, 2):
        # Extract value
        text = update.message.text
        cmd, tag, value = text.split(" ", 2)

        # Apply edit and
        edit_poll(tag, field_name, value)

        # send "success" feedback message
        new_p = get_poll(tag)
        msg = text_edit_successful.format(p=new_p)
        cid = update.message.chat_id
        bot.sendMessage(cid, msg)

        # Check if complete, and suggest to activate
        if check_if_complete(tag):
            msg2 = text_activate_suggestion.format(t=tag)
            bot.sendMessage(cid, msg2, parse_mode="Markdown")
    else:
        # A generic check failed.
        pass

    return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号