I'm trying to send a kik message through a bot, but not an official kik bot, a unoffical bot where its a user signed in rather than just a bot being hosted on kik. I'm trying to use https://github.com/tomer8007/kik-bot-api-unofficial as the main bot, but he doesn't have the image sending implemented yet. I'm trying to include it myself, but me and the developer can't seem to figure it out. Here's an example of the code
class OutgoingChatImage(XMPPElement):
"""
Represents an outgoing image chat message to another kik entity (member or group)
"""
def __init__(self, peer_jid, file_url, is_group=False):
super().__init__()
self.peer_jid = peer_jid
self.file_url = file_url
self.allow_forward = True
self.is_group = is_group
def serialize(self):
timestamp = str(int(round(time.time() * 1000)))
message_type = "direct" if not self.is_group else "public"
iconUrl=self.file_url
images= ('<preview>{}</preview>'
'<icon>{}</icon>'
'<name>"Gallery"</name>'
).format(self.file_url, iconUrl)
strings=('<app-name>Gallery</app-name>'
'<allow-forward>{}</allow-forward>'
'<file-name>"image.jpg"</file-name>'
'<file-url>{}</file-url>'
).format(self.allow_forward, self.file_url)
data = ('<message type="{}" to="{}" id="{}" cts="{}">'
'<kik push="true" qos="true" timestamp="{}" />'
'<request xmlns="kik:message:receipt" r="true" d="true" />'
'<content app-id="com.kik.ext.gallery" id="{}" v="2">'
'<strings>{}</strings>'
'<images>{}</images>'
'<uris/>'
'</content>'
'</message>'
).format(message_type, self.peer_jid, self.message_id, timestamp,
timestamp, self.message_id, strings, images)
return data.encode()
This is what i have so far. Currently, Kik's servers will reply to the image being sent with "You gotta wait 24 hours before you can send an image", but even when i send it to a chat it's been in for 24 hours, it doesn't actually send it. Or, it does send it, but it doesn't preview it. I'm not sure. If you guys have any suggestions that'll be great! I would love to hear back from you guys. If you need any other pieces of data, let me know.