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

README example code is outdated #41

Closed
hfoxy opened this issue Dec 29, 2015 · 9 comments
Closed

README example code is outdated #41

hfoxy opened this issue Dec 29, 2015 · 9 comments
Assignees

Comments

@hfoxy
Copy link
Contributor

hfoxy commented Dec 29, 2015

Title speaks all, really. Regarding the updating and deletion of the message sent, I had to rummage around the source to find a solution, which was actually casting the getReply() from the event to the correct class. Seems a little sketchy if you ask me, but oh well.

@bcorne bcorne self-assigned this Dec 29, 2015
@bcorne
Copy link
Contributor

bcorne commented Dec 29, 2015

ok I take it :)

@NomNuggetNom
Copy link

What did you cast it to? Updating is not working for me.

@nishtahir
Copy link
Contributor

I can confirm this. After investigating a little bit it seems that after sending a message, resulting object does not have a reply_to property causing the SlackJSONReplyParser to return a GenericSlackReplyImpl instead of a SlackMessageReplyImpl. This causes a masked class cast exception which is not visible in the log output.

The only work around I could come up with is to cast the getReply from handle and manually parse the JSON

((GenericSlackReply) handle.getReply()).getPlainAnswer()

I'd attempt to fix it, but i'm still trying to figure out whether or not slack message replies always include a reply_to property or not.

@hfoxy
Copy link
Contributor Author

hfoxy commented Feb 24, 2016

I fixed one error regarding this a while ago, however there are many occurrences of this and it can become somewhat confusing to fix them all. It feels like the visible API methods were changed after the backend was written. It would take a lot of work to convert it all

@nishtahir
Copy link
Contributor

Well we need to start somewhere...

On the other hand I guess a simple way of solving the sample code problem would be to add the sample code in a sample subproject. That way the build would fail if the sample code isn't up to date.

@bcorne
Copy link
Contributor

bcorne commented Mar 1, 2016

I just started the samples :) some more will come soon

@bcorne
Copy link
Contributor

bcorne commented Mar 4, 2016

Just to add some details on this issue, reply_to in only used for message sent using the RTM API ( so using sendMessageOverWebSocket method).

@bcorne
Copy link
Contributor

bcorne commented Mar 4, 2016

I've investigated further, so indeed the reply_to check was the culprit, I've replaced it by a ts presence check in the JSON reply

bcorne added a commit that referenced this issue Mar 4, 2016
This change purpose is to provide SlackMessageReply instances as
inteded when sending message, updating message and deleting messages
instead of GenericSlackReply (raised with issue #41)
@bcorne
Copy link
Contributor

bcorne commented Mar 7, 2016

fixed with d8d6a1f commit

@bcorne bcorne closed this as completed Mar 7, 2016
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

4 participants