def sendMessage(self, to, text, contentMetadata={}, contentType=0): msg = Message() msg.to, msg._from = to, self.profile.mid msg.text = text msg.contentType, msg.contentMetadata = contentType, contentMetadata if to not in self._messageReq: self._messageReq[to] = -1 self._messageReq[to] += 1 return self.talk.sendMessage(self._messageReq[to], msg)
def sendMessageWithFooter(self, to, text, title=None, link=None, iconlink=None, contentMetadata={}): msg = Message() msg.to, msg._from = to, self.profile.mid msg.text = text msg.contentType = 0 msg.contentMetadata = self.generateMessageFooter(title, link, iconlink) if contentMetadata: msg.contentMetadata.update(contentMetadata) if to not in self._messageReq: self._messageReq[to] = -1 self._messageReq[to] += 1 return self.talk.sendMessage(self._messageReq[to], msg)
def sendMessageMusic(self, to, title=None, subText=None, url=None, iconurl=None, contentMetadata={}): """ a : Android i : Ios """ self.profile = self.getProfile() self.userTicket = self.generateUserTicket() title = title if title else 'LINE MUSIC' subText = subText if subText else self.profile.displayName url = url if url else 'line://ti/p/' + self.userTicket iconurl = iconurl if iconurl else 'https://obs.line-apps.com/os/p/%s' % self.profile.mid msg = Message() msg.to, msg._from = to, self.profile.mid msg.text = title msg.contentType = 19 msg.contentMetadata = { 'text': title, 'subText': subText, 'a-installUrl': url, 'i-installUrl': url, 'a-linkUri': url, 'i-linkUri': url, 'linkUri': url, 'previewUrl': iconurl, 'type': 'mt', 'a-packageName': 'com.spotify.music', 'countryCode': 'ID', 'id': 'mt000000000a6b79f9' } if contentMetadata: msg.contentMetadata.update(contentMetadata) if to not in self._messageReq: self._messageReq[to] = -1 self._messageReq[to] += 1 return self.talk.sendMessage(self._messageReq[to], msg)
def sendLocation(self, to, address, latitude, longitude, phone=None, contentMetadata={}): msg = Message() msg.to, msg._from = to, self.profile.mid msg.text = "Location by Hello World" msg.contentType, msg.contentMetadata = 0, contentMetadata location = Location() location.address = address location.phone = phone location.latitude = float(latitude) location.longitude = float(longitude) location.title = "Location" msg.location = location if to not in self._messageReq: self._messageReq[to] = -1 self._messageReq[to] += 1 return self.talk.sendMessage(self._messageReq[to], msg)