// Send delivers media through bot b to recipient.
771990
func (v *VideoNote) Send(b *Bot, to Recipient, opt *SendOptions) (*Message, error) {
	params := map[string]string{
		"chat_id": to.Recipient(),
	}

	if v.Duration != 0 {
		params["duration"] = strconv.Itoa(v.Duration)
	}
	if v.Length != 0 {
		params["length"] = strconv.Itoa(v.Length)
	}

	embedSendOptions(params, opt)

	msg, err := b.sendObject(&v.File, "videoNote", params, thumbnailToFilemap(v.Thumbnail))
	if err != nil {
		return nil, err
	}

	msg.VideoNote.File.stealRef(&v.File)
	*v = *msg.VideoNote

	return msg, nil
}
161779
func (bot TgBot) SendVideo(cid int, photo string, caption *string, duration *int, rmi *int, rm *ReplyMarkupInt) ResultWithMessage {
	var payload interface{} = SendVideoIDQuery{cid, photo, duration, caption, rmi, rm}
	if looksLikePath(photo) {
		payload = SendVideoPathQuery{cid, photo, duration, caption, rmi, rm}
	}
	return bot.SendVideoQuery(payload)
}
136533
func (c *Client) Send(ctx context.Context, msg interface{}) error {
	return c.asynchronous.Send(ctx, msg)
}
1245477
func (link Link) Send(m amqp.Message) (Delivery, error) {
	bytes, err := m.Encode(nil)
	if err != nil {
		return Delivery{}, err
	}
	d, err := link.SendMessageBytes(bytes)
	return d, err
}
1132364
func (c *Client) Send(msg *Message) error {
	buf, err := json.Marshal(msg)
	if err != nil {
		return err
	}
	resp, err := c.HTTPClient.Post(c.url, "application/json", bytes.NewReader(buf))
	if err != nil {
		return err
	}
	defer resp.Body.Close()

	// Discard response body to reuse connection
	io.Copy(ioutil.Discard, resp.Body)

	if resp.StatusCode != 200 {
		return fmt.Errorf("unexpected status code: %d", resp.StatusCode)
	}
	return nil
}
389611
func (c *conn) Send(m Message) error {
	b, err := m.MarshalBinary()
	if err != nil {
		return err
	}

	addr := &unix.SockaddrNetlink{
		Family: unix.AF_NETLINK,
	}

	return os.NewSyscallError("sendmsg", c.s.Sendmsg(b, nil, addr, 0))
}
166773
func (c *Connection) Send(ctx context.Context, messageParts ...[]byte) (<-chan Message, error) {
	if ctx == nil {
		ctx = context.Background()
	}
	msgID := atomic.AddUint64(&c.lastMessageID, 1)
	chunks, err := buildChunks(msgID, c.maxChunkSize, messageParts...)
	if err != nil {
		return nil, driver.WithStack(err)
	}
	// Prepare for receiving a response
	m := c.msgStore.Add(msgID)
	responseChan := m.responseChan

	//panic(fmt.Sprintf("chunks: %d, messageParts: %d, first: %s", len(chunks), len(messageParts), hex.EncodeToString(messageParts[0])))

	// Send all chunks
	sendErrors := make(chan error)
	deadline, ok := ctx.Deadline()
	if !ok {
		deadline = time.Time{}
	}
	go func() {
		defer close(sendErrors)
		for _, chunk := range chunks {
			if err := c.sendChunk(deadline, chunk); err != nil {
				// Cancel response
				c.msgStore.Remove(msgID)
				// Return error
				sendErrors <- driver.WithStack(err)
				return
			}
		}
	}()

	// Wait for sending to be ready, or context to be cancelled.
	select {
	case err := <-sendErrors:
		if err != nil {
			return nil, driver.WithStack(err)
		}
		return responseChan, nil
	case <-ctx.Done():
		return nil, ctx.Err()
	}
}
241087
func (c *ClientStream) Send(message proto.Message, options ...yarpc.StreamOption) error {
	return writeToStream(context.Background(), c.stream, message)
}
795462
func (r *reply) send(bv uint64) error {
	type resp struct {
		ReqID, BV uint64
		Data      rlp.RawValue
	}
	return p2p.Send(r.w, r.msgcode, resp{r.reqID, bv, r.data})
}
128907
func (rc *Response) Send(response *restful.Response) {
	rc.SendWithHeader(http.StatusOK, response)
}
1318338
func (r *Response) Send(msg string) {
	r.bot.Client.Send(r, msg)
}
376494
func (whisper *Whisper) Send(envelope *Envelope) error {
	ok, err := whisper.add(envelope, false)
	if err == nil && !ok {
		return fmt.Errorf("failed to add envelope")
	}
	return err
}
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
}
363509
func (u *User) Send(message string) {
	textMessage := TextMessage{
		Users:   []*User{u},
		Message: message,
	}
	u.client.Send(&textMessage)
}
109309
func (i *Invoice) Send(b *Bot, to Recipient, opt *SendOptions) (*Message, error) {
	prices, _ := json.Marshal(i.Prices)

	params := map[string]string{
		"chat_id":         to.Recipient(),
		"title":           i.Title,
		"description":     i.Description,
		"start_parameter": i.Start,
		"payload":         i.Payload,
		"provider_token":  i.Token,
		"currency":        i.Currency,
		"prices":          string(prices),
	}
	embedSendOptions(params, opt)

	respJSON, err := b.Raw("sendInvoice", params)
	if err != nil {
		return nil, err
	}

	return extractMsgResponse(respJSON)
}
477362
func (c *Client) send(pkt packet.Generic, async bool) error {
	// send packet
	err := c.conn.Send(pkt, async)
	if err != nil {
		return err
	}

	c.backend.Log(PacketSent, c, pkt, nil, nil)

	return nil
}
654065
func (s *SMTPEmailService) Send(recipients []string, subject string, message string) (err error) {
	gomsg := gomail.NewMessage()
	gomsg.SetHeader("Subject", subject)
	gomsg.SetHeader("From", "noreply@itsyou.online")
	gomsg.SetHeader("To", recipients...)
	gomsg.SetBody("text/html", message)
	err = s.dialer.DialAndSend(gomsg)
	if err != nil {
		log.Error("Failed to send email ", err)
	}
	return
}