Add readme & pep8

This commit is contained in:
eternnoir 2015-09-05 18:12:52 +08:00
parent da729069c2
commit 93aa37768a
2 changed files with 12 additions and 4 deletions

View File

@ -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)

View File

@ -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):
"""