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

124

0.8.4

Diff

Changelog

Source

0.8.4 / 2018-04-26

  • [new] also overwrite name in setDisplayName
chentsulin
published 0.8.3 •

Changelog

Source

0.8.3 / 2018-04-12

  • [fix] pass extra args to match value function (#58)
  • [fix] pass extra args to all of context fns (#59)
chentsulin
published 0.8.2 •

Changelog

Source

0.8.2 / 2018-04-09

  • [new] Add setDisplayName:

Assigns to the displayName property on the action.

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

setDisplayName('sayHello', sendText('hello'));

// curry function
setDisplayName('sayHello')(sendText('hello'));
kpman
published 0.8.1 •

Changelog

Source

0.8.1 / 2018-04-02

  • [fix] warning condition on compileTemplate method.
chentsulin
published 0.8.0 •

Changelog

Source

0.8.0 / 2018-04-02

  • [new] Use Template in String:

You can use context, session, event, state to access values in your template string:

B.sendText('Hi, {{session.user.first_name}} {{session.user.last_name}}');
B.sendText('Received: {{event.text}}');
B.sendText('State: {{state.xxx}}');
  • [new] Support match:

Create a function that encapsulates value matching logic.

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

bot.onEvent(
  match('a', [
    ['a', sendText('You got a A')],
    ['b', sendText('You got a B')],
    ['c', sendText('You got a C')],
  ])
);

It accepts function with context argument:

bot.onEvent(
  match(context => context.state.answer, [
    ['a', sendText('You got a A')],
    ['b', sendText('You got a B')],
    ['c', sendText('You got a C')],
  ])
);

// curry function
const matchAnswer = match(context => context.state.answer);

bot.onEvent(
  matchAnswer([
    ['a', sendText('You got a A')],
    ['b', sendText('You got a B')],
    ['c', sendText('You got a C')],
  ])
);

To assign default action, use _ as pattern:

const { _, match, sendText } = require('bottender-compose');
bot.onEvent(
  match('a', [
    ['a', sendText('You got a A')],
    ['b', sendText('You got a B')],
    ['c', sendText('You got a C')],
    [_, sendText('You got something')],
  ])
);
chentsulin
published 0.7.0 •

Changelog

Source

0.7.0 / 2018-03-31

  • [new] Curry branch, repeat and tryCatch:
// curry branch
const trueConditionBranch = branch(context => true);

bot.onEvent(
  trueConditionBranch(sendText('You are the lucky one.'), sendText('Too bad.'))
);

// curry repeat
const repeatFiveTimes = repeat(5);

bot.onEvent(repeatFiveTimes(sendText('This will be sent 5 times.')));

// curry tryCatch
const mayFailTryCatch = tryCatch(doSomethingMayFail());

bot.onEvent(mayFailTryCatch(sendText('Error Happened~~~~~~~~~~~!')));
  • [new] support otherArgs:
const action = (context, ...otherArgs) => {};
chentsulin
published 0.6.2 •

Changelog

Source

0.6.2 / 2018-03-22

  • [new] Support new methods:

telegram:

  • editMessageText

  • editMessageCaption

  • editMessageReplyMarkup

  • deleteMessage

  • editMessageLiveLocation

  • stopMessageLiveLocation

  • forwardMessageFrom

  • forwardMessageTo

  • [removed] remove useless

messenger:

  • getAssociatedLabels

line:

  • getLinkedRichMenu
chentsulin
published 0.6.1 •

Changelog

Source

0.6.1 / 2018-03-21

  • [new] Support new methods:

messenger:

  • requestThreadControl

slack:

  • postEphemeral

telegram:

  • kickChatMember
  • unbanChatMember
  • restrictChatMember
  • promoteChatMember
  • exportChatInviteLink
  • setChatPhoto
  • deleteChatPhoto
  • setChatTitle
  • setChatDescription
  • setChatStickerSet
  • deleteChatStickerSet
  • pinChatMessage
  • unpinChatMessage
  • leaveChat
  • answerShippingQuery
  • answerPreCheckoutQuery
  • answerInlineQuery
chentsulin
published 0.6.0 •

Changelog

Source

0.6.0 / 2018-03-21

  • [new] Support passing function as argument to context methods:

You can pass function as argument to handle time-specified or context-specified case, for example:

// Lazy execution
B.sendText(() => `Now: ${new Date()}`);

// Use user information on context
B.sendText(
  context =>
    `${context.session.user.first_name} ${context.session.user.last_name}, You are the lucky one.`
);

// Use event information
B.sendText(context => `Received: ${context.event.text}`);
chentsulin
published 0.5.1 •

Changelog

Source

0.5.1 / 2017-12-20

  • [new] Support methods:
    • passThreadControl
    • passThreadControlToPageInbox
    • takeThreadControl
    • sendMediaGroup
    • sendInvoice
    • sendGame
    • setGameScore
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