1515Press Ctrl-C on the command line or send a signal to the process to stop the
1616bot.
1717"""
18- from pprint import pprint
19-
20- from telegram .utils import helpers
2118
2219from telegram .ext import Updater , CommandHandler , MessageHandler , Filters
2320import logging
@@ -40,7 +37,7 @@ def help(bot, update):
4037
4138
4239def echo (bot , update ):
43- update .message .reply_text (helpers . extract_urls ( update .message ) )
40+ update .message .reply_text (update .message . text )
4441
4542
4643def error (bot , update , error ):
@@ -49,7 +46,7 @@ def error(bot, update, error):
4946
5047def main ():
5148 # Create the EventHandler and pass it your bot's token.
52- updater = Updater ("324133401:AAHVjjXotCDXC_kIIkfM0O6bm9-l7BfJw-I " )
49+ updater = Updater ("TOKEN " )
5350
5451 # Get the dispatcher to register handlers
5552 dp = updater .dispatcher
@@ -59,22 +56,14 @@ def main():
5956 dp .add_handler (CommandHandler ("help" , help ))
6057
6158 # on noncommand i.e message - echo the message on Telegram
62- dp .add_handler (MessageHandler (Filters .photo , echo ))
59+ dp .add_handler (MessageHandler (Filters .text , echo ))
6360
6461 # log all errors
6562 dp .add_error_handler (error )
6663
6764 # Start the Bot
6865 updater .start_polling ()
6966
70- urls = "http://google.com and http://github.com/ and python-telegram-bot.readthedocs.io/en/latest/"
71- result = helpers ._extract_urls_from_text (urls )
72- pprint (result )
73- assert len (result ) == 3
74- assert result [0 ] == 'http://google.com'
75- assert result [1 ] == 'http://github.com/'
76- assert result [2 ] == 'python-telegram-bot.readthedocs.io/en/latest/'
77-
7867 # Run the bot until you press Ctrl-C or the process receives SIGINT,
7968 # SIGTERM or SIGABRT. This should be used most of the time, since
8069 # start_polling() is non-blocking and will stop the bot gracefully.
0 commit comments