Skip to content

Commit

Permalink
refactor(webhook): use createTextMessage to replace pure text
Browse files Browse the repository at this point in the history
- preventing user from forwarding these text
  • Loading branch information
MrOrz committed Jan 9, 2024
1 parent 08e799a commit 6f98e4f
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,42 @@ Object {
},
"replies": Array [
Object {
"text": "🔍 There are some messages that looks similar to the one you have sent to me.",
"type": "text",
"altText": "🔍 There are some messages that looks similar to the one you have sent to me.",
"contents": Object {
"body": Object {
"contents": Array [
Object {
"text": "🔍 There are some messages that looks similar to the one you have sent to me.",
"type": "text",
"wrap": true,
},
],
"layout": "vertical",
"type": "box",
},
"type": "bubble",
},
"type": "flex",
},
Object {
"text": "Internet rumors are often mutated and shared.
"altText": "Internet rumors are often mutated and shared.
Please choose the version that looks the most similar👇",
"type": "text",
"contents": Object {
"body": Object {
"contents": Array [
Object {
"text": "Internet rumors are often mutated and shared.
Please choose the version that looks the most similar👇",
"type": "text",
"wrap": true,
},
],
"layout": "vertical",
"type": "box",
},
"type": "bubble",
},
"type": "flex",
},
Object {
"altText": "Please choose the most similar message from the list.",
Expand Down Expand Up @@ -336,13 +365,42 @@ Object {
},
"replies": Array [
Object {
"text": "🔍 There are some messages that looks similar to the one you have sent to me.",
"type": "text",
"altText": "🔍 There are some messages that looks similar to the one you have sent to me.",
"contents": Object {
"body": Object {
"contents": Array [
Object {
"text": "🔍 There are some messages that looks similar to the one you have sent to me.",
"type": "text",
"wrap": true,
},
],
"layout": "vertical",
"type": "box",
},
"type": "bubble",
},
"type": "flex",
},
Object {
"text": "Internet rumors are often mutated and shared.
"altText": "Internet rumors are often mutated and shared.
Please choose the version that looks the most similar👇",
"type": "text",
"contents": Object {
"body": Object {
"contents": Array [
Object {
"text": "Internet rumors are often mutated and shared.
Please choose the version that looks the most similar👇",
"type": "text",
"wrap": true,
},
],
"layout": "vertical",
"type": "box",
},
"type": "bubble",
},
"type": "flex",
},
Object {
"altText": "Please choose the most similar message from the list.",
Expand Down
16 changes: 5 additions & 11 deletions src/webhook/handlers/processMedia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,23 +141,17 @@ export default async function (message: CooccurredMessage, userId: string) {
},
};

const prefixTextArticleFound: Message[] = [
{
type: 'text',
replies = [
createTextMessage({
text: `🔍 ${t`There are some messages that looks similar to the one you have sent to me.`}`,
},
];
const textArticleFound: Message[] = [
{
type: 'text',
}),
createTextMessage({
text:
t`Internet rumors are often mutated and shared.
Please choose the version that looks the most similar` + '👇',
},
}),
templateMessage,
];

replies = prefixTextArticleFound.concat(textArticleFound);
} else {
visitor.event({
ec: 'UserInput',
Expand Down

0 comments on commit 6f98e4f

Please sign in to comment.