Skip to content

Commit f546f88

Browse files
committed
Fixes yGuy#50 with bot replying in unrelated threads
1 parent bb9c82d commit f546f88

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "chatgpt-mattermost-bot",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"private": true,
55
"scripts": {
66
"start": "ts-node ./src/botservice.ts",

src/botservice.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function isMessageIgnored(msgData: MessageData, meId: string, previousPosts: Pos
123123
return true
124124
}
125125

126-
for (let i = previousPosts.length - 1; i > 0; i--) {
126+
for (let i = previousPosts.length - 1; i >= 0; i--) {
127127
// we were asked to stop participating in the conversation
128128
if (previousPosts[i].props.bot_status === 'stopped') {
129129
return true
@@ -135,8 +135,8 @@ function isMessageIgnored(msgData: MessageData, meId: string, previousPosts: Pos
135135
}
136136
}
137137

138-
// we are in a thread but were never mentioned
139-
return false
138+
// we are in a thread but did not participate or got mentioned - we should ignore this message
139+
return true
140140
}
141141

142142
/**

0 commit comments

Comments
 (0)