func (b *Bot) paramToString(param interface{}) (result string, success bool) {
	switch val := param.(type) {
	case int:
		return strconv.Itoa(val), true
	case int64:
		return strconv.FormatInt(val, 10), true
	case float32:
		return fmt.Sprintf("%.8f", val), true
	case bool:
		return strconv.FormatBool(val), true
	case string:
		return val, true
	case ChatAction:
		return string(val), true
	case ParseMode:
		return string(val), true
	case InputFile:
		if val.URL != nil {
			return *val.URL, true
		}
		if val.FileID != nil {
			return *val.FileID, true
		}
		b.error("parameter '%+v' could not be cast to string value", param)
	default: // fallback: encode to JSON string
		json, err := json.Marshal(param)
		if err == nil {
			return string(json), true
		}
		b.error("parameter '%+v' could not be encoded as json: %s", param, err)
	}

	return "", false
}
// Convert given interface to string. (for HTTP params)
Convert given interface to string. (for HTTP params)
// Convert given interface to string . ( for HTTP params )
func (b *Bot) paramToString(param interface{}) (result string, success bool) {
	switch val := param.(type) {
	case int:
		return strconv.Itoa(val), true
	case int64:
		return strconv.FormatInt(val, 10), true
	case float32:
		return fmt.Sprintf("%.8f", val), true
	case bool:
		return strconv.FormatBool(val), true
	case string:
		return val, true
	case ChatAction:
		return string(val), true
	case ParseMode:
		return string(val), true
	case InputFile:
		if val.URL != nil {
			return *val.URL, true
		}
		if val.FileID != nil {
			return *val.FileID, true
		}
		b.error("parameter '%+v' could not be cast to string value", param)
	default: 
		json, err := json.Marshal(param)
		if err == nil {
			return string(json), true
		}
		b.error("parameter '%+v' could not be encoded as json: %s", param, err)
	}
	return "", false
}
func ( b * Bot ) paramToString ( param interface { } ) ( result string , success bool ) { switch val := param . ( type ) { case int : return strconv . Itoa ( val ) , true case int64 : return strconv . FormatInt ( val , 10 ) , true case float32 : return fmt . Sprintf ( " " , val ) , true case bool : return strconv . FormatBool ( val ) , true case string : return val , true case ChatAction : return string ( val ) , true case ParseMode : return string ( val ) , true case InputFile : if val . URL != nil { return * val . URL , true } if val . FileID != nil { return * val . FileID , true } b . error ( " " , param ) default : json , err := json . Marshal ( param ) if err == nil { return string ( json ) , true } b . error ( " " , param , err ) } return " " , false }
Convert given interface to string.
Convert given interface to string .
// fallback: encode to JSON string