Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement sendChatChecked (mark as read) #43

Open
ssut opened this issue Jul 2, 2015 · 6 comments
Open

Implement sendChatChecked (mark as read) #43

ssut opened this issue Jul 2, 2015 · 6 comments

Comments

@ssut
Copy link

ssut commented Jul 2, 2015

I found a way to implement sendChatChecked method with LINE thrift while making a bot. (It's not python, https://github.com/ssut/llama)
Since you may know, there is a method which marks a message as read.

Here are the details as follows:

In thrift file:
(I think you've removed this shortcode from the origin or not. for what it's worth, you have to update the curve package for implementing.)

...
    void sendChatChecked(
        1: i32 seq,
        2: string consumer,
        3: string lastMessageId) throws(1: TalkException e);
...

In a python code:

def _sendChatChecked(self, target, msgid, seq=0):
    return self._client.sendChatChecked(seq, target, msgid)

Just as the above code shown, it requires 2 parameters:

  • The target to send it's read confirmation.
  • The msgid as we can suggest by its name, message.id.

The target becomes a reference to the interlocutor, which can be a "room", a "group" or a "user", for instance, If the chat room's ToType is a GROUP or a ROOM then it becomes a message.to.

Good luck to implement that support for developers who use this library! 👍
BTW, can I write any issues in Korean next time? :p (just, All issues written in English.)

@carpedm20
Copy link
Owner

Thanks for sharing a useful information. I'll update the curve and the library soon.
In my view point, most of the users of this library is Japanese, Taiwanese or Chinese not Korean. So I think you might be better to post any issues in english to communicate with not only with me but also with others.

@shinznatkid
Copy link
Contributor

I confirmed this sendChatChecked are useable.
But unfortunately, my project cannot merge to your repository cuz private project and code are more complicated.

@neosign
Copy link

neosign commented Mar 20, 2016

It's really necessary to have this method otherwise It can't immediately send messages back to client even the bot is online.

@ii64
Copy link

ii64 commented Apr 14, 2017

I need help about this .-.

@R-N
Copy link

R-N commented Jun 1, 2017

The curve client has no "sendChatChecked" method

So I tried making one, based on "acceptGroupInvitation" method and classes. At first it gave me TalkException : 'invalid mid', but that was just because I forgot to change the field id for lastMessageId (it overwrote consumer, the mid). Now I'm getting no error but my chats are still not being read.

The fields are just like in the OP :

    1: i32 seq,
    2: string consumer,
    3: string lastMessageId

The args class writes fields according to it, and the result class also reads fields according to it.

And I passed :
seq = 0, just like the other methods
consumer = room/group mid for room/group, sender mid for private chats
lastMessageId = operation.message.id

I'm calling the method from my main client (not the group/room object nor the sender object). Passing their mids as consumer. I didn't create the methods that starts with 'process', also didnt add it to the dictionary thing. Do I need to do so?

Btw I don't see any thrift file or curve package in this repo. What were you refering to?
Did you mean this thrift file? http://altrepo.eu/sleepingpig/line-protocol/blob/561fea469014cd8c02cc506cf9cb094a0af16b60/line.thrift
This repo doesnt have it (but it works. because of curve, I guess)

Thanks

@R-N
Copy link

R-N commented Jun 1, 2017

Nvm. Turns out it read but it was still not immediate (had to send another message to refresh).

You can use the _client_out to make it immediate. In fact, the _client_out only works for this in my case. Sending messages using _client_out doesn't work. So I send message normally and THEN sendChatChecked using _client_out. The message will be sent/received after the last chat is read.

You can find about _client_out somewhere here in other issue. Forgot which.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants