Skip to content
This repository has been archived by the owner on Aug 9, 2023. It is now read-only.

go-packagist/youdu

Repository files navigation

youdu

👻👻 说明:该项目已捐赠至 AddcnOS 维护

Youdu Go SDK

Go Report Card GoDoc MIT license

Feature

Installation

go get github.com/go-packagist/youdu

Usage

package main

import (
	"github.com/go-packagist/youdu"
	"github.com/go-packagist/youdu/message"
	"log"
)

func main() {
	yd := youdu.New(&youdu.Config{
		Api:    "http://domain.com/api",
		Buin:   1111111,
		AppId:  "22222222222222",
		AesKey: "3444444444444444444444444444444444",
	})

	yd.Message().SendText("11111", "test")
	yd.Message().Send(&message.TextMessage{
		ToUser:  "11111",
		ToDept:  "",
		MsgType: message.MsgTypeText,
		Text: &message.TextItem{
			Content: "test",
		},
	})

	mediaId, err := yd.Media().Upload(youdu.MediaTypeImage, "test.jpeg")
	if err != nil {
		panic(err)
	}
	yd.Message().Send(&message.ImageMessage{
		ToUser:  "11111",
		ToDept:  "",
		MsgType: message.MsgTypeImage,
		Image: &message.MediaItem{
			MediaId: mediaId,
		},
	})

}