Open rayz1065 opened 3 months ago
Note to self: most likely related to distributed union types
This also seems to happen with filter queries:
const media = await conversation.waitFor(":media"); // photo or video
if (media.has(":photo")) {
const resolutions = media.msg.photo.length;
} else {
const { width, height } = media.msg.video; // error!
}
Suppose we have a set of chat types we want to listen for within a middleware, and a handler we need to call on match:
I expect both of the following pieces of code to work properly, but while the first one works fine, the second one shows an error:
As mentioned, the error only occurs when more than one chat is used for filtering.
It could be useful to investigate why the two pieces of code are behaving in a different way, as the second version has some use-cases not entirely covered by the first one.