From 7982a33a06f2b08403e696826b493b14057f0589 Mon Sep 17 00:00:00 2001 From: Stepan Rabotkin Date: Fri, 3 May 2024 02:37:15 +0300 Subject: [PATCH] fix: telegram default message (#4821) Hi, there is another fix of default message. I tried this message, now everything works --- go.mod | 3 +-- go.sum | 6 ++---- internal/pipe/telegram/telegram.go | 4 ++-- internal/pipe/telegram/telegram_test.go | 2 +- www/docs/customization/announce/telegram.md | 4 ++-- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index b47371899..0a30c1501 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( github.com/dghubble/go-twitter v0.0.0-20211115160449-93a8679adecb github.com/dghubble/oauth1 v0.7.3 github.com/distribution/distribution/v3 v3.0.0-alpha.1 - github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible + github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1 github.com/google/go-containerregistry v0.19.1 github.com/google/go-github/v61 v61.0.0 github.com/google/ko v0.15.2 @@ -279,7 +279,6 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.18.2 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/technoweenie/multipartstreamer v1.0.1 // indirect github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399 // indirect github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 // indirect github.com/vbatts/tar-split v0.11.5 // indirect diff --git a/go.sum b/go.sum index 43dff9be2..621167c94 100644 --- a/go.sum +++ b/go.sum @@ -347,8 +347,8 @@ github.com/go-restruct/restruct v1.2.0-alpha/go.mod h1:KqrpKpn4M8OLznErihXTGLlsX github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y= github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible h1:2cauKuaELYAEARXRkq2LrJ0yDDv1rW7+wrTEdVL3uaU= -github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible/go.mod h1:qf9acutJ8cwBUhm1bqgz6Bei9/C/c93FPDljKWwsOgM= +github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1 h1:wG8n/XJQ07TmjbITcGiUaOtXxdrINDz1b0J1w0SzqDc= +github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1/go.mod h1:A2S0CWkNylc2phvKXWBBdD3K0iGnDBGbzRpISP2zBl8= github.com/go-test/deep v1.0.4/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg= github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= @@ -761,8 +761,6 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/technoweenie/multipartstreamer v1.0.1 h1:XRztA5MXiR1TIRHxH2uNxXxaIkKQDeX7m2XsSOlQEnM= -github.com/technoweenie/multipartstreamer v1.0.1/go.mod h1:jNVxdtShOxzAsukZwTSw6MDx5eUJoiEBsSvzDU9uzog= github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399 h1:e/5i7d4oYZ+C1wj2THlRK+oAhjeS/TRQwMfkIuet3w0= github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399/go.mod h1:LdwHTNJT99C5fTAzDz0ud328OgXz+gierycbcIx2fRs= github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 h1:nrZ3ySNYwJbSpD6ce9duiP+QkD3JuLCcWkdaehUS/3Y= diff --git a/internal/pipe/telegram/telegram.go b/internal/pipe/telegram/telegram.go index 00157d0cd..fec188107 100644 --- a/internal/pipe/telegram/telegram.go +++ b/internal/pipe/telegram/telegram.go @@ -6,13 +6,13 @@ import ( "github.com/caarlos0/env/v11" "github.com/caarlos0/log" - api "github.com/go-telegram-bot-api/telegram-bot-api" + api "github.com/go-telegram-bot-api/telegram-bot-api/v5" "github.com/goreleaser/goreleaser/internal/tmpl" "github.com/goreleaser/goreleaser/pkg/context" ) const ( - defaultMessageTemplate = `{{ mdv2escape .ProjectName }} {{ mdv2escape .Tag }} is out! Check it out at {{ mdv2escape .ReleaseURL }}` + defaultMessageTemplate = `{{ mdv2escape .ProjectName }} {{ mdv2escape .Tag }} is out{{ mdv2escape "!" }} Check it out at {{ mdv2escape .ReleaseURL }}` parseModeHTML = "HTML" parseModeMarkdown = "MarkdownV2" ) diff --git a/internal/pipe/telegram/telegram_test.go b/internal/pipe/telegram/telegram_test.go index 08e9d2df6..e41e5eb0f 100644 --- a/internal/pipe/telegram/telegram_test.go +++ b/internal/pipe/telegram/telegram_test.go @@ -116,6 +116,6 @@ func TestGetMessageDetails(t *testing.T) { require.NoError(t, Pipe{}.Default(ctx)) msg, _, err := getMessageDetails(ctx) require.NoError(t, err) - require.Equal(t, "foo v1\\.0\\.0 is out! Check it out at ", msg) + require.Equal(t, "foo v1\\.0\\.0 is out\\! Check it out at ", msg) }) } diff --git a/www/docs/customization/announce/telegram.md b/www/docs/customization/announce/telegram.md index 7f8d497ae..93cf04494 100644 --- a/www/docs/customization/announce/telegram.md +++ b/www/docs/customization/announce/telegram.md @@ -25,9 +25,9 @@ announce: # Message template to use while publishing. # - # Default: '{{ mdv2escape .ProjectName }} {{ mdv2escape .Tag }} is out! Check it out at {{ mdv2escape .ReleaseURL }}' + # Default: '{{ mdv2escape .ProjectName }} {{ mdv2escape .Tag }} is out{{ mdv2escape "!" }} Check it out at {{ mdv2escape .ReleaseURL }}' # Templates: allowed - message_template: 'Awesome project {{.Tag}} is out!' + message_template: 'Awesome project {{.Tag}} is out{{ mdv2escape "!" }}' # Parse mode. #