From a8cf9f4ae59ee02b6f6737b4b2d8aa82df56ab10 Mon Sep 17 00:00:00 2001 From: OslikAi <48922415+OslikAi@users.noreply.github.com> Date: Thu, 6 Jun 2019 21:54:06 +0300 Subject: [PATCH 1/2] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 06d992c..5dcd01b 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ * [Using web hooks](#using-web-hooks) * [Logging](#logging) * [Proxy](#proxy) + * [New in library](#new-in-library) * [F.A.Q.](#faq) * [Bot 2.0](#bot-20) * [How can I distinguish a User and a GroupChat in message.chat?](#how-can-i-distinguish-a-user-and-a-groupchat-in-messagechat) @@ -510,6 +511,10 @@ apihelper.proxy = {'https':'socks5://userproxy:password@proxy_address:port'} ``` +## New in library + +06.06.2019 - Добавленна поддержка опросов (Poll). Добавлены функции send_poll, stop_poll + ## F.A.Q. ### Bot 2.0 From 63df69aeb89a4aaa9ed25c42b47be6da73179c4f Mon Sep 17 00:00:00 2001 From: OslikAi <48922415+OslikAi@users.noreply.github.com> Date: Thu, 6 Jun 2019 22:23:11 +0300 Subject: [PATCH 2/2] Delete my_tests.py --- tests/my_tests.py | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 tests/my_tests.py diff --git a/tests/my_tests.py b/tests/my_tests.py deleted file mode 100644 index 80f4abd..0000000 --- a/tests/my_tests.py +++ /dev/null @@ -1,40 +0,0 @@ -import os -from telebot import logger, logging, types, TeleBot - -try: - TOKEN = os.environ['TOKEN'] -except: - logger.error('Not variable \'TOKEN\' in environ') - exit(1) - -CHAT_ID = -1001405019571 -logger.setLevel(logging.DEBUG) - -bot = TeleBot(TOKEN) - - -@bot.message_handler(content_types=['poll']) -def po(m): - logger.debug('Give poll') - bot.send_message(m.chat.id, 'Я тоже так умею!') - m = bot.send_poll(m.chat.id, m.poll) - print(m.chat.id, m.message_id) - - -def test_send_poll(): - poll = types.Poll('Какой ты сегодня?') - poll.add('Добрый') - poll.add('Веселый') - poll.add('Грустный') - kb = types.InlineKeyboardMarkup() - kb.add(types.InlineKeyboardButton('1', url='t.me/dr_forse')) - result = bot.send_poll(CHAT_ID, poll, reply_to_message=60312, reply_markup=kb) - assert result['poll']['question'] == 'Какой ты сегодня?' - - -def test_stop_poll(): - res = bot.stop_poll(-1001405019571, 60370) - - -test_stop_poll() -bot.polling(none_stop=True, timeout=600)