mail-ru-im / bot-golang Goto Github PK
View Code? Open in Web Editor NEWGolang library for Bot API
License: MIT License
Golang library for Bot API
License: MIT License
I'm create new project:
go mod init icqbot
And use this package in very simple code from example:
`package main
import "github.com/mail-ru-im/bot-golang"
func main() {
_, _ := botgolang.NewBot("0000")
}Then build this with:
go build main.goI'm receive this error:
go: finding github.com/mail-ru-im/bot-golang latest
go: github.com/mail-ru-im/[email protected] requires
github.com/golangci/[email protected] requires
github.com/go-critic/[email protected]: invalid pseudo-version: does not match version-control timestamp (2019-05-26T07:48:19Z)`
When receiving latest updates via GetLastEventsWithContext with any message that contains an event of type inlineKeyboardMarkup, bot is unable to unmarshal it and enters an infinite loop, while constantly building a queue of unresolved events
time="..." level=error msg="Failed to get updates, retrying in 3 seconds ..." err="cannot get events: cannot parse events: parse error: expected { near offset 275 of 'payload'" retry interval="3 seconds"
time="..." level=error msg="Failed to get updates, retrying in 3 seconds ..." err="cannot get events: cannot parse events: parse error: expected { near offset 275 of 'payload'" retry interval="3 seconds"
time="..." level=error msg="Failed to get updates, retrying in 3 seconds ..." err="cannot get events: cannot parse events: parse error: expected { near offset 275 of 'payload'" retry interval="3 seconds"
При вызове метода Bot.GetFileInfo с корректным fileId всегда возвращается ошибка "error while unmarshalling information: ...", т.к. в структуре File поле Name имеет тип bool, а метод API ICQ /files/getInfo возвращает в поле filename строку.
См. схему на https://icq.com/botapi/#/files/get_files_getInfo
file.go
type File struct {
// Id of the file
ID string `json:"fileId"`
// Type of the file
Type string `json:"type"`
// Size in bytes
Size uint64 `json:"size"`
// Name of file
Name bool `json:"filename"`
// URL to the file
URL string `json:"url"`
}
при замене типа на string ошибка уходит.
Если в сообщении с файлом есть форматированный текст, то форматирование не применяется потому что parseMode не проставляется. Есть возможность проставлять в params еще parseMode?
Ребят, а нельзя поставить что-то более удобное типа io.Reader
? Судя по всему библиотека не позволяет отправить файл в виде байтов, например если он был сгенерирован. Придется обязательно его локально сохранить и передать вам в виде *os.File
.
Steps to reproduce:
Expected behaviour:
current longpoll request is cancelled
Actual behaviour:
context is only used inside of poller, GetUpdates calls ignore the context
there's no way to use custom http client with this library :(
maybe a new BotOption should be added to set the http client?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.