Closed OpenSaned closed 3 years ago
You can use ChatMessageSegment.from_str
to get a list of segments from a string, including newline segments.
Do I have to Serialize the segments individually or is there a better way to do it?
You'll have to serialize them individually.
So does this solution have problems?
segments = []
for i in hangups.ChatMessageSegment.from_str(message):
segments.append(i.serialize())
That should work.
Ok. Thanks a lot!
I have tried
\n
But it only works on mobile not on the web version, is there a way fix it without adding lots of code. This is my request Forclient.send_chat_message()
:request = #hangups.hangouts_pb2.SendChatMessageRequest( request_header=client.get_request_header(), event_request_header=hangups.hangouts_pb2.EventRequestHeader( conversation_id=hangups.hangouts_pb2.ConversationId( id=id ), client_generated_id=client.get_client_generated_id(), ), message_content=hangups.hangouts_pb2.MessageContent( segment=[ hangups.ChatMessageSegment(message).serialize() ], ), )