Skip to content

Commit be1c257

Browse files
committed
Removed unnecessary examples changes
1 parent 28274cd commit be1c257

File tree

11 files changed

+26
-41
lines changed

11 files changed

+26
-41
lines changed

examples/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Examples
22

3-
**BEFORE YOU START:** In order to run all of the examples, you must insert the token you received from @BotFather in the file `settings.py`!
4-
53
The examples in this folder are small bots meant to show you how a bot that is written with `python-telegram-bot` looks like. Some bots focus on one specific aspect of the Telegram Bot API while others focus on one of the mechanics of this library. Except for the [`echobot.py`](#pure-api) example, they all use the high-level framework this library provides with the [`telegram.ext`](https://python-telegram-bot.readthedocs.io/en/latest/telegram.ext.html) submodule.
64

75
All examples are licensed under the [CC0 License](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/LICENSE.txt) and are therefore fully dedicated to the public domain. You can use them as the base for your own bots without worrying about copyrights.

examples/conversationbot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
Press Ctrl-C on the command line or send a signal to the process to stop the
1717
bot.
1818
"""
19-
from examples.settings import TOKEN
19+
2020
from telegram import (ReplyKeyboardMarkup, ReplyKeyboardRemove)
2121
from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters, RegexHandler,
2222
ConversationHandler)
@@ -117,8 +117,8 @@ def error(bot, update, error):
117117

118118

119119
def main():
120-
# Create the Updater and pass it your bot's token as a string.
121-
updater = Updater(TOKEN)
120+
# Create the EventHandler and pass it your bot's token.
121+
updater = Updater("TOKEN")
122122

123123
# Get the dispatcher to register handlers
124124
dp = updater.dispatcher

examples/conversationbot2.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
Press Ctrl-C on the command line or send a signal to the process to stop the
1717
bot.
1818
"""
19-
from examples.settings import TOKEN
19+
2020
from telegram import ReplyKeyboardMarkup
2121
from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters, RegexHandler,
2222
ConversationHandler)
@@ -103,8 +103,8 @@ def error(bot, update, error):
103103

104104

105105
def main():
106-
# Create the Updater and pass it your bot's token as a string.
107-
updater = Updater(TOKEN)
106+
# Create the Updater and pass it your bot's token.
107+
updater = Updater("TOKEN")
108108

109109
# Get the dispatcher to register handlers
110110
dp = updater.dispatcher

examples/deeplinking.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import logging
2121

22-
from examples.settings import TOKEN
2322
from telegram import ParseMode
2423
from telegram.ext import Updater, CommandHandler, Filters
2524
# Enable logging
@@ -72,8 +71,8 @@ def error(bot, update, error):
7271

7372
def main():
7473
"""Start the bot."""
75-
# Create the Updater and pass it your bot's token as a string.
76-
updater = Updater(TOKEN)
74+
# Create the Updater and pass it your bot's token.
75+
updater = Updater("TOKEN")
7776

7877
# Get the dispatcher to register handlers
7978
dp = updater.dispatcher

examples/echobot.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,19 @@
77
This program is dedicated to the public domain under the CC0 license.
88
"""
99
import logging
10-
from time import sleep
11-
1210
import telegram
13-
from examples.settings import TOKEN
1411
from telegram.error import NetworkError, Unauthorized
12+
from time import sleep
13+
1514

1615
update_id = None
1716

1817

1918
def main():
2019
"""Run the bot."""
2120
global update_id
22-
# Telegram Bot Authorization Token as string
23-
bot = telegram.Bot(TOKEN)
21+
# Telegram Bot Authorization Token
22+
bot = telegram.Bot('TOKEN')
2423

2524
# get the first pending update_id, this is so we can skip over it in case
2625
# we get an "Unauthorized" exception.

examples/echobot2.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
Press Ctrl-C on the command line or send a signal to the process to stop the
1717
bot.
1818
"""
19-
from examples.settings import TOKEN
19+
2020
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
2121
import logging
2222

@@ -51,8 +51,8 @@ def error(bot, update, error):
5151

5252
def main():
5353
"""Start the bot."""
54-
# Create the Updater and pass it your bot's token as a string.
55-
updater = Updater(TOKEN)
54+
# Create the EventHandler and pass it your bot's token.
55+
updater = Updater("TOKEN")
5656

5757
# Get the dispatcher to register handlers
5858
dp = updater.dispatcher

examples/inlinekeyboard.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
# This program is dedicated to the public domain under the CC0 license.
66
"""
77
import logging
8-
9-
from examples.settings import TOKEN
108
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
119
from telegram.ext import Updater, CommandHandler, CallbackQueryHandler
1210

@@ -44,8 +42,8 @@ def error(bot, update, error):
4442

4543

4644
def main():
47-
# Create the Updater and pass it your bot's token as a string.
48-
updater = Updater(TOKEN)
45+
# Create the Updater and pass it your bot's token.
46+
updater = Updater("TOKEN")
4947

5048
updater.dispatcher.add_handler(CommandHandler('start', start))
5149
updater.dispatcher.add_handler(CallbackQueryHandler(button))

examples/paymentbot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
This program is dedicated to the public domain under the CC0 license.
77
"""
8-
from examples.settings import TOKEN
8+
99
from telegram import (LabeledPrice, ShippingOption)
1010
from telegram.ext import (Updater, CommandHandler, MessageHandler,
1111
Filters, PreCheckoutQueryHandler, ShippingQueryHandler)
@@ -112,8 +112,8 @@ def successful_payment_callback(bot, update):
112112

113113

114114
def main():
115-
# Create the Updater and pass it your bot's token as a string.
116-
updater = Updater(TOKEN)
115+
# Create the EventHandler and pass it your bot's token.
116+
updater = Updater(token="BOT_TOKEN")
117117

118118
# Get the dispatcher to register handlers
119119
dp = updater.dispatcher

examples/timerbot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
Press Ctrl-C on the command line or send a signal to the process to stop the
1919
bot.
2020
"""
21-
from examples.settings import TOKEN
21+
2222
from telegram.ext import Updater, CommandHandler
2323
import logging
2424

@@ -79,8 +79,8 @@ def error(bot, update, error):
7979

8080

8181
def main():
82-
# Create the Updater and pass it your bot's token as a string.
83-
updater = Updater(TOKEN)
82+
"""Run bot."""
83+
updater = Updater("TOKEN")
8484

8585
# Get the dispatcher to register handlers
8686
dp = updater.dispatcher

telegram/ext/filters.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ def __init__(self, pattern):
199199
def filter(self, message):
200200
return bool(re.search(self.pattern, message.text))
201201

202-
203202
class _Reply(BaseFilter):
204203
name = 'Filters.reply'
205204

0 commit comments

Comments
 (0)