From 04069e2eabc3f3367f3858ba233227d7e7078851 Mon Sep 17 00:00:00 2001 From: Negasus Date: Wed, 28 Dec 2022 10:43:04 +0300 Subject: [PATCH] update readme and changelog --- CHANGELOG.md | 4 ++++ README.md | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87f6228..bde3cf5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 950d373..07a05d8 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,7 @@ 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`) @@ -196,6 +196,17 @@ 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.