Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/merge-automated-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
timeout-minutes: 15
steps:
- name: 📦 Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0 # Required for GoReleaser to detect version info

- name: 🧰 Set up Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version-file: go.mod
check-latest: true
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
timeout-minutes: 5
steps:
- name: 📦 Checkout Code
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: 🧰 Setup Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version-file: go.mod
check-latest: true
Expand All @@ -50,7 +50,7 @@ jobs:
timeout-minutes: 5
steps:
- name: 📦 Checkout Code
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: 🧪 Run golangci-lint via reviewdog
uses: reviewdog/action-golangci-lint@v2
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
module github.com/beeyev/telegram-owl

go 1.24
go 1.24.0

require (
github.com/stretchr/testify v1.10.0
github.com/urfave/cli/v3 v3.0.0-beta1
resty.dev/v3 v3.0.0-beta.2
github.com/urfave/cli/v3 v3.4.1
resty.dev/v3 v3.0.0-beta.3
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/net v0.46.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/urfave/cli/v3 v3.0.0-beta1 h1:6DTaaUarcM0wX7qj5Hcvs+5Dm3dyUTBbEwIWAjcw9Zg=
github.com/urfave/cli/v3 v3.0.0-beta1/go.mod h1:FnIeEMYu+ko8zP1F9Ypr3xkZMIDqW3DR92yUtY39q1Y=
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
github.com/urfave/cli/v3 v3.4.1 h1:1M9UOCy5bLmGnuu1yn3t3CB4rG79Rtoxuv1sPhnm6qM=
github.com/urfave/cli/v3 v3.4.1/go.mod h1:FJSKtM/9AiiTOJL4fJ6TbMUkxBXn7GO9guZqoZtpYpo=
golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4=
golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
resty.dev/v3 v3.0.0-beta.2 h1:xu4mGAdbCLuc3kbk7eddWfWm4JfhwDtdapwss5nCjnQ=
resty.dev/v3 v3.0.0-beta.2/go.mod h1:OgkqiPvTDtOuV4MGZuUDhwOpkY8enjOsjjMzeOHefy4=
resty.dev/v3 v3.0.0-beta.3 h1:3kEwzEgCnnS6Ob4Emlk94t+I/gClyoah7SnNi67lt+E=
resty.dev/v3 v3.0.0-beta.3/go.mod h1:OgkqiPvTDtOuV4MGZuUDhwOpkY8enjOsjjMzeOHefy4=
4 changes: 2 additions & 2 deletions internal/cli/input_values.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func (iv *inputValues) validate() error {
if iv.cmd.String("token") == "" {
//nolint:stylecheck // Probably i need to render this message in a different way
return errors.New(`missing required flag: --token
Set it via the --token flag or the TELEGRAM_SEND_TOKEN environment variable.
Set it via the --token flag or the TELEGRAM_OWL_TOKEN environment variable.

Example:
telegram-owl --token=123:ABC
Expand All @@ -28,7 +28,7 @@ Run with --help to see all options.`)
if iv.cmd.String("chat") == "" {
//nolint:stylecheck // Probably i need to render this message in a different way
return errors.New(`missing required flag: --chat
Set it via the --chat flag or the TELEGRAM_SEND_CHAT environment variable.
Set it via the --chat flag or the TELEGRAM_OWL_CHAT environment variable.

Example:
telegram-owl --chat=31337
Expand Down
5 changes: 3 additions & 2 deletions internal/telegram/method/sendmediagroup/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"strings"
"unicode/utf8"

attach "github.com/beeyev/telegram-owl/internal/telegram/common/attachment"
"github.com/beeyev/telegram-owl/internal/telegram/httpclient"
Expand Down Expand Up @@ -98,10 +99,10 @@ func (o *Options) validate() error {
if len(o.Attachments) == 0 {
validationErrors = append(validationErrors, "at least one attachment required")
}
if len(o.Caption) > MaxCaptionLength {
if captionLen := utf8.RuneCountInString(o.Caption); captionLen > MaxCaptionLength {
validationErrors = append(
validationErrors,
fmt.Sprintf("message is too long: must be <= %d characters, got %d", MaxCaptionLength, len(o.Caption)),
fmt.Sprintf("message is too long: must be <= %d characters, got %d", MaxCaptionLength, captionLen),
)
}

Expand Down
5 changes: 3 additions & 2 deletions internal/telegram/method/sendmessage/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"strings"
"unicode/utf8"
)

// MaxTextLength defines the maximum length allowed for a text message.
Expand Down Expand Up @@ -68,10 +69,10 @@ func (o *Options) validate() error {
if o.Text == "" {
validationErrors = append(validationErrors, "message is required")
}
if len(o.Text) > MaxTextLength {
if textLen := utf8.RuneCountInString(o.Text); textLen > MaxTextLength {
validationErrors = append(
validationErrors,
fmt.Sprintf("message is too long: must be <= %d characters, got %d", MaxTextLength, len(o.Text)),
fmt.Sprintf("message is too long: must be <= %d characters, got %d", MaxTextLength, textLen),
)
}

Expand Down