// Answer start a Send petition answering the message. See Send* structs (SendPhoto, SendText, ...)
163057
func (bot *TgBot) Answer(msg Message) *Send {
	return &Send{msg.Chat.ID, bot}
}
1224487
func (s *Send) Photo(photo interface{}) *SendPhoto {
	// Check here that the interface works?
	return &SendPhoto{s, photo, nil, nil, nil}
}
1318338
func (r *Response) Send(msg string) {
	r.bot.Client.Send(r, msg)
}
125288
func (r *GetxattrRequest) Respond(resp *GetxattrResponse) {
	if r.Size == 0 {
		buf := newBuffer(unsafe.Sizeof(getxattrOut{}))
		out := (*getxattrOut)(buf.alloc(unsafe.Sizeof(getxattrOut{})))
		out.Size = uint32(len(resp.Xattr))
		r.respond(buf)
	} else {
		buf := newBuffer(uintptr(len(resp.Xattr)))
		buf = append(buf, resp.Xattr...)
		r.respond(buf)
	}
}
191538
func (r *Request) Reply(ok bool, payload []byte) error {
	if !r.WantReply {
		return nil
	}

	if r.ch == nil {
		return r.mux.ackRequest(ok, payload)
	}

	return r.ch.ackRequest(ok)
}
204504
func (r *BeeResponse) Send(response *restful.Response) {
	var keys []string
	for k := range r.bees {
		keys = append(keys, k)
	}
	sort.Strings(keys)

	for _, k := range keys {
		r.Bees = append(r.Bees, prepareBeeResponse(r.Context, r.bees[k]))
	}

	r.Response.Send(response)
}
728342
func (r *InitRequest) Respond(resp *InitResponse) {
	buf := newBuffer(unsafe.Sizeof(initOut{}))
	out := (*initOut)(buf.alloc(unsafe.Sizeof(initOut{})))
	out.Major = resp.Library.Major
	out.Minor = resp.Library.Minor
	out.MaxReadahead = resp.MaxReadahead
	out.Flags = uint32(resp.Flags)
	out.MaxWrite = resp.MaxWrite

	// MaxWrite larger than our receive buffer would just lead to
	// errors on large writes.
	if out.MaxWrite > maxWrite {
		out.MaxWrite = maxWrite
	}
	r.respond(buf)
}
550891
func (sm *storeManager) respond() {
	for w, req := range sm.waiting {
		revno := w.revno
		changes := sm.all.ChangesSince(revno)
		if len(changes) == 0 {
			if req.noChanges != nil {
				req.noChanges <- struct{}{}
				sm.removeWaitingReq(w, req)
			}
			continue
		}

		req.changes = changes
		w.revno = sm.all.latestRevno
		select {
		case req.reply <- true:
		case <-sm.tomb.Dying():
		}
		sm.removeWaitingReq(w, req)
		sm.seen(revno)
	}
}
924156
func (qs *queryResponseStream) sendResponse(from string, payload []byte) error {
	header := responseHeader{
		Seq:   qs.seq,
		Error: "",
	}
	rec := queryRecord{
		Type:    queryRecordResponse,
		From:    from,
		Payload: payload,
	}
	return qs.client.Send(&header, &rec)
}
622379
func (p *Photo) Send(b *Bot, to Recipient, opt *SendOptions) (*Message, error) {
	params := map[string]string{
		"chat_id": to.Recipient(),
		"caption": p.Caption,
	}

	embedSendOptions(params, opt)

	msg, err := b.sendObject(&p.File, "photo", params, nil)
	if err != nil {
		return nil, err
	}

	msg.Photo.File.stealRef(&p.File)
	*p = *msg.Photo

	return msg, nil
}
975339
func (r *ChainResponse) Send(response *restful.Response) {
	var keys []string
	for k := range r.chains {
		keys = append(keys, k)
	}
	sort.Strings(keys)

	for _, k := range keys {
		r.Chains = append(r.Chains, prepareChainResponse(r.Context, r.chains[k]))
	}

	r.Response.Send(response)
}
1265450
func Respond(r *http.Response, decorators ...RespondDecorator) error {
	if r == nil {
		return nil
	}
	return CreateResponder(decorators...).Respond(r)
}
1086158
func (p *Prompt) Ask(q *prompt.Question) (prompt.Response, error) {
	term, err := cp.NewTerminal()
	if err != nil {
		return prompt.RespCancel, err
	}

	if len(q.Error) > 0 {
		fmt.Fprintf(term.Out, "%s\n\n", q.Error)
	}

	switch q.Type {
	default:
		panic("Unknown question type")
	case prompt.TypeSelectMultiple:
		return prompt.RespCancel, fmt.Errorf("Selecting multiple isn't currently supported")
	case prompt.TypeSelectOne:
		return getSingle(term, q)
	}
}
567829
func (r *OpenRequest) Respond(resp *OpenResponse) {
	buf := newBuffer(unsafe.Sizeof(openOut{}))
	out := (*openOut)(buf.alloc(unsafe.Sizeof(openOut{})))
	out.Fh = uint64(resp.Handle)
	out.OpenFlags = uint32(resp.Flags)
	r.respond(buf)
}
364011
func (c check) respond(err error) {
	select {
	case <-c.stop:
	case c.response <- err:
	}
}
79203
func (a *adapter) Reply(res *hal.Response, strings ...string) error {
	newStrings := make([]string, len(strings))
	for _, str := range strings {
		s := fmt.Sprintf("@%s: %s", mentionName(res.Envelope.User), str)
		newStrings = append(newStrings, s)
	}

	return a.Send(res, newStrings...)
}
77250
func (c *RPCClient) Respond(id uint64, buf []byte) error {
	header := requestHeader{
		Command: respondCommand,
		Seq:     c.getSeq(),
	}
	req := respondRequest{
		ID:      id,
		Payload: buf,
	}
	return c.genericRPC(&header, &req, nil)
}