Python 在Yowsup中添加新成员时发送组通知
当我创建一个组并添加一个新成员(新添加的成员的号码是用于登录yowsup的号码)时,我想向所有成员发送一个通知,说“你好!”。这个答复应该是自动的。我该怎么做 我在文件demos/cli/layer.py中添加了一个函数Python 在Yowsup中添加新成员时发送组通知,python,oop,yowsup,Python,Oop,Yowsup,当我创建一个组并添加一个新成员(新添加的成员的号码是用于登录yowsup的号码)时,我想向所有成员发送一个通知,说“你好!”。这个答复应该是自动的。我该怎么做 我在文件demos/cli/layer.py中添加了一个函数 def createGroupMessage(self, groupID,messageBody): groupID = groupID + "@g.us" outgoingMessageProtocolEntity = TextMessageProtocol
def createGroupMessage(self, groupID,messageBody):
groupID = groupID + "@g.us"
outgoingMessageProtocolEntity = TextMessageProtocolEntity(
messageBody,
to = groupID
)
print outgoingMessageProtocolEntity
self.toLower(outgoingMessageProtocolEntity)
我试图在文件layers/protocolegroups/protocolenties/notification\u groups\u create.py中调用它
完成必要的导入后:
def init(self, id, from, timestamp, notify, participant, offline,
createType, groupId, creationTimestamp, creatorJid,
subject, subjectTime, subjectOwnerJid,
participants):
super(CreateGroupsNotificationProtocolEntity, self).__init(_id, _from, timestamp, notify, participant, offline)
self.setGroupProps(createType, groupId, creationTimestamp, creatorJid, subject, subjectTime, subjectOwnerJid, participants)
self.foo1 = YowsupCliLayer()
self.foo1.createGroupMessage(groupId,"Hello !\n")
虽然代码没有给出任何错误,但我在添加yowsup号码时没有收到任何消息
我得到的结果是:
Message:
ID: 1442859669-5
To: 919xxxxxx515-1442843444@g.us
Type: text
Timestamp: 1442859669
Body: Hello !!
Printing notification..
w:gp2
Notification: Notification
From: 919xxxxxx515-1442843444@g.us
Type: w:gp2
Participant: 919xxxxxx515@s.whatsapp.net
Creator: 919xxxxxx515@s.whatsapp.net
Create type: None
Creation timestamp: 1442843444
Subject: FBI
Subject owner: 919xxxxxx515@s.whatsapp.net
Subject timestamp: 1442843444
Participants: {'919xxxxxx515@s.whatsapp.net': 'admin', '91886xxxxx5@s.whatsapp.net': None}
请让我知道我哪里出了问题,或者我如何解决这个问题?
谢谢