def mention(to, nama): aa = "" bb = "" strt = int(14) akh = int(14) nm = nama for mm in nm: akh = akh + 2 aa += """{"S":""" + json.dumps(str(strt)) + ""","E":""" + json.dumps( str(akh)) + ""","M":""" + json.dumps(mm) + "}," "" strt = strt + 6 akh = akh + 4 bb += "\xe2\x95\xa0 @x \n" aa = (aa[:int(len(aa) - 1)]) msg = Message() msg.to = to msg.text = "\xe2\x95\x94\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\n" + bb + "\xe2\x95\x9a\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90" msg.contentMetadata = { 'MENTION': '{"MENTIONEES":[' + aa + ']}', 'EMTVER': '4' } print("[Command] Tag All") try: cl.sendMessage(msg) except Exception as error: print(error)
def sendMessage(to, text, contentMetadata={}, contentType=0): mes = Message() mes.to, mes.from_ = to, profile.mid mes.text = text mes.contentType, mes.contentMetadata = contentType, contentMetadata if to not in messageReq: messageReq[to] = -1 messageReq[to] += 1
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 sendLocation(self, to, latitude, longitude, address, title): msg = Message() msg.to = to msg.contentMetadata = {} msg.location = Location(latitude=latitude, longitude=longitude, address=address, title=title, phone=None) return self.talk.sendMessage(0, msg)
def sendFooter2(self, to, text, customIcon, customName, customLink): msg = Message() msg.to = to msg.text = text msg.contentMetadata = { 'AGENT_ICON': customIcon, 'AGENT_NAME': customName, 'AGENT_LINK': customLink } return self.talk.sendMessage(0, msg)
def sendMessageWithFooter1(self, to, text, link, icon, footer): footer = Message() footer.to = to footer.contentMetadata = { 'AGENT_LINK': str(link), 'AGENT_ICON': str(icon), 'AGENT_NAME': str(footer) } footer.text = text return self.talk.sendMessage(0, footer)
def sendFooter(self, to, text, name): msg = Message() msg.to = to msg.text = text msg.contentMetadata = { 'AGENT_ICON': "http://dl.profile.line-cdn.net/" + self.getProfile().picturePath, 'AGENT_NAME': name, 'AGENT_LINK': 'https://line.me/ti/p/~akugapunya.idline' } return self.talk.sendMessage(0, msg)
def sendMessageWithFooter2(self, to, text, link, name): msg = Message() msg.to = to msg.text = text msg.contentMetadata = { 'AGENT_ICON': "http://dl.profile.line-cdn.net/" + self.getProfile().picturePath, 'AGENT_NAME': name, 'AGENT_LINK': link } return self.talk.sendMessage(0, 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': 'JP', '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)
def generateReplyMessage(self, relatedMessageId): msg = Message() msg.relatedMessageServiceCode = 1 msg.messageRelationType = 3 msg.relatedMessageId = str(relatedMessageId) return msg