💡 Tip
Remember last week's post about Has Checks?
If you always want to check context objects for the same thing, you can create a predicate function once, and then apply it to many context objects. This is slightly more efficient. It can be done using Context.has—a static namespace for utility functions that create such filters.
const hasText = Context.has.filterQuery("message:text")
// later:
if (hasText(ctx)) {
const text = ctx.msg.text
}
Nifty!
Remember last week's post about Has Checks?
If you always want to check context objects for the same thing, you can create a predicate function once, and then apply it to many context objects. This is slightly more efficient. It can be done using Context.has—a static namespace for utility functions that create such filters.
const hasText = Context.has.filterQuery("message:text")
// later:
if (hasText(ctx)) {
const text = ctx.msg.text
}
Nifty!