Skip to content

Commit 3ba9799

Browse files
committed
Renaming back pytelegrambotapi module to telebot
1 parent 183230e commit 3ba9799

18 files changed

Lines changed: 102 additions & 102 deletions

‎examples/deep_linking.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
# Steps 1 to 4 will have to be implemented in a web server, using a language such as PHP, Python, C# or Java. These
3131
# steps are not shown here. Only steps 5 to 7 are illustrated, some in pseudo-code, with this example.
3232

33-
import pytelegrambotapi
33+
import telebot
3434
import time
3535

36-
bot = pytelegrambotapi.TeleBot('TOKEN')
36+
bot = telebot.TeleBot('TOKEN')
3737

3838
def extract_unique_code(text):
3939
# Extracts the unique_code from the sent /start command.

‎examples/detailed_example/detailed_example.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
This is a detailed example using almost every command of the API
33
"""
44

5-
import pytelegrambotapi
6-
from pytelegrambotapi import types
5+
import telebot
6+
from telebot import types
77
import time
88

99
TOKEN = '<token_string>'
@@ -48,7 +48,7 @@ def listener(messages):
4848
print str(m.chat.first_name) + " [" + str(m.chat.id) + "]: " + m.text
4949

5050

51-
bot = pytelegrambotapi.TeleBot(TOKEN)
51+
bot = telebot.TeleBot(TOKEN)
5252
bot.set_update_listener(listener) # register listener
5353

5454

‎examples/echo_bot.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# This is a simple echo bot using the decorator mechanism.
22
# It echoes any incoming text messages.
33

4-
import pytelegrambotapi
4+
import telebot
55

66
API_TOKEN = '<api_token>'
77

8-
bot = pytelegrambotapi.TeleBot(API_TOKEN)
8+
bot = telebot.TeleBot(API_TOKEN)
99

1010
# Handle '/start' and '/help'
1111
@bot.message_handler(commands=['help', 'start'])

‎examples/step_example.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
"""
55
import time
66

7-
import pytelegrambotapi
8-
from pytelegrambotapi import types
7+
import telebot
8+
from telebot import types
99

1010
API_TOKEN = '<api_token>'
1111

12-
bot = pytelegrambotapi.TeleBot(API_TOKEN)
12+
bot = telebot.TeleBot(API_TOKEN)
1313

1414
user_dict = {}
1515

‎examples/telebot_bot/telebot_bot.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# and goes by the name 'TeleBot (@pyTeleBot)'. Join our group to talk to him!
44
# WARNING: Tested with Python 2.7
55

6-
import pytelegrambotapi
6+
import telebot
77
import os
88

99
text_messages = {
@@ -30,7 +30,7 @@
3030
if "TELEBOT_BOT_TOKEN" not in os.environ or "GROUP_CHAT_ID" not in os.environ:
3131
raise AssertionError("Please configure TELEBOT_BOT_TOKEN and GROUP_CHAT_ID as environment variables")
3232

33-
bot = pytelegrambotapi.AsyncTeleBot(os.environ["TELEBOT_BOT_TOKEN"])
33+
bot = telebot.AsyncTeleBot(os.environ["TELEBOT_BOT_TOKEN"])
3434
GROUP_CHAT_ID = int(os.environ["GROUP_CHAT_ID"])
3535

3636
def is_api_group(chat_id):

‎examples/webhook_examples/webhook_aiohttp_echo_bot.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from aiohttp import web
1111

12-
import pytelegrambotapi
12+
import telebot
1313

1414

1515
API_TOKEN = '<api_token>'
@@ -33,10 +33,10 @@
3333
WEBHOOK_URL_PATH = "/{}/".format(API_TOKEN)
3434

3535

36-
logger = pytelegrambotapi.logger
37-
pytelegrambotapi.logger.setLevel(logging.INFO)
36+
logger = telebot.logger
37+
telebot.logger.setLevel(logging.INFO)
3838

39-
bot = pytelegrambotapi.TeleBot(API_TOKEN)
39+
bot = telebot.TeleBot(API_TOKEN)
4040

4141
app = web.Application()
4242

@@ -45,7 +45,7 @@
4545
async def handle(request):
4646
if request.match_info.get('token') == bot.token:
4747
request_body_dict = await request.json()
48-
update = pytelegrambotapi.types.Update.de_json(request_body_dict)
48+
update = telebot.types.Update.de_json(request_body_dict)
4949
bot.process_new_updates([update])
5050
return web.Response()
5151
else:

‎examples/webhook_examples/webhook_cherrypy_echo_bot.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# It echoes any incoming text messages and does not use the polling method.
66

77
import cherrypy
8-
import pytelegrambotapi
8+
import telebot
99
import logging
1010

1111

@@ -30,10 +30,10 @@
3030
WEBHOOK_URL_PATH = "/%s/" % (API_TOKEN)
3131

3232

33-
logger = pytelegrambotapi.logger
34-
pytelegrambotapi.logger.setLevel(logging.INFO)
33+
logger = telebot.logger
34+
telebot.logger.setLevel(logging.INFO)
3535

36-
bot = pytelegrambotapi.TeleBot(API_TOKEN)
36+
bot = telebot.TeleBot(API_TOKEN)
3737

3838

3939
# WebhookServer, process webhook calls
@@ -45,7 +45,7 @@ def index(self):
4545
cherrypy.request.headers['content-type'] == 'application/json':
4646
length = int(cherrypy.request.headers['content-length'])
4747
json_string = cherrypy.request.body.read(length).decode("utf-8")
48-
update = pytelegrambotapi.types.Update.de_json(json_string)
48+
update = telebot.types.Update.de_json(json_string)
4949
bot.process_new_updates([update])
5050
return ''
5151
else:

‎examples/webhook_examples/webhook_cpython_echo_bot.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import BaseHTTPServer
88
import ssl
9-
import pytelegrambotapi
9+
import telebot
1010
import logging
1111

1212

@@ -31,10 +31,10 @@
3131
WEBHOOK_URL_PATH = "/%s/" % (API_TOKEN)
3232

3333

34-
logger = pytelegrambotapi.logger
35-
pytelegrambotapi.logger.setLevel(logging.INFO)
34+
logger = telebot.logger
35+
telebot.logger.setLevel(logging.INFO)
3636

37-
bot = pytelegrambotapi.TeleBot(API_TOKEN)
37+
bot = telebot.TeleBot(API_TOKEN)
3838

3939

4040
# WebhookHandler, process webhook calls
@@ -59,7 +59,7 @@ def do_POST(self):
5959
self.send_response(200)
6060
self.end_headers()
6161

62-
update = pytelegrambotapi.types.Update.de_json(json_string)
62+
update = telebot.types.Update.de_json(json_string)
6363
bot.process_new_messages([update.message])
6464
else:
6565
self.send_error(403)

‎examples/webhook_examples/webhook_flask_echo_bot.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# It echoes any incoming text messages and does not use the polling method.
66

77
import flask
8-
import pytelegrambotapi
8+
import telebot
99
import logging
1010

1111

@@ -30,10 +30,10 @@
3030
WEBHOOK_URL_PATH = "/%s/" % (API_TOKEN)
3131

3232

33-
logger = pytelegrambotapi.logger
34-
pytelegrambotapi.logger.setLevel(logging.INFO)
33+
logger = telebot.logger
34+
telebot.logger.setLevel(logging.INFO)
3535

36-
bot = pytelegrambotapi.TeleBot(API_TOKEN)
36+
bot = telebot.TeleBot(API_TOKEN)
3737

3838
app = flask.Flask(__name__)
3939

@@ -49,7 +49,7 @@ def index():
4949
def webhook():
5050
if flask.request.headers.get('content-type') == 'application/json':
5151
json_string = flask.request.get_data().decode('utf-8')
52-
update = pytelegrambotapi.types.Update.de_json(json_string)
52+
update = telebot.types.Update.de_json(json_string)
5353
bot.process_new_updates([update])
5454
return ''
5555
else:

‎examples/webhook_examples/webhook_flask_heroku_echo.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import os
22

3-
import pytelegrambotapi
3+
import telebot
44
from flask import Flask, request
55

66
TOKEN = '<api_token>'
7-
bot = pytelegrambotapi.TeleBot(TOKEN)
7+
bot = telebot.TeleBot(TOKEN)
88
server = Flask(__name__)
99

1010

@@ -20,7 +20,7 @@ def echo_message(message):
2020

2121
@server.route('/' + TOKEN, methods=['POST'])
2222
def getMessage():
23-
bot.process_new_updates([pytelegrambotapi.types.Update.de_json(request.stream.read().decode("utf-8"))])
23+
bot.process_new_updates([telebot.types.Update.de_json(request.stream.read().decode("utf-8"))])
2424
return "!", 200
2525

2626

0 commit comments

Comments
 (0)