From f82c0ec609cef72e259278aa362424c0e489ddc7 Mon Sep 17 00:00:00 2001 From: Demian Date: Thu, 21 May 2020 12:02:35 +0300 Subject: [PATCH] telebot: fix linter inspection problems --- README.md | 14 ++++++++------ bot.go | 12 ++++++------ callbacks.go | 10 +++++----- editable.go | 2 +- errors.go | 6 +++--- options.go | 16 ++++++++-------- polls.go | 2 +- webhook.go | 2 +- 8 files changed, 33 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index dfaa56b..0eef986 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,6 @@ go get -u gopkg.in/tucnak/telebot.v2 - [Editable](#editable) - [Keyboards](#keyboards) - [Inline mode](#inline-mode) - - [Poll](#poll) * [Contributing](#contributing) * [Donate](#donate) * [License](#license) @@ -45,10 +44,13 @@ Let's take a look at the minimal telebot setup: package main import ( - "time" - "log" +"log" +"time" - tb "gopkg.in/tucnak/telebot.v2" + + + +tb "gopkg.in/tucnak/telebot.v2" ) func main() { @@ -105,7 +107,7 @@ b.Handle(tb.OnQuery, func (q *tb.Query) { There's dozens of supported endpoints (see package consts). Let me know if you'd like to see some endpoint or endpoint idea implemented. This system is completely extensible, so I can introduce them without breaking -backwards-compatibity. +backwards-compatibility. ## Poller Telebot doesn't really care how you provide it with incoming updates, as long @@ -273,7 +275,7 @@ it made sense for *any* Go struct to be editable as a Telegram message, to imple // for edit operations. // // Use case: DB model struct for messages to-be -// edited with, say two collums: msg_id,chat_id +// edited with, say two columns: msg_id,chat_id // could easily implement MessageSig() making // instances of stored messages editable. type Editable interface { diff --git a/bot.go b/bot.go index b11559f..6d2faeb 100644 --- a/bot.go +++ b/bot.go @@ -119,7 +119,7 @@ type Update struct { // Command represents a bot command. type Command struct { - // Text is a aext of the command, 1-32 characters. + // Text is a text of the command, 1-32 characters. // Can contain only lowercase English letters, digits and underscores. Text string `json:"command"` @@ -196,7 +196,7 @@ func (b *Bot) ProcessUpdate(upd Update) { // Commands if m.Text != "" { - // Filtering malicious messsages + // Filtering malicious messages if m.Text[0] == '\a' { return } @@ -494,7 +494,7 @@ func (b *Bot) handleMedia(m *Message) bool { // // - *SendOptions (the actual object accepted by Telegram API) // - *ReplyMarkup (a component of SendOptions) -// - Option (a shorcut flag for popular options) +// - Option (a shortcut flag for popular options) // - ParseMode (HTML, Markdown, etc) // func (b *Bot) Send(to Recipient, what interface{}, options ...interface{}) (*Message, error) { @@ -945,9 +945,9 @@ func (b *Bot) Notify(to Recipient, action ChatAction) error { // requesting an address and the parameter is_flexible was specified. // // Usage: -// b.Ship(query) // OK -// b.Ship(query, options...) // OK with options -// b.Ship(query, "Oops!") // Error message +// b.Ship(query) // OK +// b.Ship(query, opts...) // OK with options +// b.Ship(query, "Oops!") // Error message // func (b *Bot) Ship(query *ShippingQuery, what ...interface{}) error { params := map[string]string{ diff --git a/callbacks.go b/callbacks.go index 527d4b8..4e2fa60 100644 --- a/callbacks.go +++ b/callbacks.go @@ -95,7 +95,7 @@ func (t *InlineButton) With(data string) *InlineButton { } } -// CallbackUnique returns InlineButto.Unique. +// CallbackUnique returns InlineButton.Unique. func (t *InlineButton) CallbackUnique() string { return "\f" + t.Unique } @@ -119,15 +119,15 @@ type Login struct { // It needed to avoid InlineQueryChat and Login fields conflict. // If you have Login field in your button, InlineQueryChat must be skipped. func (t *InlineButton) MarshalJSON() ([]byte, error) { - type InineButtonJSON InlineButton + type InlineButtonJSON InlineButton if t.Login != nil { return json.Marshal(struct { - InineButtonJSON + InlineButtonJSON InlineQueryChat string `json:"switch_inline_query_current_chat,omitempty"` }{ - InineButtonJSON: InineButtonJSON(*t), + InlineButtonJSON: InlineButtonJSON(*t), }) } - return json.Marshal(InineButtonJSON(*t)) + return json.Marshal(InlineButtonJSON(*t)) } diff --git a/editable.go b/editable.go index f00a95f..ec1fb5b 100644 --- a/editable.go +++ b/editable.go @@ -6,7 +6,7 @@ package telebot // for edit operations. // // Use case: DB model struct for messages to-be -// edited with, say two collums: msg_id,chat_id +// edited with, say two columns: msg_id,chat_id // could easily implement MessageSig() making // instances of stored messages editable. type Editable interface { diff --git a/errors.go b/errors.go index f740479..5673d59 100644 --- a/errors.go +++ b/errors.go @@ -76,7 +76,7 @@ var ( ErrWrongFileIDCharacter = NewAPIError(400, "Bad Request: wrong remote file id specified: Wrong character in the string") ErrWrongFileIDPadding = NewAPIError(400, "Bad Request: wrong remote file id specified: Wrong padding in the string") ErrFailedImageProcess = NewAPIError(400, "Bad Request: IMAGE_PROCESS_FAILED", "Image process failed") - ErrInvaliadStickerset = NewAPIError(400, "Bad Request: STICKERSET_INVALID", "Stickerset is invalid") + ErrInvalidStickerSet = NewAPIError(400, "Bad Request: STICKERSET_INVALID", "Stickerset is invalid") ErrBadPollOptions = NewAPIError(400, "Bad Request: expected Array of String as options") // No rights errors @@ -164,8 +164,8 @@ func ErrByDescription(s string) error { return ErrWrongFileIDPadding case ErrFailedImageProcess.ʔ(): return ErrFailedImageProcess - case ErrInvaliadStickerset.ʔ(): - return ErrInvaliadStickerset + case ErrInvalidStickerSet.ʔ(): + return ErrInvalidStickerSet default: return nil } diff --git a/options.go b/options.go index 7641e5e..f777922 100644 --- a/options.go +++ b/options.go @@ -5,7 +5,7 @@ import ( "fmt" ) -// Option is a shorcut flag type for certain message features +// Option is a shortcut flag type for certain message features // (so-called options). It means that instead of passing // fully-fledged SendOptions* to Send(), you can use these // flags instead. @@ -93,7 +93,7 @@ type ReplyMarkup struct { // Requests clients to remove the reply keyboard. // - // Dafaults to false. + // Defaults to false. ReplyKeyboardRemove bool `json:"remove_keyboard,omitempty"` // Use this param if you want to force reply from @@ -106,17 +106,17 @@ type ReplyMarkup struct { Selective bool `json:"selective,omitempty"` } -func (og *ReplyMarkup) copy() *ReplyMarkup { - cp := *og +func (r *ReplyMarkup) copy() *ReplyMarkup { + cp := *r - cp.ReplyKeyboard = make([][]ReplyButton, len(og.ReplyKeyboard)) - for i, row := range og.ReplyKeyboard { + cp.ReplyKeyboard = make([][]ReplyButton, len(r.ReplyKeyboard)) + for i, row := range r.ReplyKeyboard { cp.ReplyKeyboard[i] = make([]ReplyButton, len(row)) copy(cp.ReplyKeyboard[i], row) } - cp.InlineKeyboard = make([][]InlineButton, len(og.InlineKeyboard)) - for i, row := range og.InlineKeyboard { + cp.InlineKeyboard = make([][]InlineButton, len(r.InlineKeyboard)) + for i, row := range r.InlineKeyboard { cp.InlineKeyboard[i] = make([]InlineButton, len(row)) copy(cp.InlineKeyboard[i], row) } diff --git a/polls.go b/polls.go index dae11bc..bd44c65 100644 --- a/polls.go +++ b/polls.go @@ -44,7 +44,7 @@ func (p *Poll) IsRegular() bool { return p.Type == PollRegular } -// IsQuiz says wheter poll is a quiz. +// IsQuiz says whether poll is a quiz. func (p *Poll) IsQuiz() bool { return p.Type == PollQuiz } diff --git a/webhook.go b/webhook.go index cd9263a..a17a1c0 100644 --- a/webhook.go +++ b/webhook.go @@ -37,7 +37,7 @@ type WebhookEndpoint struct { // add the Webhook to a http-mux. type Webhook struct { Listen string `json:"url"` - MaxConnections int `json:"max_conecctions"` + MaxConnections int `json:"max_connections"` AllowedUpdates []string `json:"allowed_updates"` // (WebhookInfo)