1.1.8 • Published 8 months ago

mys-villa v1.1.8

Weekly downloads
-
License
GPL-2.0
Repository
-
Last release
8 months ago

MYS-VILLA-SDK

起步

npm install mys-villa

创建 index.js

import { createClient, Client, hmacSha256 } from 'mys-villa'
createClient(
  {
    // 账号
    bot_id: '',
    //  secre pub_key
    bot_secret: hmacSha256('secret', 'pub_key'),
    // 回调地址
    callback_url: '/api/mys/callback'
    // 即 http://ip:8080/api/mys/callback
    // 端口|图片缓存地址 可选
    // callback_port = 8080,
    // IMAGE_DIR = '/data/mys/img',
    // img_url = '/api/mys/img',
    // img_size = 999,
  },
  callBack, // 回调接收函数
  async () => {
    console.info('欢迎使用~')
  }
)
/**
 * 回调数据
 * @param event
 * @returns
 */
async function callBack(event) {
  console.info('数据包', event)
  // 请求分组列表
  const list = await Client.getGroupList(event.robot.villa_id)
  // 查看列表信息
  console.info(list)
  return
}

启动 index.js

node index.js

新接口不再支持原secret直接输入,需要经过hmacSha256哈希

特殊接口

模板消息

模板语法

<@!everyone> 艾特全体

<@!{{uid}}> 艾特用户

<#{{cid}}> 引入频道

[${name}](${url}) 引入外链

解析模板

import { stringParsing } from 'mys-villa'
const { entities , content } =  stringParsing(msg: string | string[], villa_id: number)

entities 特效对象

content 模板消息

接口文档

SDK接口命名同官方接口

官方文档☞API

实际用例

阿柠檬机器人

开源协议

GNU GPL 是使用最广泛的自由软件许可证,并有强烈的版权要求

分发衍生作品时,作品的源代码必须在同一许可证下可用

GNUGPL 有多种变体,每个变体都有不同的要求

1.1.8

8 months ago

1.1.7

8 months ago

1.1.1

8 months ago

1.1.6

8 months ago

1.1.5

8 months ago

1.1.4

8 months ago

1.1.3

8 months ago

1.1.2

8 months ago

1.1.0

9 months ago

1.0.10

10 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago