Skip to content

Commit

Permalink
update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
akshettrj committed Sep 28, 2023
1 parent 344e6ca commit 8a78de6
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 24 deletions.
19 changes: 10 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,33 @@ go 1.19

require (
github.com/Benau/tgsconverter v0.0.0-20210809170556-99f4a4f6337f
github.com/PaulSonOfLars/gotgbot/v2 v2.0.0-rc.20
github.com/PaulSonOfLars/gotgbot/v2 v2.0.0-rc.22
github.com/davecgh/go-spew v1.1.1
github.com/emersion/go-vcard v0.0.0-20230815062825-8fda7d206ec9
github.com/forPelevin/gomoji v1.1.8
github.com/go-co-op/gocron v1.31.2
github.com/go-co-op/gocron v1.34.2
github.com/jackc/pgx/v5 v5.4.3
github.com/kolesa-team/go-webp v1.0.4
github.com/lithammer/fuzzysearch v1.1.8
github.com/mattn/go-sqlite3 v1.14.17
github.com/mdp/qrterminal/v3 v3.1.1
go.mau.fi/whatsmeow v0.0.0-20230817083005-1c185f033d88
go.uber.org/zap v1.25.0
golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb
go.mau.fi/whatsmeow v0.0.0-20230926223531-00abc29ba510
go.uber.org/zap v1.26.0
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
google.golang.org/protobuf v1.31.0
gopkg.in/yaml.v3 v3.0.1
gorm.io/driver/mysql v1.5.1
gorm.io/driver/postgres v1.5.2
gorm.io/driver/sqlite v1.5.3
gorm.io/gorm v1.25.3
gorm.io/gorm v1.25.4
)

require (
filippo.io/edwards25519 v1.0.0 // indirect
github.com/Benau/go_rlottie v0.0.0-20210807002906-98c1b2421989 // indirect
github.com/av-elier/go-decimal-to-rational v0.0.0-20191127152832-89e6aad02ecf // indirect
github.com/go-sql-driver/mysql v1.7.1 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
Expand All @@ -40,10 +41,10 @@ require (
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/sizeofint/webpanimation v0.0.0-20210809145948-1d2b32119882 // indirect
go.mau.fi/libsignal v0.1.0 // indirect
go.mau.fi/util v0.0.0-20230805171708-199bf3eec776 // indirect
go.mau.fi/util v0.1.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
rsc.io/qr v0.2.0 // indirect
)
20 changes: 20 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ github.com/Benau/tgsconverter v0.0.0-20210809170556-99f4a4f6337f h1:aUkwZDEMJIGR
github.com/Benau/tgsconverter v0.0.0-20210809170556-99f4a4f6337f/go.mod h1:AQiQKKI/YIIctvDt3hI3c1S05/JXMM7v/sQcRd0paVE=
github.com/PaulSonOfLars/gotgbot/v2 v2.0.0-rc.20 h1:LgJ2DwqvtvvUOMS2q7IdeaLS1olDUQqDZ4GZliQZAPM=
github.com/PaulSonOfLars/gotgbot/v2 v2.0.0-rc.20/go.mod h1:r815fYWTudnU9JhtsJAxUtuV7QrSgKpChJkfTSMFpfg=
github.com/PaulSonOfLars/gotgbot/v2 v2.0.0-rc.22 h1:IWnsvf0mmpu8gBRB8Q6JejWcgDLC1W+M6aFRxrI+cgU=
github.com/PaulSonOfLars/gotgbot/v2 v2.0.0-rc.22/go.mod h1:kL1v4iIjlalwm3gCYGvF4NLa3hs+aKEfRkNJvj4aoDU=
github.com/av-elier/go-decimal-to-rational v0.0.0-20191127152832-89e6aad02ecf h1:csfEAyvOG4/498Q4SyF48ysFqQC9ESj3o8ppRtg+Rog=
github.com/av-elier/go-decimal-to-rational v0.0.0-20191127152832-89e6aad02ecf/go.mod h1:POPnOeaYF7U9o3PjLTb9icRfEOxjBNLRXh9BLximJGM=
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
Expand All @@ -19,12 +21,16 @@ github.com/forPelevin/gomoji v1.1.8 h1:JElzDdt0TyiUlecy6PfITDL6eGvIaxqYH1V52zrd0
github.com/forPelevin/gomoji v1.1.8/go.mod h1:8+Z3KNGkdslmeGZBC3tCrwMrcPy5GRzAD+gL9NAwMXg=
github.com/go-co-op/gocron v1.31.2 h1:tAUW64bxYc5QlzEy2t30TnHX2+uInNDajKXxWi4SACA=
github.com/go-co-op/gocron v1.31.2/go.mod h1:39f6KNSGVOU1LO/ZOoZfcSxwlsJDQOKSu8erN0SH48Y=
github.com/go-co-op/gocron v1.34.2 h1:vI/Up5gQDogTF7VIQQ1ynwkVDIuUwQ0oPhDR13/X/KM=
github.com/go-co-op/gocron v1.34.2/go.mod h1:NLi+bkm4rRSy1F8U7iacZOz0xPseMoIOnvabGoSe/no=
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
Expand Down Expand Up @@ -82,8 +88,12 @@ go.mau.fi/libsignal v0.1.0 h1:vAKI/nJ5tMhdzke4cTK1fb0idJzz1JuEIpmjprueC+c=
go.mau.fi/libsignal v0.1.0/go.mod h1:R8ovrTezxtUNzCQE5PH30StOQWWeBskBsWE55vMfY9I=
go.mau.fi/util v0.0.0-20230805171708-199bf3eec776 h1:VrxDCO/gLFHLQywGUsJzertrvt2mUEMrZPf4hEL/s18=
go.mau.fi/util v0.0.0-20230805171708-199bf3eec776/go.mod h1:AxuJUMCxpzgJ5eV9JbPWKRH8aAJJidxetNdUj7qcb84=
go.mau.fi/util v0.1.0 h1:BwIFWIOEeO7lsiI2eWKFkWTfc5yQmoe+0FYyOFVyaoE=
go.mau.fi/util v0.1.0/go.mod h1:AxuJUMCxpzgJ5eV9JbPWKRH8aAJJidxetNdUj7qcb84=
go.mau.fi/whatsmeow v0.0.0-20230817083005-1c185f033d88 h1:OyWiw4j6s8unaOhRuIYO1pTnJLFREIRnflDDp+GNJ2U=
go.mau.fi/whatsmeow v0.0.0-20230817083005-1c185f033d88/go.mod h1:Iv3G4uv6+HWtqL7XSLRa2dSy077Bnji14IvqUbG+bRo=
go.mau.fi/whatsmeow v0.0.0-20230926223531-00abc29ba510 h1:qLaBZGD5I4cyM4DWs1JKxONXnLCfI6H3XCo3aaoII1M=
go.mau.fi/whatsmeow v0.0.0-20230926223531-00abc29ba510/go.mod h1:1xFS2b5zqsg53ApsYB4FDtko7xG7r+gVgBjh9k+9/GE=
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
Expand All @@ -92,12 +102,18 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.25.0 h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c=
go.uber.org/zap v1.25.0/go.mod h1:JIAUzQIH94IC4fOJQm7gMmBJP5k7wQfdcnYdPoEXJYk=
go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb h1:mIKbk8weKhSeLH2GmUTrvx8CjkyJmnU1wFmg59CUjFA=
golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
Expand Down Expand Up @@ -125,6 +141,8 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
Expand All @@ -151,5 +169,7 @@ gorm.io/driver/sqlite v1.5.3/go.mod h1:qxAuCol+2r6PannQDpOP1FP6ag3mKi4esLnB/jHed
gorm.io/gorm v1.25.1/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
gorm.io/gorm v1.25.3 h1:zi4rHZj1anhZS2EuEODMhDisGy+Daq9jtPrNGgbQYD8=
gorm.io/gorm v1.25.3/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
gorm.io/gorm v1.25.4 h1:iyNd8fNAe8W9dvtlgeRI5zSVZPsq3OpcTu37cYcpCmw=
gorm.io/gorm v1.25.4/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
rsc.io/qr v0.2.0 h1:6vBLea5/NRMVTz8V66gipeLycZMl/+UlFmk8DvqQ6WY=
rsc.io/qr v0.2.0/go.mod h1:IF+uZjkb9fqyeF/4tlBoynqmQxUoPfWEKh921coOuXs=
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func main() {
panic(fmt.Errorf("failed to load config file: %s", err))
}

if cfg.Telegram.APIURL == "" {
cfg.Telegram.APIURL = gotgbot.DefaultAPIURL
}

if cfg.DebugMode {
developmentConfig := zap.NewDevelopmentConfig()
developmentConfig.OutputPaths = append(developmentConfig.OutputPaths, "debug.log")
Expand Down
14 changes: 8 additions & 6 deletions telegram/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ func NewTelegramClient() error {
defer logger.Sync()

bot, err := gotgbot.NewBot(cfg.Telegram.BotToken, &gotgbot.BotOpts{
Client: http.Client{},
DefaultRequestOpts: &gotgbot.RequestOpts{
APIURL: cfg.Telegram.APIURL,
Timeout: time.Duration(math.MaxInt64),
BotClient: &gotgbot.BaseBotClient{
Client: http.Client{},
DefaultRequestOpts: &gotgbot.RequestOpts{
APIURL: cfg.Telegram.APIURL,
Timeout: time.Duration(math.MaxInt64),
},
},
})
if err != nil {
Expand Down Expand Up @@ -61,7 +63,7 @@ func NewTelegramClient() error {

err = updater.StartPolling(bot, &ext.PollingOpts{
DropPendingUpdates: true,
GetUpdatesOpts: gotgbot.GetUpdatesOpts{
GetUpdatesOpts: &gotgbot.GetUpdatesOpts{
Timeout: 9,
RequestOpts: &gotgbot.RequestOpts{
Timeout: 10 * time.Second,
Expand All @@ -76,7 +78,7 @@ func NewTelegramClient() error {
zap.Int64("id", bot.Id),
zap.String("name", bot.FirstName),
zap.String("username", "@"+bot.Username),
zap.String("api_url", bot.GetAPIURL()),
zap.String("api_url", cfg.Telegram.APIURL),
)

return nil
Expand Down
4 changes: 2 additions & 2 deletions telegram/middlewares/auto_handle_rate_limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type autoHandleRateLimitBotClient struct {
}

func (b *autoHandleRateLimitBotClient) RequestWithContext(ctx context.Context,
method string, params map[string]string,
token string, method string, params map[string]string,
data map[string]gotgbot.NamedReader,
opts *gotgbot.RequestOpts) (json.RawMessage, error) {

Expand All @@ -25,7 +25,7 @@ func (b *autoHandleRateLimitBotClient) RequestWithContext(ctx context.Context,
}

for {
response, err := b.BotClient.RequestWithContext(ctx, method, params, data, opts)
response, err := b.BotClient.RequestWithContext(ctx, token, method, params, data, opts)
if err == nil {
return response, err
}
Expand Down
4 changes: 2 additions & 2 deletions telegram/middlewares/disable_web_page_preview.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ type disableWebPagePreviewBotClient struct {
}

func (b *disableWebPagePreviewBotClient) RequestWithContext(ctx context.Context,
method string, params map[string]string,
token string, method string, params map[string]string,
data map[string]gotgbot.NamedReader,
opts *gotgbot.RequestOpts) (json.RawMessage, error) {

if strings.HasPrefix(method, "send") || strings.HasPrefix(method, "edit") {
params["disable_web_page_preview"] = "true"
}

return b.BotClient.RequestWithContext(ctx, method, params, data, opts)
return b.BotClient.RequestWithContext(ctx, token, method, params, data, opts)
}

func DisableWebPagePreview(b gotgbot.BotClient) gotgbot.BotClient {
Expand Down
4 changes: 2 additions & 2 deletions telegram/middlewares/parse_mode_html.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ type parseModeHTMLBotClient struct {
}

func (b *parseModeHTMLBotClient) RequestWithContext(ctx context.Context,
method string, params map[string]string,
token string, method string, params map[string]string,
data map[string]gotgbot.NamedReader,
opts *gotgbot.RequestOpts) (json.RawMessage, error) {

if strings.HasPrefix(method, "send") || strings.HasPrefix(method, "edit") {
params["parse_mode"] = "html"
}

return b.BotClient.RequestWithContext(ctx, method, params, data, opts)
return b.BotClient.RequestWithContext(ctx, token, method, params, data, opts)
}

func ParseAsHTML(b gotgbot.BotClient) gotgbot.BotClient {
Expand Down
4 changes: 2 additions & 2 deletions telegram/middlewares/send_without_reply.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ type sendWithoutReplyBotClient struct {
}

func (b *sendWithoutReplyBotClient) RequestWithContext(ctx context.Context,
method string, params map[string]string,
token string, method string, params map[string]string,
data map[string]gotgbot.NamedReader,
opts *gotgbot.RequestOpts) (json.RawMessage, error) {

if strings.HasPrefix(method, "send") || method == "copyMessage" {
params["allow_sending_without_reply"] = "true"
}

return b.BotClient.RequestWithContext(ctx, method, params, data, opts)
return b.BotClient.RequestWithContext(ctx, token, method, params, data, opts)
}

func SendWithoutReply(b gotgbot.BotClient) gotgbot.BotClient {
Expand Down
2 changes: 1 addition & 1 deletion utils/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TgDownloadByFilePath(b *gotgbot.Bot, filePath string) ([]byte, error) {
}

req, err := http.NewRequest("GET", fmt.Sprintf("%s/file/bot%s/%s",
b.GetAPIURL(), b.GetToken(), filePath), nil)
state.State.Config.Telegram.APIURL, b.Token, filePath), nil)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 8a78de6

Please sign in to comment.