Skip to content

Commit 5969a66

Browse files
authored
Merge pull request eternnoir#1 from eternnoir/master
Merging to master
2 parents 89f515b + 791a183 commit 5969a66

3 files changed

Lines changed: 92 additions & 5 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,8 @@ Get help. Discuss. Chat.
542542
* [proxybot](https://github.com/p-hash/proxybot) - Simple Proxy Bot for Telegram. by p-hash
543543
* [DonantesMalagaBot](https://github.com/vfranch/DonantesMalagaBot)- DonantesMalagaBot facilitates information to Malaga blood donors about the places where they can donate today or in the incoming days. It also records the date of the last donation so that it helps the donors to know when they can donate again. - by vfranch
544544
* [DuttyBot](https://github.com/DmytryiStriletskyi/DuttyBot) by *Dmytryi Striletskyi* - Timetable for one university in Kiev.
545-
* [dailypepebot](https://telegram.me/dailypepebot) by [*jaime*](https://github.com/jiwidi) - Get's you random pepe images and gives you their id, then you can call this image with the number.
545+
* [dailypepebot](https://telegram.me/dailypepebot) by [*Jaime*](https://github.com/jiwidi/Dailypepe) - Get's you random pepe images and gives you their id, then you can call this image with the number.
546+
* [DailyQwertee](https://t.me/DailyQwertee) by [*Jaime*](https://github.com/jiwidi/DailyQwertee) - Bot that manages a channel that sends qwertee daily tshirts every day at 00:00
546547
* [wat-bridge](https://github.com/rmed/wat-bridge) by [*rmed*](https://github.com/rmed) - Send and receive messages to/from WhatsApp through Telegram
547548
* [flibusta_bot](https://github.com/Kurbezz/flibusta_bot) by [*Kurbezz*](https://github.com/Kurbezz)
548549
* [EmaProject](https://github.com/halkliff/emaproject) by [*halkliff*](https://github.com/halkliff) - Ema - Eastern Media Assistant was made thinking on the ease-to-use feature. Coding here is simple, as much as is fast and powerful.

‎telebot/__init__.py‎

Lines changed: 86 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class TeleBot:
4545
getUpdates
4646
"""
4747

48-
def __init__(self, token, threaded=True, skip_pending=False):
48+
def __init__(self, token, threaded=True, skip_pending=False, num_threads=2):
4949
"""
5050
:param token: bot API token
5151
:return: Telebot object.
@@ -76,7 +76,7 @@ def __init__(self, token, threaded=True, skip_pending=False):
7676

7777
self.threaded = threaded
7878
if self.threaded:
79-
self.worker_pool = util.ThreadPool()
79+
self.worker_pool = util.ThreadPool(num_threads=num_threads)
8080

8181
def set_webhook(self, url=None, certificate=None, max_connections=None, allowed_updates=None):
8282
return apihelper.set_webhook(self.token, url, certificate, max_connections, allowed_updates)
@@ -885,10 +885,38 @@ def __init__(self, *args, **kwargs):
885885
def get_me(self):
886886
return TeleBot.get_me(self)
887887

888+
@util.async()
889+
def get_file(self, *args):
890+
return TeleBot.get_file(self, *args)
891+
892+
@util.async()
893+
def download_file(self, *args):
894+
return TeleBot.download_file(self, *args)
895+
888896
@util.async()
889897
def get_user_profile_photos(self, *args, **kwargs):
890898
return TeleBot.get_user_profile_photos(self, *args, **kwargs)
891899

900+
@util.async()
901+
def get_chat(self, *args):
902+
return TeleBot.get_chat(self, *args)
903+
904+
@util.async()
905+
def leave_chat(self, *args):
906+
return TeleBot.leave_chat(self, *args)
907+
908+
@util.async()
909+
def get_chat_administrators(self, *args):
910+
return TeleBot.get_chat_administrators(self, *args)
911+
912+
@util.async()
913+
def get_chat_members_count(self, *args):
914+
return TeleBot.get_chat_members_count(self, *args)
915+
916+
@util.async()
917+
def get_chat_member(self, *args):
918+
return TeleBot.get_chat_member(self, *args)
919+
892920
@util.async()
893921
def send_message(self, *args, **kwargs):
894922
return TeleBot.send_message(self, *args, **kwargs)
@@ -897,6 +925,10 @@ def send_message(self, *args, **kwargs):
897925
def forward_message(self, *args, **kwargs):
898926
return TeleBot.forward_message(self, *args, **kwargs)
899927

928+
@util.async()
929+
def delete_message(self, *args):
930+
return TeleBot.delete_message(self, *args)
931+
900932
@util.async()
901933
def send_photo(self, *args, **kwargs):
902934
return TeleBot.send_photo(self, *args, **kwargs)
@@ -905,6 +937,10 @@ def send_photo(self, *args, **kwargs):
905937
def send_audio(self, *args, **kwargs):
906938
return TeleBot.send_audio(self, *args, **kwargs)
907939

940+
@util.async()
941+
def send_voice(self, *args, **kwargs):
942+
return TeleBot.send_voice(self, *args, **kwargs)
943+
908944
@util.async()
909945
def send_document(self, *args, **kwargs):
910946
return TeleBot.send_document(self, *args, **kwargs)
@@ -921,6 +957,54 @@ def send_video(self, *args, **kwargs):
921957
def send_location(self, *args, **kwargs):
922958
return TeleBot.send_location(self, *args, **kwargs)
923959

960+
@util.async()
961+
def send_venue(self, *args, **kwargs):
962+
return TeleBot.send_venue(self, *args, **kwargs)
963+
964+
@util.async()
965+
def send_contact(self, *args, **kwargs):
966+
return TeleBot.send_contact(self, *args, **kwargs)
967+
924968
@util.async()
925969
def send_chat_action(self, *args, **kwargs):
926970
return TeleBot.send_chat_action(self, *args, **kwargs)
971+
972+
@util.async()
973+
def kick_chat_member(self, *args):
974+
return TeleBot.kick_chat_member(self, *args)
975+
976+
@util.async()
977+
def unban_chat_member(self, *args):
978+
return TeleBot.unban_chat_member(self, *args)
979+
980+
@util.async()
981+
def edit_message_text(self, *args, **kwargs):
982+
return TeleBot.edit_message_text(self, *args, **kwargs)
983+
984+
@util.async()
985+
def edit_message_reply_markup(self, *args, **kwargs):
986+
return TeleBot.edit_message_reply_markup(self, *args, **kwargs)
987+
988+
@util.async()
989+
def send_game(self, *args, **kwargs):
990+
return TeleBot.send_game(self, *args, **kwargs)
991+
992+
@util.async()
993+
def set_game_score(self, *args, **kwargs):
994+
return TeleBot.set_game_score(self, *args, **kwargs)
995+
996+
@util.async()
997+
def get_game_high_scores(self, *args, **kwargs):
998+
return TeleBot.get_game_high_scores(self, *args, **kwargs)
999+
1000+
@util.async()
1001+
def edit_message_caption(self, *args, **kwargs):
1002+
return TeleBot.edit_message_caption(self, *args, **kwargs)
1003+
1004+
@util.async()
1005+
def answer_inline_query(self, *args, **kwargs):
1006+
return TeleBot.answer_inline_query(self, *args, **kwargs)
1007+
1008+
@util.async()
1009+
def answer_callback_query(self, *args, **kwargs):
1010+
return TeleBot.answer_callback_query(self, *args, **kwargs)

‎telebot/types.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,15 @@ def de_json(cls, json_string):
168168
first_name = obj['first_name']
169169
last_name = obj.get('last_name')
170170
username = obj.get('username')
171-
return cls(id, first_name, last_name, username)
171+
language_code = obj.get('language_code')
172+
return cls(id, first_name, last_name, username, language_code)
172173

173-
def __init__(self, id, first_name, last_name=None, username=None):
174+
def __init__(self, id, first_name, last_name=None, username=None, language_code=None):
174175
self.id = id
175176
self.first_name = first_name
176177
self.username = username
177178
self.last_name = last_name
179+
self.language_code = language_code
178180

179181

180182
class GroupChat(JsonDeserializable):

0 commit comments

Comments
 (0)