Nambers / Mirai-Resend

Mirai重发插件

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mirai-Resend

重发插件, 设置一条重发条件后, 当该条件被触发, 相当于机器人收到另外一条信息

原型: miraiForum

配置文件

data class Config(
    // 好友的重发条件
    val resendsForFriend: ArrayList<ResendCommand>,
    // 群聊的重发条件
    val resendsForGroup: ArrayList<ResendCommand>,
    // 匹配消息的content(MessageChain.contentToString)
    val content: Boolean? = null,
    // 匹配消息的MiraiCode(MessageChain.serializeToMiraiCode)
    val miraiCode: Boolean? = null,
    // 阻止其他监听器获取重发前的信息
    val intercept: Boolean? = null,
    // 屏蔽全部好友信息
    val blockFriend: Boolean? = null,
    // 屏蔽全部群聊信息
    val blockGroup: Boolean? = null,
    // 每条信息只匹配一次
    val matchOnce: Boolean? = null
) {
    data class ResendCommand(
        // 触发字符串, 可为正则表达式
        val target: String,
        // 重发字符串, 可为MiraiCode
        val to: String,
        // 触发字符串是否是正则表达式
        val regex: Boolean? = null,
        // 重发字符串是否为MiraiCode
        val miraiCode: Boolean? = null
    )
}

例子:

// 下文 `//` 开头的注释只是解释作用, 实际上的json并不能存在注释
{
  "matchOne": false,
  "resendsForFriend": [ // 好友重发条件
    {
      "target": "a", // 触发字符串
      "to": "b", // 重发字符串
      "regex": false, // target是否是正则表达式
      "miraiCode": false // to是否是miraiCode
    },
    {
      "target": "c", 
      "to": "d",
      "regex": false,
      "miraiCode": false
    }
  ],
  "resendsForGroup": [ // 群聊重发条件
    {
      "target": "a",
      "to": "b",
      "regex": false,
      "miraiCode": false
    }
  ]
}

指令

有两个指令

  • /重发 <from> <to> [groupOrFriend] [regex] [miraicode] 重发一个消息, from是激活消息的文本, to是重发成什么信息, groupOrFriend 应用到群聊(1)还是好友(2)或者全部(0), regex是触发的字符串是不是正则形式 miraicode是重发的信息是不是miraicode形式
  • /取消重发 <from> <to> [groupOrFriend] [regex] [miraicode] 删除一个重发条件, 注意:在运行中删除重发条件可能会导致不可预料的报错

可以在help里看

About

Mirai重发插件

License:GNU Affero General Public License v3.0


Languages

Language:Kotlin 100.0%