Skip to content

Commit

Permalink
fix(sticker): fix image convert error (#361)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugefiver authored Jun 14, 2024
1 parent 45a6296 commit 374c324
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
14 changes: 8 additions & 6 deletions base/sticker.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"slices"
"strings"

_ "golang.org/x/image/webp"

"go.uber.org/zap"
tb "gopkg.in/telebot.v3"

Expand Down Expand Up @@ -72,9 +74,9 @@ func GetSticker(ctx tb.Context) error {
switch opt.format {
case "", "webp":
sendFile := &tb.Document{
File: *file,
FileName: filename + ".webp",
Caption: emoji,
File: *file,
FileName: filename + ".webp",
Caption: emoji,
DisableTypeDetection: true,
}
return ctx.Reply(sendFile)
Expand Down Expand Up @@ -122,9 +124,9 @@ func GetSticker(ctx tb.Context) error {
}

sendFile := &tb.Document{
File: tb.FromReader(bs),
FileName: filename,
Caption: emoji,
File: tb.FromReader(bs),
FileName: filename,
Caption: emoji,
DisableTypeDetection: true,
}

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ require (
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/image v0.17.0 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,8 @@ golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJ
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.17.0 h1:nTRVVdajgB8zCMZVsViyzhnMKPwYeroEERRC64JuLco=
golang.org/x/image v0.17.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
Expand Down

0 comments on commit 374c324

Please sign in to comment.