telegbot.py 文件源码

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

项目:forushandeBot 作者: pouya-barzegar 项目源码 文件源码
def gen_category(categories, buttonfield,
                 callbackfield, callbackheader, url=""):
    cat_names = []
    for item in categories:
        print(item)
        cat_names.append(item[buttonfield])
    logger.info("generated a list from the name of categories; {}"
                .format(cat_names))

    button_list = [InlineKeyboardButton(s, url=url.format(str(categories[cat_names.index(s)][callbackfield])),
                                        callback_data=callbackheader + str(categories[cat_names.index(s)][callbackfield]))
                   for s in cat_names]
    return cat_names, button_list
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号