Skip to content

Commit de5d49e

Browse files
committed
Reverted echobot
1 parent 51b848f commit de5d49e

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

examples/echobot2.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
Press Ctrl-C on the command line or send a signal to the process to stop the
1616
bot.
1717
"""
18-
from pprint import pprint
19-
20-
from telegram.utils import helpers
2118

2219
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
2320
import logging
@@ -40,7 +37,7 @@ def help(bot, update):
4037

4138

4239
def echo(bot, update):
43-
update.message.reply_text(helpers.extract_urls(update.message))
40+
update.message.reply_text(update.message.text)
4441

4542

4643
def error(bot, update, error):
@@ -49,7 +46,7 @@ def error(bot, update, error):
4946

5047
def 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

Comments
 (0)