diff --git a/message.go b/message.go index 2ab2ee6..b14efbc 100644 --- a/message.go +++ b/message.go @@ -221,7 +221,7 @@ type Message struct { // Inline keyboard attached to the message. ReplyMarkup InlineKeyboardMarkup `json:"reply_markup"` - VoiceChatSchedule *VoiceChatSchedule `json:"voice_chat_scheduled,omitempty"` + VoiceChatSchedule *VoiceChatScheduled `json:"voice_chat_scheduled,omitempty"` // For a service message, a voice chat started in the chat. VoiceChatStarted *VoiceChatStarted `json:"voice_chat_started,omitempty"` diff --git a/sendable.go b/sendable.go index c843896..7047494 100644 --- a/sendable.go +++ b/sendable.go @@ -5,6 +5,7 @@ import ( "fmt" "path/filepath" "strconv" + "strings" ) // Recipient is any possible endpoint you can send @@ -345,7 +346,7 @@ func (i *Invoice) Send(b *Bot, to Recipient, opt *SendOptions) (*Message, error) params["prices"] = string(data) } if len(i.SuggestedTipAmounts) > 0 { - params["suggested_tip_amounts"] = sliceIntToString(i.SuggestedTipAmounts) + params["suggested_tip_amounts"] = "[" + strings.Join(intsToStrs(i.SuggestedTipAmounts), ",") + "]" } b.embedSendOptions(params, opt) diff --git a/util.go b/util.go index 4c95b24..f316f12 100644 --- a/util.go +++ b/util.go @@ -252,10 +252,9 @@ func isUserInList(user *User, list []User) bool { return false } -func sliceIntToString(ns []int) (s string) { +func intsToStrs(ns []int) (s []string) { for _, n := range ns { - s += strconv.Itoa(n) + "," + s = append(s, strconv.Itoa(n)) } - s = s[:len(s)-1] return } diff --git a/voicechat.go b/voice.go similarity index 69% rename from voicechat.go rename to voice.go index 549b37d..7e8f967 100644 --- a/voicechat.go +++ b/voice.go @@ -18,12 +18,12 @@ type VoiceChatParticipantsInvited struct { Users []User `json:"users"` } -// VoiceChatSchedule represents a service message about a voice chat scheduled in the chat. -type VoiceChatSchedule struct { - StartUnixTime int64 `json:"start_date"` +// VoiceChatScheduled represents a service message about a voice chat scheduled in the chat. +type VoiceChatScheduled struct { + Unixtime int64 `json:"start_date"` } // ExpireDate returns the point when the voice chat is supposed to be started by a chat administrator. -func (v *VoiceChatSchedule) ExpireDate() time.Time { - return time.Unix(v.StartUnixTime, 0) +func (v *VoiceChatScheduled) ExpireDate() time.Time { + return time.Unix(v.Unixtime, 0) }