@@ -1,3 +1,10 @@
|
|||||||
|
# 1.4.7
|
||||||
|
* 新增`#投票踢人`命令ⁿᵉʷ
|
||||||
|
* 优化发好友、发群聊
|
||||||
|
* 消息为空后可单独发送,以支持更多消息类型
|
||||||
|
* 新增`#ocr`命令ⁿᵉʷ
|
||||||
|
* 修复同意回复
|
||||||
|
|
||||||
# 1.4.6
|
# 1.4.6
|
||||||
* 状态新增默认背景图随机,`backdrop`配置设置为false则一直使用默认背景图ⁿᵉʷ
|
* 状态新增默认背景图随机,`backdrop`配置设置为false则一直使用默认背景图ⁿᵉʷ
|
||||||
* 默认背景图路径修改为**resources/state/img/bg**目录下请将背景图移至该目录
|
* 默认背景图路径修改为**resources/state/img/bg**目录下请将背景图移至该目录
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ import _ from "lodash"
|
|||||||
import { status } from "../constants/other.js"
|
import { status } from "../constants/other.js"
|
||||||
import { common, QQApi } from "../model/index.js"
|
import { common, QQApi } from "../model/index.js"
|
||||||
import { sleep } from "../tools/index.js"
|
import { sleep } from "../tools/index.js"
|
||||||
import { Config } from "../components/index.js"
|
|
||||||
import { API_ERROR } from "../constants/errorMsg.js"
|
import { API_ERROR } from "../constants/errorMsg.js"
|
||||||
import cfg from "../../../lib/config/config.js"
|
|
||||||
|
|
||||||
// 命令正则
|
// 命令正则
|
||||||
|
|
||||||
@@ -80,14 +78,6 @@ export class Assistant extends plugin {
|
|||||||
{
|
{
|
||||||
reg: "^#设置机型",
|
reg: "^#设置机型",
|
||||||
fnc: "setModel"
|
fnc: "setModel"
|
||||||
},
|
|
||||||
{
|
|
||||||
reg: "^#?(查?看|取)(群)?头像",
|
|
||||||
fnc: "LookAvatar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
reg: "^#?(设置|修改)日志等级",
|
|
||||||
fnc: "logs"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@@ -530,45 +520,4 @@ export class Assistant extends plugin {
|
|||||||
let res = await new QQApi(e).setModel(model).catch(err => logger.error(err))
|
let res = await new QQApi(e).setModel(model).catch(err => logger.error(err))
|
||||||
e.reply(_.get(res, [ "13031", "data", "rsp", "iRet" ]) == 0 ? "设置成功" : "设置失败")
|
e.reply(_.get(res, [ "13031", "data", "rsp", "iRet" ]) == 0 ? "设置成功" : "设置失败")
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 查看头像
|
|
||||||
*/
|
|
||||||
async LookAvatar() {
|
|
||||||
try {
|
|
||||||
let id, url
|
|
||||||
if (this.e.msg.includes("群")) {
|
|
||||||
id = this.e.msg.replace(/^#?(查?看|取)(群)?头像/, "").trim() || this.e.group_id
|
|
||||||
url = await this.e.bot.pickGroup(id).getAvatarUrl()
|
|
||||||
} else {
|
|
||||||
id = this.e.msg.replace(/^#?(查?看|取)(群)?头像/, "").trim() || this.e.at || this.e.message.find(item => item.type == "at")?.qq || this.e.user_id
|
|
||||||
url = await this.e.group?.pickMember(id)?.getAvatarUrl()
|
|
||||||
if (!url) url = await this.e.bot.pickFriend(id).getAvatarUrl()
|
|
||||||
}
|
|
||||||
const msgTest = this.e.msg.includes("取")
|
|
||||||
if (url) return await this.e.reply(msgTest ? `${url}` : segment.image(url), true)
|
|
||||||
} catch (error) {
|
|
||||||
logger.error("获取头像错误", error)
|
|
||||||
}
|
|
||||||
await this.reply("❎ 获取头像错误", true)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置日志等级
|
|
||||||
*/
|
|
||||||
async logs() {
|
|
||||||
if (!common.checkPermission(this.e, "master")) return
|
|
||||||
|
|
||||||
const logs = [ "trace", "debug", "info", "warn", "fatal", "mark", "error", "off" ]
|
|
||||||
const level = this.e.msg.replace(/^#?(设置|修改)日志等级/, "").trim()
|
|
||||||
|
|
||||||
if (!logs.includes(level)) return this.e.reply("❎ 请输入正确的参数,可选:\ntrace,debug,info,warn,fatal,mark,error,off")
|
|
||||||
|
|
||||||
const { log_level } = cfg.bot
|
|
||||||
if (log_level === level) return this.e.reply(`❎ 日志等级已是${level}了`)
|
|
||||||
|
|
||||||
Config.modify("bot", "log_level", level, "config", true)
|
|
||||||
this.e.reply(`✅ 已将日志等级设置为${level}`)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { common } from "../../model/index.js"
|
|
||||||
import _ from "lodash"
|
import _ from "lodash"
|
||||||
|
import { Config } from "../../components/index.js"
|
||||||
|
import { common } from "../../model/index.js"
|
||||||
|
import cfg from "../../../../lib/config/config.js"
|
||||||
|
|
||||||
export class Assistant_Other extends plugin {
|
export class Assistant_Other extends plugin {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -17,10 +19,17 @@ export class Assistant_Other extends plugin {
|
|||||||
fnc: "Face"
|
fnc: "Face"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
reg: "^#ocr",
|
reg: "^#(ocr|提?取文字)",
|
||||||
fnc: "imageOcr"
|
fnc: "imageOcr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
reg: "^#?(查?看|取)(群)?头像",
|
||||||
|
fnc: "LookAvatar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
reg: "^#?(设置|修改)日志等级",
|
||||||
|
fnc: "logs"
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -98,19 +107,29 @@ export class Assistant_Other extends plugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片提取文字
|
||||||
|
* @param e
|
||||||
|
*/
|
||||||
async imageOcr(e) {
|
async imageOcr(e) {
|
||||||
const imageOcr = e.bot.imageOcr?.bind(e.bot) || Bot.imageOcr
|
try {
|
||||||
if (!imageOcr) return this.reply("❎ 当前协议暂不支持OCR")
|
const imageOcr = e.bot?.imageOcr?.bind(e.bot) || Bot.imageOcr
|
||||||
const sourceImg = await common.takeSourceMsg(e, { img: true })
|
if (!imageOcr) return this.reply("❎ 当前协议暂不支持OCR")
|
||||||
const img = sourceImg || e.img
|
const sourceImg = await common.takeSourceMsg(e, { img: true })
|
||||||
if (_.isEmpty(img)) {
|
const img = sourceImg || e.img
|
||||||
this.setContext("_imageOcrContext")
|
if (_.isEmpty(img)) {
|
||||||
return this.reply("⚠ 请发送图片")
|
this.setContext("_imageOcrContext")
|
||||||
|
return this.reply("⚠ 请发送图片")
|
||||||
|
}
|
||||||
|
let res = await imageOcr(img[0])
|
||||||
|
let r = res?.wordslist?.map(i => i.words).join("\n")
|
||||||
|
if (!r) return e.reply("❎ 发生错误,请稍后再试。")
|
||||||
|
e.reply(r, true)
|
||||||
|
return true
|
||||||
|
} catch (error) {
|
||||||
|
e.reply("❎ 发生错误,请稍后再试。")
|
||||||
|
logger.error("获取OCR错误:", error)
|
||||||
}
|
}
|
||||||
let res = await imageOcr(img[0])
|
|
||||||
let r = res.wordslist.map(i => i.words).join("\n")
|
|
||||||
e.reply(r)
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async _imageOcrContext(e) {
|
async _imageOcrContext(e) {
|
||||||
@@ -126,4 +145,45 @@ export class Assistant_Other extends plugin {
|
|||||||
this.imageOcr(e)
|
this.imageOcr(e)
|
||||||
this.finish("_imageOcrContext")
|
this.finish("_imageOcrContext")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看头像
|
||||||
|
*/
|
||||||
|
async LookAvatar() {
|
||||||
|
try {
|
||||||
|
let id, url
|
||||||
|
if (this.e.msg.includes("群")) {
|
||||||
|
id = this.e.msg.replace(/^#?(查?看|取)(群)?头像/, "").trim() || this.e.group_id
|
||||||
|
url = await this.e.bot.pickGroup(id).getAvatarUrl()
|
||||||
|
} else {
|
||||||
|
id = this.e.msg.replace(/^#?(查?看|取)(群)?头像/, "").trim() || this.e.at || this.e.message.find(item => item.type == "at")?.qq || this.e.user_id
|
||||||
|
url = await this.e.group?.pickMember(id)?.getAvatarUrl()
|
||||||
|
if (!url) url = await this.e.bot.pickFriend(id).getAvatarUrl()
|
||||||
|
}
|
||||||
|
const msgTest = this.e.msg.includes("取")
|
||||||
|
if (url) return await this.e.reply(msgTest ? `${url}` : segment.image(url), true)
|
||||||
|
} catch (error) {
|
||||||
|
logger.error("获取头像错误", error)
|
||||||
|
}
|
||||||
|
await this.reply("❎ 获取头像错误", true)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置日志等级
|
||||||
|
*/
|
||||||
|
async logs() {
|
||||||
|
if (!common.checkPermission(this.e, "master")) return
|
||||||
|
|
||||||
|
const logs = [ "trace", "debug", "info", "warn", "fatal", "mark", "error", "off" ]
|
||||||
|
const level = this.e.msg.replace(/^#?(设置|修改)日志等级/, "").trim()
|
||||||
|
|
||||||
|
if (!logs.includes(level)) return this.e.reply("❎ 请输入正确的参数,可选:\ntrace,debug,info,warn,fatal,mark,error,off")
|
||||||
|
|
||||||
|
const { log_level } = cfg.bot
|
||||||
|
if (log_level === level) return this.e.reply(`❎ 日志等级已是${level}了`)
|
||||||
|
|
||||||
|
Config.modify("bot", "log_level", level, "config", true)
|
||||||
|
this.e.reply(`✅ 已将日志等级设置为${level}`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,18 +199,18 @@ export const helpList = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
group: "投票禁言(更多配置请看config/groupAdmin.yaml)",
|
group: "群投票(更多配置请看config/groupAdmin.yaml)",
|
||||||
list: [
|
list: [
|
||||||
{
|
{
|
||||||
title: "#(启用|禁用)投票禁言",
|
title: "#(启用|禁用)投票(禁言|踢人)",
|
||||||
desc: "是否允许群员投票",
|
desc: "是否允许群员投票",
|
||||||
icon: 4
|
icon: 4
|
||||||
}, {
|
}, {
|
||||||
title: "#投票禁言<@QQ>",
|
title: "#投票(禁言|踢人)<@QQ>",
|
||||||
desc: "投票禁言不听话的群员",
|
desc: "投票裁决不听话的群员",
|
||||||
icon: 6
|
icon: 6
|
||||||
}, {
|
}, {
|
||||||
title: "#(支持|反对)禁言<@QQ>",
|
title: "#(支持|反对)投票<@QQ>",
|
||||||
desc: "跟随投票",
|
desc: "跟随投票",
|
||||||
icon: 12
|
icon: 12
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
@@ -99,13 +99,9 @@ export const helpList = [
|
|||||||
icon: 14
|
icon: 14
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "#拉黑 #取消拉黑",
|
title: "#拉(黑|白) #取消拉(黑|白)",
|
||||||
desc: "可带at或直接键入qq,拉黑后面可带\"群\"",
|
desc: "可带at或直接键入qq,后面可带\"群\"",
|
||||||
icon: 13
|
icon: 13
|
||||||
}, {
|
|
||||||
title: "#拉白 #取消拉白",
|
|
||||||
desc: "用法与 #拉黑 相同",
|
|
||||||
icon: 14
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -243,10 +239,6 @@ export const helpList = [
|
|||||||
icon: 19,
|
icon: 19,
|
||||||
title: "#桌游排行",
|
title: "#桌游排行",
|
||||||
desc: "桌游排行"
|
desc: "桌游排行"
|
||||||
}, {
|
|
||||||
title: "#(看|取)(群)?头像 <@QQ>",
|
|
||||||
desc: "查看用户/群的高清头像图片",
|
|
||||||
icon: 16
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -280,6 +272,32 @@ export const helpList = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
group: "其他",
|
||||||
|
list: [
|
||||||
|
{
|
||||||
|
title: "#取直链",
|
||||||
|
desc: "取一条图片直链",
|
||||||
|
icon: 5
|
||||||
|
}, {
|
||||||
|
title: "#取face",
|
||||||
|
desc: "取表情id",
|
||||||
|
icon: 11
|
||||||
|
}, {
|
||||||
|
title: "#ocr",
|
||||||
|
desc: "图片取文字",
|
||||||
|
icon: 3
|
||||||
|
}, {
|
||||||
|
title: "#(看|取)(群)?头像 <@QQ>",
|
||||||
|
desc: "查看用户/群的高清头像图片",
|
||||||
|
icon: 16
|
||||||
|
}, {
|
||||||
|
title: "#设置日志等级 <参数>",
|
||||||
|
desc: "设置控制台日志等级",
|
||||||
|
icon: 6
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
group: "设置,版本相关",
|
group: "设置,版本相关",
|
||||||
auth: "master",
|
auth: "master",
|
||||||
|
|||||||
Reference in New Issue
Block a user