def sendLocation(self, chat_id, latitude, longitude, eply_to_message_id=None, reply_markup=None): if self.__token==None: raise TokenError() else: req = self._post('/sendLocation', {'chat_id': chat_id,'latitude':latitude,'longitude':longitude}) reqMessage = Message(req) reqMessage.location = Location(req['result']['location']) return reqMessage
def sendSticker(self,chat_id, sticker,reply_to_message_id=None, reply_markup=None): if os.path.isfile(sticker)==False: raise StickerError if self.__token==None: raise TokenError() else: req = self._post('/sendSticker', {'chat_id':chat_id},{'sticker':(sticker,open(sticker))}) reqMessage = Message(req) reqMessage.sticker = Sticker(req['result']['sticker']) return reqMessage
def sendVideo(self,chat_id, video,reply_to_message_id=None, reply_markup=None): if os.path.isfile(video)==False: raise VideoError if self.__token==None: raise TokenError() else: req = self._post('/sendVideo', {'chat_id':chat_id},{'video':(video,open(video))}) reqMessage = Message(req) reqMessage.video = Video(req['result']['video']) return reqMessage
def sendAudio(self, chat_id, audio, caption=None, reply_to_message_id=None, reply_markup=None): if os.path.isfile(audio)==False: raise AudioError if self.__token==None: raise TokenError() else: req = self._post('/sendAudio', {'chat_id':chat_id},{'audio':(audio,open(audio))}) reqMessage = Message(req) reqMessage.audio = Audio(req['result']['audio']) return reqMessage
def sendDocument(self,chat_id, document, caption=None, reply_to_message_id=None, reply_markup=None): if os.path.isfile(document)==False: raise DocumentError if self.__token==None: raise TokenError() else: req = self._post('/sendDocument', {'chat_id':chat_id},{'document':(document,open(document))}) reqMessage = Message(req) reqMessage.document = Document(req['result']['document']) return reqMessage
def sendPhoto(self, chat_id, photo, caption=None, reply_to_message_id=None, reply_markup=None): if os.path.isfile(photo)==False: raise PhotoError if self.__token==None: raise TokenError() else: req = self._post('/sendPhoto', {'chat_id':chat_id},{'photo':(photo,open(photo))}) reqMessage = Message(req) reqMessage.photos = [] for photoData in req['result']['photo']: reqMessage.photos.append(PhotoSize(photoData)) return reqMessage