From 93aa37768af4fa0f435a95619132d462d32d8424 Mon Sep 17 00:00:00 2001 From: eternnoir Date: Sat, 5 Sep 2015 18:12:52 +0800 Subject: [PATCH] Add readme & pep8 --- README.md | 4 ++++ telebot/__init__.py | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a18c5b7..12a643b 100644 --- a/README.md +++ b/README.md @@ -181,6 +181,10 @@ tb.polling(none_stop=False, interval=0, block=True) # getMe user = tb.get_me() +# getUpdates +updates = tb.get_updates() +updates = tb.get_updates(1234,100,20) #get_Updates(offset, limit, timeout): + # sendMessage tb.send_message(chatid, text) diff --git a/telebot/__init__.py b/telebot/__init__.py index 067914f..dc3f366 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -5,6 +5,7 @@ import threading import time import logging + logging.basicConfig() logger = logging.getLogger('Telebot') import re @@ -17,6 +18,7 @@ Module : telebot API_URL = r"https://api.telegram.org/" + class TeleBot: """ This is TeleBot Class Methods: @@ -59,7 +61,7 @@ class TeleBot: if self.__create_threads: self.worker_pool = util.ThreadPool(num_threads) - def get_Updates(self, offset=None,limit=None, timeout=20): + def get_updates(self, offset=None, limit=None, timeout=20): """ Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned. :param offset: Integer. Identifier of the first update to be returned. @@ -207,7 +209,8 @@ class TeleBot: return types.Message.de_json( apihelper.send_photo(self.token, chat_id, photo, caption, reply_to_message_id, reply_markup)) - def send_audio(self, chat_id, audio, duration=None, performer=None, title=None, reply_to_message_id=None, reply_markup=None): + def send_audio(self, chat_id, audio, duration=None, performer=None, title=None, reply_to_message_id=None, + reply_markup=None): """ Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .mp3 format. :param chat_id:Unique identifier for the message recipient @@ -220,7 +223,8 @@ class TeleBot: :return: Message """ return types.Message.de_json( - apihelper.send_audio(self.token, chat_id, audio,duration,performer,title, reply_to_message_id, reply_markup)) + apihelper.send_audio(self.token, chat_id, audio, duration, performer, title, reply_to_message_id, + reply_markup)) def send_voice(self, chat_id, voice, duration=None, reply_to_message_id=None, reply_markup=None): """ @@ -233,7 +237,7 @@ class TeleBot: :return: Message """ return types.Message.de_json( - apihelper.send_voice(self.token, chat_id, voice, duration, reply_to_message_id,reply_markup)) + apihelper.send_voice(self.token, chat_id, voice, duration, reply_to_message_id, reply_markup)) def send_document(self, chat_id, data, reply_to_message_id=None, reply_markup=None): """