I don't want it to quote my input message but send the message directly.
bot.reply_to
replies to the message itself. If you wish to send a separate message, use bot.send_message
. You'll need to pass the ID of the user you're wishing to send a message to. You can find this id on message.chat.id
so you're sending the message to the same chat.
@bot.message_handler(commands=['help'])
def send_welcome(message):
# Reply to message
bot.reply_to(message, 'This is a reply')
# Send message to person
bot.send_message(message.chat.id, 'This is a seperate message')
Also how can I get replies by just using simple Hi or Hello not /hi or /hello.
Instead off using a message_handler
with a commands=['help']
you can remove the parameter to catch each message not catched by any command message handler.
Example with above implemented:
import telebot
bot_token = '12345'
bot = telebot.TeleBot(token=bot_token)
# Handle /help
@bot.message_handler(commands=['help'])
def send_welcome(message):
# Reply to message
bot.reply_to(message, 'This is a reply')
# Send message to person
bot.send_message(message.chat.id, 'This is a seperate message')
# Handle normal messages
@bot.message_handler()
def send_normal(message):
# Detect 'hi'
if message.text == 'hi':
bot.send_message(message.chat.id, 'Reply on hi')
# Detect 'help'
if message.text == 'help':
bot.send_message(message.chat.id, 'Reply on help')
bot.polling()
Visual result:
