Skip to content
This repository has been archived by the owner on Aug 14, 2022. It is now read-only.

Porting to use telebot.v2 #44

Open
lovung opened this issue Jan 12, 2019 · 6 comments
Open

Porting to use telebot.v2 #44

lovung opened this issue Jan 12, 2019 · 6 comments

Comments

@lovung
Copy link

lovung commented Jan 12, 2019

I am doing upgrade telebot from v1 to v2 at https://github.com/vu-long/alertmanager-bot/tree/using_telebot_v2 but it runs with any response. Can you help me?

@metalmatze
Copy link
Owner

I haven't looked at the differences between v1 and v2. But if you want you're welcome to create a PR to only update the dependency and then we can work on that.

@lovung
Copy link
Author

lovung commented Jan 17, 2019

@metalmatze #45 here please. I just took some hours. Maybe I will come back to work on that in next week.

@lovung
Copy link
Author

lovung commented Jan 17, 2019

Issue (without using dep)

go get -u github.com/metalmatze/alertmanager-bot
cd $GOPATH/src/github.com/metalmatze/alertmanager-bot
go get -v -u ./...
go build ./...

Output:
github.com/metalmatze/alertmanager-bot/pkg/telegram
pkg/telegram/bot.go:81:28: cannot use token (type string) as type telebot.Settings in argument to telebot.NewBot
pkg/telegram/bot.go:166:12: b.telegram.SendMessage undefined (type *telebot.Bot has no field or method SendMessage)
pkg/telegram/bot.go:177:48: b.telegram.Identity undefined (type *telebot.Bot has no field or method Identity)
pkg/telegram/bot.go:204:23: b.telegram.SendChatAction undefined (type *telebot.Bot has no field or method SendChatAction)
pkg/telegram/bot.go:220:14: b.telegram.SendMessage undefined (type *telebot.Bot has no field or method SendMessage)
pkg/telegram/bot.go:235:12: b.telegram.Listen undefined (type *telebot.Bot has no field or method Listen)
pkg/telegram/bot.go:298:15: b.telegram.SendMessage undefined (type *telebot.Bot has no field or method SendMessage)
pkg/telegram/bot.go:305:31: cannot use message.Chat (type *telebot.Chat) as type telebot.Chat in argument to b.chats.Add
pkg/telegram/bot.go:307:13: b.telegram.SendMessage undefined (type *telebot.Bot has no field or method SendMessage)
pkg/telegram/bot.go:311:12: b.telegram.SendMessage undefined (type *telebot.Bot has no field or method SendMessage)
pkg/telegram/bot.go:311:12: too many errors

@metalmatze
Copy link
Owner

Yes, you need to enable Go modules at the moment. Please read this section on how to do that:
https://github.com/golang/go/wiki/Modules#how-to-install-and-activate-module-support

TL;DR
export GO111MODULE=on and then run go build -v ./cmd/alertmanager-bot again.

@lovung
Copy link
Author

lovung commented Jan 18, 2019

It's OK. Maybe we need to change the README.md for others.

@metalmatze
Copy link
Owner

Today I finally put some work into upgrading the telebot library to v2. It turns out it only got worse from its API calls and I actually prefer not to upgrade to it.
Right now, I'm unsure about the way forward, but we'll figure something out eventually.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants