Fixes lots of complete bollocks that got into the codebase.

- Malformed JSON field tags, OMG fixed
- Making linters happy
- Foursquare_id -> FoursquareID, fuck BC
pull/76/head^2
Ian Byrd 8 years ago
parent 276daa0732
commit d8b2ca1983
No known key found for this signature in database
GPG Key ID: 598F598CA3B8055F

@ -49,7 +49,7 @@ func (b *Bot) poll(
callbacks chan Callback,
timeout time.Duration,
) {
var latestUpdate int64 = 0
var latestUpdate int64
for {
updates, err := getUpdates(b.Token,
@ -462,8 +462,8 @@ func (b *Bot) SendVenue(recipient Recipient, venue *Venue, options *SendOptions)
"longitude": fmt.Sprintf("%f", venue.Location.Longitude),
"title": venue.Title,
"address": venue.Address}
if venue.Foursquare_id != "" {
params["foursquare_id"] = venue.Foursquare_id
if venue.FoursquareID != "" {
params["foursquare_id"] = venue.FoursquareID
}
if options != nil {
@ -733,7 +733,7 @@ func (b *Bot) GetChatAdministrators(recipient Recipient) ([]ChatMember, error) {
var responseRecieved struct {
Ok bool
Result []ChatMember
Description string `json:"description",omitempty`
Description string `json:"description"`
}
err = json.Unmarshal(responseJSON, &responseRecieved)
@ -763,7 +763,7 @@ func (b *Bot) GetChatMembersCount(recipient Recipient) (int, error) {
var responseRecieved struct {
Ok bool
Result int
Description string `json:"description",omitempty`
Description string `json:"description"`
}
err = json.Unmarshal(responseJSON, &responseRecieved)
@ -793,7 +793,7 @@ func (b *Bot) GetUserProfilePhotos(recipient Recipient) (UserProfilePhotos, erro
var responseRecieved struct {
Ok bool
Result UserProfilePhotos
Description string `json:"description",omitempty`
Description string `json:"description"`
}
err = json.Unmarshal(responseJSON, &responseRecieved)
@ -824,7 +824,7 @@ func (b *Bot) GetChatMember(recipient Recipient, user User) (ChatMember, error)
var responseRecieved struct {
Ok bool
Result ChatMember
Description string `json:"description",omitempty`
Description string `json:"description"`
}
err = json.Unmarshal(responseJSON, &responseRecieved)

@ -19,7 +19,7 @@ type InputTextMessageContent struct {
ParseMode string `json:"parse_mode,omitempty"`
// Optional. Disables link previews for links in the sent message.
DisablePreview bool `json:"disable_web_page_preview`
DisablePreview bool `json:"disable_web_page_preview"`
}
func (input *InputTextMessageContent) IsInputMessageContent() bool {

@ -129,9 +129,9 @@ type Message struct {
// Sender would lead to creator of the migration.
MigrateFrom int64 `json:"migrate_from_chat_id"`
Entities []MessageEntity `json:"entities",omitempty`
Caption string `json:"caption",omitempty`
Entities []MessageEntity `json:"entities,omitempty"`
Caption string `json:"caption,omitempty"`
}
// Origin returns an origin of message: group chat / personal.

@ -210,10 +210,10 @@ type CallbackResponse struct {
// Venue object represents a venue location with name, address and optional foursquare id.
type Venue struct {
Location Location `json:"location"`
Title string `json:"title"`
Address string `json:"address"`
Foursquare_id string `json:"foursquare_id",omitempty`
Location Location `json:"location"`
Title string `json:"title"`
Address string `json:"address"`
FoursquareID string `json:"foursquare_id,omitempty"`
}
// MessageEntity
@ -234,10 +234,10 @@ type MessageEntity struct {
Length int `json:"length"`
//url Optional. For “text_link” only, url that will be opened after user taps on the text
Url string `json:"url",omitempty`
Url string `json:"url,omitempty"`
//user Optional. For “text_mention” only, the mentioned user
User User `json:"user",omitempty`
User User `json:"user,omitempty"`
}
// ChatMember ,

Loading…
Cancel
Save