telebot: fix linter inspection problems

pull/300/head
Demian 4 years ago
parent 7a1d59c7d9
commit f82c0ec609

@ -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 {

@ -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{

@ -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))
}

@ -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 {

@ -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
}

@ -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)
}

@ -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
}

@ -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)

Loading…
Cancel
Save