Skip to content

Commit

Permalink
update readme and changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
negasus committed Dec 28, 2022
1 parent bf34945 commit 04069e2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v0.3.3 (2022-12-28)

- add `RegisterHandlerMatchFunc`

## v0.3.2 (2022-11-28)

- fix field type SendDocumentParams.Document from string to InputFile, add example
Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,25 @@ Match Types:
- `MatchTypePrefix`
- `MatchTypeContains`

Also, you can use `RegisterHandlerRegexp` to match by regular expression.
You can use `RegisterHandlerRegexp` to match by regular expression.

```go
re := regexp.MustCompile(`^/start`)

b.RegisterHandlerRegexp(bot.HandlerTypeMessageText, re, myStartHandler)
```

If you want to use custom handler, use `RegisterHandlerMatchFunc`

```go
matchFunc := func(update *models.Update) bool {
// your checks
return true
}

b.RegisterHandlerMatchFunc(bot.HandlerTypeMessageText, matchFunc, myHandler)
```

## InputFile

For some methods, like `SendPhoto`, `SendAudio` etc, you can send file by file path or file contents.
Expand Down

0 comments on commit 04069e2

Please sign in to comment.