Skip to content

Commit 9d1b047

Browse files
committed
New type: Message4Others
1 parent ccf94d0 commit 9d1b047

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { extendApp } from 'ringcentral-chatbot-core'
99
import express from 'express'
1010

1111
function eventHandler ({
12-
type, // could be 'BotRemoved', 'Message4Bot', 'BotGroupLeft', 'BotJoinGroup', 'Maintain', 'SetupDatabase'
12+
type, // could be 'BotRemoved', 'Message4Bot', 'Message4Others', 'BotGroupLeft', 'BotJoinGroup', 'Maintain', 'SetupDatabase'
1313
bot, // the bot instance, check src/models/Bot.ts for instance methods
1414
text, // the text message user posted in chatgroup
1515
group, // the group object, can get chat group id from group.id

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ringcentral-chatbot-core",
3-
"version": "1.3.4",
3+
"version": "1.4.0",
44
"license": "MIT",
55
"scripts": {
66
"test": "RINGCENTRAL_CHATBOT_DATABASE_CONNECTION_URI=sqlite:// jest -c test/jest.config.ts",

src/handlers/postAdded.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@ export const postAdded = async (Bot: any, message: Message) => {
2424
(message.body.mentions === null ||
2525
!message.body.mentions.some(m => m.type === 'Person' && m.id === botId))
2626
) {
27-
return;
27+
return {
28+
text,
29+
group,
30+
bot,
31+
userId,
32+
isPrivateChat,
33+
message: message.body,
34+
type: 'Message4Others'
35+
};
2836
}
2937
const regex = new RegExp(`!\\[:Person\\]\\(${bot.id}\\)`);
3038
text = text.replace(regex, ' ').trim();

0 commit comments

Comments
 (0)