Files changed (1) hide show
  1. plugins/filter.go +13 -2
plugins/filter.go CHANGED
@@ -650,8 +650,19 @@ func sendFilter(f *database.Filter, bot *gotgbot.Bot, chatID, messageID int64, c
650
  }
651
 
652
  content := f.Content
653
- // Strip usernames from the caption
654
- content = usernameRegex.ReplaceAllString(content, "")
 
 
 
 
 
 
 
 
 
 
 
655
 
656
  var (
657
  buttons = mapToButton(markup)
 
650
  }
651
 
652
  content := f.Content
653
+ // If it's a media filter (indexed file), use the clean filename as caption
654
+ if f.MediaType != "" {
655
+ if f.FileName != "" {
656
+ content = f.FileName
657
+ } else if content != "" {
658
+ // Extract first non-username line or fallback
659
+ content = usernameRegex.ReplaceAllString(content, "")
660
+ content = strings.TrimSpace(content)
661
+ }
662
+ } else {
663
+ // Strip usernames from text filter caption
664
+ content = usernameRegex.ReplaceAllString(content, "")
665
+ }
666
 
667
  var (
668
  buttons = mapToButton(markup)