diff --git a/telebot/__init__.py b/telebot/__init__.py index 32ed84d..fb7770b 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -1354,230 +1354,230 @@ class AsyncTeleBot(TeleBot): def __init__(self, *args, **kwargs): TeleBot.__init__(self, *args, **kwargs) - @util.async() + @util.async_dec() def get_me(self): return TeleBot.get_me(self) - @util.async() + @util.async_dec() def get_file(self, *args): return TeleBot.get_file(self, *args) - @util.async() + @util.async_dec() def download_file(self, *args): return TeleBot.download_file(self, *args) - @util.async() + @util.async_dec() def get_user_profile_photos(self, *args, **kwargs): return TeleBot.get_user_profile_photos(self, *args, **kwargs) - @util.async() + @util.async_dec() def get_chat(self, *args): return TeleBot.get_chat(self, *args) - @util.async() + @util.async_dec() def leave_chat(self, *args): return TeleBot.leave_chat(self, *args) - @util.async() + @util.async_dec() def get_chat_administrators(self, *args): return TeleBot.get_chat_administrators(self, *args) - @util.async() + @util.async_dec() def get_chat_members_count(self, *args): return TeleBot.get_chat_members_count(self, *args) - @util.async() + @util.async_dec() def set_chat_sticker_set(self, *args): return TeleBot.set_chat_sticker_set(self, *args) - @util.async() + @util.async_dec() def delete_chat_sticker_set(self, *args): return TeleBot.delete_chat_sticker_set(self, *args) - @util.async() + @util.async_dec() def get_chat_member(self, *args): return TeleBot.get_chat_member(self, *args) - @util.async() + @util.async_dec() def send_message(self, *args, **kwargs): return TeleBot.send_message(self, *args, **kwargs) - @util.async() + @util.async_dec() def forward_message(self, *args, **kwargs): return TeleBot.forward_message(self, *args, **kwargs) - @util.async() + @util.async_dec() def delete_message(self, *args): return TeleBot.delete_message(self, *args) - @util.async() + @util.async_dec() def send_photo(self, *args, **kwargs): return TeleBot.send_photo(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_audio(self, *args, **kwargs): return TeleBot.send_audio(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_voice(self, *args, **kwargs): return TeleBot.send_voice(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_document(self, *args, **kwargs): return TeleBot.send_document(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_sticker(self, *args, **kwargs): return TeleBot.send_sticker(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_video(self, *args, **kwargs): return TeleBot.send_video(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_video_note(self, *args, **kwargs): return TeleBot.send_video_note(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_media_group(self, *args, **kwargs): return TeleBot.send_media_group(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_location(self, *args, **kwargs): return TeleBot.send_location(self, *args, **kwargs) - @util.async() + @util.async_dec() def edit_message_live_location(self, *args, **kwargs): return TeleBot.edit_message_live_location(self, *args, **kwargs) - @util.async() + @util.async_dec() def stop_message_live_location(self, *args, **kwargs): return TeleBot.stop_message_live_location(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_venue(self, *args, **kwargs): return TeleBot.send_venue(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_contact(self, *args, **kwargs): return TeleBot.send_contact(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_chat_action(self, *args, **kwargs): return TeleBot.send_chat_action(self, *args, **kwargs) - @util.async() + @util.async_dec() def kick_chat_member(self, *args, **kwargs): return TeleBot.kick_chat_member(self, *args, **kwargs) - @util.async() + @util.async_dec() def unban_chat_member(self, *args): return TeleBot.unban_chat_member(self, *args) - @util.async() + @util.async_dec() def restrict_chat_member(self, *args, **kwargs): return TeleBot.restrict_chat_member(self, *args, **kwargs) - @util.async() + @util.async_dec() def promote_chat_member(self, *args, **kwargs): return TeleBot.promote_chat_member(self, *args, **kwargs) - @util.async() + @util.async_dec() def export_chat_invite_link(self, *args): return TeleBot.export_chat_invite_link(self, *args) - @util.async() + @util.async_dec() def set_chat_photo(self, *args): return TeleBot.set_chat_photo(self, *args) - @util.async() + @util.async_dec() def delete_chat_photo(self, *args): return TeleBot.delete_chat_photo(self, *args) - @util.async() + @util.async_dec() def set_chat_title(self, *args): return TeleBot.set_chat_title(self, *args) - @util.async() + @util.async_dec() def set_chat_description(self, *args): return TeleBot.set_chat_description(self, *args) - @util.async() + @util.async_dec() def pin_chat_message(self, *args, **kwargs): return TeleBot.pin_chat_message(self, *args, **kwargs) - @util.async() + @util.async_dec() def unpin_chat_message(self, *args): return TeleBot.unpin_chat_message(self, *args) - @util.async() + @util.async_dec() def edit_message_text(self, *args, **kwargs): return TeleBot.edit_message_text(self, *args, **kwargs) - @util.async() + @util.async_dec() def edit_message_reply_markup(self, *args, **kwargs): return TeleBot.edit_message_reply_markup(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_game(self, *args, **kwargs): return TeleBot.send_game(self, *args, **kwargs) - @util.async() + @util.async_dec() def set_game_score(self, *args, **kwargs): return TeleBot.set_game_score(self, *args, **kwargs) - @util.async() + @util.async_dec() def get_game_high_scores(self, *args, **kwargs): return TeleBot.get_game_high_scores(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_invoice(self, *args, **kwargs): return TeleBot.send_invoice(self, *args, **kwargs) - @util.async() + @util.async_dec() def answer_shipping_query(self, *args, **kwargs): return TeleBot.answer_shipping_query(self, *args, **kwargs) - @util.async() + @util.async_dec() def answer_pre_checkout_query(self, *args, **kwargs): return TeleBot.answer_pre_checkout_query(self, *args, **kwargs) - @util.async() + @util.async_dec() def edit_message_caption(self, *args, **kwargs): return TeleBot.edit_message_caption(self, *args, **kwargs) - @util.async() + @util.async_dec() def answer_inline_query(self, *args, **kwargs): return TeleBot.answer_inline_query(self, *args, **kwargs) - @util.async() + @util.async_dec() def answer_callback_query(self, *args, **kwargs): return TeleBot.answer_callback_query(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_sticker(self, *args, **kwargs): return TeleBot.send_sticker(self, *args, **kwargs) - @util.async() + @util.async_dec() def get_sticker_set(self, *args, **kwargs): return TeleBot.get_sticker_set(self, *args, **kwargs) - @util.async() + @util.async_dec() def upload_sticker_file(self, *args, **kwargs): return TeleBot.upload_sticker_file(self, *args, **kwargs) - @util.async() + @util.async_dec() def create_new_sticker_set(self, *args, **kwargs): return TeleBot.create_new_sticker_set(self, *args, **kwargs) - @util.async() + @util.async_dec() def add_sticker_to_set(self, *args, **kwargs): return TeleBot.add_sticker_to_set(self, *args, **kwargs) - @util.async() + @util.async_dec() def set_sticker_position_in_set(self, *args, **kwargs): return TeleBot.set_sticker_position_in_set(self, *args, **kwargs) - @util.async() + @util.async_dec() def delete_sticker_from_set(self, *args, **kwargs): return TeleBot.delete_sticker_from_set(self, *args, **kwargs) diff --git a/telebot/util.py b/telebot/util.py index 769f73b..f448d78 100644 --- a/telebot/util.py +++ b/telebot/util.py @@ -143,7 +143,7 @@ class AsyncTask: return self.result -def async(): +def async_dec(): def decorator(fn): def wrapper(*args, **kwargs): return AsyncTask(fn, *args, **kwargs)