使用不同的命令时重复相同的短语

The same phrase is repeating while using different command

我正在开发电报机器人。我在我的代码上这样做,问题是,为什么我的机器人在我输入第二个命令时重复相同的第一个短语?

TOKEN_BOT = "secret token"
bot = telebot.TeleBot(TOKEN_BOT)

@bot.message_handler(commands=["hello", "start"])
def send(message):
    bot.reply_to(message, "Welcome, I am RIOPy! BOT designed to organize your SME to your liking. To start write / start and we will get to work.")

bot.polling()

def enviar_start (message):
    bot.reply_to(message, "Great! wait 5 seconds.")

#HERE DATABASE CODE

time.sleep(5)
bot.reply_to, "DATABASE CREATED"

bot.polling()

PS:代码现在可以运行了。我删除了 if 下的 bot.pulling(),并将 /hello 和 /start 命令放在 2 个不同的行中。

@bot.message_handler(commands=["hello"])
def send(message):
    bot.reply_to(message, "Welcome, I am RIOPy! BOT designed to organize your SME to your liking. To start write / start and we will get to work.")

@bot.message_handler(commands=["start"])
def enviar_start (message):
    bot.reply_to(message, "Great! wait 5 seconds.")

当你发送 /start 命令时,你的机器人说的第一句话也是你发送 /hello 命令时它说的第一句话,因为你的机器人的 /hello 命令的消息处理程序也是/开始命令。要解决此问题,您需要创建两个单独的消息处理程序,一个用于 /hello 命令,一个用于 /start 命令。

下面几行代码我觉得不需要,可以删掉

if message == "start":
    enviar_start(message)```

The edited code should work.