首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在电报bot中创建“方法”

如何在电报bot中创建“方法”
EN

Stack Overflow用户
提问于 2020-08-11 11:13:39
回答 1查看 87关注 0票数 0

嗨,我想要创建一个机器人来实现亚马逊搜索的自动化,我希望它能非常简单的使用。当您创建一个新的机器人时,我希望它表现得像BotFather一样:

请求Bot名称输入,获取bot名称,要求bot标记输入,获取bot标记,创建bot

我不知道从哪里开始

到目前为止已完成的代码:

代码语言:javascript
运行
复制
keyboard=  types.ReplyKeyboardMarkup(row_width=1)
help_btn =  types.KeyboardButton('Aiuto')
min_price = types.KeyboardButton('Prezzominimo')
max_price = types.KeyboardButton('Prezzomassimo')
range_price = types.KeyboardButton('Range') 
keyboard.row(min_price)
keyboard.row(max_price)
keyboard.row(range_price)
keyboard.row(help_btn)














bot = telebot.AsyncTeleBot(TOKEN,'HTML')

if bot_is_active:

@bot.message_handler(commands=["start"])
def main_menu(message):
    bot.send_message(message.chat.id,"Benvenuto,questo bot ti permette di cercare articoli su Amazon",reply_markup=keyboard)
pass



@bot.message_handler(func=lambda message:True)
def kb1_handler(message):
    if message.text == 'Aiuto':
        bot.send_message(message.chat.id,Help message)    
    elif message.text == 'Range':
        bot.send_message(message.chat.id,"Cosa cerchi?")
        #range_set = True
    elif message.text == 'Prezzominimo':
        bot.send_message(message.chat.id,"Cosa cerchi?")
        min_set = True
    else:
        bot.send_message(message.chat.id,"Cosa cerchi?")
        #max_set = True
    pass

    if min_set:
        bot.send_message(message.chat.id,"trovato")

pass

博士:https://github.com/eternnoir/pyTelegramBotAPI

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-08-17 09:09:24

我建议去看看图书馆的python-电报-bot和他们的信息非常丰富的维基。代码示例包括一个用于对话机器人的示例,听起来类似于您所描述的

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63356984

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档