Drying
This commit is contained in:
parent
57a07c0c22
commit
4610c561c6
2 changed files with 25 additions and 40 deletions
|
@ -1,10 +1,10 @@
|
|||
package tgbotapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// Telegram constants
|
||||
|
@ -44,7 +44,7 @@ type Chattable struct {
|
|||
ChannelUsername string
|
||||
}
|
||||
|
||||
func (chattable *Chattable) Values() (url.Values, error){
|
||||
func (chattable *Chattable) Values() (url.Values, error) {
|
||||
v := url.Values{}
|
||||
if chattable.ChannelUsername != "" {
|
||||
v.Add("chat_id", chattable.ChannelUsername)
|
||||
|
@ -83,7 +83,6 @@ func (config *MessageConfig) Values() (url.Values, error) {
|
|||
v.Add("reply_markup", string(data))
|
||||
}
|
||||
|
||||
|
||||
return v, nil
|
||||
}
|
||||
|
||||
|
@ -330,6 +329,7 @@ func (config *LocationConfig) Values() (url.Values, error) {
|
|||
|
||||
v.Add("latitude", strconv.FormatFloat(config.Latitude, 'f', 6, 64))
|
||||
v.Add("longitude", strconv.FormatFloat(config.Longitude, 'f', 6, 64))
|
||||
|
||||
if config.ReplyToMessageID != 0 {
|
||||
v.Add("reply_to_message_id", strconv.Itoa(config.ReplyToMessageID))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue