@@ -101,36 +101,57 @@ func (v *Forumer) GetPost(thread *forum_types.LatestThread, new_post_callback fu
101101}
102102
103103func (v * Forumer ) isPostMatchTags (channel types.DiscordChannelID , new_post * forum_types.Post ) (bool , []string ) {
104+ do_we_show_this_post := false
104105 var matched_tags []string
105106
106- watch_tags , err := v .Forum .Watch .TagsList (channel )
107- if logus .CheckDebug (err , "failed to get watch tags" ) {
108- return false , matched_tags
109- }
107+ thread_watch_tags , err := v .Forum .Thread .Watch .TagsList (channel )
108+ logus .CheckDebug (err , "failed to get watch tags" )
110109
111- ignore_tags , err := v .Forum .Ignore .TagsList (channel )
110+ thread_ignore_tags , err := v .Forum . Thread .Ignore .TagsList (channel )
112111 logus .CheckDebug (err , "failed to get ignore tags" )
113112
114- do_we_show_this_post := false
115- for _ , watch_tag := range watch_tags {
113+ subforum_watch_tags , err := v .Forum .Subforum .Watch .TagsList (channel )
114+ logus .CheckDebug (err , "failed to get watch tags" )
115+
116+ subforum_ignore_tags , err := v .Forum .Subforum .Ignore .TagsList (channel )
117+ logus .CheckDebug (err , "failed to get ignore tags" )
118+
119+ for _ , watch_tag := range thread_watch_tags {
116120 if strings .Contains (string (new_post .ThreadFullName ), string (watch_tag )) ||
117121 strings .Contains (strings .ToLower (string (new_post .ThreadFullName )), strings .ToLower (string (watch_tag ))) {
118122 do_we_show_this_post = true
119123 matched_tags = append (matched_tags , string (fmt .Sprintf (`"%s"` , watch_tag )))
120124 }
121125 }
122126
123- for _ , ignore_tag := range ignore_tags {
127+ for _ , watch_tag := range subforum_watch_tags {
128+ for _ , subforum := range new_post .Subforums {
129+ if strings .Contains (string (subforum ), string (watch_tag )) ||
130+ strings .Contains (strings .ToLower (string (new_post .ThreadFullName )), strings .ToLower (string (watch_tag ))) {
131+ do_we_show_this_post = true
132+ matched_tags = append (matched_tags , string (fmt .Sprintf (`"%s"` , watch_tag )))
133+ }
134+ }
135+
136+ }
137+
138+ for _ , ignore_tag := range thread_ignore_tags {
124139 if strings .Contains (string (new_post .ThreadFullName ), string (ignore_tag )) {
125140 do_we_show_this_post = false
126141 break
127142 }
128143 }
129144
130- if ! do_we_show_this_post {
131- return false , matched_tags
145+ for _ , ignore_tag := range subforum_ignore_tags {
146+ for _ , subforum := range new_post .Subforums {
147+ if strings .Contains (string (subforum ), string (ignore_tag )) {
148+ do_we_show_this_post = false
149+ break
150+ }
151+ }
132152 }
133- return true , matched_tags
153+
154+ return do_we_show_this_post , matched_tags
134155}
135156
136157func CreateDeDuplicator (new_post * forum_types.Post , msgs []* discorder.DiscordMessage ) * discorder.Deduplicator {
@@ -183,6 +204,13 @@ func (v *Forumer) TrySendMsg(channel types.DiscordChannelID, new_post *forum_typ
183204 Inline : true ,
184205 })
185206
207+ subforums := utils .CompL (new_post .Subforums , func (x forum_types.Subforum ) string { return string (x ) })
208+ embed .Fields = append (embed .Fields , & discordgo.MessageEmbedField {
209+ Name : "Subforums" ,
210+ Value : strings .Join (subforums , " / " ),
211+ Inline : false ,
212+ })
213+
186214 var post_content string = string (new_post .PostContent )
187215 if len (post_content ) >= 600 {
188216 post_content = post_content [:600 ]
0 commit comments