Skip to content

Commit

Permalink
feat(index.js): add ai loading for line
Browse files Browse the repository at this point in the history
  • Loading branch information
supersonictw committed Jun 11, 2024
1 parent 91170be commit 28c595f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/triggers/line/message/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ module.exports = async (event) => {
text: messageText,
} = message;

const sourceId = whereSentMessageEvent(event);

let requestContent = messageText;
if (sourceType !== "user" && !requestContent.startsWith(prefix)) {
return;
Expand All @@ -35,6 +33,11 @@ module.exports = async (event) => {
requestContent = requestContent.slice(prefix.length).trim();
}

const sourceId = whereSentMessageEvent(event);
if (sourceType === "user") {
await client.showLoadingAnimation({chatId: sourceId});
}

if (!requestContent) {
await client.replyMessage({
replyToken,
Expand Down

0 comments on commit 28c595f

Please sign in to comment.