From c4b749d65c3cc212bb1b301a276b1109cafe1f29 Mon Sep 17 00:00:00 2001 From: Artem Yadelskyi Date: Thu, 15 Feb 2024 12:37:57 +0200 Subject: [PATCH] Updated examples --- examples/go.mod | 5 +++-- examples/go.sum | 14 ++++++++------ examples/handler_specific/main.go | 2 +- examples/utility_methods/main.go | 4 +++- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/examples/go.mod b/examples/go.mod index be691a47..ee990691 100644 --- a/examples/go.mod +++ b/examples/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/fasthttp/router v1.4.22 - github.com/mymmrac/telego v0.28.0 + github.com/mymmrac/telego v0.28.1-0.20240215103418-2d5ed0705897 github.com/valyala/fasthttp v1.52.0 golang.ngrok.com/ngrok v1.8.1 ) @@ -15,7 +15,7 @@ require ( github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect github.com/chenzhuoyu/iasm v0.9.1 // indirect github.com/go-stack/stack v1.8.1 // indirect - github.com/goccy/go-json v0.10.2 // indirect + github.com/grbit/go-json v0.11.0 // indirect github.com/inconshreveable/log15 v3.0.0-testing.3+incompatible // indirect github.com/inconshreveable/log15/v3 v3.0.0-testing.5 // indirect github.com/jpillora/backoff v1.0.0 // indirect @@ -28,6 +28,7 @@ require ( github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect + github.com/valyala/fastjson v1.6.4 // indirect go.uber.org/multierr v1.11.0 // indirect golang.ngrok.com/muxado/v2 v2.0.0 // indirect golang.org/x/arch v0.6.0 // indirect diff --git a/examples/go.sum b/examples/go.sum index f9ae5d73..ec1ff48f 100644 --- a/examples/go.sum +++ b/examples/go.sum @@ -19,11 +19,11 @@ github.com/fasthttp/router v1.4.22 h1:qwWcYBbndVDwts4dKaz+A2ehsnbKilmiP6pUhXBfYK github.com/fasthttp/router v1.4.22/go.mod h1:KeMvHLqhlB9vyDWD5TSvTccl9qeWrjSSiTJrJALHKV0= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= -github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= -github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/grbit/go-json v0.11.0 h1:bAbyMdYrYl/OjYsSqLH99N2DyQ291mHy726Mx+sYrnc= +github.com/grbit/go-json v0.11.0/go.mod h1:IYpHsdybQ386+6g3VE6AXQ3uTGa5mquBme5/ZWmtzek= github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/inconshreveable/log15 v3.0.0-testing.3+incompatible h1:zaX5fYT98jX5j4UhO/WbfY8T1HkgVrydiDMC9PWqGCo= @@ -46,8 +46,8 @@ github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxec github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mymmrac/telego v0.28.0 h1:DNXaYISeZw1J9oB81vCNdskLow8gCRRUJxufqLuH3XE= -github.com/mymmrac/telego v0.28.0/go.mod h1:oRperySNzJq8dRTl24+uBF1Uy7tlQGIjid/JQtHDsZg= +github.com/mymmrac/telego v0.28.1-0.20240215103418-2d5ed0705897 h1:KYYltzQGl0Ahp/IRNjn6B6+0ZUYFZoqRFQsVWxN8PPo= +github.com/mymmrac/telego v0.28.1-0.20240215103418-2d5ed0705897/go.mod h1:ZLD1+L2TQRr97NPOCoN1V2w8y9kmFov33OfZ3qT8cF4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= @@ -69,8 +69,10 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.52.0 h1:wqBQpxH71XW0e2g+Og4dzQM8pk34aFYlA1Ga8db7gU0= github.com/valyala/fasthttp v1.52.0/go.mod h1:hf5C4QnVMkNXMspnsUlfM3WitlgYflyhHYoKol/szxQ= -go.uber.org/mock v0.3.0 h1:3mUxI1No2/60yUYax92Pt8eNOEecx2D3lcXZh2NEZJo= -go.uber.org/mock v0.3.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ= +github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= golang.ngrok.com/muxado/v2 v2.0.0 h1:bu9eIDhRdYNtIXNnqat/HyMeHYOAbUH55ebD7gTvW6c= diff --git a/examples/handler_specific/main.go b/examples/handler_specific/main.go index 856fa7d2..8df1fe6c 100644 --- a/examples/handler_specific/main.go +++ b/examples/handler_specific/main.go @@ -45,7 +45,7 @@ func main() { // Register new handler with match on a call back query with data equal to `go` and non-nil message bh.HandleCallbackQuery(func(bot *telego.Bot, query telego.CallbackQuery) { // Send message - _, _ = bot.SendMessage(tu.Message(tu.ID(query.Message.Chat.ID), "GO")) + _, _ = bot.SendMessage(tu.Message(tu.ID(query.Message.GetChat().ID), "GO")) // Answer callback query _ = bot.AnswerCallbackQuery(tu.CallbackQuery(query.ID).WithText("Done")) diff --git a/examples/utility_methods/main.go b/examples/utility_methods/main.go index 4749f750..922a8c9d 100644 --- a/examples/utility_methods/main.go +++ b/examples/utility_methods/main.go @@ -30,7 +30,9 @@ func main() { // Create a message and change optional parameters msg := tu.Message(chatID, "Hello World"). - WithReplyToMessageID(1234). + WithReplyParameters(&telego.ReplyParameters{ + MessageID: 123, + }). WithDisableNotification(). WithProtectContent() _, _ = bot.SendMessage(msg)