Python Forum

Full Version: Bot coding telegram.ext
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Dear All,
Excuse me if my post is in not proper forum.

I am trying bot library from telegram.ext.
Used the same code from python telegram bot. The echo function is working as expected. But the caps function is not producing capital text . Could throw some light.

def echo(update, context):
    context.bot.send_message(chat_id=update.effective_chat.id, text=update.message.text)

from telegram.ext import MessageHandler, Filters
echo_handler = MessageHandler(Filters.text & (~Filters.command), echo)
dispatcher.add_handler(echo_handler)

def caps(update, context):
    text_caps = ' '.join(context.args).upper()
    context.bot.send_message(chat_id=update.effective_chat.id, text=text_caps)

caps_handler = CommandHandler('caps', caps)
dispatcher.add_handler(caps_handler)
sorry, i have not used the command /caps before text input. thank you al.