Skip to content

Commit 240b9a4

Browse files
committed
fix: bug with duplicating msgs
1 parent 73a1482 commit 240b9a4

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

app/forumer/run.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,16 @@ func (v *Forumer) update() {
134134
content := msg.Content
135135
for _, embed := range msg.Embeds {
136136
content += embed.Description
137+
content += embed.Title
138+
content += embed.URL
137139
}
138140

139-
if strings.Contains(content, string(new_post.PostID)) &&
140-
strings.Contains(content, string(new_post.ThreadID)) {
141+
if strings.Contains(content, string(new_post.PostPermamentLink)) {
142+
logus.Debug("Post already exists!", logus.Post(new_post))
141143
return true
142144
}
143145
}
146+
logus.Debug("Post does not exist like that", logus.Post(new_post))
144147
return false
145148
})
146149
v.Discorder.SendDeduplicatedMsg(

app/settings/logus/params.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,12 @@ func DiscordMessage(value string) slogParam {
194194
c.params["discord_message"] = value
195195
}
196196
}
197+
198+
func Post(value *forum_types.Post) slogParam {
199+
return func(c *slogGroup) {
200+
c.params["post_id"] = string(value.PostID)
201+
c.params["post_author_name"] = string(value.PostAuthorName)
202+
c.params["post_thread_id"] = string(value.ThreadID)
203+
c.params["post_thread_full_name"] = string(value.ThreadFullName)
204+
}
205+
}

0 commit comments

Comments
 (0)