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

How can I get the message ID of a message I send? #74

Open
badp opened this issue Aug 14, 2014 · 2 comments
Open

How can I get the message ID of a message I send? #74

badp opened this issue Aug 14, 2014 · 2 comments

Comments

@badp
Copy link
Contributor

badp commented Aug 14, 2014

Say I send a message I would like to modify later. Do I have to look at the events to find that message ID (...or way better: the message object), or is there another way?

(It seems that chat does send you the new message ID in response to the POST to chats/.../messages/new, but I don't know how convoluted the process would be to bubble this response all the way to the Rooms class.)

@Manishearth
Copy link
Owner

Any watchers will get notified of the message (with the ID), of course, and you can just use edit()

I don't see any other way to record it, since sending messages is async I can't just return the ID.

Suggestions welcome.

thomas-daniels added a commit to thomas-daniels/ChatExchange that referenced this issue Jul 24, 2015
@thomas-daniels
Copy link
Collaborator

@badp There is now an alternative way to do this: you can set the on_message_sent method on a Client object, which will get called when a message is sent through ChatExchange. The on_message_sent method needs two parameters, the first for the message ID and the second for the room ID.

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

No branches or pull requests

3 participants