func (b *Bot) requestResponseMessageOrBool(method string, params map[string]interface{}) (result APIResponseMessageOrBool) {
	var errStr string

	if bytes, err := b.request(method, params); err == nil {
		// try APIResponseMessage type,
		var jsonResponseMessage APIResponseMessage
		err = json.Unmarshal(bytes, &jsonResponseMessage)
		if err == nil {
			return APIResponseMessageOrBool{
				APIResponseBase: APIResponseBase{Ok: true, Description: jsonResponseMessage.Description},
				ResultMessage:   jsonResponseMessage.Result,
			}
		}

		// then try APIResponseBool type,
		var jsonResponseBool APIResponseBool
		err = json.Unmarshal(bytes, &jsonResponseBool)
		if err == nil {
			return APIResponseMessageOrBool{
				APIResponseBase: APIResponseBase{Ok: true, Description: jsonResponseBool.Description},
				ResultBool:      &jsonResponseBool.Result,
			}
		}

		errStr = fmt.Sprintf("json parse error: not in Message nor bool type (%s)", string(bytes))
	} else {
		errStr = fmt.Sprintf("%s failed with error: %s", method, err)
	}

	b.error(errStr)

	return APIResponseMessageOrBool{APIResponseBase: APIResponseBase{Ok: false, Description: &errStr}}
}
// Send request for APIResponseMessageOrBool and fetch its result.
Send request for APIResponseMessageOrBool and fetch its result.
// Send request for APIResponseMessageOrBool and fetch its result .
func (b *Bot) requestResponseMessageOrBool(method string, params map[string]interface{}) (result APIResponseMessageOrBool) {
	var errStr string
	if bytes, err := b.request(method, params); err == nil {
		var jsonResponseMessage APIResponseMessage
		err = json.Unmarshal(bytes, &jsonResponseMessage)
		if err == nil {
			return APIResponseMessageOrBool{
				APIResponseBase: APIResponseBase{Ok: true, Description: jsonResponseMessage.Description},
				ResultMessage:   jsonResponseMessage.Result,
			}
		}
		var jsonResponseBool APIResponseBool
		err = json.Unmarshal(bytes, &jsonResponseBool)
		if err == nil {
			return APIResponseMessageOrBool{
				APIResponseBase: APIResponseBase{Ok: true, Description: jsonResponseBool.Description},
				ResultBool:      &jsonResponseBool.Result,
			}
		}
		errStr = fmt.Sprintf("json parse error: not in Message nor bool type (%s)", string(bytes))
	} else {
		errStr = fmt.Sprintf("%s failed with error: %s", method, err)
	}
	b.error(errStr)
	return APIResponseMessageOrBool{APIResponseBase: APIResponseBase{Ok: false, Description: &errStr}}
}
func ( b * Bot ) requestResponseMessageOrBool ( method string , params map [ string ] interface { } ) ( result APIResponseMessageOrBool ) { var errStr string if bytes , err := b . request ( method , params ) ; err == nil { var jsonResponseMessage APIResponseMessage err = json . Unmarshal ( bytes , & jsonResponseMessage ) if err == nil { return APIResponseMessageOrBool { APIResponseBase : APIResponseBase { Ok : true , Description : jsonResponseMessage . Description } , ResultMessage : jsonResponseMessage . Result , } } var jsonResponseBool APIResponseBool err = json . Unmarshal ( bytes , & jsonResponseBool ) if err == nil { return APIResponseMessageOrBool { APIResponseBase : APIResponseBase { Ok : true , Description : jsonResponseBool . Description } , ResultBool : & jsonResponseBool . Result , } } errStr = fmt . Sprintf ( " " , string ( bytes ) ) } else { errStr = fmt . Sprintf ( " " , method , err ) } b . error ( errStr ) return APIResponseMessageOrBool { APIResponseBase : APIResponseBase { Ok : false , Description : & errStr } } }
Send request for APIResponseMessageOrBool and fetch its result.
Send request for APIResponseMessageOrBool and fetch its result .
// try APIResponseMessage type, // then try APIResponseBool type,