Skip to content

Commit 4166fb2

Browse files
committed
Code base cleanup
1 parent 2e99472 commit 4166fb2

16 files changed

Lines changed: 52 additions & 97 deletions

File tree

‎.github/workflows/setup_python.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
runs-on: ubuntu-latest
2121
strategy:
2222
matrix:
23-
python-version: [ '3.6','3.7','3.8','3.9', 'pypy-3.6', 'pypy-3.7' ] #'pypy-3.8', 'pypy-3.9' NOT SUPPORTED NOW
23+
python-version: [ '3.7','3.8','3.9', 'pypy-3.7', 'pypy-3.8' ] #'pypy-3.9' NOT SUPPORTED NOW
2424
name: ${{ matrix.python-version }} and tests
2525
steps:
2626
- uses: actions/checkout@v2

‎examples/anonymous_bot.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from telebot import types
1010

1111
# Initialize bot with your token
12-
bot = telebot.TeleBot(TOKEN)
12+
bot = telebot.TeleBot('TOKEN')
1313

1414
# The `users` variable is needed to contain chat ids that are either in the search or in the active dialog, like {chat_id, chat_id}
1515
users = {}
@@ -47,7 +47,7 @@ def find(message: types.Message):
4747
if message.chat.id not in users:
4848
bot.send_message(message.chat.id, 'Finding...')
4949

50-
if freeid == None:
50+
if freeid is None:
5151
freeid = message.chat.id
5252
else:
5353
# Question:

‎examples/asynchronous_telebot/custom_states.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import telebot
21
from telebot import asyncio_filters
32
from telebot.async_telebot import AsyncTeleBot
43

54
# list of storages, you can use any storage
6-
from telebot.asyncio_storage import StateRedisStorage,StateMemoryStorage,StatePickleStorage
5+
from telebot.asyncio_storage import StateMemoryStorage
76

87
# new feature for states.
98
from telebot.asyncio_handler_backends import State, StatesGroup

‎examples/asynchronous_telebot/middleware/flooding_middleware.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Just a little example of middleware handlers
22

3-
import telebot
43
from telebot.asyncio_handler_backends import BaseMiddleware
54
from telebot.async_telebot import AsyncTeleBot
65
from telebot.async_telebot import CancelUpdate

‎examples/custom_states.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from telebot.handler_backends import State, StatesGroup #States
55

66
# States storage
7-
from telebot.storage import StateRedisStorage, StatePickleStorage, StateMemoryStorage
7+
from telebot.storage import StateMemoryStorage
88

99

1010
# Beginning from version 4.4.0+, we support storages.

‎examples/timer_bot.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ def send_welcome(message):
1818
def beep(chat_id) -> None:
1919
"""Send the beep message."""
2020
bot.send_message(chat_id, text='Beep!')
21-
return schedule.CancelJob # Run a job once
2221

2322

2423
@bot.message_handler(commands=['set'])

‎examples/webhook_examples/webhook_tornado_echo_bot.py‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# Documenation to Tornado: http://tornadoweb.org
66

77
import signal
8+
from typing import Optional, Awaitable
89

910
import tornado.httpserver
1011
import tornado.ioloop
@@ -33,12 +34,18 @@
3334

3435

3536
class Root(tornado.web.RequestHandler):
37+
def data_received(self, chunk: bytes) -> Optional[Awaitable[None]]:
38+
pass
39+
3640
def get(self):
3741
self.write("Hi! This is webhook example!")
3842
self.finish()
3943

4044

41-
class webhook_serv(tornado.web.RequestHandler):
45+
class WebhookServ(tornado.web.RequestHandler):
46+
def data_received(self, chunk: bytes) -> Optional[Awaitable[None]]:
47+
pass
48+
4249
def get(self):
4350
self.write("What are you doing here?")
4451
self.finish()
@@ -93,7 +100,7 @@ def send_welcome(message):
93100
signal.signal(signal.SIGINT, signal_handler)
94101
application = tornado.web.Application([
95102
(r"/", Root),
96-
(r"/" + WEBHOOK_SECRET, webhook_serv)
103+
(r"/" + WEBHOOK_SECRET, WebhookServ)
97104
])
98105

99106
http_server = tornado.httpserver.HTTPServer(application, ssl_options={

0 commit comments

Comments
 (0)