グループを作って新しいメンバーを追加したとき(追加したメンバーの番号はyowsupにログインするための番号です)、メンバー全員に「こんにちは!」という通知を送りたいです。この返信は自動化する必要があります。どうすればいいですか?
ファイル 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}
どこが間違っているのか、またはどうすれば解決できるのか教えてください。ありがとう!