Giter Site home page Giter Site logo

mirai-api-http's Introduction

logo
title

Gitter Actions Status

Mirai 是一个在全平台下运行,提供 QQ Android 和 TIM PC 协议支持的高效率机器人框架

这个项目的名字来源于

京都动画作品《境界的彼方》栗山未来(Kuriyama Mirai)

CRYPTON初音未来为代表的创作与活动(Magical Mirai)

图标以及形象由画师DazeCake绘制

mirai-api-http

Mirai HTTP API (console) plugin

Mirai-API-http插件 提供HTTP API供所有语言使用mirai

安装mirai-api-http

使用 Mirai Console Loader 安装mirai-api-http

  • MCL 支持自动更新插件,支持设置插件更新频道等功能
  • 2.x 版本需要切换到 stable-v2 的 channel

./mcl --update-package net.mamoe:mirai-api-http --channel stable-v2 --type plugin

  • 启动 MCL 完成自动更新和启动

./mcl -u

开始使用

  1. 编辑config/net.mamoe.mirai-api-http/setting.yml配置文件 (没有则自行创建)
  2. 启动MCL ./mcl
  3. 如果手动安装则启动 mirai-console(不建议)
  4. 记录日志中出现的authKey

setting.yml模板

## 配置文件中的值,全为默认值

## 启用的 adapter, 内置有 http, ws, reverse-ws, webhook
adapters:
  - http
  - ws

## 是否开启认证流程, 若为 true 则建立连接时需要验证 verifyKey
## 建议公网连接时开启
enableVerify: true
verifyKey: 1234567890

## 开启一些调式信息
debug: false

## 是否开启单 session 模式, 若为 true,则自动创建 session 绑定 console 中登录的 bot
## 开启后,接口中任何 sessionKey 不需要传递参数
## 若 console 中有多个 bot 登录,则行为未定义
## 确保 console 中只有一个 bot 登陆时启用
singleMode: false

## 历史消息的缓存大小
## 同时,也是 http adapter 的消息队列容量
cacheSize: 4096

## adapter 的单独配置,键名与 adapters 项配置相同
adapterSettings:
  ## 详情看 http adapter 使用说明 配置
  http:
    host: localhost
    port: 8080
    cors: ["*"]
    unreadQueueMaxSize: 100
  
  ## 详情看 websocket adapter 使用说明 配置
  ws:
    host: localhost
    port: 8080
    reservedSyncId: -1

Adapter

mirai-api-http 提供了多种接口调用方式, 并进行模块化称为 adapter

对于较常使用的调用方式, 内置了4种 adapter

  • http: 基于轮询的 http 接口
  • ws: websocket server 形式的接口
  • reverse-ws: websocket client 形式的接口
  • webhook: http 回调形式的接口

adapter 可以多个同时开启, 请按需启用

Adapter 一览

迁移至 2.x

从 1.x 迁移至 2.x 有不少变动,提供迁移文档参考

可能无法覆盖所有变更

调试API

(2.x 未更新)

更新日志

点我查看

文档

在线文档

mirai-api-http's People

Contributors

ai-himmel avatar aruelius avatar asakuramizu avatar blueglassblock avatar chuanwise avatar copydog avatar cyenoch avatar dfaofeng avatar excaive avatar hieuzest avatar him188 avatar hoshinotented avatar icebear67 avatar iskyil avatar karlatemp avatar kawaiizapic avatar lanyizi avatar lenoreric avatar liujiahua123123 avatar mnixry avatar nutr1t07 avatar pa733 avatar peratx avatar programripper avatar rf-tar-railt avatar ryoii avatar wyapx avatar wybxc avatar yanyongyu avatar yunyoujun avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.