在Yowsup

时间:2015-09-21 18:55:15

标签: python oop yowsup

当我创建一个组并添加一个新成员时(新添加的成员的编号是用于登录yowsup的编号),我想向所有成员发送“Hello!”的通知。此回复应自动化。我该怎么做?

我在文件demos / cli / layer.py

中添加了一个函数
def createGroupMessage(self, groupID,messageBody):
    groupID = groupID + "@g.us" 
    outgoingMessageProtocolEntity = TextMessageProtocolEntity(
    messageBody,
    to = groupID
    )
    print outgoingMessageProtocolEntity
    self.toLower(outgoingMessageProtocolEntity)

我试图在文件layers / protocol_groups / protocolentities / notification_groups_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}

请告诉我哪里出错了或者我该如何解决?         谢谢!

0 个答案:

没有答案