Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bottender-compose

Package Overview
Dependencies
Maintainers
3
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bottender-compose - npm Package Versions

134

0.12.2

Diff

Changelog

Source

0.12.2 / 2018-09-05

  • [new] add param support for template string:

use param to access object values that provided as sencond argument when calling action:

B.sendText('User: {{param.name}}')(context, { name: 'Super User' });
chentsulin
published 0.12.1 •

Changelog

Source

0.12.1 / 2018-09-05

  • [fix] add missing export for attachOptions.
chentsulin
published 0.12.0 •

Changelog

Source

0.12.0 / 2018-09-05

  • [new] add attachOptions:

attachOptions

Attaches additional options to the action.

const { attachOptions, sendText } = require('bottender-compose');

bot.onEvent(
  attachOptions({ tag: 'ISSUE_RESOLUTION' }, sendText('Issue Resolved'))
);

// curry function
const attachIssueResolutionTag = attachOptions({ tag: 'ISSUE_RESOLUTION' });

bot.onEvent(attachIssueResolutionTag(sendText('Issue Resolved')));
chentsulin
published 0.11.0 •

Changelog

Source

0.11.0 / 2018-08-27

  • [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
chentsulin
published 0.10.3 •

Changelog

Source

0.10.3 / 2018-08-08

  • [fix] fallback to empty string when template getting falsy value
chentsulin
published 0.10.2 •

Changelog

Source

0.10.2 / 2018-07-25

  • [new] Support user accessor: {{user.xxx}} in template.
chentsulin
published 0.10.1 •

Changelog

Source

0.10.1 / 2018-05-16

  • [fix] run babel compilation before publish.
chentsulin
published 0.10.0 •

Changelog

Source

0.10.0 / 2018-05-16

  • [new] build source with babel to have real support for node >= 7.6
chentsulin
published 0.9.1 •

Changelog

Source

0.9.1 / 2018-05-07

  • Add new logger methods:
B.series([
  B.log('sending hello'),
  B.info('sending hello'),
  B.warn('sending hello'),
  B.error('sending hello'),

  B.sendText('hello'),
]);

It supports template too.

B.series([
  B.log('user: {{ session.user.id }} x: {{ state.x }}'),
  B.sendText('hello'),
]);

You can use your owner adapter for the logger:

const { log, info, warn, error } = B.createLogger({
  log: debug('log'),
  info: debug('info'),
  warn: debug('warn'),
  error: debug('error'),
});

B.series([log('sending hello'), B.sendText('hello')]);
chentsulin
published 0.9.0 •

Changelog

Source

0.9.0 / 2018-05-06

  • [new] effect:
const { effect } = require('bottender-compose');

bot.onEvent(
  effect(
    // function has side effects
    async context => {
      await doSomeSideEffects();
      return {
        derivedState: {
          x: 1,
        },
        derivedParam: {
          y: 2,
        },
      };
    },

    // action
    async (context, param) => {
      console.log(context.state.x); // 1
      console.log(param.y); // 2
    }
  )
);
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc