Skip to content

0.11.0 / 2018-08-27

Choose a tag to compare

@chentsulin chentsulin released this 27 Aug 09:38
· 64 commits to master since this release
  • [new] add predicates:

isTextMatch

Creates a predicate function to return true when text matches.

const { isTextMatch } = require('bottender-compose');

isTextMatch('abc')(context); // boolean
isTextMatch(/abc/)(context); // boolean

isPayloadMatch

Creates a predicate function to return true when payload matches.

const { isPayloadMatch } = require('bottender-compose');

isPayloadMatch('abc')(context); // boolean
isPayloadMatch(/abc/)(context); // boolean

hasStateEqual

Creates a predicate function to return true when state matches.

const { hasStateEqual } = require('bottender-compose');

hasStateEqual('x', 1)(context); // boolean
hasStateEqual('x.y.z', 1)(context); // boolean
hasStateEqual('x', { y: { z: 1 } })(context); // boolean

not

Creates a predicate function with not condition.

const { not, hasStateEqual } = require('bottender-compose');

const predicate = not(hasStateEqual('x', 1));

predicate(context); // boolean

and

Creates a predicate function with and condition.

const { and, hasStateEqual } = require('bottender-compose');

const predicate = and([
  isTextMatch('abc'),
  hasStateEqual('x', 1))
]);

predicate(context) // boolean

or

Creates a predicate function with or condition.

const { or, hasStateEqual } = require('bottender-compose');

const predicate = or([
  isTextMatch('abc'),
  hasStateEqual('x', 1))
]);

predicate(context) // boolean

alwaysTrue

Creates a predicate function that always return true.

const { alwaysTrue } = require('bottender-compose');

const predicate = alwaysTrue();

predicate(context); // true

alwaysFalse

Creates a predicate function that always return false.

const { alwaysFalse } = require('bottender-compose');

const predicate = alwaysFalse();

predicate(context); // false

Messenger

  • isMessage
  • isText
  • hasAttachment
  • isImage
  • isAudio
  • isVideo
  • isLocation
  • isFile
  • isFallback
  • isSticker
  • isLikeSticker
  • isQuickReply
  • isEcho
  • isPostback
  • isGamePlay
  • isOptin
  • isPayment
  • isCheckoutUpdate
  • isPreCheckout
  • isRead
  • isDelivery
  • isPayload
  • isPolicyEnforcement
  • isAppRoles
  • isStandby
  • isPassThreadControl
  • isTakeThreadControl
  • isRequestThreadControl
  • isRequestThreadControlFromPageInbox
  • isFromCustomerChatPlugin
  • isReferral
  • isBrandedCamera

LINE

  • isMessage
  • isText
  • isImage
  • isVideo
  • isAudio
  • isLocation
  • isSticker
  • isFollow
  • isUnfollow
  • isJoin
  • isLeave
  • isPostback
  • isPayload
  • isBeacon
  • isAccountLink

Slack

  • isMessage
  • isChannelsMessage
  • isGroupsMessage
  • isImMessage
  • isMpimMessage
  • isText
  • isInteractiveMessage
  • isAppUninstalled
  • isChannelArchive
  • isChannelCreated
  • isChannelDeleted
  • isChannelHistoryChanged
  • isChannelRename
  • isChannelUnarchive
  • isDndUpdated
  • isDndUpdated_user
  • isEmailDomainChanged
  • isEmojiChanged
  • isFileChange
  • isFileCommentAdded
  • isFileCommentDeleted
  • isFileCommentEdited
  • isFileCreated
  • isFileDeleted
  • isFilePublic
  • isFileShared
  • isFileUnshared
  • isGridMigrationFinished
  • isGridMigrationStarted
  • isGroupArchive
  • isGroupClose
  • isGroupHistoryChanged
  • isGroupOpen
  • isGroupRename
  • isGroupUnarchive
  • isImClose
  • isImCreated
  • isImHistoryChanged
  • isImOpen
  • isLinkShared
  • isMemberJoinedChannel
  • isMemberLeftChannel
  • isPinAdded
  • isPinRemoved
  • isReactionAdded
  • isReactionRemoved
  • isStarAdded
  • isStarRemoved
  • isSubteamCreated
  • isSubteamMembersChanged
  • isSubteamSelfAdded
  • isSubteamSelfRemoved
  • isSubteamUpdated
  • isTeamDomainChange
  • isTeamJoin
  • isTeamRename
  • isTokensRevoked
  • isUrlVerification
  • isUserChange

Telegram

  • isMessage
  • isText
  • isAudio
  • isDocument
  • isGame
  • isPhoto
  • isSticker
  • isVideo
  • isVoice
  • isVideoNote
  • isContact
  • isLocation
  • isVenue
  • isEditedMessage
  • isChannelPost
  • isEditedChannelPost
  • isInlineQuery
  • isChosenInlineResult
  • isCallbackQuery
  • isPayload
  • isShippingQuery
  • isPreCheckoutQuery

Viber

  • isMessage
  • isText
  • isPicture
  • isVideo
  • isFile
  • isSticker
  • isContact
  • isURL
  • isLocation
  • isSubscribed
  • isUnsubscribed
  • isConversationStarted
  • isDelivered
  • isSeen
  • isFailed

Facebook

  • isFeed
  • isStatus
  • isStatusAdd
  • isStatusEdited
  • isPost
  • isPostRemove
  • isComment
  • isCommentAdd
  • isCommentEdited
  • isCommentRemove
  • isLike
  • isLikeAdd
  • isLikeRemove
  • isReaction
  • isReactionAdd
  • isReactionEdit
  • isReactionRemove