From d17d28a14482e05ee9e47e731aaf49bb4ce96d37 Mon Sep 17 00:00:00 2001 From: German Date: Tue, 20 Mar 2018 23:36:29 +0300 Subject: [PATCH 01/10] create field forward_from_message_id in Message https://core.telegram.org/bots/api#message --- telebot/types.py | 1 + 1 file changed, 1 insertion(+) diff --git a/telebot/types.py b/telebot/types.py index f497a7c..70f7884 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -399,6 +399,7 @@ class Message(JsonDeserializable): self.date = date self.chat = chat self.forward_from_chat = None + self.forward_from_message_id = None self.forward_from = None self.forward_date = None self.reply_to_message = None From 27d442fabfa8b1c94b59ea788797af1dbbd0d3e5 Mon Sep 17 00:00:00 2001 From: Badiboy Date: Tue, 24 Jul 2018 00:33:13 +0300 Subject: [PATCH 02/10] timeout for send_message Add optional "timeout" parameter to send_message (the same as exists in all other send_*). Equal rights for all send functions! :) --- telebot/__init__.py | 4 ++-- telebot/apihelper.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/telebot/__init__.py b/telebot/__init__.py index fb7770b..5106f87 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -459,7 +459,7 @@ class TeleBot: return types.ChatMember.de_json(result) def send_message(self, chat_id, text, disable_web_page_preview=None, reply_to_message_id=None, reply_markup=None, - parse_mode=None, disable_notification=None): + parse_mode=None, disable_notification=None, timeout=None): """ Use this method to send text messages. @@ -477,7 +477,7 @@ class TeleBot: """ return types.Message.de_json( apihelper.send_message(self.token, chat_id, text, disable_web_page_preview, reply_to_message_id, - reply_markup, parse_mode, disable_notification)) + reply_markup, parse_mode, disable_notification, timeout)) def forward_message(self, chat_id, from_chat_id, message_id, disable_notification=None): """ diff --git a/telebot/apihelper.py b/telebot/apihelper.py index ceda96c..e919b5a 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -114,7 +114,7 @@ def download_file(token, file_path): def send_message(token, chat_id, text, disable_web_page_preview=None, reply_to_message_id=None, reply_markup=None, - parse_mode=None, disable_notification=None): + parse_mode=None, disable_notification=None, timeout=None): """ Use this method to send text messages. On success, the sent Message is returned. :param token: @@ -137,6 +137,8 @@ def send_message(token, chat_id, text, disable_web_page_preview=None, reply_to_m payload['parse_mode'] = parse_mode if disable_notification: payload['disable_notification'] = disable_notification + if timeout: + payload['connect-timeout'] = timeout return _make_request(token, method_url, params=payload, method='post') From 8634e652497065178dd5f538327fddd04a53f963 Mon Sep 17 00:00:00 2001 From: Badiboy Date: Wed, 25 Jul 2018 12:44:18 +0300 Subject: [PATCH 03/10] Fix kick_chat_member decription Fix kick_chat_member return value type description (should be boolean according to API and is boolean by fact). --- telebot/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telebot/__init__.py b/telebot/__init__.py index 5106f87..061d4d3 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -723,7 +723,7 @@ class TeleBot: :param user_id: Int : Unique identifier of the target user :param until_date: Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever - :return: types.Message + :return: boolean """ return apihelper.kick_chat_member(self.token, chat_id, user_id, until_date) From 4131b05733e1a58e9e9ff2da21e135b32e6220cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Natanael=20Andr=C3=A9s=20Garrido?= Date: Mon, 5 Nov 2018 15:11:31 -0300 Subject: [PATCH 04/10] Update README.md Adding another bot that user pyTelegramBotAPI. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fbe40e8..ee9c163 100644 --- a/README.md +++ b/README.md @@ -561,7 +561,7 @@ Get help. Discuss. Chat. * [Telegram Proxy Bot](https://github.com/mrgigabyte/proxybot) by *mrgigabyte* - `Credits for the original version of this bot goes to` **Groosha** `, simply added certain features which I thought were needed`. * [RadRetroRobot](https://github.com/Tronikart/RadRetroRobot) by *Tronikart* - Multifunctional Telegram Bot RadRetroRobot. * [League of Legends bot](https://telegram.me/League_of_Legends_bot) ([source](https://github.com/i32ropie/lol)) by *i32ropie* -* [NeoBot](https://github.com/neoranger/NeoBot) by *neoranger* +* [NeoBot](https://github.com/neoranger/NeoBot) by [@NeoRanger](https://github.com/neoranger) * [TagAlertBot](https://github.com/pitasi/TagAlertBot) by *pitasi* * [ComedoresUGRbot](http://telegram.me/ComedoresUGRbot) ([source](https://github.com/alejandrocq/ComedoresUGRbot)) by [*alejandrocq*](https://github.com/alejandrocq) - Telegram bot to check the menu of Universidad de Granada dining hall. * [picpingbot](https://web.telegram.org/#/im?p=%40picpingbot) - Fun anonymous photo exchange by Boogie Muffin. @@ -587,6 +587,7 @@ Get help. Discuss. Chat. * [MusicQuiz_bot](https://t.me/MusicQuiz_bot) by [Etoneja](https://github.com/Etoneja) - Listen to audiosamles and try to name the performer of the song. * [Bot-Telegram-Shodan ](https://github.com/rubenleon/Bot-Telegram-Shodan) by [rubenleon](https://github.com/rubenleon) * [MandangoBot](https://t.me/MandangoBot) by @Alvaricias - Bot for managing Marvel Strike Force alliances (only in spanish, atm). +* [ManjaroBot](https://t.me/ManjaroBot) by [@NeoRanger](https://github.com/neoranger) - Bot for Manjaro Linux Spanish group with a lot of info for Manjaro Newbies. Want to have your bot listed here? Send a Telegram message to @eternnoir or @pevdh. From ceea457cf1202b74aa4411ecdb320a7e74c105b0 Mon Sep 17 00:00:00 2001 From: KanerL <40599431+KanerL@users.noreply.github.com> Date: Mon, 12 Nov 2018 01:43:00 +0200 Subject: [PATCH 05/10] Update shipping option Setting list of ShippingOptions like in payments_example.py shipping_options = [ ShippingOption(id='instant', title='WorldWide Teleporter').add_price(LabeledPrice('Teleporter', 1000)), ShippingOption(id='pickup', title='Local pickup').add_price(LabeledPrice('Pickup', 300))] gives us [None,None],so It's better add_price to return self --- telebot/types.py | 1 + 1 file changed, 1 insertion(+) diff --git a/telebot/types.py b/telebot/types.py index 6165c94..1497657 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -1902,6 +1902,7 @@ class ShippingOption(JsonSerializable): """ for price in args: self.prices.append(price) + return self def to_json(self): price_list = [] From 68db5997900cd5f40640308b8171b805165d5d95 Mon Sep 17 00:00:00 2001 From: Dzianis Talkachou Date: Sat, 23 Nov 2019 21:25:29 +0300 Subject: [PATCH 06/10] Delete duplicate string --- telebot/apihelper.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/telebot/apihelper.py b/telebot/apihelper.py index 6e51bd9..df8535d 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -45,8 +45,7 @@ def _make_request(token, method_name, method='get', params=None, files=None, bas request_url = "https://api.telegram.org/bot{0}/{1}".format(token, method_name) else: request_url = base_url.format(token, method_name) - - request_url = base_url.format(token, method_name) + logger.debug("Request: method={0} url={1} params={2} files={3}".format(method, request_url, params, files)) read_timeout = READ_TIMEOUT connect_timeout = CONNECT_TIMEOUT From a71030dcdd791e2ee07aa3570db4c989a9defb97 Mon Sep 17 00:00:00 2001 From: Pablo Hinojosa Date: Sat, 30 Nov 2019 05:51:56 +0100 Subject: [PATCH 07/10] Change chatid to chat_id to be the same as other examples Change in README.md chatid to chat_id to be the same as other examples --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 874f01b..1e608a0 100644 --- a/README.md +++ b/README.md @@ -251,7 +251,7 @@ updates = tb.get_updates() updates = tb.get_updates(1234,100,20) #get_Updates(offset, limit, timeout): # sendMessage -tb.send_message(chatid, text) +tb.send_message(chat_id, text) # forwardMessage tb.forward_message(to_chat_id, from_chat_id, message_id) From a413a51221d4d39c5eb0b0e9369551ed3b20e01e Mon Sep 17 00:00:00 2001 From: Lev Svalov <30590045+LeoSvalov@users.noreply.github.com> Date: Tue, 24 Dec 2019 16:25:58 +0500 Subject: [PATCH 08/10] Update README Adding another bot that user pyTelegramBotAPI. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 874f01b..cbcdad0 100644 --- a/README.md +++ b/README.md @@ -598,5 +598,6 @@ Get help. Discuss. Chat. * [kboardbot](https://t.me/kboardbot) by [kor0p](https://github.com/kor0p) - inline switches keyboard layout (English, Hebrew, Ukrainian, Russian). * [Robbie](https://t.me/romdeliverybot) ([source](https://github.com/FacuM/romdeliverybot_support)) by @FacuM - Support Telegram bot for developers and maintainers. * [AsadovBot](https://t.me/asadov_bot) ([source](https://github.com/desexcile/BotApi)) by @DesExcile - Сatalog of poems by Eduard Asadov. +* [thesaurus_com_bot](https://t.me/thesaurus_com_bot) ([source](https://github.com/LeoSvalov/words-i-learn-bot)) by @LeoSvalov - words and synonyms from [dictionary.com](https://www.dictionary.com) and [thesaurus.com](https://www.thesaurus.com) in the telegram. Want to have your bot listed here? Send a Telegram message to @eternnoir or @pevdh. From bf844ed2026ee9334d33e32331f120b79ed1e7e8 Mon Sep 17 00:00:00 2001 From: Badiboy Date: Wed, 1 Jan 2020 13:46:18 +0300 Subject: [PATCH 09/10] HTML symbols not replaced HTML symbols not replaced because return is before replace. --- telebot/types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telebot/types.py b/telebot/types.py index 6165c94..d8fe236 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -477,10 +477,10 @@ class Message(JsonDeserializable): url = "tg://user?id={0}".format(user.id) elif type == "mention": url = "https://t.me/{0}".format(text[1:]) + text = text.replace("&", "&").replace("<", "<").replace(">", ">") if not type or not _subs.get(type): return text subs = _subs.get(type) - text = text.replace("&", "&").replace("<", "<").replace(">", ">") return subs.format(text=text, url=url) offset = 0 From 8c62b99057adf29c166b29e6988801bfb9a82da1 Mon Sep 17 00:00:00 2001 From: Badiboy Date: Fri, 3 Jan 2020 02:05:32 +0300 Subject: [PATCH 10/10] Update .travis.yml Travis: removed 2.6 and 3.3 (not supported). Added 3.7. Also added 3.8 (for experiment) --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f5f202a..d316722 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,10 @@ language: python python: - - "2.6" - "2.7" - - "3.3" - "3.4" - "3.5" - "3.6" + - "3.7" - "pypy" - "pypy3" install: "pip install -r requirements.txt"