// VoiceFn  add a function to be called when an audio arrives.
333126
func (bot *TgBot) VoiceFn(f func(TgBot, Message, Voice, string)) *TgBot {
	bot.addToConditionalFuncs(VoiceConditionalCall{f})
	return bot
}
744988
func ConnectFunc(network, addr string) func() (net.Conn, error) {
	return func() (net.Conn, error) {
		c, err := net.DialTimeout(network, addr, 15*time.Second)
		if err != nil {
			return nil, err
		}

		if tcpConn, ok := c.(*net.TCPConn); ok {
			tcpConn.SetKeepAlive(true)
		}

		return c, nil
	}
}
263806
func (client *Ivona) CreateSpeech(options SpeechOptions) (*SpeechResponse, error) {
	b, err := json.Marshal(options)

	if err != nil {
		return nil, err
	}

	r, _ := http.NewRequest("POST", createSpeechAPI, bytes.NewReader(b))
	r.Header.Set("Content-Type", "application/json")

	awsClient := aws4.Client{Keys: &aws4.Keys{
		AccessKey: client.AccessKey,
		SecretKey: client.SecretKey,
	}}

	resp, err := awsClient.Do(r)

	if err != nil {
		return nil, err
	}

	defer resp.Body.Close()

	data, err := ioutil.ReadAll(resp.Body)

	if err != nil {
		return nil, err
	}

	if resp.StatusCode != 200 {
		return nil, fmt.Errorf("Got non 200 status code: %s %q", resp.Status, data)
	}

	return &SpeechResponse{
		Audio:       data,
		RequestID:   resp.Header["X-Amzn-Ivonattsrequestid"][0],
		ContentType: resp.Header["Content-Type"][0],
	}, nil
}
936828
func (bot *TgBot) ImageFn(f func(TgBot, Message, []PhotoSize, string)) *TgBot {
	bot.addToConditionalFuncs(ImageConditionalCall{f})
	return bot
}
741920
func errorFunc(server string, w dns.ResponseWriter, r *dns.Msg, rc int) {
	state := request.Request{W: w, Req: r}

	answer := new(dns.Msg)
	answer.SetRcode(r, rc)
	state.SizeAndDo(answer)

	w.WriteMsg(answer)
}
756599
func (c *Cron) AddFunc(spec string, cmd func()) error {
	return c.AddJob(spec, FuncJob(cmd))
}
258128
func CallFunc(receiver interface{}, methodName string, args ...interface{}) interface{} {
	var ptr reflect.Value
	var value reflect.Value

	value, ok := receiver.(reflect.Value)

	if !ok {
		value = reflect.ValueOf(receiver)
	}

	funcArgs := WrapArguments(args...)

	ptr, value = getReflectPtrAndValue(value, receiver)

	method := value.MethodByName(methodName)

	if method.IsValid() {
		return UnwrapReflectValues(method.Call(funcArgs))
	}

	method = ptr.MethodByName(methodName)

	if method.IsValid() {
		return UnwrapReflectValues(method.Call(funcArgs))
	}

	panic(fmt.Sprintf("%T type objects don't have %s method.", value.Interface(), methodName))
}
1237736
func WithNameFunc(fn func(string) string) Option {
	return func(opt *options) {
		opt.nameFunc = fn
	}
}
874223
func (bot *TgBot) StickerFn(f func(TgBot, Message, Sticker, string)) *TgBot {
	bot.addToConditionalFuncs(StickerConditionalCall{f})
	return bot
}
1270705
func ColorFunc(style string) func(string) string {
	if style == "" {
		return func(s string) string {
			return s
		}
	}
	color := ColorCode(style)
	return func(s string) string {
		if plain || s == "" {
			return s
		}
		buf := bytes.NewBufferString(color)
		buf.WriteString(s)
		buf.WriteString(Reset)
		result := buf.String()
		return result
	}
}
352955
func (b *Base) AddFunc(key string, f ValueConverter) Serializer {
	return b.AddFuncIf(alwaysTrue, key, f)
}
226347
func (c *Callbacks) OnCSVCMsg_VoiceData(fn func(*dota.CSVCMsg_VoiceData) error) {
	c.onCSVCMsg_VoiceData = append(c.onCSVCMsg_VoiceData, fn)
}
1104980
func Printfln(format string, a ...interface{}) (n int, err error) {
	return Fprintfln(os.Stdout, format, a...)
}
497788
func SpeechEnd(listener func(*vecty.Event)) *vecty.EventListener {
	return &vecty.EventListener{Name: "speechend", Listener: listener}
}
790594
func (g *Group) ForFunc(f func(*Group)) *Statement {
	s := ForFunc(f)
	g.items = append(g.items, s)
	return s
}
823474
func (f CallerFunc) Call(ctx context.Context, c *scheduler.Call) (mesos.Response, error) {
	return f(ctx, c)
}
1080482
func Fn(name string, paramNames ...string) *Func {
	return &Func{
		Name:       name,
		ParamNames: paramNames,
	}
}