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

bottender

Package Overview
Dependencies
Maintainers
4
Versions
215
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bottender - npm Package Compare versions

Comparing version 0.14.14 to 0.14.15

16

CHANGELOG.md

@@ -0,1 +1,17 @@

# 0.14.15 / 2018-01-12
### slack
* [new] Add `context.postEphemeral`:
```js
context.postEphemeral({ text: 'hello' });
```
* [fix] Reply to thread instead of channel when receiving events in thread [#145](https://github.com/Yoctol/bottender/pull/145)
### telegram
* [fix] Use `message.chat.id` to reply [#148](https://github.com/Yoctol/bottender/pull/148)
# 0.14.14 / 2018-01-08

@@ -2,0 +18,0 @@

33

lib/context/SlackContext.js

@@ -53,3 +53,8 @@ 'use strict';

postMessage(text, options) {
/**
* Sends a message to the channel of the session.
*
* https://api.slack.com/methods/chat.postMessage
*/
postMessage(message, options) {
const channelId = this._getChannelIdFromSession();

@@ -64,9 +69,31 @@

return this._client.postMessage(channelId, text, _extends({}, options));
return this._client.postMessage(channelId, message, _extends({
thread_ts: this._event.rawEvent.thread_ts
}, options));
}
/**
* Send text to the owner of then session.
* Sends an ephemeral message to the session owner.
*
* https://api.slack.com/methods/chat.postMessage
*/
postEphemeral(message, options = {}) {
const channelId = this._getChannelIdFromSession();
if (!channelId) {
(0, _warning2.default)(false, 'postMessage: should not be called in context without session');
return Promise.resolve();
}
this._isHandled = true;
return this._client.postEphemeral(channelId,
// $FlowFixMe
this._session.user.id, message, options);
}
/**
* Send text to the owner of the session.
*
*/
sendText(text, options) {

@@ -73,0 +100,0 @@ return this.postMessage(text, options);

@@ -55,3 +55,3 @@ 'use strict';

*/
async sendText(text) {
async sendText(text, options) {
if (!this._session) {

@@ -64,4 +64,19 @@ (0, _warning2.default)(false, 'sendText: should not be called in context without session');

return this._client.sendMessage(this._session.user.id, text);
const chatId = this._getChatId();
return this._client.sendMessage(chatId, text, options);
}
_getChatId() {
if (this._event.isMessage) {
return this._event.message.chat.id;
}
if (this._event.isCallbackQuery && this._event.callbackQuery.message) {
return this._event.callbackQuery.message.chat.id;
}
if (this._session) {
return this._session.user.id;
}
return null;
}
}

@@ -92,3 +107,5 @@

return this._client[method](this._session.user.id, ...args);
const chatId = this._getChatId();
return this._client[method](chatId, ...args);
}

@@ -95,0 +112,0 @@ });

6

package.json

@@ -10,3 +10,3 @@ {

},
"version": "0.14.14",
"version": "0.14.15",
"main": "lib/index.js",

@@ -73,4 +73,4 @@ "bin": {

"messaging-api-line": "^0.6.7",
"messaging-api-messenger": "^0.6.6",
"messaging-api-slack": "^0.6.0",
"messaging-api-messenger": "^0.6.9",
"messaging-api-slack": "^0.6.10",
"messaging-api-telegram": "^0.6.8",

@@ -77,0 +77,0 @@ "messaging-api-viber": "^0.6.0",

@@ -107,2 +107,3 @@ # Bottender

* Keyboard
* Group Chat
* Message Live Location

@@ -109,0 +110,0 @@ * Payment

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