Skip to content

Commit

Permalink
Update message.go
Browse files Browse the repository at this point in the history
  • Loading branch information
TG-BOTSNETWORK authored Feb 18, 2024
1 parent 8e44bf7 commit 0cd2740
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ext/handlers/filters/message/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,3 +306,22 @@ func TopicAction(msg *gotgbot.Message) bool {
return TopicEdited(msg) || TopicCreated(msg) ||
TopicClosed(msg) || TopicReopened(msg)
}

func MessageEntityPre(offset int, length int, language string) func(*gotgbot.Message) bool {
return func(msg *gotgbot.Message) bool {
var entities []*gotgbot.MessageEntity
if msg.Text != nil {

Check failure on line 313 in ext/handlers/filters/message/message.go

View workflow job for this annotation

GitHub Actions / Run go tests

invalid operation: msg.Text != nil (mismatched types string and untyped nil)
entities = msg.Entities

Check failure on line 314 in ext/handlers/filters/message/message.go

View workflow job for this annotation

GitHub Actions / Run go tests

cannot use msg.Entities (variable of type []gotgbot.MessageEntity) as []*gotgbot.MessageEntity value in assignment
} else if msg.CaptionEntities != nil {
entities = msg.CaptionEntities

Check failure on line 316 in ext/handlers/filters/message/message.go

View workflow job for this annotation

GitHub Actions / Run go tests

cannot use msg.CaptionEntities (variable of type []gotgbot.MessageEntity) as []*gotgbot.MessageEntity value in assignment
} else {
return false // Neither text nor caption entities are present
}
for _, entity := range entities {
if entity.Offset == offset && entity.Length == length && entity.Language == language {

Check failure on line 321 in ext/handlers/filters/message/message.go

View workflow job for this annotation

GitHub Actions / Run go tests

invalid operation: entity.Offset == offset (mismatched types int64 and int)

Check failure on line 321 in ext/handlers/filters/message/message.go

View workflow job for this annotation

GitHub Actions / Run go tests

invalid operation: entity.Length == length (mismatched types int64 and int)
return true
}
}
return false
}
}

0 comments on commit 0cd2740

Please sign in to comment.