soxtoby / SlackNet

A comprehensive Slack API client for .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SubType = null on MessageEvent ?

Dionisos94 opened this issue · comments

Hello,

I try to add a new feature to my slackbot to be able to interact with the previous message a user posted.

i.e a user post "Can you check this object is in database ?",
On the same thread, I then write a message ".check" and the bot should be able to retrieve the previous message to act on it (i.e retrieve the object id and do a sql query)

I was hoping to use my MessageEvent handler and just look at the subType property to check if it is a MessageReplied type to then cast it and be able to access the previous message.

However, when I try it, my reply SubType is null
Is that an expected behavior ?

image

image

SlackNet version: 0.10.24

Thank you !

Turns out this is a known issue on Slack's end. Per the message_replied event documentation:

Bug alert! This event is missing the subtype field when dispatched over the Events API. Until it is fixed, examine message events' thread_ts value. When present, it's a reply. To be doubly sure, compare a thread_ts to the top-level ts value, when they differ the latter is a reply to the former.

Other message subtypes should still work as expected - looks like it's just message_replied that has different behaviour.

Hope this helps.

Thanks mate !
A shame it is not yet fixed on their end :(