telebot: some fixes

pull/408/head
Nikita 3 years ago
parent 6684383594
commit 2d4921e1ea

@ -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"`

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

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

@ -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)
}
Loading…
Cancel
Save