tomer8007 / kik-bot-api-unofficial

Python API for writing unoffical Kik bots that act like humans
MIT License
126 stars 76 forks source link

Recived group message ternication in interactive client #176

Closed aspwil closed 3 years ago

aspwil commented 3 years ago

whenever a message from a group is received it is displayed with the last 4 characters missing.

an example is if someone sends the message "Hello World" the terminal prints out something like this Math helpers - t373(long string): Hello W the last 4 chars are lost

this does not affect the messages received via dm though, only in group messages. leading me to believe it might be caused by jid_to_username(chat_message.body) under def on_group_message_received and its malforming the string somehow.

I have tried to fix this myself but I have just started python today so I'm not sure exactly how to fix it.

aspwil commented 3 years ago

I figured out the problem, instead of running jid_to_username(chat_message.body) which calls this

def jid_to_username(jid):
    return jid.split('@')[0][0:-4]

I added a

def jid_to_message(jid):
    return jid.split('@')[0]

and called that when fetching the message

aspwil commented 3 years ago

looking back on this jid_to_message is redundant, what actually need to be done is the changing of jid_to_username(chat_message.body) under def on_group_message_received to just chat_message.body

tomer8007 commented 3 years ago

Yep, nice catch. I fixed this in d64551195c5afb5b03c854a5e7f84a77c98fe06c.