-
Notifications
You must be signed in to change notification settings - Fork 7
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
The anyMessage() function is misleading #8
Comments
Hi @zhawtof, thanks for sharing this. The For your use case, you can use app.event("message", async({ payload }) => { // the payload here is union type
if (payload.subtype === "message_changed") {
// inside this if statement, the type of payload is MessageChangedEvent
}
}); The I hope you could understand this. |
Thanks for the quick response! It makes a lot of sense, and yes we did end up going with the Last QuestionMy final question is tied to the Based on what you said above, should this type consist of The Anyway, I have found my path forward, but I'm sure others might run into this in the future when they migrate from Bolt so wanted to call it out. |
AnyXXX is a naming convention that I've been using for this project and its underlying slack-web-api-client. Indeed, the overlap of the names If someone needs a new type representing the union type of the Thank you so much again for sharing valuable feedback here! Since I don't have anything else to share/discuss here, let me close this issue now. That said, please feel free to write in whenever you have more to ask on this topic. |
Context
According to the following code, AnyMessageEvent can be any of the following message events.
slack-edge/src/request/payload/event.ts
Lines 1174 to 1191 in 05eecb8
As part of
isPostedMessageEvent
, the only messages that are allowed are the 4 types:GenericMessageEvent
BotMessageEvent
FileShareMessageEvent
ThreadBroadcastMessageEvent
slack-edge/src/utility/message-events.ts
Lines 8 to 22 in 05eecb8
The Problem
The issue is that
isPostedMessageEvent
is part of the critical path of.anyMessage()
which now only executes the function for those 4 subtypes of messages.slack-edge/src/app.ts
Lines 271 to 286 in 05eecb8
This is misleading as one would assume the
AnyMessageEvent
andanyMessage()
functions would support the same message types.Recommendations
message()
logic. Unless I'm missing something, this seems like the obvious move to conform with the current Slack Web APIapp.message()
andapp.anyMessage()
toapp.postedMessage()
andapp.anyPostedMessage()
respectivelymessage_changed
,channel_topic
) should use anEventLazyHandler<'message'>
for handling.Thanks
Huge fan of the framework Kaz. We've done a lot of work migrating over to Cloudflare, but this one caught us up during the transition.
The text was updated successfully, but these errors were encountered: