diff --git a/.eslintrc.cjs b/.eslintrc.cjs
index da62004..e1bf886 100644
--- a/.eslintrc.cjs
+++ b/.eslintrc.cjs
@@ -3,12 +3,12 @@ module.exports = {
es2021: true,
node: true
},
- extends: ['standard', 'plugin:jsdoc/recommended', 'plugin:import/recommended', 'plugin:promise/recommended'],
+ extends: ["standard", "plugin:jsdoc/recommended", "plugin:import/recommended", "plugin:promise/recommended"],
parserOptions: {
- ecmaVersion: 'latest',
- sourceType: 'module'
+ ecmaVersion: "latest",
+ sourceType: "module"
},
- plugins: ['import', 'promise', 'jsdoc'],
+ plugins: ["import", "promise", "jsdoc"],
globals: {
Bot: true,
redis: true,
@@ -18,18 +18,19 @@ module.exports = {
ReplyError: true
},
rules: {
- 'eqeqeq': ['off'],
- 'prefer-const': ['off'],
- 'arrow-body-style': 'off',
- 'camelcase': 'off',
- 'quote-props': ['error', 'consistent'],
- 'no-eval': ['error', { allowIndirect: true }],
- 'jsdoc/require-returns': 0,
- 'jsdoc/require-jsdoc': 0,
- 'jsdoc/require-param-description': 0,
- 'jsdoc/require-returns-description': 0,
- 'jsdoc/require-param-type': 0,
- 'import/extensions': ['error', 'ignorePackages']
+ "eqeqeq": ["off"],
+ "prefer-const": ["off"],
+ "arrow-body-style": "off",
+ "camelcase": "off",
+ "quotes": ["error", "double"],
+ "quote-props": ["error", "consistent"],
+ "no-eval": ["error", { allowIndirect: true }],
+ "jsdoc/require-returns": 0,
+ "jsdoc/require-jsdoc": 0,
+ "jsdoc/require-param-description": 0,
+ "jsdoc/require-returns-description": 0,
+ "jsdoc/require-param-type": 0,
+ "import/extensions": ["error", "ignorePackages"]
},
- ignorePatterns: ['resources/state/echarts.min.js']
+ ignorePatterns: ["resources/state/echarts.min.js"]
}
diff --git a/apps/admin.js b/apps/admin.js
index 19bb909..d41c25a 100644
--- a/apps/admin.js
+++ b/apps/admin.js
@@ -1,43 +1,43 @@
-import plugin from '../../../lib/plugins/plugin.js'
-import fs from 'fs'
-import _ from 'lodash'
-import { Config } from '../components/index.js'
-import { common, setu, puppeteer } from '../model/index.js'
+import plugin from "../../../lib/plugins/plugin.js"
+import fs from "fs"
+import _ from "lodash"
+import { Config } from "../components/index.js"
+import { common, setu, puppeteer } from "../model/index.js"
/** 设置项 */
const OtherCfgType = {
- 全部通知: 'notificationsAll',
- 状态: 'state',
- 陌生人点赞: 'Strangers_love'
+ 全部通知: "notificationsAll",
+ 状态: "state",
+ 陌生人点赞: "Strangers_love"
}
const SeSeCfgType = {
- 涩涩: 'sese',
- 涩涩pro: 'sesepro',
+ 涩涩: "sese",
+ 涩涩pro: "sesepro",
代理: {
- name: 'proxy',
- key: 'switchProxy'
+ name: "proxy",
+ key: "switchProxy"
}
}
const NoticeCfgType = {
- 好友消息: 'privateMessage',
- 群消息: 'groupMessage',
- 群临时消息: 'grouptemporaryMessage',
- 群撤回: 'groupRecall',
- 好友撤回: 'PrivateRecall',
+ 好友消息: "privateMessage",
+ 群消息: "groupMessage",
+ 群临时消息: "grouptemporaryMessage",
+ 群撤回: "groupRecall",
+ 好友撤回: "PrivateRecall",
// 申请通知
- 好友申请: 'friendRequest',
- 群邀请: 'groupInviteRequest',
- 加群申请: 'addGroupApplication',
+ 好友申请: "friendRequest",
+ 群邀请: "groupInviteRequest",
+ 加群申请: "addGroupApplication",
// 信息变动
- 群管理变动: 'groupAdminChange',
+ 群管理变动: "groupAdminChange",
// 列表变动
- 好友列表变动: 'friendNumberChange',
- 群聊列表变动: 'groupNumberChange',
- 群成员变动: 'groupMemberNumberChange',
+ 好友列表变动: "friendNumberChange",
+ 群聊列表变动: "groupNumberChange",
+ 群成员变动: "groupMemberNumberChange",
// 其他通知
- 闪照: 'flashPhoto',
- 禁言: 'botBeenBanned',
- 输入: 'input'
+ 闪照: "flashPhoto",
+ 禁言: "botBeenBanned",
+ 输入: "input"
}
/** 分开开关和数字 */
const SwitchCfgType = {
@@ -45,45 +45,45 @@ const SwitchCfgType = {
}
const NumberCfgType = {
渲染精度: {
- key: 'renderScale',
- limit: '50-200'
+ key: "renderScale",
+ limit: "50-200"
},
删除缓存时间: {
- key: 'deltime',
- limit: '>120'
+ key: "deltime",
+ limit: ">120"
}
}
/** 支持单独设置的项 */
const aloneKeys = [
- '群消息', '群临时消息', '群撤回', '群邀请', '群管理变动', '群聊列表变动', '群成员变动', '加群通知', '禁言', '闪照', '匿名', '涩涩', '涩涩pro'
+ "群消息", "群临时消息", "群撤回", "群邀请", "群管理变动", "群聊列表变动", "群成员变动", "加群通知", "禁言", "闪照", "匿名", "涩涩", "涩涩pro"
]
-const SwitchCfgReg = new RegExp(`^#椰奶设置(${Object.keys(SwitchCfgType).join('|')})(单独)?(开启|关闭|取消)$`)
-const NumberCfgReg = new RegExp(`^#椰奶设置(${Object.keys(NumberCfgType).join('|')})(\\d+)秒?$`)
+const SwitchCfgReg = new RegExp(`^#椰奶设置(${Object.keys(SwitchCfgType).join("|")})(单独)?(开启|关闭|取消)$`)
+const NumberCfgReg = new RegExp(`^#椰奶设置(${Object.keys(NumberCfgType).join("|")})(\\d+)秒?$`)
export class Admin extends plugin {
constructor () {
super({
- name: '椰奶配置',
- event: 'message',
+ name: "椰奶配置",
+ event: "message",
priority: 100,
rule: [
{
reg: SwitchCfgReg,
- fnc: 'ConfigSwitch'
+ fnc: "ConfigSwitch"
},
{
reg: NumberCfgReg,
- fnc: 'ConfigNumber'
+ fnc: "ConfigNumber"
},
{
- reg: '^#椰奶(sese|涩涩)?设置$',
- fnc: 'Settings'
+ reg: "^#椰奶(sese|涩涩)?设置$",
+ fnc: "Settings"
},
{
- reg: '^#椰奶(启用|禁用)全部通知$',
- fnc: 'SetAllNotice'
+ reg: "^#椰奶(启用|禁用)全部通知$",
+ fnc: "SetAllNotice"
}
]
})
@@ -91,29 +91,29 @@ export class Admin extends plugin {
// 更改配置
async ConfigSwitch (e) {
- if (!common.checkPermission(e, 'master')) return
+ if (!common.checkPermission(e, "master")) return
// 解析消息
let regRet = SwitchCfgReg.exec(e.msg)
let key = regRet[1]
- let is = regRet[3] == '开启'
+ let is = regRet[3] == "开启"
if (!e.group_id && regRet[2]) {
- return e.reply('❎ 请在要单独设置的群聊发送单独设置命令')
+ return e.reply("❎ 请在要单独设置的群聊发送单独设置命令")
}
if (!aloneKeys.includes(key) && regRet[2]) {
- return e.reply('❎ 该设置项不支持单独设置')
+ return e.reply("❎ 该设置项不支持单独设置")
}
// 单独设置
if (regRet[2]) {
- let isdel = regRet[3] == '取消'
+ let isdel = regRet[3] == "取消"
Config.aloneModify(e.group_id, SwitchCfgType[key], is, isdel)
} else {
let _key = SwitchCfgType[key]
- Config.modify(_key?.name ?? 'whole', _key?.key ?? _key, is)
+ Config.modify(_key?.name ?? "whole", _key?.key ?? _key, is)
// 单独处理
- if (key == '涩涩pro' && is) Config.modify('whole', 'sese', is)
- if (key == '涩涩' && !is) Config.modify('whole', 'sesepro', is)
+ if (key == "涩涩pro" && is) Config.modify("whole", "sese", is)
+ if (key == "涩涩" && !is) Config.modify("whole", "sesepro", is)
}
// 渲染图片
if (Object.keys(SeSeCfgType).includes(key)) {
@@ -125,26 +125,26 @@ export class Admin extends plugin {
// 修改数字设置
async ConfigNumber (e) {
- if (!common.checkPermission(e, 'master')) return
+ if (!common.checkPermission(e, "master")) return
let regRet = e.msg.match(NumberCfgReg)
let type = NumberCfgType[regRet[1]]
let number = checkNumberValue(regRet[2], type.limit)
- Config.modify(type.name ?? 'whole', type.key, number)
+ Config.modify(type.name ?? "whole", type.key, number)
this.index_Settings(e)
}
// 修改全部通知设置
async SetAllNotice (e) {
- if (!common.checkPermission(e, 'master')) return
+ if (!common.checkPermission(e, "master")) return
let yes = /启用/.test(e.msg)
for (let i in NoticeCfgType) {
- Config.modify('whole', NoticeCfgType[i], yes)
+ Config.modify("whole", NoticeCfgType[i], yes)
}
this.index_Settings(e)
}
async Settings (e) {
- if (!common.checkPermission(e, 'master')) return
+ if (!common.checkPermission(e, "master")) return
if (/sese|涩涩/.test(e.msg)) {
this.SeSe_Settings(e)
} else {
@@ -155,19 +155,19 @@ export class Admin extends plugin {
// 渲染发送图片
async index_Settings (e) {
let data = {}
- const special = ['deltime', 'renderScale']
+ const special = ["deltime", "renderScale"]
let _cfg = Config.getGroup(e.group_id)
for (let key in _cfg) {
if (special.includes(key)) {
data[key] = Number(Config.whole[key])
} else {
- let groupCfg = Config.getConfig('group')[e.group_id]
+ let groupCfg = Config.getConfig("group")[e.group_id]
let isAlone = groupCfg ? groupCfg[key] : undefined
data[key] = getStatus(_cfg[key], isAlone)
}
}
// 渲染图像
- return await puppeteer.render('admin/index', {
+ return await puppeteer.render("admin/index", {
...data,
bg: await rodom()
}, {
@@ -181,13 +181,13 @@ export class Admin extends plugin {
let set = setu.getSeSeConfig(e)
let { proxy, pixiv, bika } = Config
let { sese, sesepro } = Config.getGroup(e.group_id)
- let { sese: _sese, sesepro: _sesepro } = Config.getConfig('group')[e.group_id] ?? {}
+ let { sese: _sese, sesepro: _sesepro } = Config.getConfig("group")[e.group_id] ?? {}
let data = {
sese: getStatus(sese, _sese),
sesepro: getStatus(sesepro, _sesepro),
r18: getStatus(set.r18),
cd: Number(set.cd),
- recall: set.recall ? set.recall : '无',
+ recall: set.recall ? set.recall : "无",
switchProxy: getStatus(proxy.switchProxy),
pixivDirectConnection: getStatus(pixiv.pixivDirectConnection),
bikaDirectConnection: getStatus(bika.bikaDirectConnection),
@@ -196,7 +196,7 @@ export class Admin extends plugin {
imageQuality: bika.imageQuality
}
// 渲染图像
- return await puppeteer.render('admin/sese', {
+ return await puppeteer.render("admin/sese", {
...data,
bg: await rodom()
}, {
@@ -208,7 +208,7 @@ export class Admin extends plugin {
// 随机底图
const rodom = async function () {
- let image = fs.readdirSync('./plugins/yenai-plugin/resources/admin/imgs/bg')
+ let image = fs.readdirSync("./plugins/yenai-plugin/resources/admin/imgs/bg")
let listImg = []
for (let val of image) {
listImg.push(val)
@@ -218,11 +218,11 @@ const rodom = async function () {
}
const getStatus = function (rote, alone) {
- let badge = alone != undefined ? '群单独' : ''
+ let badge = alone != undefined ? "群单独" : ""
if (rote) {
- return badge + '
已开启
'
+ return badge + "已开启
"
} else {
- return badge + '已关闭
'
+ return badge + "已关闭
"
}
}
@@ -245,13 +245,13 @@ function checkNumberValue (value, limit) {
const parsedLimitValue = parseFloat(limitValue)
// 检查比较限制条件
- if ((symbol === '<' && value > parsedLimitValue) || (symbol === '>' && value < parsedLimitValue)) {
+ if ((symbol === "<" && value > parsedLimitValue) || (symbol === ">" && value < parsedLimitValue)) {
return parsedLimitValue
}
// 检查范围限制条件
if (!isNaN(value)) {
- const [lowerLimit, upperLimit] = limit.split('-').map(parseFloat)
+ const [lowerLimit, upperLimit] = limit.split("-").map(parseFloat)
const clampedValue = Math.min(Math.max(value, lowerLimit || -Infinity), upperLimit || Infinity)
return clampedValue
}
diff --git a/apps/assistant.js b/apps/assistant.js
index 79bac43..ac9d924 100644
--- a/apps/assistant.js
+++ b/apps/assistant.js
@@ -1,15 +1,15 @@
-import _ from 'lodash'
-import moment from 'moment'
-import fs from 'node:fs'
-import yaml from 'yaml'
-import plugin from '../../../lib/plugins/plugin.js'
-import { Version } from '../components/index.js'
-import { status } from '../constants/other.js'
-import { common, QQApi } from '../model/index.js'
-import { sleep } from '../tools/index.js'
+import _ from "lodash"
+import moment from "moment"
+import fs from "node:fs"
+import yaml from "yaml"
+import plugin from "../../../lib/plugins/plugin.js"
+import { Version } from "../components/index.js"
+import { status } from "../constants/other.js"
+import { common, QQApi } from "../model/index.js"
+import { sleep } from "../tools/index.js"
/** API请求错误文案 */
-const API_ERROR = '❎ 出错辣,请稍后重试'
+const API_ERROR = "❎ 出错辣,请稍后重试"
// 命令正则
let FriendsReg = /^#发好友\s?(\d+)\s?([^]*)$/
@@ -20,117 +20,117 @@ let friendTypeReg = /^#更改好友申请方式([0123])((.*)\s(.*))?$/
export class Assistant extends plugin {
constructor () {
super({
- name: '椰奶小助手',
- event: 'message',
+ name: "椰奶小助手",
+ event: "message",
priority: 2000,
rule: [
{
- reg: '^#改头像',
- fnc: 'SetAvatar'
+ reg: "^#改头像",
+ fnc: "SetAvatar"
},
{
- reg: '^#改昵称',
- fnc: 'SetNickname'
+ reg: "^#改昵称",
+ fnc: "SetNickname"
},
{
- reg: '^#改签名',
- fnc: 'SetSignature'
+ reg: "^#改签名",
+ fnc: "SetSignature"
},
{
- reg: '^#改状态',
- fnc: 'SetOnlineStatus'
+ reg: "^#改状态",
+ fnc: "SetOnlineStatus"
},
{
reg: FriendsReg, // 发好友
- fnc: 'SendFriendMsg'
+ fnc: "SendFriendMsg"
},
{
reg: GroupMsgReg, // 发群聊
- fnc: 'SendGroupMsg'
+ fnc: "SendGroupMsg"
},
{
reg: GroupListMsgReg, // 发群列表
- fnc: 'SendGroupListMsg'
+ fnc: "SendGroupListMsg"
},
{
- reg: '^#退群',
- fnc: 'QuitGroup'
+ reg: "^#退群",
+ fnc: "QuitGroup"
},
{
- reg: '^#删好友',
- fnc: 'DeleteFriend'
+ reg: "^#删好友",
+ fnc: "DeleteFriend"
},
{
- reg: '^#改性别',
- fnc: 'SetGender'
+ reg: "^#改性别",
+ fnc: "SetGender"
},
{
- reg: '^#取直链',
- fnc: 'ImageLink'
+ reg: "^#取直链",
+ fnc: "ImageLink"
},
{
- reg: '^#取face',
- fnc: 'Face'
+ reg: "^#取face",
+ fnc: "Face"
},
{
- reg: '^#获?取说说列表(\\d+)?$',
- fnc: 'Qzonelist'
+ reg: "^#获?取说说列表(\\d+)?$",
+ fnc: "Qzonelist"
},
{
- reg: '^#删说说(\\d+)$',
- fnc: 'Qzonedel'
+ reg: "^#删说说(\\d+)$",
+ fnc: "Qzonedel"
},
{
- reg: '^#发说说',
- fnc: 'Qzonesay'
+ reg: "^#发说说",
+ fnc: "Qzonesay"
},
{
- reg: '^#(清空说说|清空留言)$',
- fnc: 'QzonedelAll'
+ reg: "^#(清空说说|清空留言)$",
+ fnc: "QzonedelAll"
},
{
- reg: '^#改群名片',
- fnc: 'SetGroupCard'
+ reg: "^#改群名片",
+ fnc: "SetGroupCard"
},
{
- reg: '^#改群头像',
- fnc: 'SetGroupAvatar'
+ reg: "^#改群头像",
+ fnc: "SetGroupAvatar"
},
{
- reg: '^#改群昵称',
- fnc: 'SetGroupName'
+ reg: "^#改群昵称",
+ fnc: "SetGroupName"
},
{
- reg: '^#获取(群|好友)列表$',
- fnc: 'GlOrFl'
+ reg: "^#获取(群|好友)列表$",
+ fnc: "GlOrFl"
},
{
- reg: '^#(开启|关闭)戳一戳$',
- fnc: 'Cyc'
+ reg: "^#(开启|关闭)戳一戳$",
+ fnc: "Cyc"
},
{
- reg: '^#?撤回$',
- fnc: 'RecallMsgown'
+ reg: "^#?撤回$",
+ fnc: "RecallMsgown"
},
{
- reg: '^#(开启|关闭)好友添加$',
- fnc: 'FriendSwitch'
+ reg: "^#(开启|关闭)好友添加$",
+ fnc: "FriendSwitch"
},
{
reg: friendTypeReg, // 更改好友申请方式
- fnc: 'FriendType'
+ fnc: "FriendType"
},
{
- reg: '#设置机型.*', // 更改好友申请方式
- fnc: 'setModel'
+ reg: "#设置机型.*", // 更改好友申请方式
+ fnc: "setModel"
},
{
- reg: '^#拉[黑白](群聊?)?',
- fnc: 'BlockOne'
+ reg: "^#拉[黑白](群聊?)?",
+ fnc: "BlockOne"
},
{
- reg: '^#(取消|(删|移)除)拉[黑白](群聊?)?',
- fnc: 'CancelBlockOne'
+ reg: "^#(取消|(删|移)除)拉[黑白](群聊?)?",
+ fnc: "CancelBlockOne"
}
]
})
@@ -145,17 +145,17 @@ export class Assistant extends plugin {
* @param e
*/
async SetAvatar (e) {
- if (!common.checkPermission(e, 'master')) return
+ if (!common.checkPermission(e, "master")) return
if (!e.img) {
- this.setContext('_avatarContext')
- e.reply('⚠ 请发送图片')
+ this.setContext("_avatarContext")
+ e.reply("⚠ 请发送图片")
return
}
await this.Bot.setAvatar(e.img[0])
- .then(() => e.reply('✅ 头像修改成功'))
+ .then(() => e.reply("✅ 头像修改成功"))
.catch((err) => {
- e.reply('❎ 头像修改失败')
+ e.reply("❎ 头像修改失败")
logger.error(err)
})
}
@@ -163,23 +163,23 @@ export class Assistant extends plugin {
async _avatarContext () {
let img = this.e.img
if (/取消/.test(this.e.msg)) {
- this.finish('_avatarContext')
- await this.reply('✅ 已取消')
+ this.finish("_avatarContext")
+ await this.reply("✅ 已取消")
return
}
if (!img) {
- this.setContext('_avatarContext')
- await this.reply('⚠ 请发送图片或取消')
+ this.setContext("_avatarContext")
+ await this.reply("⚠ 请发送图片或取消")
return
}
await (this.e.bot ?? Bot).setAvatar(img[0])
- .then(() => this.e.reply('✅ 头像修改成功'))
+ .then(() => this.e.reply("✅ 头像修改成功"))
.catch((err) => {
- this.e.reply('❎ 头像修改失败')
+ this.e.reply("❎ 头像修改失败")
logger.error(err)
})
- this.finish('_avatarContext')
+ this.finish("_avatarContext")
}
/**
@@ -187,13 +187,13 @@ export class Assistant extends plugin {
* @param e
*/
async SetNickname (e) {
- if (!common.checkPermission(e, 'master')) return
- let name = e.msg.replace(/#|改昵称/g, '').trim()
+ if (!common.checkPermission(e, "master")) return
+ let name = e.msg.replace(/#|改昵称/g, "").trim()
await this.Bot.setNickname(name)
- .then(() => e.reply('✅ 昵称修改成功'))
+ .then(() => e.reply("✅ 昵称修改成功"))
.catch((err) => {
- e.reply('❎ 昵称修改失败')
+ e.reply("❎ 昵称修改失败")
logger.error(err)
})
}
@@ -203,32 +203,32 @@ export class Assistant extends plugin {
* @param e
*/
async SetGroupCard (e) {
- if (!common.checkPermission(e, 'master')) return
- let group = ''
- let card = ''
+ if (!common.checkPermission(e, "master")) return
+ let group = ""
+ let card = ""
if (e.isPrivate) {
- let msg = e.msg.split(' ')
+ let msg = e.msg.split(" ")
group = msg[1].match(/[1-9]\d*/g)
- card = msg.slice(2).join(' ')
+ card = msg.slice(2).join(" ")
- if (!group) return e.reply('❎ 群号不能为空')
+ if (!group) return e.reply("❎ 群号不能为空")
- if (!this.Bot.gl.get(Number(msg[1]))) return e.reply('❎ 群聊列表查无此群')
+ if (!this.Bot.gl.get(Number(msg[1]))) return e.reply("❎ 群聊列表查无此群")
} else {
group = e.group_id
- card = e.msg.replace(/#|改群名片/g, '').trim()
+ card = e.msg.replace(/#|改群名片/g, "").trim()
}
if (!card) {
- return e.reply('❎ 名片不能为空')
+ return e.reply("❎ 名片不能为空")
}
this.Bot.pickGroup(group).setCard(this.Bot.uin, card)
- .then(() => e.reply('✅ 群名片修改成功'))
+ .then(() => e.reply("✅ 群名片修改成功"))
.catch(err => {
- e.reply('✅ 群名片修改失败')
+ e.reply("✅ 群名片修改失败")
logger.error(err)
})
}
@@ -240,31 +240,31 @@ export class Assistant extends plugin {
async SetGroupAvatar (e) {
if (e.isPrivate) {
if (!e.isMaster) return logger.mark(`${e.logFnc}不为主人`)
- e.group_id = e.msg.replace(/#|改群头像/g, '').trim()
+ e.group_id = e.msg.replace(/#|改群头像/g, "").trim()
- if (!e.group_id) return e.reply('❎ 群号不能为空')
+ if (!e.group_id) return e.reply("❎ 群号不能为空")
- if (!(/^\d+$/.test(e.group_id))) return e.reply('❎ 您的群号不合法')
+ if (!(/^\d+$/.test(e.group_id))) return e.reply("❎ 您的群号不合法")
- if (!this.Bot.gl.get(Number(e.group_id))) return e.reply('❎ 群聊列表查无此群')
+ if (!this.Bot.gl.get(Number(e.group_id))) return e.reply("❎ 群聊列表查无此群")
e.group_id = Number(e.group_id)
} else if (!e.member.is_admin && !e.member.is_owner && !e.isMaster) {
return logger.mark(`${e.logFnc}该群员权限不足`)
}
let groupObj = this.Bot.pickGroup(e.group_id)
if (!groupObj.is_admin && !groupObj.is_owner) {
- return e.reply('❎ 没有管理员人家做不到啦~>_<')
+ return e.reply("❎ 没有管理员人家做不到啦~>_<")
}
if (!e.img) {
- this.setContext('_GroupAvatarContext')
- e.reply('⚠ 请发送图片')
+ this.setContext("_GroupAvatarContext")
+ e.reply("⚠ 请发送图片")
return
}
this.Bot.pickGroup(e.group_id).setAvatar(e.img[0])
- .then(() => e.reply('✅ 群头像修改成功'))
+ .then(() => e.reply("✅ 群头像修改成功"))
.catch((err) => {
- e.reply('✅ 群头像修改失败')
+ e.reply("✅ 群头像修改失败")
logger.error(err)
})
}
@@ -272,23 +272,23 @@ export class Assistant extends plugin {
_GroupAvatarContext (e) {
let img = this.e.img
if (/取消/.test(this.e.msg)) {
- this.finish('_GroupAvatarContext')
- this.e.reply('✅ 已取消')
+ this.finish("_GroupAvatarContext")
+ this.e.reply("✅ 已取消")
return
}
if (!img) {
- this.setContext('_GroupAvatarContext')
- this.e.reply('⚠ 请发送图片或取消')
+ this.setContext("_GroupAvatarContext")
+ this.e.reply("⚠ 请发送图片或取消")
return
}
this.Bot.pickGroup(e.group_id).setAvatar(this.e.img[0])
- .then(() => this.e.reply('✅ 群头像修改成功'))
+ .then(() => this.e.reply("✅ 群头像修改成功"))
.catch((err) => {
- this.e.reply('✅ 群头像修改失败')
+ this.e.reply("✅ 群头像修改失败")
logger.error(err)
})
- this.finish('_GroupAvatarContext')
+ this.finish("_GroupAvatarContext")
}
/**
@@ -296,38 +296,38 @@ export class Assistant extends plugin {
* @param e
*/
async SetGroupName (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) return
- let group = ''
- let card = ''
+ if (!common.checkPermission(e, "admin", "admin")) return
+ let group = ""
+ let card = ""
if (e.isPrivate) {
if (!e.isMaster) return
- let msg = e.msg.split(' ')
+ let msg = e.msg.split(" ")
group = msg[1].match(/[1-9]\d*/g)
- card = msg.slice(2).join(' ')
+ card = msg.slice(2).join(" ")
- if (!group) return e.reply('❎ 群号不能为空')
- if (!this.Bot.gl.get(Number(msg[1]))) return e.reply('❎ 群聊列表查无此群')
+ if (!group) return e.reply("❎ 群号不能为空")
+ if (!this.Bot.gl.get(Number(msg[1]))) return e.reply("❎ 群聊列表查无此群")
} else {
if (!e.member.is_admin && !e.member.is_owner && !e.isMaster) return logger.mark(`${e.logFnc}该群员权限不足`)
group = e.group_id
- card = e.msg.replace(/#|改群昵称/g, '').trim()
+ card = e.msg.replace(/#|改群昵称/g, "").trim()
}
- if (!card) return e.reply('❎ 昵称不能为空')
+ if (!card) return e.reply("❎ 昵称不能为空")
group = Number(group)
if (this.Bot.pickGroup(group).is_admin || this.Bot.pickGroup(group).is_owner) {
this.Bot.pickGroup(group).setName(card)
- .then(() => e.reply('✅ 群昵称修改成功'))
+ .then(() => e.reply("✅ 群昵称修改成功"))
.catch(err => {
- e.reply('✅ 群昵称修改失败')
+ e.reply("✅ 群昵称修改失败")
logger.error(err)
})
} else {
- return e.reply('❎ 没有管理员人家做不到啦~>_<')
+ return e.reply("❎ 没有管理员人家做不到啦~>_<")
}
}
@@ -336,12 +336,12 @@ export class Assistant extends plugin {
* @param e
*/
async SetSignature (e) {
- if (!common.checkPermission(e, 'master')) return
- let signs = e.msg.replace(/#|改签名/g, '').trim()
+ if (!common.checkPermission(e, "master")) return
+ let signs = e.msg.replace(/#|改签名/g, "").trim()
await this.Bot.setSignature(signs)
- .then(() => e.reply('✅ 签名修改成功'))
+ .then(() => e.reply("✅ 签名修改成功"))
.catch((err) => {
- e.reply('❎ 签名修改失败')
+ e.reply("❎ 签名修改失败")
logger.error(err)
})
}
@@ -351,18 +351,18 @@ export class Assistant extends plugin {
* @param e
*/
async SetOnlineStatus (e) {
- if (!common.checkPermission(e, 'master')) return
- let signs = e.msg.replace(/#|改状态/g, '').trim()
+ if (!common.checkPermission(e, "master")) return
+ let signs = e.msg.replace(/#|改状态/g, "").trim()
- if (!signs) return e.reply('❎ 状态不为空,可选值:我在线上,离开,隐身,忙碌,Q我吧,请勿打扰')
+ if (!signs) return e.reply("❎ 状态不为空,可选值:我在线上,离开,隐身,忙碌,Q我吧,请勿打扰")
let statusMirr = _.invert(status)
- if (!(signs in statusMirr)) return e.reply('❎ 可选值:我在线上,离开,隐身,忙碌,Q我吧,请勿打扰')
+ if (!(signs in statusMirr)) return e.reply("❎ 可选值:我在线上,离开,隐身,忙碌,Q我吧,请勿打扰")
await this.Bot.setOnlineStatus(statusMirr[signs])
.then(() => e.reply(`✅ 现在的在线状态为【${status[this.Bot.status]}】`))
.catch(err => {
- e.reply('❎ 在线状态修改失败')
+ e.reply("❎ 在线状态修改失败")
logger.error(err)
})
return true
@@ -373,21 +373,21 @@ export class Assistant extends plugin {
* @param e
*/
async SendFriendMsg (e) {
- if (!common.checkPermission(e, 'master')) return
+ if (!common.checkPermission(e, "master")) return
let regRet = FriendsReg.exec(e.msg)
let qq = regRet[1]
e.message[0].text = regRet[2]
- if (!/^\d+$/.test(qq)) return e.reply('❎ QQ号不正确,人家做不到的啦>_<~')
+ if (!/^\d+$/.test(qq)) return e.reply("❎ QQ号不正确,人家做不到的啦>_<~")
- if (!this.Bot.fl.get(Number(qq))) return e.reply('❎ 好友列表查无此人')
+ if (!this.Bot.fl.get(Number(qq))) return e.reply("❎ 好友列表查无此人")
if (!e.message[0].text) e.message.shift()
- if (e.message.length === 0) return e.reply('❎ 消息不能为空')
+ if (e.message.length === 0) return e.reply("❎ 消息不能为空")
await this.Bot.pickFriend(qq).sendMsg(e.message)
- .then(() => e.reply('✅ 私聊消息已送达'))
- .catch(err => common.handleException(e, err, { MsgTemplate: '❎ 发送失败\n错误信息为:{error}' }))
+ .then(() => e.reply("✅ 私聊消息已送达"))
+ .catch(err => common.handleException(e, err, { MsgTemplate: "❎ 发送失败\n错误信息为:{error}" }))
}
/**
@@ -395,7 +395,7 @@ export class Assistant extends plugin {
* @param e
*/
async SendGroupMsg (e) {
- if (!common.checkPermission(e, 'master')) return
+ if (!common.checkPermission(e, "master")) return
let regRet = GroupMsgReg.exec(e.msg)
let gpid = regRet[1]
@@ -404,20 +404,20 @@ export class Assistant extends plugin {
if (!e.message[0].text) e.message.shift()
- if (e.message.length === 0) return e.reply('❎ 消息不能为空')
+ if (e.message.length === 0) return e.reply("❎ 消息不能为空")
- if (!/^\d+$/.test(gpid)) return e.reply('❎ 您输入的群号不合法')
+ if (!/^\d+$/.test(gpid)) return e.reply("❎ 您输入的群号不合法")
- if (!this.Bot.gl.get(Number(gpid))) return e.reply('❎ 群聊列表查无此群')
+ if (!this.Bot.gl.get(Number(gpid))) return e.reply("❎ 群聊列表查无此群")
await this.Bot.pickGroup(gpid).sendMsg(e.message)
- .then(() => e.reply('✅ 群聊消息已送达'))
- .catch((err) => common.handleException(e, err, { MsgTemplate: '❎ 发送失败\n错误信息为:{error}' }))
+ .then(() => e.reply("✅ 群聊消息已送达"))
+ .catch((err) => common.handleException(e, err, { MsgTemplate: "❎ 发送失败\n错误信息为:{error}" }))
}
// 发送群列表
async SendGroupListMsg (e) {
- if (!common.checkPermission(e, 'master')) return
+ if (!common.checkPermission(e, "master")) return
// 获取参数
let regRet = GroupListMsgReg.exec(e.msg)
let gpid = regRet[1]
@@ -425,7 +425,7 @@ export class Assistant extends plugin {
if (!e.message[0].text) e.message.shift()
- if (e.message.length === 0) return e.reply('❎ 消息不能为空')
+ if (e.message.length === 0) return e.reply("❎ 消息不能为空")
let groupidList = []
let sendList = []
@@ -437,27 +437,27 @@ export class Assistant extends plugin {
groupidList.push(item.group_id)
})
- let groupids = gpid.split(',')
+ let groupids = gpid.split(",")
- if (!groupids.every(item => item <= groupidList.length)) return e.reply('❎ 序号超过合法值!!!')
+ if (!groupids.every(item => item <= groupidList.length)) return e.reply("❎ 序号超过合法值!!!")
groupids.forEach((item) => {
sendList.push(groupidList[Number(item) - 1])
})
- if (sendList.length > 3) return e.reply('❎ 不能同时发太多群聊,号寄概率增加!!!')
+ if (sendList.length > 3) return e.reply("❎ 不能同时发太多群聊,号寄概率增加!!!")
if (sendList.length === 1) {
await this.Bot.pickGroup(sendList[0]).sendMsg(e.message)
- .then(() => e.reply('✅ ' + sendList[0] + ' 群聊消息已送达'))
+ .then(() => e.reply("✅ " + sendList[0] + " 群聊消息已送达"))
.catch((err) =>
common.handleException(e, err, { MsgTemplate: `❎ ${sendList[0]} 发送失败\n错误信息为:{error}` })
)
} else {
- e.reply('发送多个群聊,将每5秒发送一条消息!')
+ e.reply("发送多个群聊,将每5秒发送一条消息!")
for (let i of sendList) {
await this.Bot.pickGroup(i).sendMsg(e.message)
- .then(() => e.reply('✅ ' + i + ' 群聊消息已送达'))
+ .then(() => e.reply("✅ " + i + " 群聊消息已送达"))
.catch((err) =>
common.handleException(e, err, { MsgTemplate: `❎ ${i} 发送失败\n错误信息为:{error}` }))
await sleep(5000)
@@ -471,24 +471,24 @@ export class Assistant extends plugin {
* @param e
*/
async QuitGroup (e) {
- if (!common.checkPermission(e, 'master')) return
- let quits = e.msg.replace(/#|退群/g, '').trim()
+ if (!common.checkPermission(e, "master")) return
+ let quits = e.msg.replace(/#|退群/g, "").trim()
- if (!quits) return e.reply('❎ 群号不能为空')
+ if (!quits) return e.reply("❎ 群号不能为空")
- if (!/^\d+$/.test(quits)) return e.reply('❎ 群号不合法')
+ if (!/^\d+$/.test(quits)) return e.reply("❎ 群号不合法")
- if (!this.Bot.gl.get(Number(quits))) return e.reply('❎ 群聊列表查无此群')
+ if (!this.Bot.gl.get(Number(quits))) return e.reply("❎ 群聊列表查无此群")
if (quits == e.group_id) {
- e.reply('✅ 3秒后退出本群聊')
+ e.reply("✅ 3秒后退出本群聊")
await sleep(3000)
}
await this.Bot.pickGroup(quits).quit()
- .then(() => e.reply('✅ 已退出群聊'))
+ .then(() => e.reply("✅ 已退出群聊"))
.catch((err) => {
- e.reply('❎ 退出失败')
+ e.reply("❎ 退出失败")
logger.error(err)
})
}
@@ -498,22 +498,22 @@ export class Assistant extends plugin {
* @param e
*/
async DeleteFriend (e) {
- if (!common.checkPermission(e, 'master')) return
- let quits = e.msg.replace(/#|删好友/g, '').trim()
+ if (!common.checkPermission(e, "master")) return
+ let quits = e.msg.replace(/#|删好友/g, "").trim()
if (e.message[1]) {
quits = e.message[1].qq
} else {
quits = quits.match(/[1-9]\d*/g)
}
- if (!quits) return e.reply('❎ 请输入正确的QQ号')
+ if (!quits) return e.reply("❎ 请输入正确的QQ号")
- if (!this.Bot.fl.get(Number(quits))) return e.reply('❎ 好友列表查无此人')
+ if (!this.Bot.fl.get(Number(quits))) return e.reply("❎ 好友列表查无此人")
await this.Bot.pickFriend(quits).delete()
- .then(() => e.reply('✅ 已删除好友'))
+ .then(() => e.reply("✅ 已删除好友"))
.catch((err) => {
- e.reply('❎ 删除失败')
+ e.reply("❎ 删除失败")
logger.error(err)
})
}
@@ -523,22 +523,22 @@ export class Assistant extends plugin {
* @param e
*/
async SetGender (e) {
- if (!common.checkPermission(e, 'master')) return
- let sex = e.msg.replace(/#|改性别/g, '').trim()
+ if (!common.checkPermission(e, "master")) return
+ let sex = e.msg.replace(/#|改性别/g, "").trim()
- if (!sex) return e.reply('❎ 性别不能为空 可选值:男,女,无\n(改为无,为无性别)')
+ if (!sex) return e.reply("❎ 性别不能为空 可选值:男,女,无\n(改为无,为无性别)")
let res = {
无: 0,
男: 1,
女: 2
}
- if (!(sex in res)) return e.reply('❎ 可选值:男,女,无(改为无,为无性别)')
+ if (!(sex in res)) return e.reply("❎ 可选值:男,女,无(改为无,为无性别)")
await this.Bot.setGender(res[sex])
- .then(() => e.reply('✅ 已修改性别'))
+ .then(() => e.reply("✅ 已修改性别"))
.catch((err) => {
- e.reply('❎ 修改失败')
+ e.reply("❎ 修改失败")
logger.error(err)
})
}
@@ -557,7 +557,7 @@ export class Assistant extends plugin {
source = (await e.friend.getChatHistory(e.source.time, 1)).pop()
}
for (let i of source.message) {
- if (i.type == 'image') {
+ if (i.type == "image") {
img.push(i.url)
}
}
@@ -566,8 +566,8 @@ export class Assistant extends plugin {
}
if (_.isEmpty(img)) {
- this.setContext('_ImageLinkContext')
- await this.reply('⚠ 请发送图片')
+ this.setContext("_ImageLinkContext")
+ await this.reply("⚠ 请发送图片")
return
}
await e.reply(`✅ 检测到${img.length}张图片`)
@@ -575,29 +575,29 @@ export class Assistant extends plugin {
// 大于两张图片以转发消息发送
let msg = []
for (let i of img) {
- msg.push([segment.image(i), '直链:', i])
+ msg.push([segment.image(i), "直链:", i])
}
common.getforwardMsg(e, msg)
} else {
- await e.reply([segment.image(img[0]), '直链:', img[0]])
+ await e.reply([segment.image(img[0]), "直链:", img[0]])
}
return true
}
async _ImageLinkContext () {
let img = this.e.img
- if (this.e.msg === '取消') {
- this.finish('_ImageLinkContext')
- await this.reply('✅ 已取消')
+ if (this.e.msg === "取消") {
+ this.finish("_ImageLinkContext")
+ await this.reply("✅ 已取消")
return
}
if (!img) {
- this.setContext('_ImageLinkContext')
- await this.reply('⚠ 请发送图片或取消')
+ this.setContext("_ImageLinkContext")
+ await this.reply("⚠ 请发送图片或取消")
return
}
await this.e.reply(img[0])
- this.finish('_ImageLinkContext')
+ this.finish("_ImageLinkContext")
}
/**
@@ -607,17 +607,17 @@ export class Assistant extends plugin {
async Face (e) {
let face = []
for (let m of e.message) {
- if (m.type === 'face') {
+ if (m.type === "face") {
let s = false
for (let i of face) { if (i.id === m.id) s = true }
if (!s) face.push(m)
}
}
- if (face.length === 0) return e.reply('❎ 表情参数不可为空', true)
+ if (face.length === 0) return e.reply("❎ 表情参数不可为空", true)
let res = face.map(function (item) {
return [
- '表情:',
+ "表情:",
item,
`\nid:${item.id}`,
`\n描述:${item.text}`
@@ -636,8 +636,8 @@ export class Assistant extends plugin {
* @param e
*/
async Qzonelist (e) {
- if (!common.checkPermission(e, 'master')) return
- let page = e.msg.replace(/#|获?取说说列表/g, '').trim()
+ if (!common.checkPermission(e, "master")) return
+ let page = e.msg.replace(/#|获?取说说列表/g, "").trim()
if (!page) {
page = 0
} else {
@@ -648,12 +648,12 @@ export class Assistant extends plugin {
let list = await new QQApi(e).getQzone(5, page * 5)
if (!list) return e.reply(API_ERROR)
- if (list.total == 0) return e.reply('✅ 说说列表为空')
+ if (list.total == 0) return e.reply("✅ 说说列表为空")
let msg = [
- '✅ 获取成功,说说列表如下:\n',
+ "✅ 获取成功,说说列表如下:\n",
...list.msglist.map((item, index) =>
- `${page * 5 + index + 1}.${_.truncate(item.content, { length: 15 })}\n- [${item.secret ? '私密' : '公开'}] | ${moment(item.created_time * 1000).format('MM/DD HH:mm')} | ${item.commentlist?.length || 0}条评论\n`
+ `${page * 5 + index + 1}.${_.truncate(item.content, { length: 15 })}\n- [${item.secret ? "私密" : "公开"}] | ${moment(item.created_time * 1000).format("MM/DD HH:mm")} | ${item.commentlist?.length || 0}条评论\n`
),
`页数:[${page + 1}/${Math.ceil(list.total / 5)}]`
]
@@ -665,13 +665,13 @@ export class Assistant extends plugin {
* @param e
*/
async Qzonedel (e) {
- if (!common.checkPermission(e, 'master')) return
+ if (!common.checkPermission(e, "master")) return
let pos = e.msg.match(/\d+/)
// 获取说说列表
let list = await new QQApi(e).getQzone(1, pos - 1)
if (!list) return e.reply(API_ERROR)
- if (!list.msglist) return e.reply('❎ 未获取到该说说')
+ if (!list.msglist) return e.reply("❎ 未获取到该说说")
// 要删除的说说
let domain = list.msglist[0]
@@ -681,9 +681,9 @@ export class Assistant extends plugin {
// debug
logger.debug(e.logFnc, result)
- if (result.subcode != 0) e.reply('❎ 未知错误' + JSON.parse(result))
+ if (result.subcode != 0) e.reply("❎ 未知错误" + JSON.parse(result))
// 发送结果
- e.reply(`✅ 删除说说成功:\n ${pos}.${_.truncate(domain.content, { length: 15 })} \n - [${domain.secret ? '私密' : '公开'}] | ${moment(domain.created_time * 1000).format('MM/DD HH:mm')} | ${domain.commentlist?.length || 0} 条评论`)
+ e.reply(`✅ 删除说说成功:\n ${pos}.${_.truncate(domain.content, { length: 15 })} \n - [${domain.secret ? "私密" : "公开"}] | ${moment(domain.created_time * 1000).format("MM/DD HH:mm")} | ${domain.commentlist?.length || 0} 条评论`)
}
/**
@@ -691,18 +691,18 @@ export class Assistant extends plugin {
* @param e
*/
async Qzonesay (e) {
- if (!common.checkPermission(e, 'master')) return
- let con = e.msg.replace(/#|发说说/g, '').trim()
+ if (!common.checkPermission(e, "master")) return
+ let con = e.msg.replace(/#|发说说/g, "").trim()
let result = await new QQApi(e).setQzone(con, e.img)
if (!result) return e.reply(API_ERROR)
if (result.code != 0) return e.reply(`❎ 说说发表失败\n${JSON.stringify(result)}`)
- let msg = ['✅ 说说发表成功,内容:\n', _.truncate(result.content, { length: 15 })]
+ let msg = ["✅ 说说发表成功,内容:\n", _.truncate(result.content, { length: 15 })]
if (result.pic) {
msg.push(segment.image(result.pic[0].url1))
}
- msg.push(`\n- [${result.secret ? '私密' : '公开'}] | ${moment(result.t1_ntime * 1000).format('MM/DD HH:mm')}`)
+ msg.push(`\n- [${result.secret ? "私密" : "公开"}] | ${moment(result.t1_ntime * 1000).format("MM/DD HH:mm")}`)
e.reply(msg)
}
@@ -711,14 +711,14 @@ export class Assistant extends plugin {
* @param e
*/
async QzonedelAll (e) {
- if (!common.checkPermission(e, 'master')) return
+ if (!common.checkPermission(e, "master")) return
if (/清空说说/.test(e.msg)) {
- this.setContext('_QzonedelAllContext')
- e.reply('✳️ 即将删除全部说说请发送:\n' + '------确认清空或取消------')
+ this.setContext("_QzonedelAllContext")
+ e.reply("✳️ 即将删除全部说说请发送:\n" + "------确认清空或取消------")
e.Qzonedetermine = true
} else if (/清空留言/.test(e.msg)) {
- this.setContext('_QzonedelAllContext')
- e.reply('✳️ 即将删除全部留言请发送:\n' + '------确认清空或取消------')
+ this.setContext("_QzonedelAllContext")
+ e.reply("✳️ 即将删除全部留言请发送:\n" + "------确认清空或取消------")
e.Qzonedetermine = false
}
}
@@ -726,7 +726,7 @@ export class Assistant extends plugin {
async _QzonedelAllContext (e) {
let msg = this.e.msg
if (/#?确认清空/.test(msg)) {
- this.finish('_QzonedelAllContext')
+ this.finish("_QzonedelAllContext")
let result
if (e.Qzonedetermine) {
result = await new QQApi(this.e).delQzoneAll()
@@ -737,36 +737,36 @@ export class Assistant extends plugin {
this.e.reply(result)
return true
} else if (/#?取消/.test(msg)) {
- this.finish('_QzonedelAllContext')
- this.e.reply('✅ 已取消')
+ this.finish("_QzonedelAllContext")
+ this.e.reply("✅ 已取消")
return false
} else {
- this.setContext('_QzonedelAllContext')
- this.e.reply('❎ 请输入:确认清空或取消')
+ this.setContext("_QzonedelAllContext")
+ this.e.reply("❎ 请输入:确认清空或取消")
return false
}
}
// 获取群|好友列表
async GlOrFl (e) {
- if (!common.checkPermission(e, 'master')) return
+ if (!common.checkPermission(e, "master")) return
let msg = []
if (/群列表/.test(e.msg)) {
// 获取群列表并转换为数组
let listMap = Array.from(this.Bot.gl.values())
msg = [
`群列表如下,共${listMap.length}个群`,
- listMap.map((item, index) => `${index + 1}、${item.group_name}(${item.group_id})`).join('\n'),
- '可使用 #退群123456789 来退出某群',
- '可使用 #发群列表 <序号> <消息> 来快速发送消息,多个群聊请用 "," 分隔 不能大于3 容易寄'
+ listMap.map((item, index) => `${index + 1}、${item.group_name}(${item.group_id})`).join("\n"),
+ "可使用 #退群123456789 来退出某群",
+ "可使用 #发群列表 <序号> <消息> 来快速发送消息,多个群聊请用 \",\" 分隔 不能大于3 容易寄"
]
} else {
// 获取好友列表并转换为数组
let listMap = Array.from(this.Bot.fl.values())
msg = [
`好友列表如下,共${listMap.length}个好友`,
- listMap.map((item, index) => `${index + 1}、${item.nickname}(${item.user_id})`).join('\n'),
- '可使用 #删好友123456789 来删除某人'
+ listMap.map((item, index) => `${index + 1}、${item.nickname}(${item.user_id})`).join("\n"),
+ "可使用 #删好友123456789 来删除某人"
]
}
@@ -791,7 +791,7 @@ export class Assistant extends plugin {
// 私聊判断是否为Bot消息
if (source.sender.user_id != this.Bot.uin) { return logger.warn(`${e.logFnc}引用不是Bot消息`) }
}
- if (source.message[0].type === 'file' && e.isGroup) {
+ if (source.message[0].type === "file" && e.isGroup) {
// 删除文件
logger.info(`${e.logFnc}执行删除文件`)
await this.Bot.acquireGfs(e.group_id).rm(source.message[0].fid)
@@ -806,12 +806,12 @@ export class Assistant extends plugin {
let msg
if (e.isGroup) {
if (!e.group.is_admin && !e.group.is_owner) {
- msg = '人家连管理员都木有,怎么撤回两分钟前的消息或别人的消息辣o(´^`)o'
+ msg = "人家连管理员都木有,怎么撤回两分钟前的消息或别人的消息辣o(´^`)o"
} else {
- msg = '干不赢这个淫的辣(`Δ´)ゞ'
+ msg = "干不赢这个淫的辣(`Δ´)ゞ"
}
} else {
- msg = '过了两分钟,吃不掉辣(o`ε´o)'
+ msg = "过了两分钟,吃不掉辣(o`ε´o)"
}
return e.reply(msg, true, { recallMsg: 5 })
}
@@ -820,7 +820,7 @@ export class Assistant extends plugin {
// 开关好友添加
async FriendSwitch (e) {
- if (!common.checkPermission(e, 'master')) return
+ if (!common.checkPermission(e, "master")) return
let res = await new QQApi(e).addFriendSwitch(/开启/.test(e.msg) ? 1 : 2)
if (!res) return e.reply(API_ERROR)
e.reply(res.ActionStatus)
@@ -828,15 +828,15 @@ export class Assistant extends plugin {
// 好友申请方式
async FriendType (e) {
- if (!common.checkPermission(e, 'master')) return
+ if (!common.checkPermission(e, "master")) return
let regRet = friendTypeReg.exec(e.msg)
- if (regRet[1] == 0) return e.reply('1为允许所有人,2为需要验证,3为问答正确问答(需填问题和答案,格式为:#更改好友申请方式3 问题 答案)')
+ if (regRet[1] == 0) return e.reply("1为允许所有人,2为需要验证,3为问答正确问答(需填问题和答案,格式为:#更改好友申请方式3 问题 答案)")
// 单独处理
- if ((!regRet[3] || !regRet[4]) && regRet[1] == 3) return e.reply('❎ 请正确输入问题和答案!')
+ if ((!regRet[3] || !regRet[4]) && regRet[1] == 3) return e.reply("❎ 请正确输入问题和答案!")
let res = await new QQApi(e).setFriendType(regRet[1], regRet[3], regRet[4])
if (!res) return e.reply(API_ERROR)
- if (res.ec != 0) return e.reply('❎ 修改失败\n' + JSON.stringify(res))
+ if (res.ec != 0) return e.reply("❎ 修改失败\n" + JSON.stringify(res))
e.reply(res.msg)
}
@@ -845,46 +845,46 @@ export class Assistant extends plugin {
* @param e
*/
async Cyc (e) {
- if (!common.checkPermission(e, 'master')) return
+ if (!common.checkPermission(e, "master")) return
let result = await new QQApi(e).setcyc(/开启/.test(e.msg) ? 0 : 1)
if (!result) return e.reply(API_ERROR)
- if (result.ret != 0) return e.reply('❎ 未知错误\n' + JSON.stringify(result))
- e.reply(`✅ 已${/开启/.test(e.msg) ? '开启' : '关闭'}戳一戳功能`)
+ if (result.ret != 0) return e.reply("❎ 未知错误\n" + JSON.stringify(result))
+ e.reply(`✅ 已${/开启/.test(e.msg) ? "开启" : "关闭"}戳一戳功能`)
}
async setModel (e) {
- if (!common.checkPermission(e, 'master')) return
- let model = e.msg.replace(/#|设置机型/g, '')
+ if (!common.checkPermission(e, "master")) return
+ let model = e.msg.replace(/#|设置机型/g, "")
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 BlockOne (e) {
- if (!common.checkPermission(e, 'master')) return
- let type = ''
- let name = '拉'
+ if (!common.checkPermission(e, "master")) return
+ let type = ""
+ let name = "拉"
if (/^#拉白(群聊?)?/.test(this.e.msg)) {
- type += 'white'
- name += '白'
+ type += "white"
+ name += "白"
} else {
- type += 'black'
- name += '黑'
+ type += "black"
+ name += "黑"
}
if (/^#拉[黑白](群聊?)/.test(this.e.msg)) {
- type += 'Group'
- name += '群'
+ type += "Group"
+ name += "群"
} else {
- type += Version.name == 'TRSS-Yunzai' ? 'User' : 'QQ'
+ type += Version.name == "TRSS-Yunzai" ? "User" : "QQ"
}
- const configPath = 'config/config/other.yaml'
+ const configPath = "config/config/other.yaml"
/** 判断at */
if (this.e.at) {
this.blackResult = this.e.at
} else {
- if (Version.name == 'TRSS-Yunzai') {
+ if (Version.name == "TRSS-Yunzai") {
/** TRSS-Yunzai匹配所有字符 */
- const blackId = this.e.msg.replace(/^#拉[黑白](群聊?)?/, '').trim()
+ const blackId = this.e.msg.replace(/^#拉[黑白](群聊?)?/, "").trim()
this.blackResult = Number(blackId) || String(blackId)
} else {
const match = this.e.msg.match(/\d+/)
@@ -894,14 +894,14 @@ export class Assistant extends plugin {
if (!this.blackResult) { return this.e.reply(`❎ ${name}失败,没有键入用户或群号`) }
try {
const yamlContentBuffer = await fs.promises.readFile(configPath)
- const yamlContent = yamlContentBuffer.toString('utf-8')
+ const yamlContent = yamlContentBuffer.toString("utf-8")
const data = yaml.parse(yamlContent)
if (!Array.isArray(data[type])) { data[type] = [] }
if (!data[type].includes(this.blackResult)) {
data[type].push(this.blackResult)
const updatedYaml = yaml.stringify(data, { quote: false })
- const resultYaml = updatedYaml.replace(/"/g, '')
- await fs.promises.writeFile(configPath, resultYaml, 'utf-8')
+ const resultYaml = updatedYaml.replace(/"/g, "")
+ await fs.promises.writeFile(configPath, resultYaml, "utf-8")
await this.e.reply(`✅ 已把这个坏淫${name}掉惹!!!`)
} else {
await this.e.reply(`❎ 已把这个坏淫${name}过辣`)
@@ -913,28 +913,28 @@ export class Assistant extends plugin {
}
async CancelBlockOne (e) {
- if (!common.checkPermission(e, 'master')) return
- let type = ''
- let name = '取消拉'
+ if (!common.checkPermission(e, "master")) return
+ let type = ""
+ let name = "取消拉"
if (/^#(取消|删除|移除)(群聊?)?拉白(群聊?)?/.test(this.e.msg)) {
- type += 'white'
- name += '白'
+ type += "white"
+ name += "白"
} else {
- type += 'black'
- name += '黑'
+ type += "black"
+ name += "黑"
}
if (/^#(取消|删除|移除)拉[黑白](群聊?)/.test(this.e.msg)) {
- type += 'Group'
- name += '群'
+ type += "Group"
+ name += "群"
} else {
- type += Version.name == 'TRSS-Yunzai' ? 'User' : 'QQ'
+ type += Version.name == "TRSS-Yunzai" ? "User" : "QQ"
}
- const configPath = 'config/config/other.yaml'
+ const configPath = "config/config/other.yaml"
if (this.e.at) {
this.blackResult = this.e.at
} else {
- if (Version.name == 'TRSS-Yunzai') {
- const blackId = this.e.msg.replace(/^#(取消|(删|移)除)拉[黑白](群聊?)?/, '').trim()
+ if (Version.name == "TRSS-Yunzai") {
+ const blackId = this.e.msg.replace(/^#(取消|(删|移)除)拉[黑白](群聊?)?/, "").trim()
this.blackResult = Number(blackId) || String(blackId)
} else {
const match = this.e.msg.match(/\d+/)
@@ -944,13 +944,13 @@ export class Assistant extends plugin {
if (!this.blackResult) { return this.e.reply(`❎ ${name}失败,没有键入用户或群号`) }
try {
const yamlContentBuffer = await fs.promises.readFile(configPath)
- const yamlContent = yamlContentBuffer.toString('utf-8')
+ const yamlContent = yamlContentBuffer.toString("utf-8")
const data = yaml.parse(yamlContent)
if (Array.isArray(data[type]) && data[type].includes(this.blackResult)) {
const itemToRemove = this.blackResult.toString()
data[type] = data[type].filter(item => item.toString() !== itemToRemove)
const updatedYaml = yaml.stringify(data)
- await fs.promises.writeFile(configPath, updatedYaml, 'utf-8')
+ await fs.promises.writeFile(configPath, updatedYaml, "utf-8")
await this.e.reply(`✅ 已把这个坏淫${name}掉惹!!!`)
} else {
await this.e.reply(`❎ ${name}失败,找不到辣>_<`)
diff --git a/apps/bika.js b/apps/bika.js
index e32fb69..17fd3db 100644
--- a/apps/bika.js
+++ b/apps/bika.js
@@ -1,56 +1,56 @@
-import { Bika, common, Pixiv } from '../model/index.js'
-import { Config } from '../components/index.js'
-import { Admin } from './admin.js'
-import translateChinaNum from '../tools/translateChinaNum.js'
+import { Bika, common, Pixiv } from "../model/index.js"
+import { Config } from "../components/index.js"
+import { Admin } from "./admin.js"
+import translateChinaNum from "../tools/translateChinaNum.js"
// 汉字数字匹配正则
-const numReg = '[零一壹二两三四五六七八九十百千万亿\\d]+'
-const Prefix = '(bika|哔咔)'
+const numReg = "[零一壹二两三四五六七八九十百千万亿\\d]+"
+const Prefix = "(bika|哔咔)"
// 命令正则
const searchReg = new RegExp(`^#?${Prefix}(类别|作者|高级)?搜索(.*?)(第(${numReg})页)?$`)
const comicPageReg = new RegExp(`^#?${Prefix}id(.*?)(第(${numReg})页)?(第(${numReg})话)?$`)
export class NewBika extends plugin {
constructor () {
super({
- name: '椰奶哔咔',
- event: 'message',
+ name: "椰奶哔咔",
+ event: "message",
priority: 2000,
rule: [
{
reg: searchReg,
- fnc: 'search'
+ fnc: "search"
},
{
reg: comicPageReg,
- fnc: 'comicPage'
+ fnc: "comicPage"
},
{
reg: `^#?${Prefix}看\\d+$`,
- fnc: 'viewComicPage'
+ fnc: "viewComicPage"
},
{
reg: `^#?${Prefix}下一页$`,
- fnc: 'nextComicPage'
+ fnc: "nextComicPage"
},
{
reg: `^#?${Prefix}下一话$`,
- fnc: 'nextChapter'
+ fnc: "nextChapter"
},
{
reg: `^#?${Prefix}类别列表$`,
- fnc: 'categories'
+ fnc: "categories"
},
{
reg: `^#?${Prefix}(详情|细节)(.*)$`,
- fnc: 'comicDetail'
+ fnc: "comicDetail"
},
{
reg: `^#?${Prefix}修改图片质量(.*)$`,
- fnc: 'imageQuality'
+ fnc: "imageQuality"
},
{
reg: `^#?${Prefix}(开启|关闭)直连$`,
- fnc: 'directConnection'
+ fnc: "directConnection"
}
]
@@ -115,7 +115,7 @@ export class NewBika extends plugin {
*/
async nextChapter (e) {
if (!await this._Authentication(e)) return
- await Bika.next('chapter')
+ await Bika.next("chapter")
.then(res => common.recallSendForwardMsg(e, res))
.catch(err => common.handleException(e, err))
}
@@ -152,14 +152,14 @@ export class NewBika extends plugin {
async imageQuality (e) {
let quality = e.msg.match(new RegExp(`#?${Prefix}修改图片质量(.*)`))[2]
let imageQualityType = {
- 低质量: 'low',
- 中等质量: 'medium',
- 高质量: 'high',
- 原图: 'original'
+ 低质量: "low",
+ 中等质量: "medium",
+ 高质量: "high",
+ 原图: "original"
}
- if (!imageQualityType[quality] && !Object.values(imageQualityType).includes(quality)) return e.reply(`错误参数,支持的参数为${Object.keys(imageQualityType).join(',')}`)
+ if (!imageQualityType[quality] && !Object.values(imageQualityType).includes(quality)) return e.reply(`错误参数,支持的参数为${Object.keys(imageQualityType).join(",")}`)
let type = imageQualityType[quality] ?? quality
- Config.modify('bika', 'imageQuality', type)
+ Config.modify("bika", "imageQuality", type)
new Admin().SeSe_Settings(e)
}
@@ -171,21 +171,21 @@ export class NewBika extends plugin {
if (!this.e.isMaster) { return true }
let now = Config.bika.bikaDirectConnection
let isSwitch = /开启/.test(e.msg)
- if (now && isSwitch) return e.reply('❎ bika图片直连已处于开启状态')
- if (!now && !isSwitch) return e.reply('❎ bika图片直连已处于关闭状态')
- Config.modify('bika', 'bikaDirectConnection', isSwitch)
+ if (now && isSwitch) return e.reply("❎ bika图片直连已处于开启状态")
+ if (!now && !isSwitch) return e.reply("❎ bika图片直连已处于关闭状态")
+ Config.modify("bika", "bikaDirectConnection", isSwitch)
new Admin().SeSe_Settings(e)
}
async _Authentication (e) {
if (!this.e.isMaster) { return true }
- if (!common.checkSeSePermission(e, 'sesepro')) return false
+ if (!common.checkSeSePermission(e, "sesepro")) return false
if (!Config.bika.allowPM && !e.isGroup) {
- e.reply('主人已禁用私聊该功能')
+ e.reply("主人已禁用私聊该功能")
return false
}
- if (!await common.limit(e.user_id, 'bika', Config.bika.limit)) {
- e.reply('您已达今日「bika」次数上限', true, { at: true })
+ if (!await common.limit(e.user_id, "bika", Config.bika.limit)) {
+ e.reply("您已达今日「bika」次数上限", true, { at: true })
return false
}
return true
diff --git a/apps/events/input.js b/apps/events/input.js
index ca4ee05..a6d2081 100644
--- a/apps/events/input.js
+++ b/apps/events/input.js
@@ -1,13 +1,13 @@
-import { common } from '../../model/index.js'
-import { Config } from '../../components/index.js'
+import { common } from "../../model/index.js"
+import { Config } from "../../components/index.js"
-Bot.on?.('internal.input', async (e) => {
+Bot.on?.("internal.input", async (e) => {
if (!Config.whole.input) return false
// 判断是否主人消息
if (Config.masterQQ.includes(e.user_id)) return false
let msg = [
segment.image(`https://q1.qlogo.cn/g?b=qq&s=100&nk=${e.user_id}`),
- `[事件(${e.self_id}) - 对方${e.end ? '输入完毕' : '正在输入'}]\n`,
+ `[事件(${e.self_id}) - 对方${e.end ? "输入完毕" : "正在输入"}]\n`,
`好友账号:${e.user_id}`
]
await common.sendMasterMsg(msg)
diff --git a/apps/events/message.js b/apps/events/message.js
index 1cd8173..456e282 100644
--- a/apps/events/message.js
+++ b/apps/events/message.js
@@ -1,7 +1,7 @@
-import { common } from '../../model/index.js'
-import { Config } from '../../components/index.js'
+import { common } from "../../model/index.js"
+import { Config } from "../../components/index.js"
-Bot.on?.('message', async (e) => {
+Bot.on?.("message", async (e) => {
// 判断是否存在消息
if (!e?.message?.length) return false
// 判断是否为机器人消息
@@ -11,7 +11,7 @@ Bot.on?.('message', async (e) => {
// 删除缓存时间
const deltime = Config.whole.deltime
// 判断群聊还是私聊
- if (e.message_type == 'group') {
+ if (e.message_type == "group") {
// 关闭撤回停止存储
if (Config.getGroup(e.group_id).groupRecall) {
// logger.debug(`[Yenai-Plugin]存储群消息${e.group_id}=>${e.message_id}`)
@@ -22,7 +22,7 @@ Bot.on?.('message', async (e) => {
{ EX: deltime }
)
}
- } else if (e.message_type == 'private') {
+ } else if (e.message_type == "private") {
// 关闭撤回停止存储
if (Config.whole.PrivateRecall) {
// logger.debug(`[Yenai-Plugin]存储私聊消息${e.user_id}=>${e.message_id}`)
@@ -38,11 +38,11 @@ Bot.on?.('message', async (e) => {
let msg = null
let forwardMsg = null
if (
- e.message[0].type == 'flash' &&
- e.message_type === 'group'
+ e.message[0].type == "flash" &&
+ e.message_type === "group"
) {
if (!Config.getGroup(e.group_id).flashPhoto) return false
- logger.info('[Yenai-Plugin]群聊闪照')
+ logger.info("[Yenai-Plugin]群聊闪照")
msg = [
segment.image(`https://p.qlogo.cn/gh/${e.group_id}/${e.group_id}/100`),
`[消息(${e.self_id}) - 闪照消息]\n`,
@@ -53,11 +53,11 @@ Bot.on?.('message', async (e) => {
`闪照链接:${e.message[0].url}`
]
} else if (
- e.message[0].type == 'flash' &&
- e.message_type === 'discuss' &&
+ e.message[0].type == "flash" &&
+ e.message_type === "discuss" &&
Config.whole.flashPhoto
) {
- logger.info('[Yenai-Plugin]讨论组闪照')
+ logger.info("[Yenai-Plugin]讨论组闪照")
msg = [
segment.image(`https://q1.qlogo.cn/g?b=qq&s=100&nk=${e.user_id}`),
`[消息(${e.self_id}) - 闪照消息]\n`,
@@ -68,11 +68,11 @@ Bot.on?.('message', async (e) => {
`闪照链接:${e.message[0].url}`
]
} else if (
- e.message[0].type == 'flash' &&
- e.message_type === 'private' &&
+ e.message[0].type == "flash" &&
+ e.message_type === "private" &&
Config.whole.flashPhoto
) {
- logger.info('[Yenai-Plugin]好友闪照')
+ logger.info("[Yenai-Plugin]好友闪照")
msg = [
segment.image(`https://q1.qlogo.cn/g?b=qq&s=100&nk=${e.user_id}`),
`[消息(${e.self_id}) - 闪照消息]\n`,
@@ -80,7 +80,7 @@ Bot.on?.('message', async (e) => {
`发送人昵称:${e.sender.nickname}\n`,
`闪照链接:${e.message[0].url}`
]
- } else if (e.message_type === 'private' && e.sub_type === 'friend') {
+ } else if (e.message_type === "private" && e.sub_type === "friend") {
if (!Config.whole.privateMessage) return false
// 特殊消息处理
@@ -89,26 +89,26 @@ Bot.on?.('message', async (e) => {
forwardMsg = arr.msg
e.message = arr.type
}
- logger.info('[Yenai-Plugin]好友消息')
+ logger.info("[Yenai-Plugin]好友消息")
msg = [
segment.image(`https://q1.qlogo.cn/g?b=qq&s=100&nk=${e.user_id}`),
`[消息(${e.self_id}) - 好友消息]\n`,
`好友账号:${e.user_id}\n`,
`好友昵称:${e.sender.nickname}\n`,
- '消息内容:',
+ "消息内容:",
...e.message
]
// 添加提示消息
const key = `yenai:notice:privateMessage:${e.user_id}`
if (!(await redis.get(key))) {
- await redis.set(key, '1', { EX: 600 })
+ await redis.set(key, "1", { EX: 600 })
msg.push(
- '\n-------------\n',
- '引用该消息:回复 <内容>\n',
+ "\n-------------\n",
+ "引用该消息:回复 <内容>\n",
`或发送:回复 ${e.user_id} <内容>`
)
}
- } else if (e.message_type === 'private' && e.sub_type === 'group') {
+ } else if (e.message_type === "private" && e.sub_type === "group") {
if (!Config.getGroup(e.group_id).grouptemporaryMessage) return false
// 特殊消息处理
const arr = getMsgType(e.message)
@@ -116,26 +116,26 @@ Bot.on?.('message', async (e) => {
forwardMsg = arr.msg
e.message = arr.type
}
- logger.info('[Yenai-Plugin]群临时消息')
+ logger.info("[Yenai-Plugin]群临时消息")
// 发送的消息
msg = [
segment.image(`https://q1.qlogo.cn/g?b=qq&s=100&nk=${e.user_id}`),
`[消息(${e.self_id}) - 群临时消息]\n`,
`来源群号:${e.sender.group_id}\n`,
`发送人账号:${e.user_id}\n`,
- '消息内容:',
+ "消息内容:",
...e.message
]
// 添加提示消息
const key = `yenai:notice:tempprivateMessage:${e.user_id}`
if (!(await redis.get(key))) {
- await redis.set(key, '1', { EX: 600 })
+ await redis.set(key, "1", { EX: 600 })
msg.push(
- '\n-------------\n',
- '可回复 "加为好友" 添加好友\n或 "回复 <消息>"'
+ "\n-------------\n",
+ "可回复 \"加为好友\" 添加好友\n或 \"回复 <消息>\""
)
}
- } else if (e.message_type === 'group') {
+ } else if (e.message_type === "group") {
if (!Config.getGroup(e.group_id).groupMessage) return false
// 特殊消息处理
const arr = getMsgType(e.message)
@@ -143,7 +143,7 @@ Bot.on?.('message', async (e) => {
forwardMsg = arr.msg
e.message = arr.type
}
- logger.info('[Yenai-Plugin]群聊消息')
+ logger.info("[Yenai-Plugin]群聊消息")
msg = [
segment.image(`https://p.qlogo.cn/gh/${e.group_id}/${e.group_id}/100`),
`[消息(${e.self_id}) - 群聊消息]\n`,
@@ -151,12 +151,12 @@ Bot.on?.('message', async (e) => {
`来源群名:${e.group_name}\n`,
`发送人账号:${e.user_id}\n`,
`发送人昵称:${e.sender.nickname}\n`,
- '消息内容:',
+ "消息内容:",
...e.message
]
- } else if (e.message_type === 'discuss') {
+ } else if (e.message_type === "discuss") {
if (!Config.getGroup(e.group_id).groupMessage) return false
- logger.info('[Yenai-Plugin]讨论组消息')
+ logger.info("[Yenai-Plugin]讨论组消息")
msg = [
segment.image(`https://q1.qlogo.cn/g?b=qq&s=100&nk=${e.user_id}`),
`[消息(${e.self_id}) - 群聊消息]\n`,
@@ -182,15 +182,15 @@ function getMsgType (msg) {
const msgType = {
record: {
msg: segment.record(msg[0].url),
- type: '[语音]'
+ type: "[语音]"
},
video: {
msg: segment.video(msg[0].file),
- type: '[视频]'
+ type: "[视频]"
},
xml: {
msg,
- type: '[合并消息]'
+ type: "[合并消息]"
}
}
return msgType[msg[0].type]
diff --git a/apps/events/notice_friend.js b/apps/events/notice_friend.js
index 6b7492d..64b1030 100644
--- a/apps/events/notice_friend.js
+++ b/apps/events/notice_friend.js
@@ -1,13 +1,13 @@
-import { common } from '../../model/index.js'
-import { Config } from '../../components/index.js'
+import { common } from "../../model/index.js"
+import { Config } from "../../components/index.js"
-Bot.on?.('notice.friend', async (e) => {
+Bot.on?.("notice.friend", async (e) => {
let msg
let forwardMsg
switch (e.sub_type) {
- case 'increase': {
+ case "increase": {
if (!Config.whole.friendNumberChange) return false
- logger.info('[Yenai-Plugin]新增好友')
+ logger.info("[Yenai-Plugin]新增好友")
msg = [
segment.image(`https://q1.qlogo.cn/g?b=qq&s=100&nk=${e.user_id}`),
`[通知(${e.self_id}) - 新增好友]\n`,
@@ -16,9 +16,9 @@ Bot.on?.('notice.friend', async (e) => {
]
break
}
- case 'decrease': {
+ case "decrease": {
if (!Config.whole.friendNumberChange) return false
- logger.info('[Yenai-Plugin]好友减少')
+ logger.info("[Yenai-Plugin]好友减少")
msg = [
segment.image(`https://q1.qlogo.cn/g?b=qq&s=100&nk=${e.user_id}`),
`[通知(${e.self_id}) - 好友减少]\n`,
@@ -27,13 +27,13 @@ Bot.on?.('notice.friend', async (e) => {
]
break
}
- case 'recall': {
+ case "recall": {
if (!Config.whole.PrivateRecall) return false
if (e.user_id == (e.bot ?? Bot).uin) return false
// 主人撤回
if (Config.masterQQ.includes(e.user_id)) return false
- logger.info('[Yenai-Plugin]好友撤回')
+ logger.info("[Yenai-Plugin]好友撤回")
// 读取
let res = JSON.parse(
await redis.get(`notice:messagePrivate:${e.message_id}`)
@@ -43,19 +43,19 @@ Bot.on?.('notice.friend', async (e) => {
const msgType = {
flash: {
msg: () => false,
- type: ['[闪照]\n', '撤回闪照:', segment.image(res[0].url)]
+ type: ["[闪照]\n", "撤回闪照:", segment.image(res[0].url)]
},
record: {
msg: () => segment.record(res[0].url),
- type: '[语音]'
+ type: "[语音]"
},
video: {
msg: () => segment.video(res[0].file),
- type: '[视频]'
+ type: "[视频]"
},
xml: {
msg: () => res,
- type: '[合并消息]'
+ type: "[合并消息]"
}
}
if (msgType[res[0].type]) {
@@ -68,14 +68,14 @@ Bot.on?.('notice.friend', async (e) => {
`[消息(${e.self_id}) - 好友撤回消息]\n`,
`好友账号:${e.user_id}\n`,
`撤回时间:${formatDate(e.time)}\n`,
- '撤回消息:',
+ "撤回消息:",
...res
]
break
}
- case 'poke': {
+ case "poke": {
if (!Config.whole.privateMessage) return false
- logger.info('[Yenai-Plugin]好友戳一戳')
+ logger.info("[Yenai-Plugin]好友戳一戳")
msg = [
segment.image(`https://q1.qlogo.cn/g?b=qq&s=100&nk=${e.user_id}`),
`[消息(${e.self_id}) - 戳一戳]\n`,
@@ -102,14 +102,14 @@ function formatDate (time) {
// 日
let date = now.getDate()
// 补0
- if (month >= 1 && month <= 9) month = '0' + month
- if (date >= 0 && date <= 9) date = '0' + date
+ if (month >= 1 && month <= 9) month = "0" + month
+ if (date >= 0 && date <= 9) date = "0" + date
// 时
let hour = now.getHours()
// 分
let minute = now.getMinutes()
// 补0
- if (hour >= 1 && hour <= 9) hour = '0' + hour
- if (minute >= 0 && minute <= 9) minute = '0' + minute
+ if (hour >= 1 && hour <= 9) hour = "0" + hour
+ if (minute >= 0 && minute <= 9) minute = "0" + minute
return `${month}-${date} ${hour}:${minute} `
}
diff --git a/apps/events/notice_group.js b/apps/events/notice_group.js
index ed0628b..7a21b76 100644
--- a/apps/events/notice_group.js
+++ b/apps/events/notice_group.js
@@ -1,17 +1,17 @@
-import { common } from '../../model/index.js'
-import { Config } from '../../components/index.js'
-import moment from 'moment'
-import formatDuration from '../../tools/formatDuration.js'
+import { common } from "../../model/index.js"
+import { Config } from "../../components/index.js"
+import moment from "moment"
+import formatDuration from "../../tools/formatDuration.js"
-Bot.on?.('notice.group', async (e) => {
+Bot.on?.("notice.group", async (e) => {
let msg
let forwardMsg
switch (e.sub_type) {
- case 'increase': {
+ case "increase": {
if (e.user_id === (e.bot ?? Bot).uin) {
if (!Config.getGroup(e.group_id).groupNumberChange) return false
- logger.info('[Yenai-Plugin]新增群聊')
+ logger.info("[Yenai-Plugin]新增群聊")
msg = [
segment.image(`https://p.qlogo.cn/gh/${e.group_id}/${e.group_id}/100`),
@@ -21,7 +21,7 @@ Bot.on?.('notice.group', async (e) => {
} else {
if (!Config.getGroup(e.group_id).groupMemberNumberChange) return false
- logger.info('[Yenai-Plugin]新增群员')
+ logger.info("[Yenai-Plugin]新增群员")
msg = [
segment.image(`https://p.qlogo.cn/gh/${e.group_id}/${e.group_id}/100`),
@@ -33,11 +33,11 @@ Bot.on?.('notice.group', async (e) => {
}
break
}
- case 'decrease': {
+ case "decrease": {
if (e.dismiss) {
if (!Config.getGroup(e.group_id).groupNumberChange) return false
- logger.info('[Yenai-Plugin]群聊被解散')
+ logger.info("[Yenai-Plugin]群聊被解散")
msg = [
segment.image(
@@ -53,7 +53,7 @@ Bot.on?.('notice.group', async (e) => {
) {
if (!Config.getGroup(e.group_id).groupNumberChange) return false
- logger.info('[Yenai-Plugin]机器人被踢')
+ logger.info("[Yenai-Plugin]机器人被踢")
msg = [
segment.image(
@@ -69,7 +69,7 @@ Bot.on?.('notice.group', async (e) => {
) {
if (!Config.getGroup(e.group_id).groupNumberChange) return false
- logger.info('[Yenai-Plugin]机器人退群')
+ logger.info("[Yenai-Plugin]机器人退群")
msg = [
segment.image(
@@ -81,7 +81,7 @@ Bot.on?.('notice.group', async (e) => {
} else if (e.operator_id === e.user_id) {
if (!Config.getGroup(e.group_id).groupMemberNumberChange) return false
- logger.info('[Yenai-Plugin]群员退群')
+ logger.info("[Yenai-Plugin]群员退群")
msg = [
segment.image(
@@ -96,7 +96,7 @@ Bot.on?.('notice.group', async (e) => {
} else if (e.operator_id !== e.user_id) {
if (!Config.getGroup(e.group_id).groupMemberNumberChange) return false
- logger.info('[Yenai-Plugin]群员被踢')
+ logger.info("[Yenai-Plugin]群员被踢")
msg = [
segment.image(
@@ -113,10 +113,10 @@ Bot.on?.('notice.group', async (e) => {
break
}
// 群管理变动
- case 'admin': {
+ case "admin": {
if (!Config.getGroup(e.group_id).groupAdminChange) return false
- e.set ? logger.info('[Yenai-Plugin]机器人被设置管理') : logger.info('[Yenai-Plugin]机器人被取消管理')
+ e.set ? logger.info("[Yenai-Plugin]机器人被设置管理") : logger.info("[Yenai-Plugin]机器人被取消管理")
if (e.user_id === (e.bot ?? Bot).uin) {
msg = [
segment.image(
@@ -128,7 +128,7 @@ Bot.on?.('notice.group', async (e) => {
`被操作群号:${e.group_id}`
]
} else {
- e.set ? logger.info('[Yenai-Plugin]新增群管理员') : logger.info('[Yenai-Plugin]取消群管理员')
+ e.set ? logger.info("[Yenai-Plugin]新增群管理员") : logger.info("[Yenai-Plugin]取消群管理员")
msg = [
segment.image(
@@ -142,8 +142,8 @@ Bot.on?.('notice.group', async (e) => {
break
}
// 禁言
- case 'ban': {
- const forbiddenTime = formatDuration(e.duration, 'default')
+ case "ban": {
+ const forbiddenTime = formatDuration(e.duration, "default")
/** 处理白名单禁言 */
const { groupAdmin } = Config
const isMaster = Config.masterQQ?.includes(e.operator_id) || e.operator_id === (e.bot ?? Bot).uin
@@ -157,7 +157,7 @@ Bot.on?.('notice.group', async (e) => {
e.duration !== 0
) {
await e.group.muteMember(e.user_id, 0)
- e.reply('已解除白名单用户的禁言')
+ e.reply("已解除白名单用户的禁言")
}
if (!Config.getGroup(e.group_id).botBeenBanned) return false
@@ -165,7 +165,7 @@ Bot.on?.('notice.group', async (e) => {
if (e.user_id != (e.bot ?? Bot).uin) return false
if (e.duration == 0) {
- logger.info('[Yenai-Plugin]机器人被解除禁言')
+ logger.info("[Yenai-Plugin]机器人被解除禁言")
msg = [
segment.image(
`https://p.qlogo.cn/gh/${e.group_id}/${e.group_id}/100`
@@ -175,7 +175,7 @@ Bot.on?.('notice.group', async (e) => {
`处理群号:${e.group_id}`
]
} else if (e.user_id === (e.bot ?? Bot).uin) {
- logger.info('[Yenai-Plugin]机器人被禁言')
+ logger.info("[Yenai-Plugin]机器人被禁言")
msg = [
segment.image(
@@ -190,10 +190,10 @@ Bot.on?.('notice.group', async (e) => {
break
}
// 群转让
- case 'transfer': {
+ case "transfer": {
if (!Config.getGroup(e.group_id).groupNumberChange) return false
- logger.info('[Yenai-Plugin]群聊转让')
+ logger.info("[Yenai-Plugin]群聊转让")
msg = [
segment.image(
@@ -207,7 +207,7 @@ Bot.on?.('notice.group', async (e) => {
break
}
// 群撤回
- case 'recall': {
+ case "recall": {
// 开启或关闭
if (!Config.getGroup(e.group_id).groupRecall) return false
// 是否为机器人撤回
@@ -221,7 +221,7 @@ Bot.on?.('notice.group', async (e) => {
// 无数据 return出去
if (!res) return false
// 不同消息处理
- let special = ''
+ let special = ""
let msgType = {
flash: {
msg: () => e.group.makeForwardMsg([
@@ -231,19 +231,19 @@ Bot.on?.('notice.group', async (e) => {
user_id: e.user_id
}
]),
- type: '[闪照]'
+ type: "[闪照]"
},
record: {
msg: () => segment.record(res[0].url),
- type: '[语音]'
+ type: "[语音]"
},
video: {
msg: () => segment.video(res[0].file),
- type: '[视频]'
+ type: "[视频]"
},
xml: {
msg: () => res,
- type: '[合并消息]'
+ type: "[合并消息]"
}
}
if (msgType[res[0].type]) {
@@ -260,23 +260,23 @@ Bot.on?.('notice.group', async (e) => {
])
}
// 判断是否管理撤回
- let isManage = ''
+ let isManage = ""
if (e.operator_id != e.user_id) {
isManage = `撤回管理:${e.group.pickMember(e.operator_id).card}(${e.operator_id
})\n`
}
- isManage ? logger.info('[Yenai-Plugin]群聊管理撤回') : logger.info('[Yenai-Plugin]群聊撤回')
+ isManage ? logger.info("[Yenai-Plugin]群聊管理撤回") : logger.info("[Yenai-Plugin]群聊撤回")
// 发送的消息
msg = [
segment.image(`https://p.qlogo.cn/gh/${e.group_id}/${e.group_id}/100`),
- `[通知(${e.self_id}) - 群聊${isManage ? '管理' : ''}撤回]\n`,
+ `[通知(${e.self_id}) - 群聊${isManage ? "管理" : ""}撤回]\n`,
`撤回群名:${e.group_name}\n`,
`撤回群号:${e.group_id}\n`,
isManage,
- `${isManage ? '被撤回人' : '撤回人员'}:${e.group.pickMember(e.user_id).card
+ `${isManage ? "被撤回人" : "撤回人员"}:${e.group.pickMember(e.user_id).card
}(${e.user_id})\n`,
- `撤回时间:${moment(e.time * 1000).format('MM-DD HH:mm:ss')}`,
- special ? `\n特殊消息:${special}` : ''
+ `撤回时间:${moment(e.time * 1000).format("MM-DD HH:mm:ss")}`,
+ special ? `\n特殊消息:${special}` : ""
]
break
}
diff --git a/apps/events/request.js b/apps/events/request.js
index 7d55b83..379a343 100644
--- a/apps/events/request.js
+++ b/apps/events/request.js
@@ -1,21 +1,21 @@
-import cfg from '../../../../lib/config/config.js'
-import { common } from '../../model/index.js'
-import { Config } from '../../components/index.js'
+import cfg from "../../../../lib/config/config.js"
+import { common } from "../../model/index.js"
+import { Config } from "../../components/index.js"
const ROLE_MAP = {
- admin: '群管理',
- owner: '群主',
- member: '群员'
+ admin: "群管理",
+ owner: "群主",
+ member: "群员"
}
-Bot.on?.('request', async (e) => {
- let msg = ''
+Bot.on?.("request", async (e) => {
+ let msg = ""
switch (e.request_type) {
- case 'group':
+ case "group":
switch (e.sub_type) {
- case 'invite':
+ case "invite":
if (!Config.whole.groupInviteRequest) return false
if (cfg.masterQQ.includes(e.user_id)) return false
- logger.info('[Yenai-Plugin]邀请机器人进群')
+ logger.info("[Yenai-Plugin]邀请机器人进群")
msg = [
segment.image(`https://p.qlogo.cn/gh/${e.group_id}/${e.group_id}/0`),
`[通知(${e.self_id}) - 邀请机器人进群]\n`,
@@ -27,12 +27,12 @@ Bot.on?.('request', async (e) => {
`邀请码:${e.seq}\n`
]
if (cfg.other.autoQuit <= 0) {
- msg.push('----------------\n可引用该消息回复"同意"或"拒绝"')
+ msg.push("----------------\n可引用该消息回复\"同意\"或\"拒绝\"")
} else {
- msg.push('已自动处理该邀请')
+ msg.push("已自动处理该邀请")
}
break
- case 'add':
+ case "add":
if (Config.groupAdd.openGroup.includes(e.group_id)) {
let msg = [`${Config.groupAdd.msg}\n`,
segment.image(`https://q1.qlogo.cn/g?b=qq&s=100&nk=${e.user_id}`),
@@ -45,7 +45,7 @@ Bot.on?.('request', async (e) => {
await redis.set(`yenai:groupAdd:${sendmsg.message_id}`, e.user_id, { EX: 3600 })
}
if (!Config.getGroup(e.group_id).addGroupApplication) return false
- logger.info('[Yenai-Plugin]加群申请')
+ logger.info("[Yenai-Plugin]加群申请")
msg = [
segment.image(`https://p.qlogo.cn/gh/${e.group_id}/${e.group_id}/0`),
`[通知(${e.self_id}) - 加群申请]\n`,
@@ -53,25 +53,25 @@ Bot.on?.('request', async (e) => {
`群名:${e.group_name}\n`,
`账号:${e.user_id}\n`,
`昵称:${e.nickname}`,
- e.tips ? `\nTip:${e.tips}` : '',
+ e.tips ? `\nTip:${e.tips}` : "",
`\n${e.comment}`
]
break
}
break
- case 'friend':
+ case "friend":
if (!Config.whole.friendRequest) return false
- logger.info('[Yenai-Plugin]好友申请')
+ logger.info("[Yenai-Plugin]好友申请")
msg = [
segment.image(`https://q1.qlogo.cn/g?b=qq&s=100&nk=${e.user_id}`),
`[通知(${e.self_id}) - 添加好友申请]\n`,
`申请人账号:${e.user_id}\n`,
`申请人昵称:${e.nickname}\n`,
- `申请来源:${e.source || '未知'}\n`,
- `附加信息:${e.comment || '无附加信息'}\n`
+ `申请来源:${e.source || "未知"}\n`,
+ `附加信息:${e.comment || "无附加信息"}\n`
]
if (cfg.other.autoFriend == 1) {
- msg.push('Tip:已被 Yunzai 自动处理')
+ msg.push("Tip:已被 Yunzai 自动处理")
} else {
msg.push(
`-------------\n可回复:#同意好友申请${e.user_id} \n或引用该消息回复"同意"或"拒绝"`
diff --git a/apps/fun.js b/apps/fun.js
index e5466c9..cd421df 100644
--- a/apps/fun.js
+++ b/apps/fun.js
@@ -1,54 +1,54 @@
-import _ from 'lodash'
-import fetch from 'node-fetch'
-import { Config } from '../components/index.js'
-import { heisiType, pandadiuType, xiurenTypeId } from '../constants/fun.js'
-import { common, funApi, uploadRecord } from '../model/index.js'
+import _ from "lodash"
+import fetch from "node-fetch"
+import { Config } from "../components/index.js"
+import { heisiType, pandadiuType, xiurenTypeId } from "../constants/fun.js"
+import { common, funApi, uploadRecord } from "../model/index.js"
/** 开始执行文案 */
-const START_EXECUTION = '椰奶产出中......'
+const START_EXECUTION = "椰奶产出中......"
-const picApis = Config.getConfig('picApi')
+const picApis = Config.getConfig("picApi")
/** 解析匹配模式 */
const picApiKeys = []
_.forIn(picApis, (values, key) => {
let mode = values.mode !== undefined ? values.mode : picApis.mode
- key = key.split('|').map(item => mode ? '^' + item + '$' : item).join('|')
+ key = key.split("|").map(item => mode ? "^" + item + "$" : item).join("|")
picApiKeys.push(key)
})
-const apiReg = new RegExp(`(${picApiKeys.join('|')}|^jktj$|^接口统计$)`)
+const apiReg = new RegExp(`(${picApiKeys.join("|")}|^jktj$|^接口统计$)`)
export class Fun extends plugin {
constructor (e) {
super({
- name: '椰奶娱乐',
- event: 'message',
+ name: "椰奶娱乐",
+ event: "message",
priority: 500,
rule: [
{
- reg: '^#唱歌$',
- fnc: 'Sing'
+ reg: "^#唱歌$",
+ fnc: "Sing"
},
{
- reg: '^#支付宝到账',
- fnc: 'ZFB'
+ reg: "^#支付宝到账",
+ fnc: "ZFB"
},
{
- reg: '^#(([\u4e00-\u9fa5]{2,6})-)?([\u4e00-\u9fa5]{2,6})?翻译(.*)$',
- fnc: 'youdao'
+ reg: "^#(([\u4e00-\u9fa5]{2,6})-)?([\u4e00-\u9fa5]{2,6})?翻译(.*)$",
+ fnc: "youdao"
},
{
- reg: '^#?((我要|给我)?(资料卡)?(点赞)?(赞|超|操|草|抄|吵|炒)我)$|((赞|超|操|草|抄|吵|炒)(他|她|它|TA|ta|Ta))$',
- fnc: 'thumbUp'
+ reg: "^#?((我要|给我)?(资料卡)?(点赞)?(赞|超|操|草|抄|吵|炒)我)$|((赞|超|操|草|抄|吵|炒)(他|她|它|TA|ta|Ta))$",
+ fnc: "thumbUp"
},
{
- reg: 'github.com/[a-zA-Z0-9-]{1,39}/[a-zA-Z0-9_-]{1,100}',
- fnc: 'GH'
+ reg: "github.com/[a-zA-Z0-9-]{1,39}/[a-zA-Z0-9_-]{1,100}",
+ fnc: "GH"
},
{
- reg: '^#?coser$',
- fnc: 'coser'
+ reg: "^#?coser$",
+ fnc: "coser"
},
// {
// reg: '^#?铃声搜索',
@@ -56,27 +56,27 @@ export class Fun extends plugin {
// },
{
reg: apiReg,
- fnc: 'picture'
+ fnc: "picture"
},
// {
// reg: '^#?来点神秘图(\\d+|s.*)?$',
// fnc: 'mengdui'
// },
{
- reg: `^#(${Object.keys(pandadiuType).join('|')})?acg`,
- fnc: 'acg'
+ reg: `^#(${Object.keys(pandadiuType).join("|")})?acg`,
+ fnc: "acg"
},
{
- reg: `^#来点(${Object.keys(xiurenTypeId).join('|')})$`,
- fnc: 'xiuren'
+ reg: `^#来点(${Object.keys(xiurenTypeId).join("|")})$`,
+ fnc: "xiuren"
},
{
- reg: '^#?(查?看|取)头像',
- fnc: 'LookAvatar'
+ reg: "^#?(查?看|取)头像",
+ fnc: "LookAvatar"
}
]
})
- if (e?.message?.[0]?.text == '#全部赞我') { this.thumbUp(e) }
+ if (e?.message?.[0]?.text == "#全部赞我") { this.thumbUp(e) }
}
/**
@@ -95,12 +95,12 @@ export class Fun extends plugin {
* @param e
*/
async ZFB (e) {
- let amount = parseFloat(e.msg.replace(/#|支付宝到账|元|圆/g, '').trim())
+ let amount = parseFloat(e.msg.replace(/#|支付宝到账|元|圆/g, "").trim())
- if (!/^\d+(\.\d{1,2})?$/.test(amount)) return e.reply('你觉得这河里吗!!', true)
+ if (!/^\d+(\.\d{1,2})?$/.test(amount)) return e.reply("你觉得这河里吗!!", true)
if (!(amount >= 0.01 && amount <= 999999999999.99)) {
- return e.reply('数字大小超出限制,支持范围为0.01~999999999999.99')
+ return e.reply("数字大小超出限制,支持范围为0.01~999999999999.99")
}
e.reply([segment.record(`https://mm.cqu.cc/share/zhifubaodaozhang/mp3/${amount}.mp3`)])
}
@@ -118,8 +118,8 @@ export class Fun extends plugin {
: (await e.friend.getChatHistory(e.source.time, 1)).pop()
msg[4] = source.message
- .filter(item => item.type === 'text')
- .map(item => item.text).join('')
+ .filter(item => item.type === "text")
+ .map(item => item.text).join("")
}
const results = await funApi.youdao(msg[4], msg[3], msg[2])
e.reply(results, true)
@@ -135,15 +135,15 @@ export class Fun extends plugin {
// github
async GH (e) {
- const api = 'https://opengraph.githubassets.com'
+ const api = "https://opengraph.githubassets.com"
let reg = /github.com\/[a-zA-Z0-9-]{1,39}\/[a-zA-Z0-9_-]{1,100}(?:\/(?:pull|issues)\/\d+)?/
const isMatched = e.msg.match(reg)
- const id = 'Yenai'
+ const id = "Yenai"
if (isMatched) {
// const res = isMatched[0].split('/')
- let path = isMatched[0].replace('github.com/', '')
+ let path = isMatched[0].replace("github.com/", "")
e.reply(segment.image(`${api}/${id}/${path}`))
// const [user, repo] = [res[1], res[2].split('#')[0]]
// e.reply(segment.image(`${api}/${id}/${user}/${repo}`))
@@ -164,7 +164,7 @@ export class Fun extends plugin {
async acg (e) {
if (!common.checkSeSePermission(e)) return false
e.reply(START_EXECUTION)
- const reg = new RegExp(`^#(${Object.keys(pandadiuType).join('|')})?acg(.*)$`)
+ const reg = new RegExp(`^#(${Object.keys(pandadiuType).join("|")})?acg(.*)$`)
const type = e.msg.match(reg)
await funApi.pandadiu(type[1], type[2])
.then(res => common.recallSendForwardMsg(e, res))
@@ -173,7 +173,7 @@ export class Fun extends plugin {
// 黑丝
async heisiwu (e) {
- if (!common.checkSeSePermission(e, 'sesepro')) return false
+ if (!common.checkSeSePermission(e, "sesepro")) return false
e.reply(START_EXECUTION)
// 获取类型
@@ -185,7 +185,7 @@ export class Fun extends plugin {
// 萌堆
async mengdui (e) {
- if (!common.checkSeSePermission(e, 'sesepro')) return false
+ if (!common.checkSeSePermission(e, "sesepro")) return false
// 开始执行
e.reply(START_EXECUTION)
let regRet = e.msg.match(/#?来点神秘图(s)?(.*)/)
@@ -195,10 +195,10 @@ export class Fun extends plugin {
}
async xiuren (e) {
- if (!common.checkSeSePermission(e, 'pro')) return false
+ if (!common.checkSeSePermission(e, "pro")) return false
// 开始执行
e.reply(START_EXECUTION)
- await funApi.xiuren(e.msg.replace(/#?来点/, ''))
+ await funApi.xiuren(e.msg.replace(/#?来点/, ""))
.then(res => common.recallSendForwardMsg(e, res))
.catch(err => common.handleException(e, err))
}
@@ -224,13 +224,13 @@ export class Fun extends plugin {
async picture (e) {
let { sese, sesepro } = Config.getGroup(e.group_id)
if (!sese && !sesepro && !e.isMaster) return false
- let key = 'yenai:apiAggregate:CD'
+ let key = "yenai:apiAggregate:CD"
if (await redis.get(key)) return false
if (/jktj|接口统计/.test(e.msg)) {
- let msg = ['现接口数量如下']
+ let msg = ["现接口数量如下"]
for (let i in picApis) {
- if (i == 'mode') continue
+ if (i == "mode") continue
let urls = picApis[i].url || picApis[i]
msg.push(`\n♡ ${i} => ${Array.isArray(urls) ? urls.length : 1}`)
}
@@ -238,7 +238,7 @@ export class Fun extends plugin {
}
// 解析消息中的类型
let regRet = apiReg.exec(e.msg)
- if (regRet[1] == 'mode') return false
+ if (regRet[1] == "mode") return false
let picObj = picApis[_.sample(Object.keys(picApis).filter(item => new RegExp(item).test(regRet[1])))]
if (Array.isArray(picObj)) picObj = _.sample(picObj)
let urlReg = /^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i
@@ -246,7 +246,7 @@ export class Fun extends plugin {
return logger.error(`${e.logFnc}未找到url`)
}
- if (picObj.type !== 'image' && picObj.type !== 'text' && picObj.type !== 'json' && picObj.type) {
+ if (picObj.type !== "image" && picObj.type !== "text" && picObj.type !== "json" && picObj.type) {
return logger.error(`${e.logFnc}类型不正确`)
}
@@ -256,9 +256,9 @@ export class Fun extends plugin {
url = encodeURI(url)
- if (picObj.type == 'text') {
+ if (picObj.type == "text") {
url = await fetch(url).then(res => res.text()).catch(err => logger.error(err))
- } else if (picObj.type == 'json') {
+ } else if (picObj.type == "json") {
if (!picObj.path) return logger.error(`${e.logFnc}json未指定路径`)
let res = await fetch(url).then(res => res.json()).catch(err => logger.error(err))
url = _.get(res, picObj.path)
@@ -267,22 +267,22 @@ export class Fun extends plugin {
logger.debug(`${e.logFnc}使用接口:${url}`)
common.recallsendMsg(e, segment.image(url))
- redis.set(key, 'cd', { EX: 2 })
+ redis.set(key, "cd", { EX: 2 })
}
// 查看头像
async LookAvatar () {
- const id = this.e.msg.replace(/^#?((查?看头像)|取头像)/, '').trim() || this.e.at ||
- this.e.message.find(item => item.type == 'at')?.qq || this.e.user_id
+ const id = this.e.msg.replace(/^#?((查?看头像)|取头像)/, "").trim() || this.e.at ||
+ this.e.message.find(item => item.type == "at")?.qq || this.e.user_id
try {
let url = await this.e.group?.pickMember(id)?.getAvatarUrl()
if (!url) url = await this.e.bot.pickFriend(id).getAvatarUrl()
- const msgTest = this.e.msg.includes('取头像')
+ const msgTest = this.e.msg.includes("取头像")
if (url) return await this.e.reply(msgTest ? `${url}` : segment.image(url))
} catch (error) {
- logger.error('获取头像错误', error)
+ logger.error("获取头像错误", error)
}
- await this.reply('❎ 获取头像错误', true)
+ await this.reply("❎ 获取头像错误", true)
return false
}
}
diff --git a/apps/groupAdmin/groupAdmin.js b/apps/groupAdmin/groupAdmin.js
index dbdbf69..bb381b1 100644
--- a/apps/groupAdmin/groupAdmin.js
+++ b/apps/groupAdmin/groupAdmin.js
@@ -1,156 +1,156 @@
-import _ from 'lodash'
-import moment from 'moment'
-import { Config } from '../../components/index.js'
-import { Time_unit } from '../../constants/other.js'
-import { GroupAdmin as Ga, GroupBannedWords, QQApi, common, puppeteer } from '../../model/index.js'
-import { cronValidate, translateChinaNum } from '../../tools/index.js'
+import _ from "lodash"
+import moment from "moment"
+import { Config } from "../../components/index.js"
+import { Time_unit } from "../../constants/other.js"
+import { GroupAdmin as Ga, GroupBannedWords, QQApi, common, puppeteer } from "../../model/index.js"
+import { cronValidate, translateChinaNum } from "../../tools/index.js"
// API请求错误文案
-const API_ERROR = '❎ 出错辣,请稍后重试'
+const API_ERROR = "❎ 出错辣,请稍后重试"
// 正则
-const Numreg = '[零一壹二两三四五六七八九十百千万亿\\d]+'
-const TimeUnitReg = Object.keys(Time_unit).join('|')
+const Numreg = "[零一壹二两三四五六七八九十百千万亿\\d]+"
+const TimeUnitReg = Object.keys(Time_unit).join("|")
/** 清理多久没发言的人正则 */
const noactivereg = new RegExp(`^#(查看|清理|确认清理|获取)(${Numreg})个?(${TimeUnitReg})没发言的人(第(${Numreg})页)?$`)
/** 我要自闭正则 */
-const Autisticreg = new RegExp(`^#?我要(自闭|禅定)(${Numreg})?个?(${TimeUnitReg})?$`, 'i')
+const Autisticreg = new RegExp(`^#?我要(自闭|禅定)(${Numreg})?个?(${TimeUnitReg})?$`, "i")
// 获取定时任务
const redisTask = await Ga.getRedisMuteTask() || false
export class GroupAdmin extends plugin {
constructor () {
super({
- name: '椰奶群管',
- event: 'message.group',
+ name: "椰奶群管",
+ event: "message.group",
priority: 500,
rule: [
{
reg: `^#禁言\\s?((\\d+)\\s)?(${Numreg})?(${TimeUnitReg})?$`,
- fnc: 'muteMember'
+ fnc: "muteMember"
},
{
- reg: '^#解禁(\\d+)?$',
- fnc: 'noMuteMember'
+ reg: "^#解禁(\\d+)?$",
+ fnc: "noMuteMember"
},
{
- reg: '^#全(体|员)(禁言|解禁)$',
- fnc: 'muteAll'
+ reg: "^#全(体|员)(禁言|解禁)$",
+ fnc: "muteAll"
},
{
- reg: '^#踢(\\d+)?$',
- fnc: 'kickMember'
+ reg: "^#踢(\\d+)?$",
+ fnc: "kickMember"
},
{
- reg: '^#(设置|取消)管理(\\d+)?$',
- fnc: 'SetAdmin'
+ reg: "^#(设置|取消)管理(\\d+)?$",
+ fnc: "SetAdmin"
},
{
- reg: '^#发群公告',
- fnc: 'AddAnnounce'
+ reg: "^#发群公告",
+ fnc: "AddAnnounce"
},
{
- reg: '^#删群公告(\\d+)$',
- fnc: 'DelAnnounce'
+ reg: "^#删群公告(\\d+)$",
+ fnc: "DelAnnounce"
},
{
- reg: '^#查群公告$',
- fnc: 'GetAnnounce'
+ reg: "^#查群公告$",
+ fnc: "GetAnnounce"
},
{
- reg: '^#(修改|设置)头衔',
- fnc: 'adminsetTitle'
+ reg: "^#(修改|设置)头衔",
+ fnc: "adminsetTitle"
},
{
- reg: '^#申请头衔',
- fnc: 'SetGroupSpecialTitle'
+ reg: "^#申请头衔",
+ fnc: "SetGroupSpecialTitle"
},
{
- reg: '^#(查)?(幸运)?字符(列表)?$',
- fnc: 'qun_luckylist'
+ reg: "^#(查)?(幸运)?字符(列表)?$",
+ fnc: "qun_luckylist"
},
{
- reg: '^#抽(幸运)?字符$',
- fnc: 'qun_lucky'
+ reg: "^#抽(幸运)?字符$",
+ fnc: "qun_lucky"
},
{
- reg: '^#替换(幸运)?字符(\\d+)$',
- fnc: 'qun_luckyuse'
+ reg: "^#替换(幸运)?字符(\\d+)$",
+ fnc: "qun_luckyuse"
},
{
- reg: '^#(开启|关闭)(幸运)?字符$',
- fnc: 'qun_luckyset'
+ reg: "^#(开启|关闭)(幸运)?字符$",
+ fnc: "qun_luckyset"
},
{
- reg: '^#(获取|查看)?禁言列表$',
- fnc: 'Mutelist'
+ reg: "^#(获取|查看)?禁言列表$",
+ fnc: "Mutelist"
},
{
- reg: '^#解除全部禁言$',
- fnc: 'relieveAllMute'
+ reg: "^#解除全部禁言$",
+ fnc: "relieveAllMute"
},
{
reg: `^#(查看|(确认)?清理)从未发言过?的人(第(${Numreg})页)?$`,
- fnc: 'neverspeak'
+ fnc: "neverspeak"
},
{
reg: `^#(查看|获取)?(不活跃|潜水)排行榜(${Numreg})?$`,
- fnc: 'RankingList'
+ fnc: "RankingList"
},
{
reg: `^#(查看|获取)?最近的?入群(情况|记录)(${Numreg})?$`,
- fnc: 'RankingList'
+ fnc: "RankingList"
},
{
reg: noactivereg, // 清理多久没发言的人
- fnc: 'noactive'
+ fnc: "noactive"
},
{
- reg: '^#发通知',
- fnc: 'Send_notice'
+ reg: "^#发通知",
+ fnc: "Send_notice"
},
{
- reg: '^#(设置)?定时(禁言|解禁)(.*)$|^#定时禁言任务$|^#取消定时(禁言|解禁)$',
- fnc: 'timeMute'
+ reg: "^#(设置)?定时(禁言|解禁)(.*)$|^#定时禁言任务$|^#取消定时(禁言|解禁)$",
+ fnc: "timeMute"
},
{
- reg: '^#(查看|获取)?群?发言(榜单|排行)((7|七)天)?',
- fnc: 'SpeakRank'
+ reg: "^#(查看|获取)?群?发言(榜单|排行)((7|七)天)?",
+ fnc: "SpeakRank"
},
{
- reg: '^#?(谁|哪个吊毛|哪个屌毛|哪个叼毛)是龙王$',
- fnc: 'dragonKing'
+ reg: "^#?(谁|哪个吊毛|哪个屌毛|哪个叼毛)是龙王$",
+ fnc: "dragonKing"
},
{
- reg: '^#群星级$',
- fnc: 'Group_xj'
+ reg: "^#群星级$",
+ fnc: "Group_xj"
},
{
- reg: '^#群数据((7|七)天)?$',
- fnc: 'groupData'
+ reg: "^#群数据((7|七)天)?$",
+ fnc: "groupData"
},
{
- reg: '^#今日打卡$',
- fnc: 'DaySigned'
+ reg: "^#今日打卡$",
+ fnc: "DaySigned"
},
{
reg: Autisticreg, // 我要自闭
- fnc: 'Autistic'
+ fnc: "Autistic"
},
{
- reg: '^#((今|昨|前|明|后)天|\\d{4}-\\d{1,2}-\\d{1,2})谁生日$',
- fnc: 'groupBirthday'
+ reg: "^#((今|昨|前|明|后)天|\\d{4}-\\d{1,2}-\\d{1,2})谁生日$",
+ fnc: "groupBirthday"
},
{
- reg: '^#?(开启|关闭)加群通知$',
- fnc: 'handleGroupAdd'
+ reg: "^#?(开启|关闭)加群通知$",
+ fnc: "handleGroupAdd"
},
{
- reg: '^#?(加|设|移)精$',
- fnc: 'essenceMessage'
+ reg: "^#?(加|设|移)精$",
+ fnc: "essenceMessage"
},
{
- reg: '^#?群管(加|删)白(名单)?',
- fnc: 'whiteQQ'
+ reg: "^#?群管(加|删)白(名单)?",
+ fnc: "whiteQQ"
}
]
})
@@ -166,9 +166,9 @@ export class GroupAdmin extends plugin {
* @param e
*/
async muteMember (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) { return true }
- let qq = e.message.find(item => item.type == 'at')?.qq
- let reg = `#禁言\\s?((\\d+)\\s${qq ? '' : '?'})?(${Numreg})?(${TimeUnitReg})?`
+ if (!common.checkPermission(e, "admin", "admin")) { return true }
+ let qq = e.message.find(item => item.type == "at")?.qq
+ let reg = `#禁言\\s?((\\d+)\\s${qq ? "" : "?"})?(${Numreg})?(${TimeUnitReg})?`
let regRet = e.msg.match(new RegExp(reg))
const time = translateChinaNum(regRet[3])
new Ga(e).muteMember(
@@ -182,8 +182,8 @@ export class GroupAdmin extends plugin {
* @param e
*/
async noMuteMember (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) { return true }
- let qq = e.message.find(item => item.type == 'at')?.qq
+ if (!common.checkPermission(e, "admin", "admin")) { return true }
+ let qq = e.message.find(item => item.type == "at")?.qq
let regRet = e.msg.match(/#解禁(\d+)/)
new Ga(e).muteMember(
e.group_id, qq ?? regRet[1], e.user_id, 0
@@ -196,18 +196,18 @@ export class GroupAdmin extends plugin {
* @param e
*/
async muteAll (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) { return true }
+ if (!common.checkPermission(e, "admin", "admin")) { return true }
let type = /全(体|员)禁言/.test(e.msg)
let res = await e.group.muteAll(type)
- if (!res) return e.reply('❎ 未知错误', true)
- e.reply(`✅ 已${type ? '开启' : '关闭'}全体禁言`)
+ if (!res) return e.reply("❎ 未知错误", true)
+ e.reply(`✅ 已${type ? "开启" : "关闭"}全体禁言`)
}
// 踢群员
async kickMember (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) { return true }
- let qq = e.message.find(item => item.type == 'at')?.qq
- if (!qq) qq = e.msg.replace(/#|踢/g, '').trim()
+ if (!common.checkPermission(e, "admin", "admin")) { return true }
+ let qq = e.message.find(item => item.type == "at")?.qq
+ if (!qq) qq = e.msg.replace(/#|踢/g, "").trim()
new Ga(e).kickMember(e.group_id, qq, e.user_id)
.then(res => e.reply(res))
.catch(err => common.handleException(e, err))
@@ -217,49 +217,49 @@ export class GroupAdmin extends plugin {
async Autistic (e) {
// 判断是否有管理
if (!e.group.is_admin && !e.group.is_owner) return
- if (e.isMaster) return e.reply('别自闭啦~~', true)
- if (e.member.is_admin && !e.group.is_owner) return e.reply('别自闭啦~~', true)
+ if (e.isMaster) return e.reply("别自闭啦~~", true)
+ if (e.member.is_admin && !e.group.is_owner) return e.reply("别自闭啦~~", true)
// 解析正则
let regRet = Autisticreg.exec(e.msg)
// 获取数字
let TabooTime = translateChinaNum(regRet[2] || 5)
- let Company = Time_unit[_.toUpper(regRet[3]) || '分']
+ let Company = Time_unit[_.toUpper(regRet[3]) || "分"]
await e.group.muteMember(e.user_id, TabooTime * Company)
- e.reply('那我就不手下留情了~', true)
+ e.reply("那我就不手下留情了~", true)
}
// 设置管理
async SetAdmin (e) {
- if (!common.checkPermission(e, 'master', 'owner')) return
- let qq = e.message.find(item => item.type == 'at')?.qq
+ if (!common.checkPermission(e, "master", "owner")) return
+ let qq = e.message.find(item => item.type == "at")?.qq
let type = /设置管理/.test(e.msg)
- if (!qq) qq = e.msg.replace(/#|(设置|取消)管理/g, '').trim()
+ if (!qq) qq = e.msg.replace(/#|(设置|取消)管理/g, "").trim()
- if (!qq || !(/\d{5,}/.test(qq))) return e.reply('❎ 请输入正确的QQ号')
+ if (!qq || !(/\d{5,}/.test(qq))) return e.reply("❎ 请输入正确的QQ号")
let Member = e.group.pickMember(Number(qq))
// 判断是否有这个人
- if (!Member.info) return e.reply('❎ 这个群没有这个人哦~')
+ if (!Member.info) return e.reply("❎ 这个群没有这个人哦~")
let res = await e.group.setAdmin(qq, type)
let name = Member.card || Member.nickname
- if (!res) return e.reply('❎ 未知错误')
+ if (!res) return e.reply("❎ 未知错误")
type ? e.reply(`✅ 已经把「${name}」设置为管理啦!!`) : e.reply(`✅ 已取消「${name}」的管理`)
}
// 发群公告
async AddAnnounce (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) { return true }
+ if (!common.checkPermission(e, "admin", "admin")) { return true }
// 获取发送的内容
- let msg = e.msg.replace(/#|发群公告/g, '').trim()
- if (!msg) return e.reply('❎ 公告不能为空')
+ let msg = e.msg.replace(/#|发群公告/g, "").trim()
+ if (!msg) return e.reply("❎ 公告不能为空")
let result = await new QQApi(e).setAnnounce(e.group_id, msg)
if (!result) return e.reply(API_ERROR)
if (result.ec != 0) {
- e.reply('❎ 发送失败\n' + JSON.stringify(result, null, '\t'))
+ e.reply("❎ 发送失败\n" + JSON.stringify(result, null, "\t"))
}
}
@@ -272,9 +272,9 @@ export class GroupAdmin extends plugin {
// 删群公告
async DelAnnounce (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) { return true }
- let msg = e.msg.replace(/#|删群公告/, '').trim()
- if (!msg) return e.reply('❎ 序号不可为空')
+ if (!common.checkPermission(e, "admin", "admin")) { return true }
+ let msg = e.msg.replace(/#|删群公告/, "").trim()
+ if (!msg) return e.reply("❎ 序号不可为空")
let result = await new QQApi(e).delAnnounce(e.group_id, msg)
if (!result) return e.reply(API_ERROR)
@@ -282,46 +282,46 @@ export class GroupAdmin extends plugin {
if (result.ec == 0) {
e.reply(`✅ 已删除「${result.text}」`)
} else {
- e.reply('❎ 删除失败\n' + JSON.stringify(result, null, '\t'))
+ e.reply("❎ 删除失败\n" + JSON.stringify(result, null, "\t"))
}
}
// 修改头衔
async adminsetTitle (e) {
- if (!common.checkPermission(e, 'master', 'owner')) return
- let qq = e.message.find(item => item.type == 'at')?.qq
- if (!qq) return e.reply('请艾特要修改的人哦~')
- let text = e.msg.replace(/#?(修改|设置)头衔/g, '')
+ if (!common.checkPermission(e, "master", "owner")) return
+ let qq = e.message.find(item => item.type == "at")?.qq
+ if (!qq) return e.reply("请艾特要修改的人哦~")
+ let text = e.msg.replace(/#?(修改|设置)头衔/g, "")
let res = await e.group.setTitle(qq, text)
if (res) {
let Member = e.group.pickMember(Number(qq))
let name = Member.card || Member.nickname
e.reply(`✅ 已经将「${name}」的头衔设置为「${text}」`)
} else {
- e.reply('❎ 未知错误')
+ e.reply("❎ 未知错误")
}
}
// 申请头衔
async SetGroupSpecialTitle (e) {
- if (!common.checkPermission(e, 'all', 'owner')) return
- let Title = e.msg.replace(/#|申请头衔/g, '')
+ if (!common.checkPermission(e, "all", "owner")) return
+ let Title = e.msg.replace(/#|申请头衔/g, "")
// 屏蔽词处理
let TitleFilterModeChange = GroupBannedWords.getTitleFilterModeChange(e.group_id)
let TitleBannedWords = GroupBannedWords.getTitleBannedWords(e.group_id)
TitleBannedWords = _.compact(TitleBannedWords)
if (!e.isMaster && !_.isEmpty(TitleBannedWords)) {
if (TitleFilterModeChange) {
- let reg = new RegExp(TitleBannedWords.join('|'))
- if (reg.test(Title)) return e.reply('❎ 包含违禁词', true)
+ let reg = new RegExp(TitleBannedWords.join("|"))
+ if (reg.test(Title)) return e.reply("❎ 包含违禁词", true)
} else {
- if (TitleBannedWords.includes(Title)) return e.reply('❎ 包含违禁词', true)
+ if (TitleBannedWords.includes(Title)) return e.reply("❎ 包含违禁词", true)
}
}
let res = await e.group.setTitle(e.user_id, Title)
- if (!res) return e.reply('❎ 未知错误', true)
+ if (!res) return e.reply("❎ 未知错误", true)
- if (!Title) return e.reply('❎ 什么"(º Д º*)!没有头衔,哼把你的头衔吃掉!!!', true)
+ if (!Title) return e.reply("❎ 什么\"(º Д º*)!没有头衔,哼把你的头衔吃掉!!!", true)
e.reply(`✅ 已将你的头衔更换为「${Title}」`, true)
}
@@ -330,12 +330,12 @@ export class GroupAdmin extends plugin {
async qun_luckylist (e) {
let data = await new QQApi(e).luckylist(e.group_id)
if (!data) return e.reply(API_ERROR)
- if (data.retcode != 0) return e.reply('❎ 获取数据失败\n' + JSON.stringify(data))
+ if (data.retcode != 0) return e.reply("❎ 获取数据失败\n" + JSON.stringify(data))
let msg = data.data.word_list.map((item, index) => {
let { wording, word_id, word_desc } = item.word_info
return `${word_id}:${wording}\n寓意:${word_desc}`
- }).join('\n')
+ }).join("\n")
e.reply(msg)
}
@@ -344,38 +344,38 @@ export class GroupAdmin extends plugin {
let res = await new QQApi(e).drawLucky(e.group_id)
if (!res) return e.reply(API_ERROR)
- if (res.retcode == 11004) return e.reply('❎ 今天已经抽过了,明天再来抽取吧')
- if (res.retcode != 0) return e.reply('❎ 错误\n' + JSON.stringify(res.data))
+ if (res.retcode == 11004) return e.reply("❎ 今天已经抽过了,明天再来抽取吧")
+ if (res.retcode != 0) return e.reply("❎ 错误\n" + JSON.stringify(res.data))
if (res.data.word_info) {
let { wording, word_desc } = res.data.word_info.word_info
e.reply(`恭喜您抽中了${wording}\n寓意为:${word_desc}`)
} else {
- e.reply('恭喜您抽了中了个寂寞')
+ e.reply("恭喜您抽了中了个寂寞")
}
}
// 替换幸运字符
async qun_luckyuse (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) { return true }
- let id = e.msg.replace(/#|替换(幸运)?字符/g, '')
+ if (!common.checkPermission(e, "admin", "admin")) { return true }
+ let id = e.msg.replace(/#|替换(幸运)?字符/g, "")
let res = await new QQApi(e).equipLucky(e.group_id, id)
if (!res) return e.reply(API_ERROR)
- if (res.retcode != 0) return e.reply('❎替换失败\n' + JSON.stringify(res))
- e.reply('✅ OK')
+ if (res.retcode != 0) return e.reply("❎替换失败\n" + JSON.stringify(res))
+ e.reply("✅ OK")
}
// 开启或关闭群字符
async qun_luckyset (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) { return true }
+ if (!common.checkPermission(e, "admin", "admin")) { return true }
let res = await new QQApi(e).swichLucky(e.group_id, /开启/.test(e.msg))
if (!res) return e.reply(API_ERROR)
- if (res.retcode == 11111) return e.reply('❎ 重复开启或关闭')
- if (res.retcode != 0) return e.reply('❎ 错误\n' + JSON.stringify(res))
- e.reply('✅ OK')
+ if (res.retcode == 11111) return e.reply("❎ 重复开启或关闭")
+ if (res.retcode != 0) return e.reply("❎ 错误\n" + JSON.stringify(res))
+ e.reply("✅ OK")
}
// 获取禁言列表
@@ -383,27 +383,27 @@ export class GroupAdmin extends plugin {
new Ga(e).getMuteList(e.group_id, true)
.then(res => common.getforwardMsg(e, res, {
isxml: true,
- xmlTitle: '禁言列表'
+ xmlTitle: "禁言列表"
}))
.catch(err => common.handleException(e, err))
}
// 解除全部禁言
async relieveAllMute (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) { return true }
+ if (!common.checkPermission(e, "admin", "admin")) { return true }
new Ga(e).releaseAllMute()
- .then(() => e.reply('✅ 已将全部禁言解除'))
+ .then(() => e.reply("✅ 已将全部禁言解除"))
.catch(err => common.handleException(e, err))
}
// 查看和清理多久没发言的人
async noactive (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) { return true }
+ if (!common.checkPermission(e, "admin", "admin")) { return true }
let regRet = noactivereg.exec(e.msg)
regRet[2] = translateChinaNum(regRet[2] || 1)
// 确认清理直接执行
- if (regRet[1] == '确认清理') {
+ if (regRet[1] == "确认清理") {
try {
return common.getforwardMsg(e,
await new Ga(e).clearNoactive(
@@ -427,7 +427,7 @@ export class GroupAdmin extends plugin {
return common.handleException(e, err)
}
// 清理
- if (regRet[1] == '清理') {
+ if (regRet[1] == "清理") {
let list = await new Ga(e).noactiveList(e.group_id, regRet[2], regRet[3])
e.reply([
`⚠ 本次共需清理「${list.length}」人,防止误触发\n`,
@@ -436,13 +436,13 @@ export class GroupAdmin extends plugin {
}
common.getforwardMsg(e, msg, {
isxml: true,
- xmlTitle: e.msg.replace(/#|查看|清理/g, '')
+ xmlTitle: e.msg.replace(/#|查看|清理/g, "")
})
}
// 查看和清理从未发言的人
async neverspeak (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) { return true }
+ if (!common.checkPermission(e, "admin", "admin")) { return true }
let list = null
try {
list = await new Ga(e).getNeverSpeak(e.group_id)
@@ -452,7 +452,7 @@ export class GroupAdmin extends plugin {
// 确认清理直接执行
if (/^#?确认清理/.test(e.msg)) {
- e.reply('⚠ 开始清理,这可能需要一点时间')
+ e.reply("⚠ 开始清理,这可能需要一点时间")
let arr = list.map(item => item.user_id)
let msg = await new Ga(e).BatchKickMember(e.group_id, arr)
return common.getforwardMsg(e, msg)
@@ -461,7 +461,7 @@ export class GroupAdmin extends plugin {
if (/^#?清理/.test(e.msg)) {
e.reply([
`⚠ 本次共需清理「${list.length}」人,防止误触发\n`,
- '请发送:#确认清理从未发言的人'
+ "请发送:#确认清理从未发言的人"
])
}
// 发送列表
@@ -470,7 +470,7 @@ export class GroupAdmin extends plugin {
new Ga(e).getNeverSpeakInfo(e.group_id, page)
.then(res => common.getforwardMsg(e, res, {
isxml: true,
- xmlTitle: e.msg.replace(/#|查看|清理/g, '')
+ xmlTitle: e.msg.replace(/#|查看|清理/g, "")
}))
.catch(err => common.handleException(e, err))
}
@@ -479,7 +479,7 @@ export class GroupAdmin extends plugin {
async RankingList (e) {
let num = e.msg.match(new RegExp(Numreg))
num = num ? translateChinaNum(num[0]) : 10
- let msg = ''
+ let msg = ""
if (/(不活跃|潜水)/.test(e.msg)) {
msg = await new Ga(e).InactiveRanking(e.group_id, num)
} else {
@@ -490,32 +490,32 @@ export class GroupAdmin extends plugin {
// 发送通知
async Send_notice (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) return
+ if (!common.checkPermission(e, "admin", "admin")) return
- e.message[0].text = e.message[0].text.replace('#发通知', '').trim()
+ e.message[0].text = e.message[0].text.replace("#发通知", "").trim()
if (!e.message[0].text) e.message.shift()
- if (_.isEmpty(e.message)) return e.reply('❎ 通知不能为空')
- e.message.unshift(segment.at('all'))
+ if (_.isEmpty(e.message)) return e.reply("❎ 通知不能为空")
+ e.message.unshift(segment.at("all"))
e.reply(e.message)
}
// 设置定时群禁言
async timeMute (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) return
+ if (!common.checkPermission(e, "admin", "admin")) return
let type = /禁言/.test(e.msg)
if (/任务/.test(e.msg)) {
let task = new Ga(e).getMuteTask()
- if (!task.length) return e.reply('目前还没有定时禁言任务')
+ if (!task.length) return e.reply("目前还没有定时禁言任务")
return common.getforwardMsg(e, task)
}
if (/取消/.test(e.msg)) {
new Ga(e).delMuteTask(e.group_id, type)
- return e.reply(`已取消本群定时${type ? '禁言' : '解禁'}`)
+ return e.reply(`已取消本群定时${type ? "禁言" : "解禁"}`)
}
let RegRet = e.msg.match(/定时(禁言|解禁)((\d{1,2})(:|:)(\d{1,2})|.*)/)
- if (!RegRet || !RegRet[2]) return e.reply(`格式不对\n示范:#定时${type ? '禁言' : '解禁'}00:00 或 #定时${type ? '禁言' : '解禁'} + cron表达式`)
- let cron = ''
+ if (!RegRet || !RegRet[2]) return e.reply(`格式不对\n示范:#定时${type ? "禁言" : "解禁"}00:00 或 #定时${type ? "禁言" : "解禁"} + cron表达式`)
+ let cron = ""
if (RegRet[3] && RegRet[5]) {
cron = `0 ${RegRet[5]} ${RegRet[3]} * * ?`
} else {
@@ -528,8 +528,8 @@ export class GroupAdmin extends plugin {
let res = await new Ga(e).setMuteTask(e.group_id, cron, type, e.self_id ?? Bot.uin)
res
- ? e.reply('✅设置定时禁言成功,可发【#定时禁言任务】查看')
- : e.reply(`❎ 该群定时${type ? '禁言' : '解禁'}已存在不可重复设置`)
+ ? e.reply("✅设置定时禁言成功,可发【#定时禁言任务】查看")
+ : e.reply(`❎ 该群定时${type ? "禁言" : "解禁"}已存在不可重复设置`)
}
// 谁是龙王
@@ -537,7 +537,7 @@ export class GroupAdmin extends plugin {
// 浏览器截图
let screenshot = await puppeteer.Webpage({
url: `https://qun.qq.com/interactive/honorlist?gc=${e.group_id}&type=1&_wv=3&_wwv=129`,
- headers: { Cookie: this.Bot.cookies['qun.qq.com'] },
+ headers: { Cookie: this.Bot.cookies["qun.qq.com"] },
font: true
})
if (screenshot) return e.reply(screenshot)
@@ -558,17 +558,17 @@ export class GroupAdmin extends plugin {
async Group_xj (e) {
let screenshot = await puppeteer.Webpage({
url: `https://qqweb.qq.com/m/business/qunlevel/index.html?gc=${e.group_id}&from=0&_wv=1027`,
- cookie: common.getck('qun.qq.com', this.Bot, true),
- emulate: 'QQTheme',
+ cookie: common.getck("qun.qq.com", this.Bot, true),
+ emulate: "QQTheme",
font: true
})
if (screenshot) return e.reply(screenshot)
// 出错后发送数据
let result = await new QQApi(e).getCreditLevelInfo(e.group_id)
if (!result) return e.reply(API_ERROR)
- if (result.ec != 0) return e.reply('❎ 查询错误\n' + JSON.stringify(result))
+ if (result.ec != 0) return e.reply("❎ 查询错误\n" + JSON.stringify(result))
let { uiGroupLevel, group_name, group_uin } = result.info
- let str = '⭐'
+ let str = "⭐"
str = str.repeat(uiGroupLevel)
e.reply([
`群名:${group_name}\n`,
@@ -579,22 +579,22 @@ export class GroupAdmin extends plugin {
// 群发言榜单
async SpeakRank (e) {
- if (!common.checkPermission(e, 'all', 'admin')) return
+ if (!common.checkPermission(e, "all", "admin")) return
// 图片截图
let screenshot = await puppeteer.Webpage({
url: `https://qun.qq.com/m/qun/activedata/speaking.html?gc=${e.group_id}&time=${/(7|七)天/.test(e.msg) ? 1 : 0}`,
- headers: { Cookie: this.Bot.cookies['qun.qq.com'] },
+ headers: { Cookie: this.Bot.cookies["qun.qq.com"] },
font: true
})
if (screenshot) return e.reply(screenshot)
// 出错后发送文字数据
let res = await new QQApi(e).SpeakRank(e.group_id, /(7|七)天/.test(e.msg))
if (!res) return e.reply(API_ERROR)
- if (res.retcode != 0) return e.reply('❎ 未知错误\n' + JSON.stringify(res))
+ if (res.retcode != 0) return e.reply("❎ 未知错误\n" + JSON.stringify(res))
let msg = _.take(res.data.speakRank.map((item, index) =>
`${index + 1}:${item.nickname}-${item.uin}\n连续活跃${item.active}天:发言${item.msgCount}次`
- ), 10).join('\n')
+ ), 10).join("\n")
e.reply(msg)
}
@@ -603,42 +603,42 @@ export class GroupAdmin extends plugin {
// 浏览器截图
let screenshot = await puppeteer.Webpage({
url: `https://qun.qq.com/v2/signin/list?gc=${e.group_id}`,
- emulate: 'iPhone 6',
- cookie: common.getck('qun.qq.com', this.Bot, true),
+ emulate: "iPhone 6",
+ cookie: common.getck("qun.qq.com", this.Bot, true),
font: true
})
if (screenshot) return e.reply(screenshot)
// 出错后使用接口
let res = await new QQApi(e).signInToday(e.group_id)
if (!res) return e.reply(API_ERROR)
- if (res.retCode != 0) return e.reply('❎ 未知错误\n' + JSON.stringify(res))
+ if (res.retCode != 0) return e.reply("❎ 未知错误\n" + JSON.stringify(res))
let list = res.response.page[0]
- if (list.total == 0) return e.reply('❎ 今天还没有人打卡')
+ if (list.total == 0) return e.reply("❎ 今天还没有人打卡")
// 发送消息
- let msg = list.infos.map((item, index) => `${index + 1}:${item.uidGroupNick}-${item.uid}\n打卡时间:${moment(item.signedTimeStamp * 1000).format('YYYY-MM-DD HH:mm:ss')}`).join('\n')
+ let msg = list.infos.map((item, index) => `${index + 1}:${item.uidGroupNick}-${item.uid}\n打卡时间:${moment(item.signedTimeStamp * 1000).format("YYYY-MM-DD HH:mm:ss")}`).join("\n")
e.reply(msg)
}
// 查看某天谁生日
async groupBirthday (e) {
let date = e.msg.match(/^#?(今天|昨天|明天|后天|\d{4}-\d{1,2}-\d{1,2})谁生日$/)[1]
- if (date == '昨天') {
- date = moment().subtract(1, 'days').format('YYYY-MM-DD')
- } else if (date == '前天') {
- date = moment().subtract(2, 'days').format('YYYY-MM-DD')
- } else if (date == '明天') {
- date = moment().add(1, 'days').format('YYYY-MM-DD')
- } else if (date == '后天') {
- date = moment().add(2, 'days').format('YYYY-MM-DD')
- } else if (date == '今天') {
- date = moment().format('YYYY-MM-DD')
+ if (date == "昨天") {
+ date = moment().subtract(1, "days").format("YYYY-MM-DD")
+ } else if (date == "前天") {
+ date = moment().subtract(2, "days").format("YYYY-MM-DD")
+ } else if (date == "明天") {
+ date = moment().add(1, "days").format("YYYY-MM-DD")
+ } else if (date == "后天") {
+ date = moment().add(2, "days").format("YYYY-MM-DD")
+ } else if (date == "今天") {
+ date = moment().format("YYYY-MM-DD")
}
e.reply(
await puppeteer.Webpage({
url: `https://qun.qq.com/qqweb/m/qun/calendar/detail.html?_wv=1031&_bid=2340&src=3&gc=${e.group_id}&type=2&date=${date}`,
- cookie: common.getck('qun.qq.com', this.Bot, true),
- emulate: 'iPhone 6',
+ cookie: common.getck("qun.qq.com", this.Bot, true),
+ emulate: "iPhone 6",
font: true
})
)
@@ -646,20 +646,20 @@ export class GroupAdmin extends plugin {
// 群数据
async groupData (e) {
- if (!common.checkPermission(e, 'all', 'admin')) return
+ if (!common.checkPermission(e, "all", "admin")) return
// 浏览器截图
let screenshot = await puppeteer.Webpage({
url: `https://qun.qq.com/m/qun/activedata/active.html?_wv=3&_wwv=128&gc=${e.group_id}&src=2`,
- cookie: common.getck('qun.qq.com', this.Bot, true),
+ cookie: common.getck("qun.qq.com", this.Bot, true),
click: /(7|七)天/.test(e.msg)
? [
{
- selector: '#app > div.tabbar > div.tabbar__time > div.tabbar__time__date',
+ selector: "#app > div.tabbar > div.tabbar__time > div.tabbar__time__date",
time: 500
},
{
- selector: '#app > div.tabbar > div.tabbar__date-selector > div > div:nth-child(3)',
+ selector: "#app > div.tabbar > div.tabbar__date-selector > div > div:nth-child(3)",
time: 1000
}
]
@@ -674,14 +674,14 @@ export class GroupAdmin extends plugin {
let { groupInfo, activeData, msgInfo, joinData, exitData, applyData } = res.data
e.reply(
[
- `${groupInfo.groupName}(${groupInfo.groupCode})${/(7|七)天/.test(e.msg) ? '七天' : '昨天'}的群数据\n`,
- '------------消息条数---------\n',
+ `${groupInfo.groupName}(${groupInfo.groupCode})${/(7|七)天/.test(e.msg) ? "七天" : "昨天"}的群数据\n`,
+ "------------消息条数---------\n",
`消息条数:${msgInfo.total}\n`,
- '------------活跃人数---------\n',
+ "------------活跃人数---------\n",
`活跃人数:${activeData.activeData}\n`,
`总人数:${activeData.groupMember}\n`,
`活跃比例:${activeData.ratio}%\n`,
- '-----------加退群人数--------\n',
+ "-----------加退群人数--------\n",
`申请人数:${joinData.total}\n`,
`入群人数:${applyData.total}\n`,
`退群人数:${exitData.total}\n`
@@ -694,13 +694,13 @@ export class GroupAdmin extends plugin {
* @param e
*/
async handleGroupAdd (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) return
- let type = /开启/.test(e.msg) ? 'add' : 'del'
+ if (!common.checkPermission(e, "admin", "admin")) return
+ let type = /开启/.test(e.msg) ? "add" : "del"
let isopen = Config.groupAdd.openGroup.includes(e.group_id)
- if (isopen && type == 'add') return e.reply('❎ 本群加群申请通知已处于开启状态')
- if (!isopen && type == 'del') return e.reply('❎ 本群暂未开启加群申请通知')
- Config.modifyarr('groupAdd', 'openGroup', e.group_id, type)
- e.reply(`✅ 已${type == 'add' ? '开启' : '关闭'}「${e.group_id}」的加群申请通知`)
+ if (isopen && type == "add") return e.reply("❎ 本群加群申请通知已处于开启状态")
+ if (!isopen && type == "del") return e.reply("❎ 本群暂未开启加群申请通知")
+ Config.modifyarr("groupAdd", "openGroup", e.group_id, type)
+ e.reply(`✅ 已${type == "add" ? "开启" : "关闭"}「${e.group_id}」的加群申请通知`)
}
/**
@@ -708,12 +708,12 @@ export class GroupAdmin extends plugin {
* @param e
*/
async essenceMessage (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) return
- if (!e.source) return e.reply('请对要加精的消息进行引用')
+ if (!common.checkPermission(e, "admin", "admin")) return
+ if (!e.source) return e.reply("请对要加精的消息进行引用")
let source = (await e.group.getChatHistory(e.source.seq, 1)).pop()
let isAdd = e.msg.match(/加|设|移/)?.[0]
let res
- if (isAdd == '加' || isAdd == '设') {
+ if (isAdd == "加" || isAdd == "设") {
res = await this.Bot.setEssenceMessage(source.message_id)
} else {
res = await this.Bot.removeEssenceMessage(source.message_id)
@@ -725,19 +725,19 @@ export class GroupAdmin extends plugin {
* 加白名单
*/
async whiteQQ () {
- if (!common.checkPermission(this.e, 'master')) return
+ if (!common.checkPermission(this.e, "master")) return
- let type = /加/.test(this.e.msg) ? 'add' : 'del'
- let qq = this.e.at || (this.e.msg.match(/\d+/)?.[0] || '')
+ let type = /加/.test(this.e.msg) ? "add" : "del"
+ let qq = this.e.at || (this.e.msg.match(/\d+/)?.[0] || "")
qq = Number(qq) || String(qq)
const { whiteQQ } = Config.groupAdmin
const isWhite = whiteQQ.includes(qq)
- if (isWhite && type === 'add') return this.reply('❎ 此人已在群管白名单内')
- if (!isWhite && type === 'del') return this.reply('❎ 此人未在群管白名单中')
+ if (isWhite && type === "add") return this.reply("❎ 此人已在群管白名单内")
+ if (!isWhite && type === "del") return this.reply("❎ 此人未在群管白名单中")
- Config.modifyarr('groupAdmin', 'whiteQQ', qq, type)
- this.reply(`✅ 已${type === 'add' ? '加入' : '删除'}${qq}到群管白名单`)
+ Config.modifyarr("groupAdmin", "whiteQQ", qq, type)
+ this.reply(`✅ 已${type === "add" ? "加入" : "删除"}${qq}到群管白名单`)
}
}
diff --git a/apps/groupAdmin/groupBannedWords.js b/apps/groupAdmin/groupBannedWords.js
index 8567d51..95c1eff 100644
--- a/apps/groupAdmin/groupBannedWords.js
+++ b/apps/groupAdmin/groupBannedWords.js
@@ -1,46 +1,46 @@
-import { common, GroupBannedWords } from '../../model/index.js'
-import { Config } from '../../components/index.js'
-import _ from 'lodash'
+import { common, GroupBannedWords } from "../../model/index.js"
+import { Config } from "../../components/index.js"
+import _ from "lodash"
export class NewGroupBannedWords extends plugin {
constructor () {
super({
- name: '椰奶群违禁词',
- event: 'message.group',
+ name: "椰奶群违禁词",
+ event: "message.group",
priority: 1,
rule: [
{
- reg: '^#?新增(模糊|精确|正则)?(踢|禁|撤|踢撤|禁撤)?违禁词',
- fnc: 'add'
+ reg: "^#?新增(模糊|精确|正则)?(踢|禁|撤|踢撤|禁撤)?违禁词",
+ fnc: "add"
},
{
- reg: '^#?删除违禁词',
- fnc: 'del'
+ reg: "^#?删除违禁词",
+ fnc: "del"
},
{
- reg: '^#?查看违禁词',
- fnc: 'query'
+ reg: "^#?查看违禁词",
+ fnc: "query"
},
{
- reg: '',
- fnc: 'monitor',
+ reg: "",
+ fnc: "monitor",
log: false
},
{
- reg: '^#?违禁词列表$',
- fnc: 'list'
+ reg: "^#?违禁词列表$",
+ fnc: "list"
},
{
- reg: '^#?设置违禁词禁言时间(\\d+)$',
- fnc: 'muteTime'
+ reg: "^#?设置违禁词禁言时间(\\d+)$",
+ fnc: "muteTime"
},
{
- reg: '^#(增加|减少|查看)头衔屏蔽词',
- fnc: 'ProhibitedTitle'
+ reg: "^#(增加|减少|查看)头衔屏蔽词",
+ fnc: "ProhibitedTitle"
},
{
- reg: '^#切换头衔屏蔽词匹配(模式)?$',
- fnc: 'ProhibitedTitlePattern'
+ reg: "^#切换头衔屏蔽词匹配(模式)?$",
+ fnc: "ProhibitedTitlePattern"
}
]
@@ -57,8 +57,8 @@ export class NewGroupBannedWords extends plugin {
return false
}
const KeyWord = e.toString()
- .replace(/#|#/g, '')
- .replace(`{at:${Bot.uin}}`, '')
+ .replace(/#|#/g, "")
+ .replace(`{at:${Bot.uin}}`, "")
.trim()
const trimmedKeyWord = this.#trimAlias(KeyWord)
let data = null
@@ -84,10 +84,10 @@ export class NewGroupBannedWords extends plugin {
}
}
const groupPenaltyAction = {
- 1: '踢出群聊',
+ 1: "踢出群聊",
2: `禁言${muteTime}秒`,
- 3: '撤回消息',
- 4: '踢出群聊并撤回消息',
+ 3: "撤回消息",
+ 4: "踢出群聊并撤回消息",
5: `禁言${muteTime}秒并撤回消息`
}
if (punishments[data.penaltyType]) {
@@ -95,7 +95,7 @@ export class NewGroupBannedWords extends plugin {
const keyWordTran = await GroupBannedWords.keyWordTran(data.rawItem)
const senderCard = e.sender.card || e.sender.nickname
const wordNum = keyWordTran.length - 2
- const replaceWord = '*'.repeat(wordNum < 0 ? 0 : wordNum)
+ const replaceWord = "*".repeat(wordNum < 0 ? 0 : wordNum)
const bannedWord = keyWordTran.substr(0, 2) + replaceWord
e.reply([
`触发违禁词:${bannedWord}\n`,
@@ -134,16 +134,16 @@ export class NewGroupBannedWords extends plugin {
}
async add (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) return false
+ if (!common.checkPermission(e, "admin", "admin")) return false
let word = this.#trimAlias(e.toString())
word = word.match(/^#?新增(模糊|精确|正则)?(踢|禁|撤|踢撤|禁撤)?违禁词(.*)$/)
- if (!word[3]) return e.reply('需要添加的屏蔽词为空')
+ if (!word[3]) return e.reply("需要添加的屏蔽词为空")
// 校验正则
- if (word[1] === '正则') {
+ if (word[1] === "正则") {
try {
global.eval(word[3])
} catch {
- return e.reply('正则表达式错误')
+ return e.reply("正则表达式错误")
}
}
try {
@@ -151,8 +151,8 @@ export class NewGroupBannedWords extends plugin {
e.group_id, word[3].trim(), word[1], word[2], e.user_id
)
e.reply([
- '✅ 成功添加违禁词\n',
- '违禁词:',
+ "✅ 成功添加违禁词\n",
+ "违禁词:",
await res.words,
`\n匹配模式:${res.matchType}\n`,
`处理方式:${res.penaltyType}`
@@ -163,13 +163,13 @@ export class NewGroupBannedWords extends plugin {
}
async del (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) return false
+ if (!common.checkPermission(e, "admin", "admin")) return false
let word = this.#trimAlias(e.toString())
- word = word.replace(/#?删除违禁词/, '').trim()
- if (!word) return e.reply('需要删除的屏蔽词为空')
+ word = word.replace(/#?删除违禁词/, "").trim()
+ if (!word) return e.reply("需要删除的屏蔽词为空")
try {
let msg = await GroupBannedWords.delBannedWords(e.group_id, word)
- e.reply(['✅ 成功删除:', msg])
+ e.reply(["✅ 成功删除:", msg])
} catch (error) {
common.handleException(e, error)
}
@@ -177,18 +177,18 @@ export class NewGroupBannedWords extends plugin {
async query (e) {
let word = this.#trimAlias(e.toString())
- word = word.replace(/#?查看违禁词/, '').trim()
- if (!word) return e.reply('需要查询的屏蔽词为空')
+ word = word.replace(/#?查看违禁词/, "").trim()
+ if (!word) return e.reply("需要查询的屏蔽词为空")
try {
const { words, matchType, penaltyType, addedBy, date } = GroupBannedWords.queryBannedWords(e.group_id, word)
e.reply([
- '✅ 查询违禁词\n',
- '违禁词:',
+ "✅ 查询违禁词\n",
+ "违禁词:",
await words,
`\n匹配模式:${matchType}\n`,
`处理方式:${penaltyType}\n`,
- `添加人:${addedBy ?? '未知'}\n`,
- `添加时间:${date ?? '未知'}`
+ `添加人:${addedBy ?? "未知"}\n`,
+ `添加时间:${date ?? "未知"}`
])
} catch (error) {
common.handleException(e, error)
@@ -198,25 +198,25 @@ export class NewGroupBannedWords extends plugin {
async list (e) {
const groupBannedWords = GroupBannedWords.initTextArr(e.group_id)
if (_.isEmpty(groupBannedWords)) {
- return e.reply('❎ 没有违禁词')
+ return e.reply("❎ 没有违禁词")
}
const msg = []
for (const [, v] of groupBannedWords) {
const { matchType, penaltyType, addedBy, date, rawItem } = v
msg.push([
- '违禁词:',
+ "违禁词:",
await GroupBannedWords.keyWordTran(rawItem),
`\n匹配模式:${GroupBannedWords.matchTypeMap[matchType]}\n`,
`处理方式:${GroupBannedWords.penaltyTypeMap[penaltyType]}\n`,
- `添加人:${addedBy ?? '未知'}\n`,
- `添加时间:${date ?? '未知'}`
+ `添加人:${addedBy ?? "未知"}\n`,
+ `添加时间:${date ?? "未知"}`
])
}
common.getforwardMsg(e, msg)
}
async muteTime (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) return false
+ if (!common.checkPermission(e, "admin", "admin")) return false
let time = e.msg.match(/\d+/)[0]
GroupBannedWords.setMuteTime(e.group_id, time)
e.reply(`✅ 群${e.group_id}违禁词禁言时间已设置为${time}s`)
@@ -229,11 +229,11 @@ export class NewGroupBannedWords extends plugin {
// 判断是否需要查看头衔屏蔽词
if (/查看/.test(e.msg)) {
// 返回已有的头衔屏蔽词列表
- return e.reply(`现有的头衔屏蔽词如下:${shieldingWords.join('\n')}`)
+ return e.reply(`现有的头衔屏蔽词如下:${shieldingWords.join("\n")}`)
}
- if (!common.checkPermission(e, 'admin', 'admin')) return false
+ if (!common.checkPermission(e, "admin", "admin")) return false
// 获取用户输入的要增加或删除的屏蔽词
- let message = e.msg.replace(/#|(增加|减少)头衔屏蔽词/g, '').trim().split(',')
+ let message = e.msg.replace(/#|(增加|减少)头衔屏蔽词/g, "").trim().split(",")
// 判断用户是要增加还是删除屏蔽词
let isAddition = /增加/.test(e.msg)
let existingWords = []
@@ -257,29 +257,29 @@ export class NewGroupBannedWords extends plugin {
// 添加新的屏蔽词
if (!_.isEmpty(newWords)) {
GroupBannedWords.addTitleBannedWords(e.group_id, newWords)
- e.reply(`✅ 成功添加:${newWords.join(',')}`)
+ e.reply(`✅ 成功添加:${newWords.join(",")}`)
}
// 提示已有的屏蔽词
if (!_.isEmpty(existingWords)) {
- e.reply(`❎ 以下词已存在:${existingWords.join(',')}`)
+ e.reply(`❎ 以下词已存在:${existingWords.join(",")}`)
}
} else {
// 删除已有的屏蔽词
if (!_.isEmpty(existingWords)) {
GroupBannedWords.delTitleBannedWords(e.group_id, existingWords)
- e.reply(`✅ 成功删除:${existingWords.join(',')}`)
+ e.reply(`✅ 成功删除:${existingWords.join(",")}`)
}
// 提示不在屏蔽词中的词
if (!_.isEmpty(newWords)) {
- e.reply(`❎ 以下词未在屏蔽词中:${newWords.join(',')}`)
+ e.reply(`❎ 以下词未在屏蔽词中:${newWords.join(",")}`)
}
}
}
// 修改头衔匹配模式
async ProhibitedTitlePattern (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) return false
+ if (!common.checkPermission(e, "admin", "admin")) return false
let res = GroupBannedWords.setTitleFilterModeChange(e.group_id)
- e.reply(`✅ 已修改匹配模式为${res ? '精确' : '模糊'}匹配`)
+ e.reply(`✅ 已修改匹配模式为${res ? "精确" : "模糊"}匹配`)
}
}
diff --git a/apps/groupAdmin/groupVerify.js b/apps/groupAdmin/groupVerify.js
index 621c756..7c7e01f 100644
--- a/apps/groupAdmin/groupVerify.js
+++ b/apps/groupAdmin/groupVerify.js
@@ -1,37 +1,37 @@
-import { Config } from '../../components/index.js'
-import { common, GroupAdmin as Ga } from '../../model/index.js'
-import _ from 'lodash'
-import { sleep } from '../../tools/index.js'
+import { Config } from "../../components/index.js"
+import { common, GroupAdmin as Ga } from "../../model/index.js"
+import _ from "lodash"
+import { sleep } from "../../tools/index.js"
// 全局
let temp = {}
-const ops = ['+', '-']
+const ops = ["+", "-"]
export class NewGroupVerify extends plugin {
constructor () {
super({
- name: '椰奶入群验证',
- dsc: '重新验证和绕过验证',
- event: 'message.group',
+ name: "椰奶入群验证",
+ dsc: "重新验证和绕过验证",
+ event: "message.group",
priority: 5,
rule: [
{
- reg: '^#重新验证(\\d+|从未发言的人)?$',
- fnc: 'cmdReverify'
+ reg: "^#重新验证(\\d+|从未发言的人)?$",
+ fnc: "cmdReverify"
},
{
- reg: '^#绕过验证(\\d+)?$',
- fnc: 'cmdPass'
+ reg: "^#绕过验证(\\d+)?$",
+ fnc: "cmdPass"
},
{
- reg: '^#(开启|关闭)验证$',
- fnc: 'handelverify'
+ reg: "^#(开启|关闭)验证$",
+ fnc: "handelverify"
},
{
- reg: '^#切换验证模式$',
- fnc: 'setmode'
+ reg: "^#切换验证模式$",
+ fnc: "setmode"
},
{
- reg: '^#设置验证超时时间(\\d+)(s|秒)?$',
- fnc: 'setovertime'
+ reg: "^#设置验证超时时间(\\d+)(s|秒)?$",
+ fnc: "setovertime"
}
]
})
@@ -40,40 +40,40 @@ export class NewGroupVerify extends plugin {
// 重新验证
async cmdReverify (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) return
+ if (!common.checkPermission(e, "admin", "admin")) return
- if (!this.verifycfg.openGroup.includes(e.group_id)) return e.reply('当前群未开启验证哦~', true)
+ if (!this.verifycfg.openGroup.includes(e.group_id)) return e.reply("当前群未开启验证哦~", true)
- let qq = e.message.find(item => item.type == 'at')?.qq
- if (!qq) qq = e.msg.replace(/#|重新验证/g, '').trim()
+ let qq = e.message.find(item => item.type == "at")?.qq
+ if (!qq) qq = e.msg.replace(/#|重新验证/g, "").trim()
- if (qq == '从未发言的人') return this.cmdReverifyNeverSpeak(e)
+ if (qq == "从未发言的人") return this.cmdReverifyNeverSpeak(e)
- if (!(/\d{5,}/.test(qq))) return e.reply('❎ 请输入正确的QQ号')
+ if (!(/\d{5,}/.test(qq))) return e.reply("❎ 请输入正确的QQ号")
qq = Number(qq)
if (qq == (e.bot ?? Bot).uin) return
- if (Config.masterQQ.includes(qq)) return e.reply('❎ 该命令对机器人管理员无效')
+ if (Config.masterQQ.includes(qq)) return e.reply("❎ 该命令对机器人管理员无效")
- if (temp[qq + e.group_id]) return e.reply('❎ 目标群成员处于验证状态')
+ if (temp[qq + e.group_id]) return e.reply("❎ 目标群成员处于验证状态")
await verify(qq, e.group_id, e)
}
// 绕过验证
async cmdPass (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) return
+ if (!common.checkPermission(e, "admin", "admin")) return
- if (!this.verifycfg.openGroup.includes(e.group_id)) return e.reply('当前群未开启验证哦~', true)
+ if (!this.verifycfg.openGroup.includes(e.group_id)) return e.reply("当前群未开启验证哦~", true)
- let qq = e.message.find(item => item.type == 'at')?.qq
- if (!qq) qq = e.msg.replace(/#|绕过验证/g, '').trim()
+ let qq = e.message.find(item => item.type == "at")?.qq
+ if (!qq) qq = e.msg.replace(/#|绕过验证/g, "").trim()
- if (!(/\d{5,}/.test(qq))) return e.reply('❎ 请输入正确的QQ号')
+ if (!(/\d{5,}/.test(qq))) return e.reply("❎ 请输入正确的QQ号")
if (qq == (e.bot ?? Bot).uin) return
qq = Number(qq)
- if (!temp[qq + e.group_id]) return e.reply('❎ 目标群成员当前无需验证')
+ if (!temp[qq + e.group_id]) return e.reply("❎ 目标群成员当前无需验证")
clearTimeout(temp[qq + e.group_id].kickTimer)
@@ -81,7 +81,7 @@ export class NewGroupVerify extends plugin {
delete temp[qq + e.group_id]
- return await e.reply(this.verifycfg.SuccessMsgs[e.group_id] || this.verifycfg.SuccessMsgs[0] || '✅ 验证成功,欢迎入群')
+ return await e.reply(this.verifycfg.SuccessMsgs[e.group_id] || this.verifycfg.SuccessMsgs[0] || "✅ 验证成功,欢迎入群")
}
async cmdReverifyNeverSpeak (e) {
@@ -99,37 +99,37 @@ export class NewGroupVerify extends plugin {
// 开启验证
async handelverify (e) {
- if (!common.checkPermission(e, 'admin', 'admin')) return
- let type = /开启/.test(e.msg) ? 'add' : 'del'
+ if (!common.checkPermission(e, "admin", "admin")) return
+ let type = /开启/.test(e.msg) ? "add" : "del"
let isopen = this.verifycfg.openGroup.includes(e.group_id)
- if (isopen && type == 'add') return e.reply('❎ 本群验证已处于开启状态')
- if (!isopen && type == 'del') return e.reply('❎ 本群暂未开启验证')
- Config.modifyarr('groupverify', 'openGroup', e.group_id, type)
- e.reply(`✅ 已${type == 'add' ? '开启' : '关闭'}本群验证`)
+ if (isopen && type == "add") return e.reply("❎ 本群验证已处于开启状态")
+ if (!isopen && type == "del") return e.reply("❎ 本群暂未开启验证")
+ Config.modifyarr("groupverify", "openGroup", e.group_id, type)
+ e.reply(`✅ 已${type == "add" ? "开启" : "关闭"}本群验证`)
}
// 切换验证模式
async setmode (e) {
- if (!common.checkPermission(e, 'master')) return
- let value = this.verifycfg.mode == '模糊' ? '精确' : '模糊'
- Config.modify('groupverify', 'mode', value)
+ if (!common.checkPermission(e, "master")) return
+ let value = this.verifycfg.mode == "模糊" ? "精确" : "模糊"
+ Config.modify("groupverify", "mode", value)
e.reply(`✅ 已切换验证模式为${value}验证`)
}
// 设置验证超时时间
async setovertime (e) {
- if (!common.checkPermission(e, 'master')) return
+ if (!common.checkPermission(e, "master")) return
let overtime = e.msg.match(/\d+/g)
- Config.modify('groupverify', 'time', Number(overtime))
+ Config.modify("groupverify", "time", Number(overtime))
e.reply(`✅ 已将验证超时时间设置为${overtime}秒`)
if (overtime < 60) {
- e.reply('建议至少一分钟(60秒)哦ε(*´・ω・)з')
+ e.reply("建议至少一分钟(60秒)哦ε(*´・ω・)з")
}
}
}
// 进群监听
-Bot.on?.('notice.group.increase', async (e) => {
+Bot.on?.("notice.group.increase", async (e) => {
logger.mark(`[Yenai-Plugin][进群验证]收到${e.user_id}的进群事件`)
let { openGroup, DelayTime } = Config.groupverify
@@ -144,7 +144,7 @@ Bot.on?.('notice.group.increase', async (e) => {
})
// 答案监听
-Bot.on?.('message.group', async (e) => {
+Bot.on?.("message.group", async (e) => {
let { openGroup, mode, SuccessMsgs } = Config.groupverify
if (!openGroup.includes(e.group_id)) return
@@ -157,9 +157,9 @@ Bot.on?.('message.group', async (e) => {
const { nums, operator } = temp[e.user_id + e.group_id]
- const isAccurateModeOK = mode === '精确' && e.raw_message == verifyCode
+ const isAccurateModeOK = mode === "精确" && e.raw_message == verifyCode
- const isVagueModeOK = mode === '模糊' && e.raw_message?.includes(verifyCode)
+ const isVagueModeOK = mode === "模糊" && e.raw_message?.includes(verifyCode)
const isOK = isAccurateModeOK || isVagueModeOK
@@ -167,7 +167,7 @@ Bot.on?.('message.group', async (e) => {
delete temp[e.user_id + e.group_id]
clearTimeout(kickTimer)
clearTimeout(remindTimer)
- return await e.reply(SuccessMsgs[e.group_id] || SuccessMsgs[0] || '✅ 验证成功,欢迎入群')
+ return await e.reply(SuccessMsgs[e.group_id] || SuccessMsgs[0] || "✅ 验证成功,欢迎入群")
} else {
temp[e.user_id + e.group_id].remainTimes -= 1
@@ -181,14 +181,14 @@ Bot.on?.('message.group', async (e) => {
}
clearTimeout(kickTimer)
clearTimeout(remindTimer)
- await e.reply([segment.at(e.user_id), '\n验证失败,请重新申请'])
+ await e.reply([segment.at(e.user_id), "\n验证失败,请重新申请"])
delete temp[e.user_id + e.group_id]
return await e.group.kickMember(e.user_id)
}
})
// 主动退群
-Bot.on?.('notice.group.decrease', async (e) => {
+Bot.on?.("notice.group.decrease", async (e) => {
if (!e.group.is_admin && !e.group.is_owner) return
if (!temp[e.user_id + e.group_id]) return
@@ -225,10 +225,10 @@ async function verify (user_id, group_id, e) {
[m, n] = [m >= n ? m : n, m >= n ? n : m]
- const verifyCode = String(operator === '-' ? m - n : m + n)
+ const verifyCode = String(operator === "-" ? m - n : m + n)
logger.mark(`[Yenai-Plugin][进群验证]答案:${verifyCode}`)
const kickTimer = setTimeout(async () => {
- e.reply([segment.at(user_id), '\n验证超时,移出群聊,请重新申请'])
+ e.reply([segment.at(user_id), "\n验证超时,移出群聊,请重新申请"])
delete temp[user_id + group_id]
diff --git a/apps/groupAdmin/privateGroupAdmin.js b/apps/groupAdmin/privateGroupAdmin.js
index eacfdf2..fc3c3a9 100644
--- a/apps/groupAdmin/privateGroupAdmin.js
+++ b/apps/groupAdmin/privateGroupAdmin.js
@@ -1,39 +1,39 @@
-import { GroupAdmin as Ga, common } from '../../model/index.js'
-import { Time_unit } from '../../constants/other.js'
-import translateChinaNum from '../../tools/translateChinaNum.js'
+import { GroupAdmin as Ga, common } from "../../model/index.js"
+import { Time_unit } from "../../constants/other.js"
+import translateChinaNum from "../../tools/translateChinaNum.js"
// 正则
-const Numreg = '[一壹二两三四五六七八九十百千万亿\\d]+'
-const TimeUnitReg = Object.keys(Time_unit).join('|')
+const Numreg = "[一壹二两三四五六七八九十百千万亿\\d]+"
+const TimeUnitReg = Object.keys(Time_unit).join("|")
const muteMemberReg = new RegExp(`^#禁言\\s?(\\d+)\\s(\\d+)\\s(${Numreg})?(${TimeUnitReg})?$`)
export class PrivateGroupAdmin extends plugin {
constructor () {
super({
- name: '椰奶私聊群管',
- event: 'message',
+ name: "椰奶私聊群管",
+ event: "message",
priority: 2000,
rule: [
{
reg: muteMemberReg,
- fnc: 'muteMember'
+ fnc: "muteMember"
},
{
- reg: '^#解禁\\s?(\\d+)\\s(\\d+)$',
- fnc: 'nomuteMember'
+ reg: "^#解禁\\s?(\\d+)\\s(\\d+)$",
+ fnc: "nomuteMember"
},
{
- reg: '^#全体(禁言|解禁)(\\d+)$',
- fnc: 'muteAll'
+ reg: "^#全体(禁言|解禁)(\\d+)$",
+ fnc: "muteAll"
},
{
- reg: '^#踢\\s?(\\d+)\\s(\\d+)$',
- fnc: 'kickMember'
+ reg: "^#踢\\s?(\\d+)\\s(\\d+)$",
+ fnc: "kickMember"
}
]
})
}
async muteMember (e) {
- if (!common.checkPermission(e, 'master')) return
+ if (!common.checkPermission(e, "master")) return
let regRet = e.msg.match(muteMemberReg)
const time = translateChinaNum(regRet[3])
let res = await new Ga(e).muteMember(regRet[1], regRet[2], e.user_id, time, regRet[4])
@@ -41,22 +41,22 @@ export class PrivateGroupAdmin extends plugin {
}
async noMuteMember (e) {
- if (!common.checkPermission(e, 'master')) return
+ if (!common.checkPermission(e, "master")) return
let regRet = e.msg.match(/^#解禁\s?(\d+)\s(\d+)$/)
let res = await new Ga(e).muteMember(regRet[1], regRet[2], e.user_id, 0)
e.reply(res)
}
async muteAll (e) {
- if (!common.checkPermission(e, 'master')) return
+ if (!common.checkPermission(e, "master")) return
let regRet = e.msg.match(/全体(禁言|解禁)(\d+)/)
let group = (e.bot ?? Bot).pickGroup(Number(regRet[2]))
- group.muteAll(regRet[1] == '禁言')
- e.reply(`✅ 已将群「${group.name}(${group.group_id})」${regRet[1] == '禁言' ? '开启' : '解除'}全体禁言`)
+ group.muteAll(regRet[1] == "禁言")
+ e.reply(`✅ 已将群「${group.name}(${group.group_id})」${regRet[1] == "禁言" ? "开启" : "解除"}全体禁言`)
}
async kickMember (e) {
- if (!common.checkPermission(e, 'master')) return
+ if (!common.checkPermission(e, "master")) return
let regRet = e.msg.match(/#踢\s?(\d+)\s(\d+)$/)
let res = await Ga.kickMember(regRet[1], regRet[2], e.user_id)
e.reply(res)
diff --git a/apps/handle.js b/apps/handle.js
index a803b87..8da3378 100644
--- a/apps/handle.js
+++ b/apps/handle.js
@@ -1,51 +1,51 @@
-import _ from 'lodash'
-import moment from 'moment'
-import plugin from '../../../lib/plugins/plugin.js'
-import { common } from '../model/index.js'
-import { sleep } from '../tools/index.js'
+import _ from "lodash"
+import moment from "moment"
+import plugin from "../../../lib/plugins/plugin.js"
+import { common } from "../model/index.js"
+import { sleep } from "../tools/index.js"
const ROLE_MAP = {
- admin: '群管理',
- owner: '群主',
- member: '群员'
+ admin: "群管理",
+ owner: "群主",
+ member: "群员"
}
export class NewHandle extends plugin {
constructor () {
super({
- name: '椰奶申请处理',
- event: 'message',
+ name: "椰奶申请处理",
+ event: "message",
priority: 500,
rule: [
{
- reg: '^#?(同意|拒绝)$',
- fnc: 'Handle'
+ reg: "^#?(同意|拒绝)$",
+ fnc: "Handle"
},
{
- reg: '^#?回复',
- fnc: 'Replys',
- event: 'message.private'
+ reg: "^#?回复",
+ fnc: "Replys",
+ event: "message.private"
},
{
- reg: '^#?(同意|拒绝|查看)(全部)?好友申请(\\d+)?$',
- fnc: 'PrivateAdd'
+ reg: "^#?(同意|拒绝|查看)(全部)?好友申请(\\d+)?$",
+ fnc: "PrivateAdd"
},
{
- reg: '^#?(加为|添加)好友$',
- fnc: 'addFriend',
- event: 'message.private'
+ reg: "^#?(加为|添加)好友$",
+ fnc: "addFriend",
+ event: "message.private"
},
{
- reg: '^#?(同意|拒绝|查看)(全部)?(加|入)?群申请(\\d+)?$',
- fnc: 'GroupAdd',
- event: 'message.group'
+ reg: "^#?(同意|拒绝|查看)(全部)?(加|入)?群申请(\\d+)?$",
+ fnc: "GroupAdd",
+ event: "message.group"
},
{
- reg: '^#?(同意|拒绝|查看)(全部)?群邀请(\\d+)?$',
- fnc: 'GroupInvite'
+ reg: "^#?(同意|拒绝|查看)(全部)?群邀请(\\d+)?$",
+ fnc: "GroupInvite"
},
{
- reg: '^#?查看全部请求$',
- fnc: 'SystemMsgAll'
+ reg: "^#?查看全部请求$",
+ fnc: "SystemMsgAll"
}
]
})
@@ -61,11 +61,11 @@ export class NewHandle extends plugin {
const systemMsg = (await (e.bot ?? Bot).getSystemMsg())
let FriendAdd = systemMsg.filter(
- item => item.request_type == 'friend' &&
- (item.sub_type === 'add' || item.sub_type === 'single')
+ item => item.request_type == "friend" &&
+ (item.sub_type === "add" || item.sub_type === "single")
)
- if (_.isEmpty(FriendAdd)) return e.reply('暂无好友申请(。-ω-)zzz', true)
+ if (_.isEmpty(FriendAdd)) return e.reply("暂无好友申请(。-ω-)zzz", true)
if (/查看好友申请/.test(e.msg)) {
FriendAdd = FriendAdd.map((item) => {
@@ -73,23 +73,23 @@ export class NewHandle extends plugin {
segment.image(`https://q1.qlogo.cn/g?b=qq&s=100&nk=${item.user_id}`),
`\n申请人QQ:${item.user_id}\n`,
`申请人昵称:${item.nickname}\n`,
- `申请来源:${item.source || '未知'}\n`,
- `申请时间:${moment(item.time * 1000).format('YYYY-MM-DD HH:mm:ss')}\n`,
- `附加信息:${item.comment || '无附加信息'}`
+ `申请来源:${item.source || "未知"}\n`,
+ `申请时间:${moment(item.time * 1000).format("YYYY-MM-DD HH:mm:ss")}\n`,
+ `附加信息:${item.comment || "无附加信息"}`
]
})
let msg = [
`现有未处理的好友申请如下,共${FriendAdd.length}条`,
- '可用"#同意好友申请"或"#拒绝好友申请"进行处理',
+ "可用\"#同意好友申请\"或\"#拒绝好友申请\"进行处理",
...FriendAdd
]
return common.getforwardMsg(e, msg)
} else if (/全部/.test(e.msg)) {
// 同意全部好友申请
- await e.reply('好哒,我开始处理辣٩(๑•ㅂ•)۶')
+ await e.reply("好哒,我开始处理辣٩(๑•ㅂ•)۶")
let success = []; let fail = []
for (let i of FriendAdd) {
- logger.mark(`${e.logFnc}${yes ? '同意' : '拒绝'}${i.user_id}的好友申请`)
+ logger.mark(`${e.logFnc}${yes ? "同意" : "拒绝"}${i.user_id}的好友申请`)
let res = await i.approve(yes)
if (res) {
success.push(`${success.length + 1}、${i.user_id}`)
@@ -99,25 +99,25 @@ export class NewHandle extends plugin {
await sleep(2000)
}
let msg = [
- `本次共${yes ? '同意' : '拒绝'}${FriendAdd.length}条好友申请\n成功:${success.length}\n失败:${fail.length}`
+ `本次共${yes ? "同意" : "拒绝"}${FriendAdd.length}条好友申请\n成功:${success.length}\n失败:${fail.length}`
]
- if (!_.isEmpty(success)) msg.push(['以下为成功的名单:\n', success.join('\n')])
- if (!_.isEmpty(fail)) msg.push(['以下为失败的名单:\n', fail.join('\n')])
+ if (!_.isEmpty(success)) msg.push(["以下为成功的名单:\n", success.join("\n")])
+ if (!_.isEmpty(fail)) msg.push(["以下为失败的名单:\n", fail.join("\n")])
return common.getforwardMsg(e, msg)
} else {
// 处理单个好友申请
- let qq = e.msg.replace(/#|(同意|拒绝)好友申请/g, '').trim()
- if (!qq) return e.reply('❎ 请输入正确的QQ')
+ let qq = e.msg.replace(/#|(同意|拒绝)好友申请/g, "").trim()
+ if (!qq) return e.reply("❎ 请输入正确的QQ")
let member = FriendAdd.find(item => item.user_id == qq)
- if (_.isEmpty(member)) return e.reply('❎ 没有找到这个人的好友申请')
+ if (_.isEmpty(member)) return e.reply("❎ 没有找到这个人的好友申请")
let result = member.approve(yes)
if (result) {
- e.reply(`✅ 已${yes ? '同意' : '拒绝'}${member.nickname}(${qq})的好友申请`)
+ e.reply(`✅ 已${yes ? "同意" : "拒绝"}${member.nickname}(${qq})的好友申请`)
} else {
- e.reply('❎ 未知错误')
+ e.reply("❎ 未知错误")
}
}
}
@@ -136,68 +136,68 @@ export class NewHandle extends plugin {
} else {
source = (await e.friend.getChatHistory(e.source.time, 1)).pop()
}
- if (!source) return e.reply('❎ 获取消息失败')
- let sourceMsg = source.raw_message?.split('\n')
- if (!sourceMsg) return e.reply('❎ 获取原消息失败,请使用"同意xxx"进行处理')
+ if (!source) return e.reply("❎ 获取消息失败")
+ let sourceMsg = source.raw_message?.split("\n")
+ if (!sourceMsg) return e.reply("❎ 获取原消息失败,请使用\"同意xxx\"进行处理")
if (e.isGroup) {
- if (!common.checkPermission(e, 'admin', 'admin')) return
+ if (!common.checkPermission(e, "admin", "admin")) return
let source = (await e.group.getChatHistory(e.source.seq, 1)).pop()
let yes = /同意/.test(e.msg)
- logger.mark(`${e.logFnc}${yes ? '同意' : '拒绝'}加群通知`)
+ logger.mark(`${e.logFnc}${yes ? "同意" : "拒绝"}加群通知`)
let userId = await redis.get(`yenai:groupAdd:${source.message_id}`)
- if (!userId) return e.reply('找不到原消息了,手动同意叭~')
+ if (!userId) return e.reply("找不到原消息了,手动同意叭~")
let member = (await (e.bot ?? Bot).getSystemMsg())
- .find(item => item.request_type == 'group' && item.sub_type == 'add' && item.group_id == e.group_id && item.user_id == userId)
+ .find(item => item.request_type == "group" && item.sub_type == "add" && item.group_id == e.group_id && item.user_id == userId)
- if (_.isEmpty(member)) return e.reply('呜呜呜,没找到这个淫的加群申请(つд⊂)')
+ if (_.isEmpty(member)) return e.reply("呜呜呜,没找到这个淫的加群申请(つд⊂)")
- if (/风险/.test(member.tips)) return e.reply('该账号为风险账号请手动处理哦ಠ~ಠ')
+ if (/风险/.test(member.tips)) return e.reply("该账号为风险账号请手动处理哦ಠ~ಠ")
if (await member.approve(yes)) {
- e.reply(`已${yes ? '同意' : '拒绝'}${member.nickname}(${member.user_id})的加群申请辣٩(๑^o^๑)۶`)
+ e.reply(`已${yes ? "同意" : "拒绝"}${member.nickname}(${member.user_id})的加群申请辣٩(๑^o^๑)۶`)
} else {
- e.reply('呜呜呜,处理失败辣(இωஇ)')
+ e.reply("呜呜呜,处理失败辣(இωஇ)")
}
return true
} else {
if (!e.isMaster) return false
if (/添加好友申请/.test(sourceMsg[0])) {
let qq = sourceMsg[1].match(/[1-9]\d*/g)
- if ((e.bot ?? Bot).fl.get(Number(qq))) return e.reply('❎ 已经同意过该申请了哦~')
+ if ((e.bot ?? Bot).fl.get(Number(qq))) return e.reply("❎ 已经同意过该申请了哦~")
- logger.mark(`${e.logFnc}${yes ? '同意' : '拒绝'}好友申请`)
+ logger.mark(`${e.logFnc}${yes ? "同意" : "拒绝"}好友申请`)
await (e.bot ?? Bot).pickFriend(qq)
- .setFriendReq('', yes)
- .then(() => e.reply(`✅ 已${yes ? '同意' : '拒绝'}${qq}的好友申请`))
- .catch(() => e.reply('❎ 请检查是否已同意该申请'))
+ .setFriendReq("", yes)
+ .then(() => e.reply(`✅ 已${yes ? "同意" : "拒绝"}${qq}的好友申请`))
+ .catch(() => e.reply("❎ 请检查是否已同意该申请"))
} else if (/邀请机器人进群/.test(sourceMsg[0])) {
let groupid = sourceMsg[1].match(/[1-9]\d*/g)
- if ((e.bot ?? Bot).fl.get(Number(groupid))) { return e.reply('❎ 已经同意过该申请了哦~') }
+ if ((e.bot ?? Bot).fl.get(Number(groupid))) { return e.reply("❎ 已经同意过该申请了哦~") }
let qq = sourceMsg[3].match(/[1-9]\d*/g)
let seq = sourceMsg[6].match(/[1-9]\d*/g)
- logger.mark(`${e.logFnc}${yes ? '同意' : '拒绝'}群邀请`);
+ logger.mark(`${e.logFnc}${yes ? "同意" : "拒绝"}群邀请`);
(e.bot ?? Bot).pickUser(qq)
.setGroupInvite(groupid, seq, yes)
- .then(() => e.reply(`✅ 已${yes ? '同意' : '拒绝'}${qq}的群邀请`))
- .catch(() => e.reply('❎ 请检查是否已同意该邀请'))
+ .then(() => e.reply(`✅ 已${yes ? "同意" : "拒绝"}${qq}的群邀请`))
+ .catch(() => e.reply("❎ 请检查是否已同意该邀请"))
} else if (/加群申请/.test(sourceMsg[0])) {
let groupId = sourceMsg[1].match(/\d+/g)
let qq = sourceMsg[3].match(/\d+/g)
- let member = (await (e.bot ?? Bot).getSystemMsg()).find(item => item.sub_type == 'add' && item.group_id == groupId && item.user_id == qq)
- if (_.isEmpty(member)) return e.reply('没有找到这个人的加群申请哦')
+ let member = (await (e.bot ?? Bot).getSystemMsg()).find(item => item.sub_type == "add" && item.group_id == groupId && item.user_id == qq)
+ if (_.isEmpty(member)) return e.reply("没有找到这个人的加群申请哦")
let result = member.approve(yes)
if (result) {
- e.reply(`已${yes ? '同意' : '拒绝'}${member.nickname}(${qq})的加群申请`)
+ e.reply(`已${yes ? "同意" : "拒绝"}${member.nickname}(${qq})的加群申请`)
} else {
- e.reply('失败了,可能为风险账号请手动处理')
+ e.reply("失败了,可能为风险账号请手动处理")
}
} else {
return false
@@ -208,16 +208,16 @@ export class NewHandle extends plugin {
// 回复好友消息
async Replys (e) {
if (!e.isMaster) return false
- let qq = ''
- let group = ''
- let msgs = e.message[0].text.split(' ')
+ let qq = ""
+ let group = ""
+ let msgs = e.message[0].text.split(" ")
if (e.source) {
let source = (await e.friend.getChatHistory(e.source.time, 1)).pop()
let res
try {
- res = source.raw_message.split('\n')
+ res = source.raw_message.split("\n")
} catch {
- return e.reply('❎ 消息可能已过期')
+ return e.reply("❎ 消息可能已过期")
}
if (/好友消息/.test(res[0]) && /好友账号/.test(res[1])) {
qq = res[1].match(/[1-9]\d*/g)
@@ -225,40 +225,40 @@ export class NewHandle extends plugin {
qq = res[2].match(/[1-9]\d*/g)
group = res[1].match(/[1-9]\d*/g)
} else {
- return e.reply('❎ 请检查是否引用正确')
+ return e.reply("❎ 请检查是否引用正确")
}
- e.message[0].text = e.message[0].text.replace(/#|回复/g, '').trim()
+ e.message[0].text = e.message[0].text.replace(/#|回复/g, "").trim()
} else {
if (msgs.length == 1 && !/\d/.test(msgs[0])) {
- return e.reply('❎ QQ号不能为空')
+ return e.reply("❎ QQ号不能为空")
} else if (/\d/.test(msgs[0])) {
qq = msgs[0].match(/[1-9]\d*/g)
- e.message[0].text = msgs.slice(1).join(' ')
+ e.message[0].text = msgs.slice(1).join(" ")
} else {
qq = msgs[1]
- e.message[0].text = msgs.slice(2).join(' ')
+ e.message[0].text = msgs.slice(2).join(" ")
}
}
if (!e.message[0].text) e.message.shift()
- if (e.message.length === 0) return e.reply('❎ 消息不能为空')
+ if (e.message.length === 0) return e.reply("❎ 消息不能为空")
if (group) {
logger.mark(`${e.logFnc}回复临时消息`)
return (e.bot ?? Bot).sendTempMsg(group, qq, e.message)
- .then(() => e.reply('✅ 已把消息发给它了哦~'))
- .catch((err) => common.handleException(e, err, { MsgTemplate: '❎ 发送失败\n错误信息为:{error}' }))
+ .then(() => e.reply("✅ 已把消息发给它了哦~"))
+ .catch((err) => common.handleException(e, err, { MsgTemplate: "❎ 发送失败\n错误信息为:{error}" }))
}
- if (!/^\d+$/.test(qq)) return e.reply('❎ QQ号不正确,人家做不到的啦>_<~')
+ if (!/^\d+$/.test(qq)) return e.reply("❎ QQ号不正确,人家做不到的啦>_<~")
- if (!(e.bot ?? Bot).fl.get(Number(qq))) return e.reply('❎ 好友列表查无此人')
+ if (!(e.bot ?? Bot).fl.get(Number(qq))) return e.reply("❎ 好友列表查无此人")
logger.mark(`${e.logFnc}回复好友消息`);
(e.bot ?? Bot).pickFriend(qq)
.sendMsg(e.message)
- .then(() => e.reply('✅ 已把消息发给它了哦~'))
- .catch((err) => common.handleException(e, err, { MsgTemplate: '❎ 发送失败\n错误信息为:{error}' }))
+ .then(() => e.reply("✅ 已把消息发给它了哦~"))
+ .catch((err) => common.handleException(e, err, { MsgTemplate: "❎ 发送失败\n错误信息为:{error}" }))
}
// 加群员为好友
@@ -266,24 +266,24 @@ export class NewHandle extends plugin {
if (!e.isMaster) return false
if (!e.source) return false
let source = (await e.friend.getChatHistory(e.source.time, 1)).pop()
- let msg = source.raw_message.split('\n')
+ let msg = source.raw_message.split("\n")
if (!/临时消息/.test(msg[0]) || !/来源群号/.test(msg[1]) || !/发送人QQ/.test(msg[2])) return false
let group = msg[1].match(/\d+/g)
let qq = msg[2].match(/\d+/g)
- if ((e.bot ?? Bot).fl.get(Number(qq))) return e.reply('❎ 已经有这个人的好友了哦~')
- if (!(e.bot ?? Bot).gl.get(Number(group))) { return e.reply('❎ 群聊列表查无此群') }
+ if ((e.bot ?? Bot).fl.get(Number(qq))) return e.reply("❎ 已经有这个人的好友了哦~")
+ if (!(e.bot ?? Bot).gl.get(Number(group))) { return e.reply("❎ 群聊列表查无此群") }
logger.mark(`${e.logFnc}主动添加好友`);
(e.bot ?? Bot).addFriend(group, qq)
.then(() => e.reply(`✅ 已向${qq}发送了好友请求`))
- .catch(() => e.reply('❎ 发送请求失败'))
+ .catch(() => e.reply("❎ 发送请求失败"))
}
// 入群请求
async GroupAdd (e) {
let SystemMsg = (await (e.bot ?? Bot).getSystemMsg())
- .filter(item => item.request_type == 'group' && item.sub_type == 'add' && item.group_id == e.group_id)
- if (_.isEmpty(SystemMsg)) return e.reply('暂无加群申请(。-ω-)zzz', true)
+ .filter(item => item.request_type == "group" && item.sub_type == "add" && item.group_id == e.group_id)
+ if (_.isEmpty(SystemMsg)) return e.reply("暂无加群申请(。-ω-)zzz", true)
// 查看
if (/查看/.test(e.msg)) {
SystemMsg = SystemMsg.map(item => {
@@ -291,22 +291,22 @@ export class NewHandle extends plugin {
segment.image(`https://q1.qlogo.cn/g?b=qq&s=100&nk=${item.user_id}`),
`\nQQ:${item.user_id}\n`,
`昵称:${item.nickname}\n`,
- item.tips ? `Tips:${item.tips}\n` : '',
+ item.tips ? `Tips:${item.tips}\n` : "",
`${item.comment}`
]
})
let msg = [
`现有未处理的加群申请如下,总共${SystemMsg.length}条`,
- '可使用 "#(同意|拒绝)加群申请xxx"\n或 "#(同意|拒绝)全部加群申请"',
+ "可使用 \"#(同意|拒绝)加群申请xxx\"\n或 \"#(同意|拒绝)全部加群申请\"",
...SystemMsg
]
return common.getforwardMsg(e, msg)
}
- if (!common.checkPermission(e, 'admin', 'admin')) return
+ if (!common.checkPermission(e, "admin", "admin")) return
let yes = /同意/.test(e.msg)
if (/全部/.test(e.msg)) {
- e.reply('好哒,我开始处理辣٩(๑•ㅂ•)۶')
+ e.reply("好哒,我开始处理辣٩(๑•ㅂ•)۶")
let success = []; let fail = []; let risk = []
for (let i of SystemMsg) {
if (await i.approve(yes)) {
@@ -323,25 +323,25 @@ export class NewHandle extends plugin {
let msg = [
`本次共处理${SystemMsg.length}条群申请\n成功:${success.length}\n失败:${fail.length}\n风险:${risk.length}`
]
- if (!_.isEmpty(success)) msg.push(['以下为成功的名单:\n', success.join('\n')])
- if (!_.isEmpty(fail)) msg.push(['以下为失败的名单:\n', fail.join('\n')])
- if (!_.isEmpty(risk)) msg.push(['以下为风险账号名单:\n', risk.join('\n')])
+ if (!_.isEmpty(success)) msg.push(["以下为成功的名单:\n", success.join("\n")])
+ if (!_.isEmpty(fail)) msg.push(["以下为失败的名单:\n", fail.join("\n")])
+ if (!_.isEmpty(risk)) msg.push(["以下为风险账号名单:\n", risk.join("\n")])
common.getforwardMsg(e, msg)
} else {
- let qq = e.msg.replace(/#(同意|拒绝)(加|入)群申请/g, '').trim()
+ let qq = e.msg.replace(/#(同意|拒绝)(加|入)群申请/g, "").trim()
- if (!qq) return e.reply('QQ号呢,QQ号呢d(ŐдŐ๑)', true)
+ if (!qq) return e.reply("QQ号呢,QQ号呢d(ŐдŐ๑)", true)
let member = SystemMsg.find(item => item.user_id == qq)
- if (_.isEmpty(member)) return e.reply('呜呜呜,没找到这个淫的加群申请(つд⊂)')
+ if (_.isEmpty(member)) return e.reply("呜呜呜,没找到这个淫的加群申请(つд⊂)")
- if (/风险/.test(member.tips)) return e.reply('该账号为风险账号请手动处理哦ಠ~ಠ')
+ if (/风险/.test(member.tips)) return e.reply("该账号为风险账号请手动处理哦ಠ~ಠ")
if (await member.approve(yes)) {
- e.reply(`已${yes ? '同意' : '拒绝'}${member.nickname}(${member.user_id})的加群申请辣٩(๑^o^๑)۶`)
+ e.reply(`已${yes ? "同意" : "拒绝"}${member.nickname}(${member.user_id})的加群申请辣٩(๑^o^๑)۶`)
} else {
- e.reply('呜呜呜,处理失败辣(இωஇ)')
+ e.reply("呜呜呜,处理失败辣(இωஇ)")
}
}
}
@@ -349,8 +349,8 @@ export class NewHandle extends plugin {
// 群邀请列表
async GroupInvite (e) {
if (!e.isMaster) return false
- let SystemMsg = (await (e.bot ?? Bot).getSystemMsg()).filter(item => item.request_type == 'group' && item.sub_type == 'invite')
- if (_.isEmpty(SystemMsg)) return e.reply('暂无群邀请哦(。-ω-)zzz', true)
+ let SystemMsg = (await (e.bot ?? Bot).getSystemMsg()).filter(item => item.request_type == "group" && item.sub_type == "invite")
+ if (_.isEmpty(SystemMsg)) return e.reply("暂无群邀请哦(。-ω-)zzz", true)
let yes = /同意/.test(e.msg)
// 查看
if (/查看/.test(e.msg)) {
@@ -366,12 +366,12 @@ export class NewHandle extends plugin {
})
let msg = [
`现有未处理的群邀请如下,总共${SystemMsg.length}条`,
- '可使用 "#(同意|拒绝)群邀请xxx"\n或 "#(同意|拒绝)全部群邀请"',
+ "可使用 \"#(同意|拒绝)群邀请xxx\"\n或 \"#(同意|拒绝)全部群邀请\"",
...SystemMsg
]
return common.getforwardMsg(e, msg)
} else if (/全部/.test(e.msg)) {
- e.reply('好哒,我开始处理辣٩(๑•ㅂ•)۶')
+ e.reply("好哒,我开始处理辣٩(๑•ㅂ•)۶")
let success = []; let fail = []
for (let i of SystemMsg) {
if (await i.approve(yes)) {
@@ -382,22 +382,22 @@ export class NewHandle extends plugin {
await sleep(1000)
}
let msg = [`本次共处理${SystemMsg.length}条群邀请\n成功:${success.length}\n失败:${fail.length}`]
- if (!_.isEmpty(success)) msg.push(['以下为成功的名单:\n', success.join('\n')])
- if (!_.isEmpty(fail)) msg.push(['以下为失败的名单:\n', fail.join('\n')])
+ if (!_.isEmpty(success)) msg.push(["以下为成功的名单:\n", success.join("\n")])
+ if (!_.isEmpty(fail)) msg.push(["以下为失败的名单:\n", fail.join("\n")])
common.getforwardMsg(e, msg)
} else {
- let groupid = e.msg.replace(/#(同意|拒绝)群邀请/g, '').trim()
+ let groupid = e.msg.replace(/#(同意|拒绝)群邀请/g, "").trim()
- if (!groupid) return e.reply('群号呢,群号呢d(ŐдŐ๑)', true)
+ if (!groupid) return e.reply("群号呢,群号呢d(ŐдŐ๑)", true)
let Invite = SystemMsg.find(item => item.group_id == groupid)
- if (_.isEmpty(Invite)) return e.reply('欸,你似不似傻哪有这个群邀请(O∆O)')
+ if (_.isEmpty(Invite)) return e.reply("欸,你似不似傻哪有这个群邀请(O∆O)")
if (await Invite.approve(yes)) {
- e.reply(`已${yes ? '同意' : '拒绝'}${Invite.group_id}这个群邀请辣٩(๑^o^๑)۶`)
+ e.reply(`已${yes ? "同意" : "拒绝"}${Invite.group_id}这个群邀请辣٩(๑^o^๑)۶`)
} else {
- e.reply('呜呜呜,处理失败辣(இωஇ)')
+ e.reply("呜呜呜,处理失败辣(இωஇ)")
}
}
}
@@ -408,14 +408,14 @@ export class NewHandle extends plugin {
let SystemMsg = await (e.bot ?? Bot).getSystemMsg()
let FriendAdd = []; let onewayFriend = []; let GroupAdd = []; let GroupInvite = []
for (let i of SystemMsg) {
- if (i.request_type == 'friend') {
- if (i.sub_type == 'add') {
+ if (i.request_type == "friend") {
+ if (i.sub_type == "add") {
FriendAdd.push(i)
} else {
onewayFriend.push(i)
}
} else {
- if (i.sub_type == 'add') {
+ if (i.sub_type == "add") {
GroupAdd.push(i)
} else {
GroupInvite.push(i)
@@ -430,8 +430,8 @@ export class NewHandle extends plugin {
GroupAdd = GroupAdd.filter(item => item.group_id == e.group.id)
if (!_.isEmpty(GroupAdd)) msg.push(`当前群申请:${GroupAdd.length}条`)
}
- if (_.isEmpty(msg)) return e.reply('好耶!!一条请求都没有哦o( ❛ᴗ❛ )o', true)
- msg.unshift('以下为暂未处理的请求')
+ if (_.isEmpty(msg)) return e.reply("好耶!!一条请求都没有哦o( ❛ᴗ❛ )o", true)
+ msg.unshift("以下为暂未处理的请求")
common.getforwardMsg(e, msg)
}
}
diff --git a/apps/help.js b/apps/help.js
index 8c6da12..faeb991 100644
--- a/apps/help.js
+++ b/apps/help.js
@@ -1,25 +1,25 @@
-import plugin from '../../../lib/plugins/plugin.js'
-import fs from 'fs'
-import _ from 'lodash'
-import { Data } from '../components/index.js'
-import { puppeteer } from '../model/index.js'
+import plugin from "../../../lib/plugins/plugin.js"
+import fs from "fs"
+import _ from "lodash"
+import { Data } from "../components/index.js"
+import { puppeteer } from "../model/index.js"
const helpType = {
- 群管: 'gpAdmin',
- 涩涩: 'sese'
+ 群管: "gpAdmin",
+ 涩涩: "sese"
}
const helpReg = new RegExp(
- `^#?椰奶(插件)?(${Object.keys(helpType).join('|')})?(帮助|菜单|功能)$`
+ `^#?椰奶(插件)?(${Object.keys(helpType).join("|")})?(帮助|菜单|功能)$`
)
export class YenaiHelp extends plugin {
constructor () {
super({
- name: '椰奶帮助',
- event: 'message',
+ name: "椰奶帮助",
+ event: "message",
priority: 2000,
rule: [
{
reg: helpReg,
- fnc: 'message'
+ fnc: "message"
}
]
})
@@ -45,7 +45,7 @@ async function help (e) {
diyCfg = gpAdminHelp.diyCfg
sysCfg = gpAdminHelp.sysCfg
} else {
- let indexHelp = await Data.importCfg('help')
+ let indexHelp = await Data.importCfg("help")
diyCfg = indexHelp.diyCfg
sysCfg = indexHelp.sysCfg
}
@@ -57,14 +57,14 @@ async function help (e) {
let helpGroup = []
_.forEach(helpList, (group) => {
- if (group.auth && group.auth === 'master' && !e.isMaster) {
+ if (group.auth && group.auth === "master" && !e.isMaster) {
return true
}
_.forEach(group.list, (help) => {
let icon = help.icon * 1
if (!icon) {
- help.css = 'display:none'
+ help.css = "display:none"
} else {
let x = (icon - 1) % 10
let y = (icon - x - 1) / 10
@@ -74,12 +74,12 @@ async function help (e) {
helpGroup.push(group)
})
- return await puppeteer.render('help/index', {
+ return await puppeteer.render("help/index", {
helpCfg: helpConfig,
helpGroup,
bg: await rodom(),
colCount: 3,
- element: 'default'
+ element: "default"
}, {
e,
scale: 1.2
@@ -87,7 +87,7 @@ async function help (e) {
}
const rodom = async function () {
- let image = fs.readdirSync('./plugins/yenai-plugin/resources/help/imgs/')
+ let image = fs.readdirSync("./plugins/yenai-plugin/resources/help/imgs/")
let list_img = []
for (let val of image) {
list_img.push(val)
diff --git a/apps/nga.js b/apps/nga.js
index cad7c3e..f83f60d 100644
--- a/apps/nga.js
+++ b/apps/nga.js
@@ -1,25 +1,25 @@
-import plugin from '../../../lib/plugins/plugin.js'
-import fs from 'node:fs'
-import common from '../../../lib/common/common.js'
-import { Data, Plugin_Path } from '../components/index.js'
-import { incomeCurve } from '../constants/nga.js'
+import plugin from "../../../lib/plugins/plugin.js"
+import fs from "node:fs"
+import common from "../../../lib/common/common.js"
+import { Data, Plugin_Path } from "../components/index.js"
+import { incomeCurve } from "../constants/nga.js"
let gsCfg
try {
- gsCfg = (await import('../../genshin/model/gsCfg.js')).default
+ gsCfg = (await import("../../genshin/model/gsCfg.js")).default
} catch (err) {}
export class NGA extends plugin {
constructor () {
super({
- name: '椰奶NGA',
- dsc: '收益曲线',
- event: 'message',
+ name: "椰奶NGA",
+ dsc: "收益曲线",
+ event: "message",
priority: 500,
rule: [
{
- reg: '^#?(更新)?(.*)(收益曲线|参考面板)(帮助)?$',
- fnc: 'NGA'
+ reg: "^#?(更新)?(.*)(收益曲线|参考面板)(帮助)?$",
+ fnc: "NGA"
}
]
})
@@ -30,14 +30,14 @@ export class NGA extends plugin {
// 初始化
async initFolder (type) {
- Data.createDir(`data/${type == '收益曲线' ? 'incomeCurve' : 'referencPanel'}`)
+ Data.createDir(`data/${type == "收益曲线" ? "incomeCurve" : "referencPanel"}`)
}
async NGA () {
let role = {}
- let regRet = this.e.msg.match('^#?(更新)?(.*)(收益曲线|参考面板)(帮助)?$')
+ let regRet = this.e.msg.match("^#?(更新)?(.*)(收益曲线|参考面板)(帮助)?$")
if (regRet[4]) {
- role.name = '帮助'
+ role.name = "帮助"
} else {
if (!gsCfg) return false
role = gsCfg.getRole(regRet[2])
@@ -47,8 +47,8 @@ export class NGA extends plugin {
let type = regRet[3]
/** 主角特殊处理 */
- if (['10000005', '10000007', '20000000'].includes(String(role.roleId))) {
- if (!['风主', '岩主', '雷主', '草主'].includes(role.alias)) {
+ if (["10000005", "10000007", "20000000"].includes(String(role.roleId))) {
+ if (!["风主", "岩主", "雷主", "草主"].includes(role.alias)) {
await this.e.reply(`请选择:风主${type}、岩主${type}、雷主${type}、草主${type}`)
return
} else {
@@ -58,10 +58,10 @@ export class NGA extends plugin {
let imgList = []
- if (type == '收益曲线') {
+ if (type == "收益曲线") {
// 收益曲线
if (!this.incomeCurveObj[role.name]) {
- return this.e.reply('暂时无该角色收益曲线~>_<')
+ return this.e.reply("暂时无该角色收益曲线~>_<")
}
let urls = this.incomeCurveObj[role.name]
diff --git a/apps/picSearch.js b/apps/picSearch.js
index 70ef72c..19efd51 100644
--- a/apps/picSearch.js
+++ b/apps/picSearch.js
@@ -1,32 +1,32 @@
-import { PicSearch, common } from '../model/index.js'
-import { Config } from '../components/index.js'
-import _ from 'lodash'
+import { PicSearch, common } from "../model/index.js"
+import { Config } from "../components/index.js"
+import _ from "lodash"
export class NewPicSearch extends plugin {
constructor () {
super({
- name: '椰奶图片搜索',
- event: 'message',
+ name: "椰奶图片搜索",
+ event: "message",
priority: 2000,
rule: [
{
- reg: '^#?(椰奶)?(以图)?搜图$',
- fnc: 'SauceNAO'
+ reg: "^#?(椰奶)?(以图)?搜图$",
+ fnc: "SauceNAO"
},
{
reg: /^#?(SauceNAO|sn)搜图$/i,
- fnc: 'SauceNAO'
+ fnc: "SauceNAO"
},
{
reg: /^#?(椰奶|WhatAnime|wa)?(以图)?搜番$/i,
- fnc: 'WhatAnime'
+ fnc: "WhatAnime"
},
{
reg: /^#?(Ascii2D|ac)搜图$/i,
- fnc: 'Ascii2D'
+ fnc: "Ascii2D"
},
{
reg: /^#设置SauceNAOApiKey/i,
- fnc: 'UploadSauceNAOKey'
+ fnc: "UploadSauceNAOKey"
}
]
@@ -35,7 +35,7 @@ export class NewPicSearch extends plugin {
async SauceNAO (e) {
if (!await this._Authentication(e)) return
- if (!await this.handelImg(e, 'SauceNAO')) return
+ if (!await this.handelImg(e, "SauceNAO")) return
await PicSearch.SauceNAO(e.img[0])
.then(async res => res.length == 1
? common.recallsendMsg(e, res[0], true)
@@ -44,7 +44,7 @@ export class NewPicSearch extends plugin {
.catch(async err => {
await common.handleException(e, err)
if (Config.picSearch.useAscii2dWhenFailed) {
- await e.reply('SauceNAO搜图出错,自动使用Ascii2D进行搜索')
+ await e.reply("SauceNAO搜图出错,自动使用Ascii2D进行搜索")
await this.Ascii2D(e)
}
})
@@ -52,7 +52,7 @@ export class NewPicSearch extends plugin {
async Ascii2D (e) {
if (!await this._Authentication(e)) return
- if (!await this.handelImg(e, 'Ascii2D')) return
+ if (!await this.handelImg(e, "Ascii2D")) return
await PicSearch.Ascii2D(e.img[0])
.then(res => common.recallSendForwardMsg(e, [...res.color, ...res.bovw], { xmlTitle: false }))
.catch(err => common.handleException(e, err))
@@ -60,8 +60,8 @@ export class NewPicSearch extends plugin {
async WhatAnime (e) {
if (!await this._Authentication(e)) return
- if (!await this.handelImg(e, 'WhatAnime')) return
- await PicSearch.WhatAnime(e.img[0].replace('/c2cpicdw.qpic.cn/offpic_new/', '/gchat.qpic.cn/gchatpic_new/'))
+ if (!await this.handelImg(e, "WhatAnime")) return
+ await PicSearch.WhatAnime(e.img[0].replace("/c2cpicdw.qpic.cn/offpic_new/", "/gchat.qpic.cn/gchatpic_new/"))
.then(async res => {
for (let i of res) {
await e.reply(i)
@@ -73,26 +73,26 @@ export class NewPicSearch extends plugin {
async UploadSauceNAOKey (e) {
if (!this.e.isMaster) { return true }
- if (e.isGroup) return e.reply('请私聊进行添加')
- let apiKey = e.msg.replace(/#设置SauceNAOapiKey/i, '').trim()
- if (!apiKey) return e.reply('❎ 请发送正确的apikey')
- Config.modify('picSearch', 'SauceNAOApiKey', apiKey)
- e.reply('OK')
+ if (e.isGroup) return e.reply("请私聊进行添加")
+ let apiKey = e.msg.replace(/#设置SauceNAOapiKey/i, "").trim()
+ if (!apiKey) return e.reply("❎ 请发送正确的apikey")
+ Config.modify("picSearch", "SauceNAOApiKey", apiKey)
+ e.reply("OK")
}
async _Authentication (e) {
if (!this.e.isMaster) { return true }
const { allowPM, limit, isMasterUse } = Config.picSearch
if (isMasterUse) {
- e.reply('主人没有开放这个功能哦(*/ω\*)')
+ e.reply("主人没有开放这个功能哦(*/ω\*)")
return false
}
if (!allowPM && !e.isGroup) {
- e.reply('主人已禁用私聊该功能')
+ e.reply("主人已禁用私聊该功能")
return false
}
- if (!await common.limit(e.user_id, 'picSearch', limit)) {
- e.reply('您已达今日「搜图搜番」次数上限', true, { at: true })
+ if (!await common.limit(e.user_id, "picSearch", limit)) {
+ e.reply("您已达今日「搜图搜番」次数上限", true, { at: true })
return false
}
return true
@@ -106,21 +106,21 @@ export class NewPicSearch extends plugin {
} else {
source = (await e.friend.getChatHistory(e.source.time, 1)).pop()
}
- e.img = [source.message.find(item => item.type == 'image')?.url]
+ e.img = [source.message.find(item => item.type == "image")?.url]
}
if (!_.isEmpty(e.img)) return true
e.sourceFunName = funName
- this.setContext('MonitorImg')
- e.reply('⚠ 请发送图片')
+ this.setContext("MonitorImg")
+ e.reply("⚠ 请发送图片")
return false
}
async MonitorImg () {
if (!this.e.img) {
- this.e.reply('❎ 未检测到图片操作已取消')
+ this.e.reply("❎ 未检测到图片操作已取消")
} else {
this[this.getContext().MonitorImg.sourceFunName](this.e)
}
- this.finish('MonitorImg')
+ this.finish("MonitorImg")
}
}
diff --git a/apps/pixiv.js b/apps/pixiv.js
index 17823d6..d9d8986 100644
--- a/apps/pixiv.js
+++ b/apps/pixiv.js
@@ -1,83 +1,83 @@
-import plugin from '../../../lib/plugins/plugin.js'
-import { Config } from '../components/index.js'
-import { Pixiv, common, setu } from '../model/index.js'
-import { Admin } from './admin.js'
-import { ImageRPSS } from '../constants/pixiv.js'
-import translateChinaNum from '../tools/translateChinaNum.js'
+import plugin from "../../../lib/plugins/plugin.js"
+import { Config } from "../components/index.js"
+import { Pixiv, common, setu } from "../model/index.js"
+import { Admin } from "./admin.js"
+import { ImageRPSS } from "../constants/pixiv.js"
+import translateChinaNum from "../tools/translateChinaNum.js"
// 文案
-const SWITCH_ERROR = '主人没有开放这个功能哦(*/ω\*)'
+const SWITCH_ERROR = "主人没有开放这个功能哦(*/ω\*)"
// 汉字数字匹配正则
-const numReg = '[一壹二两三四五六七八九十百千万亿\\d]+'
+const numReg = "[一壹二两三四五六七八九十百千万亿\\d]+"
// 正则
const pidReg = /^#?pid搜图\s?(\d+)$/i
-const rankingrReg = new RegExp(`^#?看看((\\d{4}-\\d{1,2}-\\d{1,2})的)?(${Object.keys(Pixiv.ranktype).join('|')})(r18)?榜\\s?(第(${numReg})页)?$`, 'i')
-const tagReg = new RegExp(`^#?tag(pro)?搜图(.*?)(第(${numReg})页)?$`, 'i')
-const uidReg = new RegExp(`^#?uid搜图(.*?)(第(${numReg})页)?$`, 'i')
-const searchUser = new RegExp(`^#?user搜索(.*?)(第(${numReg})页)?$`, 'i')
+const rankingrReg = new RegExp(`^#?看看((\\d{4}-\\d{1,2}-\\d{1,2})的)?(${Object.keys(Pixiv.ranktype).join("|")})(r18)?榜\\s?(第(${numReg})页)?$`, "i")
+const tagReg = new RegExp(`^#?tag(pro)?搜图(.*?)(第(${numReg})页)?$`, "i")
+const uidReg = new RegExp(`^#?uid搜图(.*?)(第(${numReg})页)?$`, "i")
+const searchUser = new RegExp(`^#?user搜索(.*?)(第(${numReg})页)?$`, "i")
const randomImgReg = new RegExp(`^#?来(${numReg})?张(好(康|看)(的|哒)|hkd|涩图)$|^#有内鬼$`)
export class NewPixiv extends plugin {
constructor () {
super({
- name: '椰奶pixiv',
- event: 'message',
+ name: "椰奶pixiv",
+ event: "message",
priority: 500,
rule: [
{
reg: pidReg,
- fnc: 'searchPid'
+ fnc: "searchPid"
},
{
reg: rankingrReg,
- fnc: 'pixivRank'
+ fnc: "pixivRank"
},
{
reg: tagReg,
- fnc: 'searchTags'
+ fnc: "searchTags"
},
{
reg: uidReg,
- fnc: 'searchUid'
+ fnc: "searchUid"
},
{
reg: searchUser,
- fnc: 'searchUser'
+ fnc: "searchUser"
},
{
reg: randomImgReg,
- fnc: 'vilipixRandomImg'
+ fnc: "vilipixRandomImg"
},
{
- reg: '^#?(查看|获取)?热门(t|T)(a|A)(g|G)$',
- fnc: 'popularTags'
+ reg: "^#?(查看|获取)?热门(t|T)(a|A)(g|G)$",
+ fnc: "popularTags"
},
{
- reg: '^#?看?看?相关作品(\\d+)$',
- fnc: 'relatedIllust'
+ reg: "^#?看?看?相关作品(\\d+)$",
+ fnc: "relatedIllust"
},
{
- reg: '^#来(\\d+)?张推荐图$',
- fnc: 'illustRecommended'
+ reg: "^#来(\\d+)?张推荐图$",
+ fnc: "illustRecommended"
},
{
- reg: '^#?(P|p)ximg(pro)?$',
- fnc: 'pximg'
+ reg: "^#?(P|p)ximg(pro)?$",
+ fnc: "pximg"
},
{
- reg: '^#(p站|pixiv)(查看|更换)代理',
- fnc: 'setProxy',
- permission: 'master'
+ reg: "^#(p站|pixiv)(查看|更换)代理",
+ fnc: "setProxy",
+ permission: "master"
},
{
- reg: '^#(p站|pixiv)(开启|关闭)直连$',
- fnc: 'directConnection',
- permission: 'master'
+ reg: "^#(p站|pixiv)(开启|关闭)直连$",
+ fnc: "directConnection",
+ permission: "master"
},
{
- reg: '^#(p站|pixiv)登录信息$',
- fnc: 'loginInfo',
- permission: 'master'
+ reg: "^#(p站|pixiv)登录信息$",
+ fnc: "loginInfo",
+ permission: "master"
}
]
})
@@ -85,7 +85,7 @@ export class NewPixiv extends plugin {
// pid搜图
async searchPid (e) {
- if (!await this._Authentication(e, 'sese')) return
+ if (!await this._Authentication(e, "sese")) return
e.reply(Pixiv.startMsg)
let regRet = pidReg.exec(e.msg)
let filter = !e.isMaster && !setu.getR18(e.group_id)
@@ -100,7 +100,7 @@ export class NewPixiv extends plugin {
// p站排行榜
async pixivRank (e) {
let regRet = rankingrReg.exec(e.msg)
- if (!await this._Authentication(e, 'sese')) return
+ if (!await this._Authentication(e, "sese")) return
if ((regRet[4] && !setu.getR18(e.group_id)) && !e.isMaster) {
return e.reply(SWITCH_ERROR)
}
@@ -119,13 +119,13 @@ export class NewPixiv extends plugin {
*/
async searchTags (e) {
let regRet = tagReg.exec(e.msg)
- if (!await this._Authentication(e, 'sese')) return
- if (regRet[1] && !await this._Authentication(e, 'sesepro')) return
+ if (!await this._Authentication(e, "sese")) return
+ if (regRet[1] && !await this._Authentication(e, "sesepro")) return
e.reply(Pixiv.startMsg)
let page = translateChinaNum(regRet[4])
- await Pixiv[`${regRet[1] ? 's' : 'vilipixS'}earchTags`](regRet[2], page, !setu.getR18(e.group_id))
+ await Pixiv[`${regRet[1] ? "s" : "vilipixS"}earchTags`](regRet[2], page, !setu.getR18(e.group_id))
.then(res => common.recallSendForwardMsg(e, res))
.catch(err => common.handleException(e, err))
}
@@ -135,7 +135,7 @@ export class NewPixiv extends plugin {
* @param e
*/
async popularTags (e) {
- if (!await this._Authentication(e, 'sese')) return
+ if (!await this._Authentication(e, "sese")) return
e.reply(Pixiv.startMsg)
await Pixiv.PopularTags()
.then(res => common.recallSendForwardMsg(e, res))
@@ -147,7 +147,7 @@ export class NewPixiv extends plugin {
* @param e
*/
async searchUid (e) {
- if (!await this._Authentication(e, 'sese')) return
+ if (!await this._Authentication(e, "sese")) return
e.reply(Pixiv.startMsg)
@@ -161,13 +161,13 @@ export class NewPixiv extends plugin {
// 随机原创插画
async vilipixRandomImg (e) {
- if (!await this._Authentication(e, 'sese')) return
+ if (!await this._Authentication(e, "sese")) return
e.reply(Pixiv.startMsg)
let regRet = randomImgReg.exec(e.msg)
let num = regRet[1] || 1
if (num > 50) {
- e.reply('你要的太多辣,奴家只给你一张辣(•́へ•́ ╬)')
+ e.reply("你要的太多辣,奴家只给你一张辣(•́へ•́ ╬)")
num = 1
}
num = translateChinaNum(num)
@@ -178,7 +178,7 @@ export class NewPixiv extends plugin {
// 相关作品
async relatedIllust (e) {
- if (!await this._Authentication(e, 'sese')) return
+ if (!await this._Authentication(e, "sese")) return
e.reply(Pixiv.startMsg)
@@ -191,8 +191,8 @@ export class NewPixiv extends plugin {
// p站单图
async pximg (e) {
let ispro = /pro/.test(e.msg)
- if (!await this._Authentication(e, 'sese')) return
- if (ispro && !await this._Authentication(e, 'sesepro', false)) return
+ if (!await this._Authentication(e, "sese")) return
+ if (ispro && !await this._Authentication(e, "sesepro", false)) return
await Pixiv.pximg(ispro)
.then(res => ispro ? common.recallSendForwardMsg(e, [res]) : common.recallsendMsg(e, res, false))
@@ -204,7 +204,7 @@ export class NewPixiv extends plugin {
* @param e
*/
async searchUser (e) {
- if (!await this._Authentication(e, 'sese')) return
+ if (!await this._Authentication(e, "sese")) return
e.reply(Pixiv.startMsg)
let regRet = e.msg.match(searchUser)
@@ -219,7 +219,7 @@ export class NewPixiv extends plugin {
* @param e
*/
async illustRecommended (e) {
- if (!await this._Authentication(e, 'sese')) return
+ if (!await this._Authentication(e, "sese")) return
e.reply(Pixiv.startMsg)
let num = e.msg.match(/\d+/) || 1
await Pixiv.illustRecommended(num).then(res => res.length == 1
@@ -230,16 +230,16 @@ export class NewPixiv extends plugin {
// 更换代理
async setProxy (e) {
- if (/查看/.test(e.msg)) return e.reply(await redis.get('yenai:proxy'))
- let proxy = e.msg.replace(/#|(p站|pixiv)更换代理/g, '').trim()
+ if (/查看/.test(e.msg)) return e.reply(await redis.get("yenai:proxy"))
+ let proxy = e.msg.replace(/#|(p站|pixiv)更换代理/g, "").trim()
if (new RegExp(`^[1-${ImageRPSS.length}]$`).test(proxy)) {
proxy = ImageRPSS[proxy - 1]
}
if (!/([\w\d]+\.){2}[\w\d]+/.test(proxy)) {
- return e.reply('请检查代理地址是否正确')
+ return e.reply("请检查代理地址是否正确")
}
logger.mark(`${e.logFnc}切换为${proxy}`)
- Config.modify('pixiv', 'pixivImageProxy', proxy)
+ Config.modify("pixiv", "pixivImageProxy", proxy)
new Admin().SeSe_Settings(e)
}
@@ -249,7 +249,7 @@ export class NewPixiv extends plugin {
*/
async directConnection (e) {
let isSwitch = /开启/.test(e.msg)
- Config.modify('pixiv', 'pixivDirectConnection', isSwitch)
+ Config.modify("pixiv", "pixivDirectConnection", isSwitch)
new Admin().SeSe_Settings(e)
}
@@ -263,15 +263,15 @@ export class NewPixiv extends plugin {
.catch(err => common.handleException(e, err))
}
- async _Authentication (e, type = 'sese', limit = true) {
+ async _Authentication (e, type = "sese", limit = true) {
if (e.isMaster) return true
if (!Config.pixiv.allowPM && !e.isGroup) {
- e.reply('主人已禁用私聊该功能')
+ e.reply("主人已禁用私聊该功能")
return false
}
if (!common.checkSeSePermission(e, type)) return false
- if (limit && !await common.limit(e.user_id, 'pixiv', Config.pixiv.limit)) {
- e.reply('您已达今日「Pixiv」次数上限', true, { at: true })
+ if (limit && !await common.limit(e.user_id, "pixiv", Config.pixiv.limit)) {
+ e.reply("您已达今日「Pixiv」次数上限", true, { at: true })
return false
}
return true
diff --git a/apps/search.js b/apps/search.js
index f236eda..afab6a2 100644
--- a/apps/search.js
+++ b/apps/search.js
@@ -1,32 +1,32 @@
-import plugin from '../../../lib/plugins/plugin.js'
-import _ from 'lodash'
-import { puppeteer, funApi } from '../model/index.js'
-import { SEARCH_MAP } from '../constants/search.js'
-import common from '../lib/common/common.js'
-const searchReg = new RegExp(`^#?(${_.keys(SEARCH_MAP).join('|')})搜索(.*)`)
+import plugin from "../../../lib/plugins/plugin.js"
+import _ from "lodash"
+import { puppeteer, funApi } from "../model/index.js"
+import { SEARCH_MAP } from "../constants/search.js"
+import common from "../lib/common/common.js"
+const searchReg = new RegExp(`^#?(${_.keys(SEARCH_MAP).join("|")})搜索(.*)`)
export class NewSearch extends plugin {
constructor () {
super({
- name: '椰奶搜索',
- event: 'message',
+ name: "椰奶搜索",
+ event: "message",
priority: 500,
rule: [
{
reg: searchReg,
- fnc: 'search'
+ fnc: "search"
},
{
- reg: '^#?搜索菜单$',
- fnc: 'help'
+ reg: "^#?搜索菜单$",
+ fnc: "help"
},
{
- reg: '^#桌游搜索',
- fnc: 'bggSearch'
+ reg: "^#桌游搜索",
+ fnc: "bggSearch"
},
{
- reg: '^#桌游排行$',
- fnc: 'bggRank'
+ reg: "^#桌游排行$",
+ fnc: "bggRank"
}
]
@@ -35,27 +35,27 @@ export class NewSearch extends plugin {
async help (e) {
const searchs = Object.keys(SEARCH_MAP)
- const menu = '当前支持的搜索引擎:\n'
- const tip = '\n格式:<搜索引擎> + 搜索 + <关键词>\n比如:萌娘百科搜索可莉'
- return e.reply(menu + searchs.join('、') + tip)
+ const menu = "当前支持的搜索引擎:\n"
+ const tip = "\n格式:<搜索引擎> + 搜索 + <关键词>\n比如:萌娘百科搜索可莉"
+ return e.reply(menu + searchs.join("、") + tip)
}
async search (e) {
let regRet = searchReg.exec(e.msg)
- if (/(lp|ip)|(i|p|l)(地址|查询)/ig.test(regRet[2])) return e.reply('(;`O´)o警告!!触发屏蔽词!!!', true)
+ if (/(lp|ip)|(i|p|l)(地址|查询)/ig.test(regRet[2])) return e.reply("(;`O´)o警告!!触发屏蔽词!!!", true)
let url = SEARCH_MAP[regRet[1]] + encodeURIComponent(regRet[2])
e.reply([await puppeteer.Webpage({ url }), url])
}
async bggSearch (e) {
- let keyword = e.msg.replace(/#?桌游搜索/, '')
+ let keyword = e.msg.replace(/#?桌游搜索/, "")
funApi.bgg(keyword)
.then(res => e.reply(res))
.catch(err => common.handleException(e, err))
}
async bggRank (e) {
- let url = 'https://boardgamegeek.com/browse/boardgame'
- e.reply([await puppeteer.Webpage({ url }), '目前BGG桌游排行榜如图,访问链接:' + url])
+ let url = "https://boardgamegeek.com/browse/boardgame"
+ e.reply([await puppeteer.Webpage({ url }), "目前BGG桌游排行榜如图,访问链接:" + url])
}
}
diff --git a/apps/setu.js b/apps/setu.js
index 8aa655b..1c28365 100644
--- a/apps/setu.js
+++ b/apps/setu.js
@@ -1,41 +1,41 @@
-import plugin from '../../../lib/plugins/plugin.js'
-import { Config } from '../components/index.js'
-import { setu, common } from '../model/index.js'
-import { Admin } from './admin.js'
-import translateChinaNum from '../tools/translateChinaNum.js'
+import plugin from "../../../lib/plugins/plugin.js"
+import { Config } from "../components/index.js"
+import { setu, common } from "../model/index.js"
+import { Admin } from "./admin.js"
+import translateChinaNum from "../tools/translateChinaNum.js"
-const NumReg = '[零一壹二两三四五六七八九十百千万亿\\d]+'
+const NumReg = "[零一壹二两三四五六七八九十百千万亿\\d]+"
export class SeSe extends plugin {
constructor () {
super({
- name: '椰奶setu',
- event: 'message',
+ name: "椰奶setu",
+ event: "message",
priority: 500,
rule: [
{
- reg: '^#椰奶tag(.*)$',
- fnc: 'setuTag'
+ reg: "^#椰奶tag(.*)$",
+ fnc: "setuTag"
},
{
reg: `^#(setu|无内鬼)\\s?((${NumReg})张)?$`, // 无内鬼
- fnc: 'setuRandom'
+ fnc: "setuRandom"
},
{
reg: `^#(撤回间隔|群(c|C)(d|D))(${NumReg})(s|秒)?$`,
- fnc: 'setGroupRecallAndCD',
- event: 'message.group',
- permission: 'master'
+ fnc: "setGroupRecallAndCD",
+ event: "message.group",
+ permission: "master"
},
{
- reg: '^#(开启|关闭)(私聊)?涩涩$',
- fnc: 'setSeSe',
- permission: 'master'
+ reg: "^#(开启|关闭)(私聊)?涩涩$",
+ fnc: "setSeSe",
+ permission: "master"
},
{
reg: `^#?设置cd\\s?((\\d+)\\s)?(${NumReg})(s|秒)?$`, // 设置cd
- fnc: 'setCd',
- permission: 'master'
+ fnc: "setCd",
+ permission: "master"
}
]
})
@@ -51,9 +51,9 @@ export class SeSe extends plugin {
let num = e.msg.match(new RegExp(NumReg))
num = num ? translateChinaNum(num[0]) : 1
if (num > 20) {
- return e.reply('❎ 最大张数不能大于20张')
+ return e.reply("❎ 最大张数不能大于20张")
} else if (num > 6) {
- e.reply('你先等等,你冲的有点多~')
+ e.reply("你先等等,你冲的有点多~")
}
// 开始执行
@@ -71,26 +71,26 @@ export class SeSe extends plugin {
let cdTime = setu.getRemainingCd(e.user_id, e.group_id)
if (cdTime) return e.reply(` ${setu.CDMsg}你的CD还有${cdTime}`, false, { at: true })
- let tag = e.msg.replace(/#|椰奶tag/g, '').trim()
+ let tag = e.msg.replace(/#|椰奶tag/g, "").trim()
let num = e.msg.match(new RegExp(`(${NumReg})张`))
if (!num) {
num = 1
} else {
- tag = tag.replace(num[0], '').trim()
+ tag = tag.replace(num[0], "").trim()
num = translateChinaNum(num[1])
}
if (num > 20) {
- return e.reply('❎ 最大张数不能大于20张')
+ return e.reply("❎ 最大张数不能大于20张")
} else if (num > 6) {
- e.reply('你先等等,你冲的有点多~')
+ e.reply("你先等等,你冲的有点多~")
} else {
e.reply(setu.startMsg)
}
- if (!tag) return e.reply('tag为空!!!', false, { at: true })
- tag = tag.split(' ')?.map(item => item.split('|'))
- if (tag.length > 3) return e.reply('tag最多只能指定三个哦~', false, { at: true })
+ if (!tag) return e.reply("tag为空!!!", false, { at: true })
+ tag = tag.split(" ")?.map(item => item.split("|"))
+ if (tag.length > 3) return e.reply("tag最多只能指定三个哦~", false, { at: true })
await setu.setuApi(setu.getR18(e.group_id), num, tag)
.then(res => setu.sendMsgOrSetCd(e, res))
@@ -101,12 +101,12 @@ export class SeSe extends plugin {
if (e.isMaster) return true
const { allowPM, limit } = Config.setu
if (!allowPM && !e.isGroup) {
- e.reply('主人已禁用私聊该功能')
+ e.reply("主人已禁用私聊该功能")
return false
}
- if (!common.checkSeSePermission(e, 'sesepro')) return false
- if (!await common.limit(e.user_id, 'setu', limit)) {
- e.reply('您已达今日「setu」次数上限', true, { at: true })
+ if (!common.checkSeSePermission(e, "sesepro")) return false
+ if (!await common.limit(e.user_id, "setu", limit)) {
+ e.reply("您已达今日「setu」次数上限", true, { at: true })
return false
}
return true
@@ -132,10 +132,10 @@ export class SeSe extends plugin {
async setCd (e) {
let reg = `^#?设置cd\\s?((\\d+)\\s)?(${NumReg})(s|秒)?$`
let regRet = e.msg.match(new RegExp(reg))
- let qq = e.message.find(item => item.type == 'at')?.qq ?? regRet[2]
+ let qq = e.message.find(item => item.type == "at")?.qq ?? regRet[2]
let cd = translateChinaNum(regRet[3])
- if (!qq) return e.reply('❎ 请输入要设置QQ', true)
- if (!cd) return e.reply('❎ CD为空,请检查', true)
+ if (!qq) return e.reply("❎ 请输入要设置QQ", true)
+ if (!cd) return e.reply("❎ CD为空,请检查", true)
setu.setUserCd(e, qq ?? regRet[2], cd)
}
}
diff --git a/apps/state.js b/apps/state.js
index 9e47db5..80682d8 100644
--- a/apps/state.js
+++ b/apps/state.js
@@ -1,23 +1,23 @@
-import plugin from '../../../lib/plugins/plugin.js'
-import { Config } from '../components/index.js'
-import { puppeteer } from '../model/index.js'
-import { getData, si } from '../model/State/index.js'
-import Monitor from '../model/State/Monitor.js'
+import plugin from "../../../lib/plugins/plugin.js"
+import { Config } from "../components/index.js"
+import { puppeteer } from "../model/index.js"
+import { getData, si } from "../model/State/index.js"
+import Monitor from "../model/State/Monitor.js"
let interval = false
export class NewState extends plugin {
constructor () {
super({
- name: '椰奶状态',
- event: 'message',
+ name: "椰奶状态",
+ event: "message",
priority: 50,
rule: [
{
- reg: '^#?(椰奶)?状态(pro)?$',
- fnc: 'state'
+ reg: "^#?(椰奶)?状态(pro)?$",
+ fnc: "state"
}, {
- reg: '^#椰奶监控$',
- fnc: 'monitor'
+ reg: "^#椰奶监控$",
+ fnc: "monitor"
}
]
@@ -25,7 +25,7 @@ export class NewState extends plugin {
}
async monitor (e) {
- await puppeteer.render('state/monitor', {
+ await puppeteer.render("state/monitor", {
chartData: JSON.stringify(Monitor.chartData)
}, {
e,
@@ -36,7 +36,7 @@ export class NewState extends plugin {
async state (e) {
if (!/椰奶/.test(e.msg) && !Config.whole.state) return false
- if (!si) return e.reply('❎ 没有检测到systeminformation依赖,请运行:"pnpm add systeminformation -w"进行安装')
+ if (!si) return e.reply("❎ 没有检测到systeminformation依赖,请运行:\"pnpm add systeminformation -w\"进行安装")
// 防止多次触发
if (interval) { return false } else interval = true
@@ -45,7 +45,7 @@ export class NewState extends plugin {
let data = await getData(e)
// 渲染图片
- await puppeteer.render('state/state', {
+ await puppeteer.render("state/state", {
...data
}, {
e,
diff --git a/apps/update.js b/apps/update.js
index 57b12e4..11e3284 100644
--- a/apps/update.js
+++ b/apps/update.js
@@ -1,21 +1,21 @@
-import { update as Update } from '../../other/update.js'
+import { update as Update } from "../../other/update.js"
export class YenaiUpdate extends plugin {
constructor () {
super({
- name: '椰奶更新插件',
- event: 'message',
+ name: "椰奶更新插件",
+ event: "message",
priority: 1000,
rule: [
{
- reg: '^#*椰奶(插件)?(强制)?更新$',
- fnc: 'update'
+ reg: "^#*椰奶(插件)?(强制)?更新$",
+ fnc: "update"
}
]
})
}
async update (e = this.e) {
- e.msg = `#${e.msg.includes('强制') ? '强制' : ''}更新yenai-plugin`
+ e.msg = `#${e.msg.includes("强制") ? "强制" : ""}更新yenai-plugin`
const up = new Update(e)
up.e = e
return up.update()
diff --git a/apps/version.js b/apps/version.js
index f344a77..3541d9c 100644
--- a/apps/version.js
+++ b/apps/version.js
@@ -1,25 +1,25 @@
-import plugin from '../../../lib/plugins/plugin.js'
-import { update } from '../../other/update.js'
-import { Version, Plugin_Name } from '../components/index.js'
-import { puppeteer } from '../model/index.js'
+import plugin from "../../../lib/plugins/plugin.js"
+import { update } from "../../other/update.js"
+import { Version, Plugin_Name } from "../components/index.js"
+import { puppeteer } from "../model/index.js"
export class NewVersion extends plugin {
constructor () {
super({
- name: '椰奶版本信息',
- event: 'message',
+ name: "椰奶版本信息",
+ event: "message",
priority: 400,
rule: [
{
- reg: '^#?椰奶(插件)?版本$',
- fnc: 'plugin_version'
+ reg: "^#?椰奶(插件)?版本$",
+ fnc: "plugin_version"
},
{
- reg: '^#?椰奶(插件)?更新日志$',
- fnc: 'update_log'
+ reg: "^#?椰奶(插件)?更新日志$",
+ fnc: "update_log"
}
]
})
- this.key = 'yenai:restart'
+ this.key = "yenai:restart"
}
async plugin_version () {
@@ -45,11 +45,11 @@ export class NewVersion extends plugin {
*/
async function versionInfo (e) {
return await puppeteer.render(
- 'help/version-info',
+ "help/version-info",
{
currentVersion: Version.ver,
changelogs: Version.logs,
- elem: 'cryo'
+ elem: "cryo"
},
{ e, scale: 1.4 }
)
diff --git a/components/Config.js b/components/Config.js
index 45252b2..6f6f28f 100644
--- a/components/Config.js
+++ b/components/Config.js
@@ -1,14 +1,14 @@
-import YAML from 'yaml'
-import chokidar from 'chokidar'
-import fs from 'node:fs'
-import YamlReader from './YamlReader.js'
-import cfg from '../../../lib/config/config.js'
-import loader from '../../../lib/plugins/loader.js'
-import _ from 'lodash'
-import moment from 'moment'
+import YAML from "yaml"
+import chokidar from "chokidar"
+import fs from "node:fs"
+import YamlReader from "./YamlReader.js"
+import cfg from "../../../lib/config/config.js"
+import loader from "../../../lib/plugins/loader.js"
+import _ from "lodash"
+import moment from "moment"
const Path = process.cwd()
-const Plugin_Name = 'yenai-plugin'
+const Plugin_Name = "yenai-plugin"
const Plugin_Path = `${Path}/plugins/${Plugin_Name}`
class Config {
constructor () {
@@ -24,12 +24,12 @@ class Config {
initCfg () {
let path = `${Plugin_Path}/config/config/`
let pathDef = `${Plugin_Path}/config/default_config/`
- const files = fs.readdirSync(pathDef).filter(file => file.endsWith('.yaml'))
+ const files = fs.readdirSync(pathDef).filter(file => file.endsWith(".yaml"))
for (let file of files) {
if (!fs.existsSync(`${path}${file}`)) {
fs.copyFileSync(`${pathDef}${file}`, `${path}${file}`)
}
- this.watch(`${path}${file}`, file.replace('.yaml', ''), 'config')
+ this.watch(`${path}${file}`, file.replace(".yaml", ""), "config")
}
}
@@ -37,10 +37,10 @@ class Config {
* 群配置
* @param groupId
*/
- getGroup (groupId = '') {
- let config = this.getConfig('whole')
- let group = this.getConfig('group')
- let defCfg = this.getdefSet('whole')
+ getGroup (groupId = "") {
+ let config = this.getConfig("whole")
+ let group = this.getConfig("group")
+ let defCfg = this.getdefSet("whole")
if (group[groupId]) {
return { ...defCfg, ...config, ...group[groupId] }
@@ -55,56 +55,56 @@ class Config {
/** 获取全局设置 */
get whole () {
- return this.getDefOrConfig('whole')
+ return this.getDefOrConfig("whole")
}
/** 进群验证配置 */
get groupverify () {
- return this.getDefOrConfig('groupverify')
+ return this.getDefOrConfig("groupverify")
}
/** 头衔屏蔽词 */
get groupTitle () {
- return this.getDefOrConfig('groupTitle')
+ return this.getDefOrConfig("groupTitle")
}
/** 加群通知 */
get groupAdd () {
- return this.getDefOrConfig('groupAdd')
+ return this.getDefOrConfig("groupAdd")
}
/** 代理 */
get proxy () {
- return this.getDefOrConfig('proxy')
+ return this.getDefOrConfig("proxy")
}
/** pixiv */
get pixiv () {
- return this.getDefOrConfig('pixiv')
+ return this.getDefOrConfig("pixiv")
}
/** 哔咔 */
get bika () {
- return this.getDefOrConfig('bika')
+ return this.getDefOrConfig("bika")
}
/** 搜图 */
get picSearch () {
- return this.getDefOrConfig('picSearch')
+ return this.getDefOrConfig("picSearch")
}
/** setu */
get setu () {
- return this.getDefOrConfig('setu')
+ return this.getDefOrConfig("setu")
}
/** 状态 */
get state () {
- return this.getDefOrConfig('state')
+ return this.getDefOrConfig("state")
}
get groupAdmin () {
- return this.getDefOrConfig('groupAdmin')
+ return this.getDefOrConfig("groupAdmin")
}
/**
@@ -122,7 +122,7 @@ class Config {
* @param name
*/
getdefSet (name) {
- return this.getYaml('default_config', name)
+ return this.getYaml("default_config", name)
}
/**
@@ -130,7 +130,7 @@ class Config {
* @param name
*/
getConfig (name) {
- return this.getYaml('config', name)
+ return this.getYaml("config", name)
}
/**
@@ -145,7 +145,7 @@ class Config {
if (this.config[key]) return this.config[key]
this.config[key] = YAML.parse(
- fs.readFileSync(file, 'utf8')
+ fs.readFileSync(file, "utf8")
)
this.watch(file, name, type)
@@ -159,15 +159,15 @@ class Config {
* @param name
* @param type
*/
- watch (file, name, type = 'default_config') {
+ watch (file, name, type = "default_config") {
let key = `${type}.${name}`
if (this.watcher[key]) return
const watcher = chokidar.watch(file)
- watcher.on('change', path => {
+ watcher.on("change", path => {
delete this.config[key]
- if (typeof Bot == 'undefined') return
+ if (typeof Bot == "undefined") return
logger.mark(`[Yenai-Plugin][修改配置文件][${type}][${name}]`)
if (this[`change_${name}`]) {
this[`change_${name}`]()
@@ -184,7 +184,7 @@ class Config {
* @param {string | number} value 修改的value值
* @param {'config'|'default_config'} type 配置文件或默认
*/
- modify (name, key, value, type = 'config') {
+ modify (name, key, value, type = "config") {
let path = `${Plugin_Path}/config/${type}/${name}.yaml`
new YamlReader(path).set(key, value)
delete this.config[`${type}.${name}`]
@@ -203,7 +203,7 @@ class Config {
let groupCfg = yaml.jsonData[groupId] ?? {}
isDel ? delete groupCfg[key] : groupCfg[key] = value
yaml.set(groupId, groupCfg)
- delete this.config['config.group']
+ delete this.config["config.group"]
}
/**
@@ -214,10 +214,10 @@ class Config {
* @param {'add'|'del'} category 类别 add or del
* @param {'config'|'default_config'} type 配置文件或默认
*/
- modifyarr (name, key, value, category = 'add', type = 'config') {
+ modifyarr (name, key, value, category = "add", type = "config") {
let path = `${Plugin_Path}/config/${type}/${name}.yaml`
let yaml = new YamlReader(path)
- if (category == 'add') {
+ if (category == "add") {
yaml.addIn(key, value)
} else {
let index = yaml.jsonData[key].indexOf(value)
@@ -228,14 +228,14 @@ class Config {
async change_picApi () {
let tmp = {}
- logger.debug('[Yenai-Plugin]api接口修改,重载fun.js')
- tmp = await import(`../apps/fun.js?${moment().format('x')}`)
+ logger.debug("[Yenai-Plugin]api接口修改,重载fun.js")
+ tmp = await import(`../apps/fun.js?${moment().format("x")}`)
_.forEach(tmp, (p) => {
/* eslint-disable new-cap */
let plugin = new p()
for (let i in loader.priority) {
- if (loader.priority[i].key == Plugin_Name && loader.priority[i].name == '椰奶娱乐') {
+ if (loader.priority[i].key == Plugin_Name && loader.priority[i].name == "椰奶娱乐") {
loader.priority[i].class = p
loader.priority[i].priority = plugin.priority
}
@@ -244,8 +244,8 @@ class Config {
}
async change_pixiv () {
- let pixiv = (await import('../model/index.js')).Pixiv
- let PixivApi = (await import('../model/Pixiv/api.js')).default
+ let pixiv = (await import("../model/index.js")).Pixiv
+ let PixivApi = (await import("../model/Pixiv/api.js")).default
pixiv.PixivClient = new PixivApi(this.pixiv.refresh_token)
}
}
diff --git a/components/Data.js b/components/Data.js
index a337221..97c9367 100644
--- a/components/Data.js
+++ b/components/Data.js
@@ -1,11 +1,11 @@
-import _ from 'lodash'
-import fs from 'fs'
-import path from 'path'
+import _ from "lodash"
+import fs from "fs"
+import path from "path"
const _path = process.cwd()
-const plugin = 'yenai-plugin'
-const getRoot = (root = '') => {
- if (root === 'root' || root === 'yunzai') {
+const plugin = "yenai-plugin"
+const getRoot = (root = "") => {
+ if (root === "root" || root === "yunzai") {
root = `${_path}/`
} else if (!root) {
root = `${_path}/plugins/${plugin}/`
@@ -18,14 +18,14 @@ let Data = {
/*
* 根据指定的path依次检查与创建目录
* */
- createDir (path = '', root = '', includeFile = false) {
+ createDir (path = "", root = "", includeFile = false) {
root = getRoot(root)
- let pathList = path.split('/')
+ let pathList = path.split("/")
let nowPath = root
pathList.forEach((name, idx) => {
name = name.trim()
if (!includeFile && idx <= pathList.length - 1) {
- nowPath += name + '/'
+ nowPath += name + "/"
if (name) {
if (!fs.existsSync(nowPath)) {
fs.mkdirSync(nowPath)
@@ -40,11 +40,11 @@ let Data = {
* @param file
* @param root
*/
- readJSON (file = '', root = '') {
+ readJSON (file = "", root = "") {
root = getRoot(root)
if (fs.existsSync(`${root}/${file}`)) {
try {
- return JSON.parse(fs.readFileSync(`${root}/${file}`, 'utf8'))
+ return JSON.parse(fs.readFileSync(`${root}/${file}`, "utf8"))
} catch (e) {
console.log(e)
}
@@ -59,7 +59,7 @@ let Data = {
* @param root
* @param space
*/
- writeJSON (file, data, root = '', space = '\t') {
+ writeJSON (file, data, root = "", space = "\t") {
// 检查并创建目录
Data.createDir(file, root, true)
root = getRoot(root)
@@ -89,10 +89,10 @@ let Data = {
await redis.set(key, JSON.stringify(data), { EX })
},
- async importModule (file, root = '') {
+ async importModule (file, root = "") {
root = getRoot(root)
if (!/\.js$/.test(file)) {
- file = file + '.js'
+ file = file + ".js"
}
if (fs.existsSync(`${root}/${file}`)) {
try {
@@ -139,18 +139,18 @@ let Data = {
*
* */
- getData (target, keyList = '', cfg = {}) {
+ getData (target, keyList = "", cfg = {}) {
target = target || {}
let defaultData = cfg.defaultData || {}
let ret = {}
// 分割逗号
- if (typeof (keyList) === 'string') {
- keyList = keyList.split(',')
+ if (typeof (keyList) === "string") {
+ keyList = keyList.split(",")
}
_.forEach(keyList, (keyCfg) => {
// 处理通过:指定 toKey & fromKey
- let _keyCfg = keyCfg.split(':')
+ let _keyCfg = keyCfg.split(":")
let keyTo = _keyCfg[0].trim()
let keyFrom = (_keyCfg[1] || _keyCfg[0]).trim()
let keyRet = keyTo
@@ -211,8 +211,8 @@ let Data = {
// 循环字符串回调
eachStr: (arr, fn) => {
if (_.isString(arr)) {
- arr = arr.replace(/\s*(;|;|、|,)\s*/, ',')
- arr = arr.split(',')
+ arr = arr.replace(/\s*(;|;|、|,)\s*/, ",")
+ arr = arr.split(",")
} else if (_.isNumber(arr)) {
arr = [arr.toString()]
}
diff --git a/components/Version.js b/components/Version.js
index 97d70f7..b4363ef 100644
--- a/components/Version.js
+++ b/components/Version.js
@@ -1,6 +1,6 @@
-import fs from 'fs'
-import _ from 'lodash'
-import cfg from '../../../lib/config/config.js'
+import fs from "fs"
+import _ from "lodash"
+import cfg from "../../../lib/config/config.js"
const Plugin_Path = `${process.cwd()}/plugins/yenai-plugin`
const README_path = `${Plugin_Path}/README.md`
const CHANGELOG_path = `${Plugin_Path}/CHANGELOG.md`
@@ -12,19 +12,19 @@ let currentVersion
let versionCount = 2
const getLine = function (line) {
- line = line.replace(/(^\s*\*|\r)/g, '')
- line = line.replace(/\s*`([^`]+`)/g, '$1')
- line = line.replace(/`\s*/g, '')
- line = line.replace(/\s*\*\*([^*]+\*\*)/g, '$1')
- line = line.replace(/\*\*\s*/g, '')
- line = line.replace(/ⁿᵉʷ/g, '')
+ line = line.replace(/(^\s*\*|\r)/g, "")
+ line = line.replace(/\s*`([^`]+`)/g, "$1")
+ line = line.replace(/`\s*/g, "")
+ line = line.replace(/\s*\*\*([^*]+\*\*)/g, "$1")
+ line = line.replace(/\*\*\s*/g, "")
+ line = line.replace(/ⁿᵉʷ/g, "")
return line
}
try {
if (fs.existsSync(CHANGELOG_path)) {
- logs = fs.readFileSync(CHANGELOG_path, 'utf8') || ''
- logs = logs.replace(/\t/g, ' ').split('\n')
+ logs = fs.readFileSync(CHANGELOG_path, "utf8") || ""
+ logs = logs.replace(/\t/g, " ").split("\n")
let temp = {}
let lastLine = {}
_.forEach(logs, (line) => {
@@ -78,7 +78,7 @@ try {
try {
if (fs.existsSync(README_path)) {
- let README = fs.readFileSync(README_path, 'utf8') || ''
+ let README = fs.readFileSync(README_path, "utf8") || ""
let reg = /版本:(.*)/.exec(README)
if (reg) {
currentVersion = reg[1]
@@ -87,12 +87,12 @@ try {
} catch (err) { }
let yunzaiName = cfg.package.name
-if (yunzaiName == 'miao-yunzai') {
- yunzaiName = 'Miao-Yunzai'
-} else if (yunzaiName == 'yunzai') {
- yunzaiName = 'Yunzai-Bot'
-} else if (yunzaiName == 'trss-yunzai') {
- yunzaiName = 'TRSS-Yunzai'
+if (yunzaiName == "miao-yunzai") {
+ yunzaiName = "Miao-Yunzai"
+} else if (yunzaiName == "yunzai") {
+ yunzaiName = "Yunzai-Bot"
+} else if (yunzaiName == "trss-yunzai") {
+ yunzaiName = "TRSS-Yunzai"
} else {
yunzaiName = _.capitalize(yunzaiName)
}
diff --git a/components/YamlReader.js b/components/YamlReader.js
index 3cfb057..4433ec9 100644
--- a/components/YamlReader.js
+++ b/components/YamlReader.js
@@ -1,7 +1,7 @@
-import fs from 'fs'
-import YAML from 'yaml'
-import _ from 'lodash'
-import chokidar from 'chokidar'
+import fs from "fs"
+import YAML from "yaml"
+import _ from "lodash"
+import chokidar from "chokidar"
// import Constant from '../server/constant/Constant.js'
export default class YamlReader {
@@ -18,9 +18,9 @@ export default class YamlReader {
initYaml () {
// parseDocument 将会保留注释
- this.document = YAML.parseDocument(fs.readFileSync(this.yamlPath, 'utf8'))
+ this.document = YAML.parseDocument(fs.readFileSync(this.yamlPath, "utf8"))
if (this.isWatch && !this.watcher) {
- this.watcher = chokidar.watch(this.yamlPath).on('change', () => {
+ this.watcher = chokidar.watch(this.yamlPath).on("change", () => {
if (this.isSave) {
this.isSave = false
return
@@ -40,7 +40,7 @@ export default class YamlReader {
/* 检查集合是否包含key的值 */
has (keyPath) {
- return this.document.hasIn(keyPath.split('.'))
+ return this.document.hasIn(keyPath.split("."))
}
/* 返回key的值 */
@@ -56,19 +56,19 @@ export default class YamlReader {
/* 删除key */
delete (keyPath) {
- this.document.deleteIn(keyPath.split('.'))
+ this.document.deleteIn(keyPath.split("."))
this.save()
}
// 数组添加数据
addIn (keyPath, value) {
- this.document.addIn(keyPath.split('.'), value)
+ this.document.addIn(keyPath.split("."), value)
this.save()
}
// 彻底删除某个key
deleteKey (keyPath) {
- let keys = keyPath.split('.')
+ let keys = keyPath.split(".")
keys = this.mapParentKeys(keys)
this.document.deleteIn(keys)
this.save()
@@ -77,6 +77,6 @@ export default class YamlReader {
save () {
this.isSave = true
let yaml = this.document.toString()
- fs.writeFileSync(this.yamlPath, yaml, 'utf8')
+ fs.writeFileSync(this.yamlPath, yaml, "utf8")
}
}
diff --git a/components/index.js b/components/index.js
index ce2eae8..d93aab6 100644
--- a/components/index.js
+++ b/components/index.js
@@ -1,8 +1,8 @@
-import Version from './Version.js'
-import Data from './Data.js'
-import Config from './Config.js'
-import YamlReader from './YamlReader.js'
+import Version from "./Version.js"
+import Data from "./Data.js"
+import Config from "./Config.js"
+import YamlReader from "./YamlReader.js"
const Path = process.cwd()
-const Plugin_Name = 'yenai-plugin'
+const Plugin_Name = "yenai-plugin"
const Plugin_Path = `${Path}/plugins/${Plugin_Name}`
export { Config, Data, Version, Path, Plugin_Name, Plugin_Path, YamlReader }
diff --git a/config/system/gpAdmin_system.js b/config/system/gpAdmin_system.js
index 5b25c52..267cf06 100644
--- a/config/system/gpAdmin_system.js
+++ b/config/system/gpAdmin_system.js
@@ -6,310 +6,310 @@
* */
export const helpCfg = {
- title: '椰奶群管帮助',
- subTitle: 'Yunzai-Bot & Yenai-Plugin',
+ title: "椰奶群管帮助",
+ subTitle: "Yunzai-Bot & Yenai-Plugin",
columnCount: 3,
colWidth: 265,
- theme: 'all',
- themeExclude: ['default'],
+ theme: "all",
+ themeExclude: ["default"],
style: {
- fontColor: '#ceb78b',
- descColor: '#eee',
- contBgColor: 'rgba(6, 21, 31, .5)',
+ fontColor: "#ceb78b",
+ descColor: "#eee",
+ contBgColor: "rgba(6, 21, 31, .5)",
contBgBlur: 3,
- headerBgColor: 'rgba(6, 21, 31, .4)',
- rowBgColor1: 'rgba(6, 21, 31, .2)',
- rowBgColor2: 'rgba(6, 21, 31, .35)'
+ headerBgColor: "rgba(6, 21, 31, .4)",
+ rowBgColor1: "rgba(6, 21, 31, .2)",
+ rowBgColor2: "rgba(6, 21, 31, .35)"
}
}
export const helpList = [{
- group: '基础功能',
+ group: "基础功能",
list: [{
icon: 1,
- title: '#禁言 <@QQ> <时间>',
- desc: '=-='
+ title: "#禁言 <@QQ> <时间>",
+ desc: "=-="
},
{
icon: 2,
- title: '#解禁 <@QQ>',
- desc: '=-='
+ title: "#解禁 <@QQ>",
+ desc: "=-="
},
{
icon: 3,
- title: '#全体禁言|解禁',
- desc: '顾名思义'
+ title: "#全体禁言|解禁",
+ desc: "顾名思义"
},
{
icon: 16,
- title: '#发通知 <消息>',
- desc: '发送@全体的通知'
+ title: "#发通知 <消息>",
+ desc: "发送@全体的通知"
},
{
- title: '#踢 <@QQ>',
- desc: '顾名思义',
+ title: "#踢 <@QQ>",
+ desc: "顾名思义",
icon: 4
}, {
- title: '#发群公告 <文字>',
- desc: '发送简易公告',
+ title: "#发群公告 <文字>",
+ desc: "发送简易公告",
icon: 16
}, {
- title: '#查群公告$',
- desc: '查看现有公告',
+ title: "#查群公告$",
+ desc: "查看现有公告",
icon: 3
}, {
- title: '#删群公告 <序号>',
- desc: '用查看公告获取序号',
+ title: "#删群公告 <序号>",
+ desc: "用查看公告获取序号",
icon: 4
},
{
- title: '#获取禁言列表',
- desc: '查看本群被禁言的人',
+ title: "#获取禁言列表",
+ desc: "查看本群被禁言的人",
icon: 8
},
{
- title: '#解除全部禁言',
- desc: '解除本群全部被禁言的人',
+ title: "#解除全部禁言",
+ desc: "解除本群全部被禁言的人",
icon: 6
},
{
- title: '#查看n月没发言的人',
- desc: '查看多少天|周|月没发言的人',
+ title: "#查看n月没发言的人",
+ desc: "查看多少天|周|月没发言的人",
icon: 15
},
{
- title: '#清理n天没发言的人',
- desc: '清理多少天|周|月没发言的人',
+ title: "#清理n天没发言的人",
+ desc: "清理多少天|周|月没发言的人",
icon: 14
},
{
- title: '#查看从未发言的人',
- desc: '查看进群后从未发言的人',
+ title: "#查看从未发言的人",
+ desc: "查看进群后从未发言的人",
icon: 1
},
{
- title: '#清理从未发言的人',
- desc: '清理进群后从未发言的人',
+ title: "#清理从未发言的人",
+ desc: "清理进群后从未发言的人",
icon: 5
},
{
- title: '#查看不活跃排行榜',
- desc: '后面可以加数字',
+ title: "#查看不活跃排行榜",
+ desc: "后面可以加数字",
icon: 16
},
{
- title: '#查看最近入群情况',
- desc: '后面可以加数字',
+ title: "#查看最近入群情况",
+ desc: "后面可以加数字",
icon: 4
},
{
- title: '#查看加群申请',
- desc: '查看本群的加群申请',
+ title: "#查看加群申请",
+ desc: "查看本群的加群申请",
icon: 2
},
{
- title: '#同意|拒绝加群申请',
- desc: '处理本群的加群申请',
+ title: "#同意|拒绝加群申请",
+ desc: "处理本群的加群申请",
icon: 19
},
{
- title: '#同意|拒绝全部加群申请',
- desc: '处理本群的全部加群申请',
+ title: "#同意|拒绝全部加群申请",
+ desc: "处理本群的全部加群申请",
icon: 3
},
{
- title: '#我要自闭 <时间>',
- desc: '自闭一会',
+ title: "#我要自闭 <时间>",
+ desc: "自闭一会",
icon: 20
},
{
- title: '#加|移精',
- desc: '回复消息进行加/移精',
+ title: "#加|移精",
+ desc: "回复消息进行加/移精",
icon: 18
}
]
}, {
- group: '字符',
+ group: "字符",
list: [
{
- title: '#幸运字符列表',
- desc: '查看现有字符',
+ title: "#幸运字符列表",
+ desc: "查看现有字符",
icon: 16
},
{
- title: '#替换幸运字符+(id)',
- desc: '用列表获取id',
+ title: "#替换幸运字符+(id)",
+ desc: "用列表获取id",
icon: 3
},
{
- title: '#抽幸运字符',
- desc: 'bot抽取字符',
+ title: "#抽幸运字符",
+ desc: "bot抽取字符",
icon: 4
},
{
- title: '#开启|关闭幸运字符',
- desc: '=-=',
+ title: "#开启|关闭幸运字符",
+ desc: "=-=",
icon: 5
}
]
},
{
- group: '定时禁言',
+ group: "定时禁言",
list: [
{
- title: '#定时(禁言|解禁)00:00',
- desc: '设置定时可用cron表达式设置',
+ title: "#定时(禁言|解禁)00:00",
+ desc: "设置定时可用cron表达式设置",
icon: 12
}, {
- title: '#定时禁言任务',
- desc: '查看禁言任务',
+ title: "#定时禁言任务",
+ desc: "查看禁言任务",
icon: 10
}, {
- title: '#取消定时(禁言|解禁)',
- desc: '取消查看禁言任务',
+ title: "#取消定时(禁言|解禁)",
+ desc: "取消查看禁言任务",
icon: 3
}
]
},
{
- group: '群信息',
+ group: "群信息",
list: [
{
icon: 2,
- title: '#群星级',
- desc: '查看群星级'
+ title: "#群星级",
+ desc: "查看群星级"
},
{
- title: '#今天谁生日',
- desc: '今天可换为昨天或后天或日期',
+ title: "#今天谁生日",
+ desc: "今天可换为昨天或后天或日期",
icon: 12
}, {
- title: '#哪个叼毛是龙王',
- desc: '查看谁是龙王',
+ title: "#哪个叼毛是龙王",
+ desc: "查看谁是龙王",
icon: 6
}, {
- title: '#今日打卡',
- desc: '查看今日打卡',
+ title: "#今日打卡",
+ desc: "查看今日打卡",
icon: 5
}, {
- title: '#群数据(7天)?',
- desc: '活跃数据等',
+ title: "#群数据(7天)?",
+ desc: "活跃数据等",
icon: 7
}, {
- title: '#群发言榜单(7天)?',
- desc: '不加7天查看昨天的数据',
+ title: "#群发言榜单(7天)?",
+ desc: "不加7天查看昨天的数据",
icon: 16
}
]
},
{
- group: '其他',
+ group: "其他",
list: [
{
- title: '#开启|关闭加群通知',
- desc: '将加群申请发送至群',
+ title: "#开启|关闭加群通知",
+ desc: "将加群申请发送至群",
icon: 2
}, {
- title: '#群管(加|删)白 <@QQ>',
- desc: '白名单可以不被群管功能操作',
+ title: "#群管(加|删)白 <@QQ>",
+ desc: "白名单可以不被群管功能操作",
icon: 1
}, {
- title: '#开启|关闭白名单解禁',
- desc: '白名单被禁言时自动解禁',
+ title: "#开启|关闭白名单解禁",
+ desc: "白名单被禁言时自动解禁",
icon: 8
}]
},
{
- group: '进群验证(更多设置请在config/groupverify.yaml进行设置)',
+ group: "进群验证(更多设置请在config/groupverify.yaml进行设置)",
list: [
{
- title: '#开启验证',
- desc: '开启本群验证',
+ title: "#开启验证",
+ desc: "开启本群验证",
icon: 4
},
{
- title: '#关闭验证',
- desc: '关闭本群验证',
+ title: "#关闭验证",
+ desc: "关闭本群验证",
icon: 15
},
{
- title: '#重新验证 <@群员>',
- desc: '重新发起验证',
+ title: "#重新验证 <@群员>",
+ desc: "重新发起验证",
icon: 1
}, {
- title: '#绕过验证 <@群员>',
- desc: '绕过本次验证',
+ title: "#绕过验证 <@群员>",
+ desc: "绕过本次验证",
icon: 3
},
{
- title: '#切换验证模式',
- desc: '更换答案匹配模式',
+ title: "#切换验证模式",
+ desc: "更换答案匹配模式",
icon: 2
},
{
- title: '#设置验证超时时间+(s)',
- desc: '多少秒后踢出',
+ title: "#设置验证超时时间+(s)",
+ desc: "多少秒后踢出",
icon: 17
}]
}, {
- group: '违禁词',
+ group: "违禁词",
list: [
{
- title: '#新增违禁词.*',
- desc: '文档查看具体用法',
+ title: "#新增违禁词.*",
+ desc: "文档查看具体用法",
icon: 7
},
{
- title: '#删除违禁词.*',
- desc: '---',
+ title: "#删除违禁词.*",
+ desc: "---",
icon: 3
},
{
- title: '#查看违禁词.*',
- desc: '---',
+ title: "#查看违禁词.*",
+ desc: "---",
icon: 9
},
{
- title: '#违禁词列表',
- desc: '列表',
+ title: "#违禁词列表",
+ desc: "列表",
icon: 17
},
{
- title: '#设置违禁词禁言时间400',
- desc: '禁言时间',
+ title: "#设置违禁词禁言时间400",
+ desc: "禁言时间",
icon: 11
}]
}, {
- group: 'Bot为群主可用',
+ group: "Bot为群主可用",
list: [
{
- title: '#设置管理 <@QQ>',
- desc: '增加管理',
+ title: "#设置管理 <@QQ>",
+ desc: "增加管理",
icon: 8
},
{
- title: '#取消管理 <@QQ> ',
- desc: '=-=',
+ title: "#取消管理 <@QQ> ",
+ desc: "=-=",
icon: 9
},
{
- title: '#申请头衔 <头衔>',
- desc: '群员自己设置',
+ title: "#申请头衔 <头衔>",
+ desc: "群员自己设置",
icon: 19
},
{
- title: '#修改头衔 <@QQ> <头衔>',
- desc: '主人给别人设置',
+ title: "#修改头衔 <@QQ> <头衔>",
+ desc: "主人给别人设置",
icon: 10
},
{
- title: '#(增加|减少|查看)头衔屏蔽词',
- desc: '头衔屏蔽词',
+ title: "#(增加|减少|查看)头衔屏蔽词",
+ desc: "头衔屏蔽词",
icon: 2
},
{
- title: '#切换头衔屏蔽词匹配模式',
- desc: '模糊匹配和精确匹配',
+ title: "#切换头衔屏蔽词匹配模式",
+ desc: "模糊匹配和精确匹配",
icon: 13
}]
}]
diff --git a/config/system/help_system.js b/config/system/help_system.js
index 298ff0b..289e673 100644
--- a/config/system/help_system.js
+++ b/config/system/help_system.js
@@ -6,293 +6,293 @@
* */
export const helpCfg = {
- title: '椰奶帮助',
- subTitle: 'Yunzai-Bot & Yenai-Plugin',
+ title: "椰奶帮助",
+ subTitle: "Yunzai-Bot & Yenai-Plugin",
columnCount: 3,
colWidth: 265,
- theme: 'all',
- themeExclude: ['default'],
+ theme: "all",
+ themeExclude: ["default"],
style: {
- fontColor: '#ceb78b',
- descColor: '#eee',
- contBgColor: 'rgba(6, 21, 31, .5)',
+ fontColor: "#ceb78b",
+ descColor: "#eee",
+ contBgColor: "rgba(6, 21, 31, .5)",
contBgBlur: 3,
- headerBgColor: 'rgba(6, 21, 31, .4)',
- rowBgColor1: 'rgba(6, 21, 31, .2)',
- rowBgColor2: 'rgba(6, 21, 31, .35)'
+ headerBgColor: "rgba(6, 21, 31, .4)",
+ rowBgColor1: "rgba(6, 21, 31, .2)",
+ rowBgColor2: "rgba(6, 21, 31, .35)"
}
}
export const helpList = [{
- group: 'Bot相关',
- auth: 'master',
+ group: "Bot相关",
+ auth: "master",
list: [{
icon: 1,
- title: '#发好友 <消息>',
- desc: '给好友发送一条涩涩的消息'
+ title: "#发好友 <消息>",
+ desc: "给好友发送一条涩涩的消息"
},
{
icon: 2,
- title: '#发群聊 <群号> <消息>',
- desc: '给群聊发送一条涩涩的消息'
+ title: "#发群聊 <群号> <消息>",
+ desc: "给群聊发送一条涩涩的消息"
},
{
icon: 3,
- title: '#改头像 <图片>',
- desc: '顾名思义'
+ title: "#改头像 <图片>",
+ desc: "顾名思义"
},
{
icon: 4,
- title: '#改状态 <状态> ',
- desc: '顾名思义'
+ title: "#改状态 <状态> ",
+ desc: "顾名思义"
},
{
icon: 5,
- title: '#改昵称 <昵称> ',
- desc: '顾名思义'
+ title: "#改昵称 <昵称> ",
+ desc: "顾名思义"
},
{
icon: 6,
- title: '#改签名 <签名> ',
- desc: '顾名思义'
+ title: "#改签名 <签名> ",
+ desc: "顾名思义"
},
{
- title: '#改性别 <性别> ',
- desc: '顾名思义',
+ title: "#改性别 <性别> ",
+ desc: "顾名思义",
icon: 7
},
{
- title: '#改群名片 <名片> ',
- desc: '群里Bot自己的名片',
+ title: "#改群名片 <名片> ",
+ desc: "群里Bot自己的名片",
icon: 8
},
{
- title: '#改群昵称 <昵称>',
- desc: '改群的昵称',
+ title: "#改群昵称 <昵称>",
+ desc: "改群的昵称",
icon: 9
},
{
- title: '#改群头像 <图片>',
- desc: '顾名思义',
+ title: "#改群头像 <图片>",
+ desc: "顾名思义",
icon: 10
},
{
- title: '#删好友 ',
- desc: '删掉涩涩的好友',
+ title: "#删好友 ",
+ desc: "删掉涩涩的好友",
icon: 11
},
{
- title: '#退群 <群号> ',
- desc: '退掉涩涩的群',
+ title: "#退群 <群号> ",
+ desc: "退掉涩涩的群",
icon: 12
},
{
- title: '#获取群列表',
- desc: '获取Bot的所有群',
+ title: "#获取群列表",
+ desc: "获取Bot的所有群",
icon: 13
},
{
- title: '#获取好友列表',
- desc: '获取Bot的所有好友',
+ title: "#获取好友列表",
+ desc: "获取Bot的所有好友",
icon: 14
},
{
- title: '#取说说列表 <页数> ',
- desc: '获取Bot的说说列表',
+ title: "#取说说列表 <页数> ",
+ desc: "获取Bot的说说列表",
icon: 15
},
{
- title: '#发说说 <内容> ',
- desc: '发送一条涩涩的说说',
+ title: "#发说说 <内容> ",
+ desc: "发送一条涩涩的说说",
icon: 16
},
{
- title: '#删说说 <序号>',
- desc: '用取说说列表获取序号',
+ title: "#删说说 <序号>",
+ desc: "用取说说列表获取序号",
icon: 17
},
{
- title: '#清空说说',
- desc: '一键清空',
+ title: "#清空说说",
+ desc: "一键清空",
icon: 18
},
{
- title: '#清空留言',
- desc: '一键清空留言',
+ title: "#清空留言",
+ desc: "一键清空留言",
icon: 19
}, {
- title: '#开启|关闭戳一戳',
- desc: 'QQ的戳一戳开关',
+ title: "#开启|关闭戳一戳",
+ desc: "QQ的戳一戳开关",
icon: 5
}, {
- title: '#同意|拒绝全部好友申请',
- desc: '顾名思义',
+ title: "#同意|拒绝全部好友申请",
+ desc: "顾名思义",
icon: 6
}, {
- title: '#查看好友申请',
- desc: '查看现有好友申请',
+ title: "#查看好友申请",
+ desc: "查看现有好友申请",
icon: 1
},
{
- title: '同意|拒绝好友申请 ',
- desc: '同意或拒绝好友申请',
+ title: "同意|拒绝好友申请 ",
+ desc: "同意或拒绝好友申请",
icon: 18
},
{
- title: '#查看群邀请',
- desc: '查看现有群邀请',
+ title: "#查看群邀请",
+ desc: "查看现有群邀请",
icon: 3
}, {
- title: '#同意|拒绝全部群邀请',
- desc: '同意或拒绝全部群邀请',
+ title: "#同意|拒绝全部群邀请",
+ desc: "同意或拒绝全部群邀请",
icon: 15
}, {
- title: '#同意|拒绝群邀请 <群号>',
- desc: '同意或拒绝全部群邀请',
+ title: "#同意|拒绝群邀请 <群号>",
+ desc: "同意或拒绝全部群邀请",
icon: 7
}, {
- title: '#查看全部请求',
- desc: '查看所有请求',
+ title: "#查看全部请求",
+ desc: "查看所有请求",
icon: 20
}, {
- title: '#(开启|关闭)好友添加',
- desc: '是否开启好友添加',
+ title: "#(开启|关闭)好友添加",
+ desc: "是否开启好友添加",
icon: 7
}, {
- title: '#更改好友申请方式[0123]',
- desc: '带0参数为帮助',
+ title: "#更改好友申请方式[0123]",
+ desc: "带0参数为帮助",
icon: 12
}, {
- title: '#拉黑 #取消拉黑',
- desc: '可带at或直接键入qq,拉黑后面可带"群"',
+ title: "#拉黑 #取消拉黑",
+ desc: "可带at或直接键入qq,拉黑后面可带\"群\"",
icon: 13
}, {
- title: '#拉白 #取消拉白',
- desc: '用法与 #拉黑 相同',
+ title: "#拉白 #取消拉白",
+ desc: "用法与 #拉黑 相同",
icon: 14
}]
},
{
- group: '娱乐功能',
+ group: "娱乐功能",
list: [
{
icon: 7,
- title: '#椰羊收益曲线',
- desc: '查看角色收益曲线'
+ title: "#椰羊收益曲线",
+ desc: "查看角色收益曲线"
},
{
icon: 13,
- title: '#椰羊参考面板',
- desc: '查看角色参考面板'
+ title: "#椰羊参考面板",
+ desc: "查看角色参考面板"
},
{
icon: 9,
- title: '#收益曲线帮助',
- desc: '=-='
+ title: "#收益曲线帮助",
+ desc: "=-="
}, {
icon: 20,
- title: '#唱歌',
- desc: '随机唱鸭'
+ title: "#唱歌",
+ desc: "随机唱鸭"
},
{
icon: 13,
- title: '#(全部)?赞我',
- desc: '给你点一个大大的赞'
+ title: "#(全部)?赞我",
+ desc: "给你点一个大大的赞"
},
{
icon: 15,
- title: '#支付宝到账<数字>',
- desc: '听到账爽一下'
+ title: "#支付宝到账<数字>",
+ desc: "听到账爽一下"
}, {
icon: 17,
- title: '#翻译',
- desc: '有道翻译'
+ title: "#翻译",
+ desc: "有道翻译"
}, {
icon: 9,
- title: '#搜索菜单',
- desc: '各大引擎搜索'
+ title: "#搜索菜单",
+ desc: "各大引擎搜索"
}, {
icon: 7,
- title: '#铃声搜索',
- desc: '铃声多多'
+ title: "#铃声搜索",
+ desc: "铃声多多"
}, {
icon: 1,
- title: '#桌游搜索<关键词>',
- desc: '桌游搜索'
+ title: "#桌游搜索<关键词>",
+ desc: "桌游搜索"
}, {
icon: 19,
- title: '#桌游排行',
- desc: '桌游排行'
+ title: "#桌游排行",
+ desc: "桌游排行"
}, {
- title: '#看头像 <@QQ>',
- desc: '查看该用户的高清头像图片',
+ title: "#看头像 <@QQ>",
+ desc: "查看该用户的高清头像图片",
icon: 16
}]
},
{
- group: '搜图搜番',
+ group: "搜图搜番",
list: [
{
- title: '#搜图',
- desc: '默认SauceNAO',
+ title: "#搜图",
+ desc: "默认SauceNAO",
icon: 10
},
{
- title: '#搜番',
- desc: 'WhatAnime',
+ title: "#搜番",
+ desc: "WhatAnime",
icon: 6
},
{
- title: '#(SauceNAO|sn)搜图',
- desc: 'SauceNAO',
+ title: "#(SauceNAO|sn)搜图",
+ desc: "SauceNAO",
icon: 1
},
{
- title: '#(Ascii2D|ac)搜图',
- desc: 'Ascii2D',
+ title: "#(Ascii2D|ac)搜图",
+ desc: "Ascii2D",
icon: 5
},
{
- title: '#设置SauceNAOApiKey',
- desc: 'SauceNAOApiKey',
+ title: "#设置SauceNAOApiKey",
+ desc: "SauceNAOApiKey",
icon: 9
}
]
},
{
- group: '设置,版本相关',
- auth: 'master',
+ group: "设置,版本相关",
+ auth: "master",
list: [{
icon: 8,
- title: '#椰奶设置',
- desc: '查看椰奶设置'
+ title: "#椰奶设置",
+ desc: "查看椰奶设置"
},
{
icon: 1,
- title: '#椰奶(强制)更新',
- desc: '更新椰奶'
+ title: "#椰奶(强制)更新",
+ desc: "更新椰奶"
},
{
icon: 15,
- title: '#椰奶版本',
- desc: '查看版本信息'
+ title: "#椰奶版本",
+ desc: "查看版本信息"
},
{
icon: 12,
- title: '#椰奶更新日志',
- desc: '查看更新日志'
+ title: "#椰奶更新日志",
+ desc: "查看更新日志"
}, {
icon: 8,
- title: '#椰奶状态(pro)?',
- desc: '查看系统状态'
+ title: "#椰奶状态(pro)?",
+ desc: "查看系统状态"
}, {
icon: 3,
- title: '#椰奶群管帮助',
- desc: '群管帮助'
+ title: "#椰奶群管帮助",
+ desc: "群管帮助"
}, {
icon: 12,
- title: '#椰奶(启|禁)用全部通知',
- desc: '一键启用或禁用全部通知'
+ title: "#椰奶(启|禁)用全部通知",
+ desc: "一键启用或禁用全部通知"
}]
}]
diff --git a/config/system/sese_system.js b/config/system/sese_system.js
index 96bad38..11c5131 100644
--- a/config/system/sese_system.js
+++ b/config/system/sese_system.js
@@ -1,134 +1,134 @@
/** 涩涩帮助 */
export const helpCfg = {
- title: '椰奶涩涩帮助',
- subTitle: 'Yunzai-Bot & Yenai-Plugin',
+ title: "椰奶涩涩帮助",
+ subTitle: "Yunzai-Bot & Yenai-Plugin",
columnCount: 3,
colWidth: 265,
- theme: 'all',
- themeExclude: ['default'],
+ theme: "all",
+ themeExclude: ["default"],
style: {
- fontColor: '#ceb78b',
- descColor: '#eee',
- contBgColor: 'rgba(6, 21, 31, .5)',
+ fontColor: "#ceb78b",
+ descColor: "#eee",
+ contBgColor: "rgba(6, 21, 31, .5)",
contBgBlur: 3,
- headerBgColor: 'rgba(6, 21, 31, .4)',
- rowBgColor1: 'rgba(6, 21, 31, .2)',
- rowBgColor2: 'rgba(6, 21, 31, .35)'
+ headerBgColor: "rgba(6, 21, 31, .4)",
+ rowBgColor1: "rgba(6, 21, 31, .2)",
+ rowBgColor2: "rgba(6, 21, 31, .35)"
}
}
export const helpList = [{
- group: 'Pixiv',
+ group: "Pixiv",
list: [{
icon: 1,
- title: '#无内鬼 #setu',
- desc: 'luoli接口随机图片'
+ title: "#无内鬼 #setu",
+ desc: "luoli接口随机图片"
},
{
icon: 2,
- title: '#椰奶tag <关键词*3>',
- desc: 'luoli接口搜索tag'
+ title: "#椰奶tag <关键词*3>",
+ desc: "luoli接口搜索tag"
},
{
icon: 3,
- title: '#来(n)张好康的',
- desc: '国内镜像站接口,比较健康'
+ title: "#来(n)张好康的",
+ desc: "国内镜像站接口,比较健康"
},
{
icon: 4,
- title: '#pximg(pro)?',
- desc: '随机图片'
+ title: "#pximg(pro)?",
+ desc: "随机图片"
},
{
icon: 5,
- title: '#查看热门tag',
- desc: '顾名思义'
+ title: "#查看热门tag",
+ desc: "顾名思义"
},
{
icon: 6,
- title: '#Pid搜图 ',
- desc: '图片详情信息'
+ title: "#Pid搜图 ",
+ desc: "图片详情信息"
},
{
- title: '#tag(pro)搜图 <关键词>',
- desc: '不加Pro为国内镜像站接口',
+ title: "#tag(pro)搜图 <关键词>",
+ desc: "不加Pro为国内镜像站接口",
icon: 7
},
{
- title: '#Uid搜图 ',
- desc: '搜索画师插画',
+ title: "#Uid搜图 ",
+ desc: "搜索画师插画",
icon: 8
},
{
- title: '#相关作品 ',
- desc: '作品的相关作品',
+ title: "#相关作品 ",
+ desc: "作品的相关作品",
icon: 9
},
{
- title: '#看看<类型>榜',
- desc: 'Pixiv榜单',
+ title: "#看看<类型>榜",
+ desc: "Pixiv榜单",
icon: 10
},
{
- title: '#来(n)?张推荐图',
- desc: '登录后使用',
+ title: "#来(n)?张推荐图",
+ desc: "登录后使用",
icon: 19
},
{
- title: '#pixiv登录信息',
- desc: '登录后使用',
+ title: "#pixiv登录信息",
+ desc: "登录后使用",
icon: 19
}
]
},
{
- group: '哔咔',
+ group: "哔咔",
list: [
{
icon: 7,
- title: '#哔咔搜索<关键词>',
- desc: '更多使用请查看文档'
+ title: "#哔咔搜索<关键词>",
+ desc: "更多使用请查看文档"
},
{
icon: 13,
- title: '#哔咔id(第n页)?(第n话)?',
- desc: '查看作品详情'
+ title: "#哔咔id(第n页)?(第n话)?",
+ desc: "查看作品详情"
},
{
icon: 9,
- title: '#哔咔类别列表',
- desc: '适用于类别搜索'
+ title: "#哔咔类别列表",
+ desc: "适用于类别搜索"
}, {
icon: 20,
- title: '#哔咔看<1~20>',
- desc: '搜索后使用'
+ title: "#哔咔看<1~20>",
+ desc: "搜索后使用"
},
{
icon: 13,
- title: '#哔咔下一页',
- desc: '快速翻页'
+ title: "#哔咔下一页",
+ desc: "快速翻页"
},
{
icon: 15,
- title: '#哔咔下一话',
- desc: '快速下一话'
+ title: "#哔咔下一话",
+ desc: "快速下一话"
}]
},
{
- group: '其他',
+ group: "其他",
list: [
{
icon: 15,
- title: '#coser',
- desc: '养眼=-='
+ title: "#coser",
+ desc: "养眼=-="
}, {
- title: '#acg刻晴',
- desc: 'acgcos',
+ title: "#acg刻晴",
+ desc: "acgcos",
icon: 9
},
{
- title: '#来点xxx',
- desc: 'xxx',
+ title: "#来点xxx",
+ desc: "xxx",
icon: 1
}
]
diff --git a/constants/fun.js b/constants/fun.js
index 2e18802..b0e3d50 100644
--- a/constants/fun.js
+++ b/constants/fun.js
@@ -1,119 +1,119 @@
/** 点赞成功回复的图片 */
export const successImgs = [
- 'https://xiaobai.klizi.cn/API/ce/xin.php?qq=',
- 'https://xiaobai.klizi.cn/API/ce/zan.php?qq='
+ "https://xiaobai.klizi.cn/API/ce/xin.php?qq=",
+ "https://xiaobai.klizi.cn/API/ce/zan.php?qq="
]
/** 点赞失败回复的图片 */
export const faildsImgs = [
- 'https://xiaobai.klizi.cn/API/ce/paa.php?qq='
+ "https://xiaobai.klizi.cn/API/ce/paa.php?qq="
]
export const heisiType = {
- '白丝': { type: 'baisi', page: 17 },
- '黑丝': { type: 'heisi', page: 43 },
- '巨乳': { type: 'juru', page: 8 },
- 'jk': { type: 'jk', page: 6 },
- '网红': { type: 'mcn', page: 36 },
- '美足': { type: 'meizu', page: 9 }
+ "白丝": { type: "baisi", page: 17 },
+ "黑丝": { type: "heisi", page: 43 },
+ "巨乳": { type: "juru", page: 8 },
+ "jk": { type: "jk", page: 6 },
+ "网红": { type: "mcn", page: 36 },
+ "美足": { type: "meizu", page: 9 }
}
export const xiurenTypeId = {
- '秀人': {
+ "秀人": {
id: 117,
maxPage: 88
},
- '足控': {
+ "足控": {
id: 229,
maxPage: 8
},
- '雅拉伊': {
+ "雅拉伊": {
id: 306,
maxPage: 18
}
}
export const pandadiuType = {
- '制服': {
+ "制服": {
id: 66,
page: 8
},
- '写真': {
+ "写真": {
id: 65,
page: 55
},
- 'cos': {
+ "cos": {
id: 30,
page: 210
},
- '正片': {
+ "正片": {
id: 31,
page: 187
},
- '场照': {
+ "场照": {
id: 75,
page: 23
}
}
export const youDaoLangType = [{
- code: 'ar',
- label: '阿拉伯语',
- alphabet: 'A'
+ code: "ar",
+ label: "阿拉伯语",
+ alphabet: "A"
}, {
- code: 'de',
- label: '德语',
- alphabet: 'D'
+ code: "de",
+ label: "德语",
+ alphabet: "D"
}, {
- code: 'ru',
- label: '俄语',
- alphabet: 'E'
+ code: "ru",
+ label: "俄语",
+ alphabet: "E"
}, {
- code: 'fr',
- label: '法语',
- alphabet: 'F'
+ code: "fr",
+ label: "法语",
+ alphabet: "F"
}, {
- code: 'ko',
- label: '韩语',
- alphabet: 'H'
+ code: "ko",
+ label: "韩语",
+ alphabet: "H"
}, {
- code: 'nl',
- label: '荷兰语',
- alphabet: 'H'
+ code: "nl",
+ label: "荷兰语",
+ alphabet: "H"
}, {
- code: 'pt',
- label: '葡萄牙语',
- alphabet: 'P'
+ code: "pt",
+ label: "葡萄牙语",
+ alphabet: "P"
}, {
- code: 'ja',
- label: '日语',
- alphabet: 'R'
+ code: "ja",
+ label: "日语",
+ alphabet: "R"
}, {
- code: 'th',
- label: '泰语',
- alphabet: 'T'
+ code: "th",
+ label: "泰语",
+ alphabet: "T"
}, {
- code: 'es',
- label: '西班牙语',
- alphabet: 'X'
+ code: "es",
+ label: "西班牙语",
+ alphabet: "X"
}, {
- code: 'en',
- label: '英语',
- alphabet: 'Y'
+ code: "en",
+ label: "英语",
+ alphabet: "Y"
}, {
- code: 'it',
- label: '意大利语',
- alphabet: 'Y'
+ code: "it",
+ label: "意大利语",
+ alphabet: "Y"
}, {
- code: 'vi',
- label: '越南语',
- alphabet: 'Y'
+ code: "vi",
+ label: "越南语",
+ alphabet: "Y"
}, {
- code: 'id',
- label: '印度尼西亚语',
- alphabet: 'Y'
+ code: "id",
+ label: "印度尼西亚语",
+ alphabet: "Y"
}, {
- code: 'zh-CHS',
- label: '中文',
- alphabet: 'Z'
+ code: "zh-CHS",
+ label: "中文",
+ alphabet: "Z"
}]
diff --git a/constants/msg.js b/constants/msg.js
index 6665440..03716e8 100644
--- a/constants/msg.js
+++ b/constants/msg.js
@@ -1,67 +1,67 @@
export const setuMsg = {
start: [
- '正在给你找setu了,你先等等再冲~',
- '你先别急,正在找了~',
- '马上去给你找涩图,你先憋一会~',
- '奴家马上去给你找瑟瑟的图片~'
+ "正在给你找setu了,你先等等再冲~",
+ "你先别急,正在找了~",
+ "马上去给你找涩图,你先憋一会~",
+ "奴家马上去给你找瑟瑟的图片~"
],
cd: [
- '你这么喜欢色图,还不快点冲!',
- '你的色图不出来了!',
- '注意身体,色图看多了对身体不太好',
- '憋住,不准冲!',
- '憋再冲了!',
- '呃...好像冲了好多次...感觉不太好呢...',
- '憋冲了!你已经冲不出来了!',
- '你急啥呢?',
- '你是被下半身控制了大脑吗?'
+ "你这么喜欢色图,还不快点冲!",
+ "你的色图不出来了!",
+ "注意身体,色图看多了对身体不太好",
+ "憋住,不准冲!",
+ "憋再冲了!",
+ "呃...好像冲了好多次...感觉不太好呢...",
+ "憋冲了!你已经冲不出来了!",
+ "你急啥呢?",
+ "你是被下半身控制了大脑吗?"
],
send: [
- '给大佬递图',
- '这是你的🐍图',
- '你是大色批',
- '看!要色图的色批出现了!',
- '?',
- '喏,图',
- '给给给个🐍图',
- '色图有我好冲吗?',
- '呐呐呐,欧尼酱别看色图了呐',
- '有什么好色图有给发出来让大伙看看!',
- '没有,有也不给(骗你的~)',
- '天天色图色图的,今天就把你变成色图!',
- '咱没有色图(骗你的~)',
- '哈?你的脑子一天都在想些什么呢,咱才没有这种东西啦。',
- '呀!不要啊!等一...下~',
- '呜...不要啦!太色了咱~',
- '不要这样子啦(*/ω\*)',
- 'Hen....Hentai!。',
- '讨....讨厌了(脸红)',
- '你想...想做什么///',
- '啊.....你...你要干什么?!走开.....走开啦大hentai!一巴掌拍飞!(╯‵□′)╯︵┻━┻',
- '变态baka死宅?',
- '已经可以了,现在很多死宅也都没你这么恶心了',
- '噫…你这个死变态想干嘛!居然想叫咱做这种事,死宅真恶心!快离我远点,我怕你污染到周围空气了(嫌弃脸)',
- '这么喜欢色图呢?不如来点岛风色图?',
- 'hso!',
- '这么喜欢看色图哦?变态?',
- 'eee,死肥宅不要啦!恶心心!'
+ "给大佬递图",
+ "这是你的🐍图",
+ "你是大色批",
+ "看!要色图的色批出现了!",
+ "?",
+ "喏,图",
+ "给给给个🐍图",
+ "色图有我好冲吗?",
+ "呐呐呐,欧尼酱别看色图了呐",
+ "有什么好色图有给发出来让大伙看看!",
+ "没有,有也不给(骗你的~)",
+ "天天色图色图的,今天就把你变成色图!",
+ "咱没有色图(骗你的~)",
+ "哈?你的脑子一天都在想些什么呢,咱才没有这种东西啦。",
+ "呀!不要啊!等一...下~",
+ "呜...不要啦!太色了咱~",
+ "不要这样子啦(*/ω\*)",
+ "Hen....Hentai!。",
+ "讨....讨厌了(脸红)",
+ "你想...想做什么///",
+ "啊.....你...你要干什么?!走开.....走开啦大hentai!一巴掌拍飞!(╯‵□′)╯︵┻━┻",
+ "变态baka死宅?",
+ "已经可以了,现在很多死宅也都没你这么恶心了",
+ "噫…你这个死变态想干嘛!居然想叫咱做这种事,死宅真恶心!快离我远点,我怕你污染到周围空气了(嫌弃脸)",
+ "这么喜欢色图呢?不如来点岛风色图?",
+ "hso!",
+ "这么喜欢看色图哦?变态?",
+ "eee,死肥宅不要啦!恶心心!"
]
}
export const pixivMsg = {
start: [
- '你先别急,正在给你搜了(。-ω-)zzz',
- '你先别急,马上去给你找哦ε(*´・ω・)з',
- '你先别急,正在给你搜了(。-ω-)zzz',
- '你先别急,马上去给你找哦ε(*´・ω・)з'
+ "你先别急,正在给你搜了(。-ω-)zzz",
+ "你先别急,马上去给你找哦ε(*´・ω・)з",
+ "你先别急,正在给你搜了(。-ω-)zzz",
+ "你先别急,马上去给你找哦ε(*´・ω・)з"
]
}
export const groupTitleMsg = [
- '换上辣(´•ω•̥`)',
- '嗯!不戳的头衔哦٩(๑•ㅂ•)۶',
- '给你换上了哦(*^ワ^*)',
- '又要换了吗,真是喜新厌旧呢( •̥́ ˍ •̀ू )',
- '啾咪٩(๑•̀ω•́๑)۶',
- '弃旧恋新了么笨蛋( 。ớ ₃ờ)ھ'
+ "换上辣(´•ω•̥`)",
+ "嗯!不戳的头衔哦٩(๑•ㅂ•)۶",
+ "给你换上了哦(*^ワ^*)",
+ "又要换了吗,真是喜新厌旧呢( •̥́ ˍ •̀ू )",
+ "啾咪٩(๑•̀ω•́๑)۶",
+ "弃旧恋新了么笨蛋( 。ớ ₃ờ)ھ"
]
diff --git a/constants/nga.js b/constants/nga.js
index fbbb51f..1c7bb6f 100644
--- a/constants/nga.js
+++ b/constants/nga.js
@@ -1,74 +1,74 @@
export const incomeCurve = {
- 帮助: 'https://img.nga.178.com/attachments/mon_202208/21/i2Qjk1-j5voXxZ96T3cS1di-q9.png',
- 烟绯: 'https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-gz71XxZ96T3cS1di-q9.png',
- 辛焱: 'https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-1uboXyZ9cT3cS1di-q9.png',
- 宵宫: 'https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-acsfXyZ9eT3cS1di-q9.png',
- 香菱: 'https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-akwxXwZ8wT3cS1di-q9.png',
- 托马: 'https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-in5cXwZ90T3cS1di-q9.png',
- 胡桃: 'https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-6vbsXvZ8pT3cS1di-q9.png',
- 迪卢克: 'https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-dgbbXxZ92T3cS1di-q9.png',
- 安柏: 'https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-8m6vXxZ91T3cS1di-q9.png',
- 夜兰: 'https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-3oq4XxZ95T3cS1di-q9.png',
- 行秋: 'https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-b18cXwZ91T3cS1di-q9.png',
- 神里绫人: 'https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-hyagXyZ9fT3cS1di-q9.png',
- 珊瑚宫心海: 'https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-3ktjXxZ9bT3cS1di-q9.png',
- 莫娜: 'https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-9cifXyZ9bT3cS1di-q9.png',
- 达达利亚: 'https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-hu24XyZ9cT3cS1di-q9.png',
- 芭芭拉: 'https://img.nga.178.com/attachments/mon_202303/05/i2Qjr7-16o0XtZ7yT3cS1di-q9.png',
- 可莉: 'https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-bplpXwZ8zT3cS1di-q9.png',
- 班尼特: 'https://img.nga.178.com/attachments/mon_202303/05/i2Qjr7-ggrvXsZ7sT3cS1di-q9.png',
- 重云: 'https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-al2oXxZ9bT3cS1di-q9.png',
- 优菈: 'https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-ec2aXxZ98T3cS1di-q9.png',
- 神里绫华: 'https://img.nga.178.com/attachments/mon_202303/27/i2Q8sgk-k1u4XxZ99T3cS1di-q9.png',
- 申鹤: 'https://img.nga.178.com/attachments/mon_202303/27/i2Q8sgk-j2z6XtZ81T3cS1di-q9.png',
- 七七: 'https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-gbmkXxZ99T3cS1di-q9.png',
- 罗莎莉亚: 'https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-2tppXyZ9cT3cS1di-q9.png',
- 凯亚: 'https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-cpsdXxZ96T3cS1di-q9.png',
- 甘雨: 'https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-jh27XxZ96T3cS1di-q9.png',
- 迪奥娜: 'https://img.nga.178.com/attachments/mon_202303/27/i2Q8sgk-9xe5XtZ80T3cS1di-q9.png',
- 埃洛伊: 'https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-a90bXwZ8yT3cS1di-q9.png',
- 钟离: 'https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-3ifiXwZ8zT3cS1di-q9.png',
- 云堇: 'https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-9yzvXxZ97T3cS1di-q9.png',
- 五郎: 'https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-j6rfXxZ9aT3cS1di-q9.png',
- 诺艾尔: 'https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-9ht1XxZ97T3cS1di-q9.png',
- 凝光: 'https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-3sa1XxZ94T3cS1di-q9.png',
- 岩主: 'https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-kje0XxZ92T3cS1di-q9.png',
- 荒泷一斗: 'https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-73zhXxZ97T3cS1di-q9.png',
- 阿贝多: 'https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-cwmhXwZ8wT3cS1di-q9.png',
- 早柚: 'https://img.nga.178.com/attachments/mon_202208/21/i2Qjk1-28j7XxZ94T3cS1di-q9.png',
- 魈: 'https://img.nga.178.com/attachments/mon_202208/21/i2Qjk1-htbXwZ8yT3cS1di-q9.png',
- 琴: 'https://img.nga.178.com/attachments/mon_202208/21/i2Qjk1-kqstXxZ9aT3cS1di-q9.png',
- 鹿野院平藏: 'https://img.nga.178.com/attachments/mon_202208/21/i2Qjk1-jx1yXxZ92T3cS1di-q9.png',
- 雷主: 'https://img.nga.178.com/attachments/mon_202208/21/i2Qjk1-aqakXxZ93T3cS1di-q9.png',
- 雷泽: 'https://img.nga.178.com/attachments/mon_202208/21/i2Qjk1-axdiXxZ97T3cS1di-q9.png',
+ 帮助: "https://img.nga.178.com/attachments/mon_202208/21/i2Qjk1-j5voXxZ96T3cS1di-q9.png",
+ 烟绯: "https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-gz71XxZ96T3cS1di-q9.png",
+ 辛焱: "https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-1uboXyZ9cT3cS1di-q9.png",
+ 宵宫: "https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-acsfXyZ9eT3cS1di-q9.png",
+ 香菱: "https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-akwxXwZ8wT3cS1di-q9.png",
+ 托马: "https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-in5cXwZ90T3cS1di-q9.png",
+ 胡桃: "https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-6vbsXvZ8pT3cS1di-q9.png",
+ 迪卢克: "https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-dgbbXxZ92T3cS1di-q9.png",
+ 安柏: "https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-8m6vXxZ91T3cS1di-q9.png",
+ 夜兰: "https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-3oq4XxZ95T3cS1di-q9.png",
+ 行秋: "https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-b18cXwZ91T3cS1di-q9.png",
+ 神里绫人: "https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-hyagXyZ9fT3cS1di-q9.png",
+ 珊瑚宫心海: "https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-3ktjXxZ9bT3cS1di-q9.png",
+ 莫娜: "https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-9cifXyZ9bT3cS1di-q9.png",
+ 达达利亚: "https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-hu24XyZ9cT3cS1di-q9.png",
+ 芭芭拉: "https://img.nga.178.com/attachments/mon_202303/05/i2Qjr7-16o0XtZ7yT3cS1di-q9.png",
+ 可莉: "https://img.nga.178.com/attachments/mon_202208/17/i2Q2q-bplpXwZ8zT3cS1di-q9.png",
+ 班尼特: "https://img.nga.178.com/attachments/mon_202303/05/i2Qjr7-ggrvXsZ7sT3cS1di-q9.png",
+ 重云: "https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-al2oXxZ9bT3cS1di-q9.png",
+ 优菈: "https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-ec2aXxZ98T3cS1di-q9.png",
+ 神里绫华: "https://img.nga.178.com/attachments/mon_202303/27/i2Q8sgk-k1u4XxZ99T3cS1di-q9.png",
+ 申鹤: "https://img.nga.178.com/attachments/mon_202303/27/i2Q8sgk-j2z6XtZ81T3cS1di-q9.png",
+ 七七: "https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-gbmkXxZ99T3cS1di-q9.png",
+ 罗莎莉亚: "https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-2tppXyZ9cT3cS1di-q9.png",
+ 凯亚: "https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-cpsdXxZ96T3cS1di-q9.png",
+ 甘雨: "https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-jh27XxZ96T3cS1di-q9.png",
+ 迪奥娜: "https://img.nga.178.com/attachments/mon_202303/27/i2Q8sgk-9xe5XtZ80T3cS1di-q9.png",
+ 埃洛伊: "https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-a90bXwZ8yT3cS1di-q9.png",
+ 钟离: "https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-3ifiXwZ8zT3cS1di-q9.png",
+ 云堇: "https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-9yzvXxZ97T3cS1di-q9.png",
+ 五郎: "https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-j6rfXxZ9aT3cS1di-q9.png",
+ 诺艾尔: "https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-9ht1XxZ97T3cS1di-q9.png",
+ 凝光: "https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-3sa1XxZ94T3cS1di-q9.png",
+ 岩主: "https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-kje0XxZ92T3cS1di-q9.png",
+ 荒泷一斗: "https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-73zhXxZ97T3cS1di-q9.png",
+ 阿贝多: "https://img.nga.178.com/attachments/mon_202208/19/i2Q2q-cwmhXwZ8wT3cS1di-q9.png",
+ 早柚: "https://img.nga.178.com/attachments/mon_202208/21/i2Qjk1-28j7XxZ94T3cS1di-q9.png",
+ 魈: "https://img.nga.178.com/attachments/mon_202208/21/i2Qjk1-htbXwZ8yT3cS1di-q9.png",
+ 琴: "https://img.nga.178.com/attachments/mon_202208/21/i2Qjk1-kqstXxZ9aT3cS1di-q9.png",
+ 鹿野院平藏: "https://img.nga.178.com/attachments/mon_202208/21/i2Qjk1-jx1yXxZ92T3cS1di-q9.png",
+ 雷主: "https://img.nga.178.com/attachments/mon_202208/21/i2Qjk1-aqakXxZ93T3cS1di-q9.png",
+ 雷泽: "https://img.nga.178.com/attachments/mon_202208/21/i2Qjk1-axdiXxZ97T3cS1di-q9.png",
雷电将军: [
- 'https://img.nga.178.com/attachments/mon_202303/05/i2Qjr7-kszoXyZ9eT3cS1di-q9.png',
- 'https://img.nga.178.com/attachments/mon_202303/05/i2Qjr7-ei3cXyZ9fT3cS1di-q9.png'
+ "https://img.nga.178.com/attachments/mon_202303/05/i2Qjr7-kszoXyZ9eT3cS1di-q9.png",
+ "https://img.nga.178.com/attachments/mon_202303/05/i2Qjr7-ei3cXyZ9fT3cS1di-q9.png"
],
- 九条裟罗: 'https://img.nga.178.com/attachments/mon_202208/21/i2Qjk1-ep0dXwZ8yT3cS1di-q9.png',
- 提纳里: 'https://img.nga.178.com/attachments/mon_202208/24/i2Q8oyf-1twzXwZ8uT3cS1di-q9.png',
- 草主: 'https://img.nga.178.com/attachments/mon_202208/24/i2Q8oyf-620hXuZ8aT3cS1di-q9.png',
- 枫原万叶: 'https://img.nga.178.com/attachments/mon_202208/24/i2Q8oyf-i5niXvZ8iT3cS1di-q9.png',
- 丽莎: 'https://img.nga.178.com/attachments/mon_202208/24/i2Q8oyf-ba0sXxZ96T3cS1di-q9.png',
- 刻晴: 'https://img.nga.178.com/attachments/mon_202208/24/i2Q8oyf-j403XyZ9hT3cS1di-q9.png',
- 久岐忍: 'https://img.nga.178.com/attachments/mon_202208/24/i2Q8oyf-1zzuXxZ97T3cS1di-q9.png',
- 菲谢尔: 'https://img.nga.178.com/attachments/mon_202208/24/i2Q8oyf-77grXxZ98T3cS1di-q9.png',
- 北斗: 'https://img.nga.178.com/attachments/mon_202208/24/i2Q8oyf-5xbkZ2dT3cS1di-q9.png',
- 八重神子: 'https://img.nga.178.com/attachments/mon_202208/24/i2Q8oyf-ddaeXyZ9kT3cS1di-q9.png',
- 多莉: 'https://img.nga.178.com/attachments/mon_202209/09/i2Q181-45azXyZ9bT3cS1di-q9.png',
- 柯莱: 'https://img.nga.178.com/attachments/mon_202303/05/i2Qjr7-a7huXsZ7wT3cS1di-q9.png',
- 温迪: 'https://img.nga.178.com/attachments/mon_202208/24/i2Q8oyf-2s69XwZ8uT3cS1di-q9.png',
- 砂糖: 'https://img.nga.178.com/attachments/mon_202303/27/i2Q8sgk-6rx4XtZ81T3cS1di-q9.png',
- 风主: 'https://img.nga.178.com/attachments/mon_202208/24/i2Q8oyf-bplhXvZ8lT3cS1di-q9.png',
- 坎蒂丝: 'https://img.nga.178.com/attachments/mon_202302/07/i2Q180-jknyXxZ98T3cS1di-q9.png',
- 赛诺: 'https://img.nga.178.com/attachments/mon_202302/07/i2Q180-i3a5X10Z9vT3cS1di-q9.png',
- 妮露: 'https://img.nga.178.com/attachments/mon_202302/07/i2Q180-7njbXuZ8aT3cS1di-q9.png',
- 纳西妲: 'https://img.nga.178.com/attachments/mon_202302/07/i2Q180-klw9Z2pT3cS1di-q9.png',
- 莱依拉: 'https://img.nga.178.com/attachments/mon_202302/07/i2Q180-p52XuZ8bT3cS1di-q9.png',
- 珐露珊: 'https://img.nga.178.com/attachments/mon_202302/07/i2Q180-cf75XuZ87T3cS1di-q9.png',
- 流浪者: 'https://img.nga.178.com/attachments/mon_202302/07/i2Q180-71e3XtZ87T3cS1di-q9.png',
- 艾尔海森: 'https://img.nga.178.com/attachments/mon_202302/07/i2Q180-4ntzXuZ8fT3cS1di-q9.png',
- 瑶瑶: 'https://img.nga.178.com/attachments/mon_202302/07/i2Q180-a6gvXtZ82T3cS1di-q9.png',
- 迪希雅: 'https://img.nga.178.com/attachments/mon_202303/05/i2Qjr7-iq98XtZ85T3cS1di-q9.png',
- 米卡: 'https://img.nga.178.com/attachments/mon_202303/27/i2Q8sgk-5qquXtZ7zT3cS1di-q9.png'
+ 九条裟罗: "https://img.nga.178.com/attachments/mon_202208/21/i2Qjk1-ep0dXwZ8yT3cS1di-q9.png",
+ 提纳里: "https://img.nga.178.com/attachments/mon_202208/24/i2Q8oyf-1twzXwZ8uT3cS1di-q9.png",
+ 草主: "https://img.nga.178.com/attachments/mon_202208/24/i2Q8oyf-620hXuZ8aT3cS1di-q9.png",
+ 枫原万叶: "https://img.nga.178.com/attachments/mon_202208/24/i2Q8oyf-i5niXvZ8iT3cS1di-q9.png",
+ 丽莎: "https://img.nga.178.com/attachments/mon_202208/24/i2Q8oyf-ba0sXxZ96T3cS1di-q9.png",
+ 刻晴: "https://img.nga.178.com/attachments/mon_202208/24/i2Q8oyf-j403XyZ9hT3cS1di-q9.png",
+ 久岐忍: "https://img.nga.178.com/attachments/mon_202208/24/i2Q8oyf-1zzuXxZ97T3cS1di-q9.png",
+ 菲谢尔: "https://img.nga.178.com/attachments/mon_202208/24/i2Q8oyf-77grXxZ98T3cS1di-q9.png",
+ 北斗: "https://img.nga.178.com/attachments/mon_202208/24/i2Q8oyf-5xbkZ2dT3cS1di-q9.png",
+ 八重神子: "https://img.nga.178.com/attachments/mon_202208/24/i2Q8oyf-ddaeXyZ9kT3cS1di-q9.png",
+ 多莉: "https://img.nga.178.com/attachments/mon_202209/09/i2Q181-45azXyZ9bT3cS1di-q9.png",
+ 柯莱: "https://img.nga.178.com/attachments/mon_202303/05/i2Qjr7-a7huXsZ7wT3cS1di-q9.png",
+ 温迪: "https://img.nga.178.com/attachments/mon_202208/24/i2Q8oyf-2s69XwZ8uT3cS1di-q9.png",
+ 砂糖: "https://img.nga.178.com/attachments/mon_202303/27/i2Q8sgk-6rx4XtZ81T3cS1di-q9.png",
+ 风主: "https://img.nga.178.com/attachments/mon_202208/24/i2Q8oyf-bplhXvZ8lT3cS1di-q9.png",
+ 坎蒂丝: "https://img.nga.178.com/attachments/mon_202302/07/i2Q180-jknyXxZ98T3cS1di-q9.png",
+ 赛诺: "https://img.nga.178.com/attachments/mon_202302/07/i2Q180-i3a5X10Z9vT3cS1di-q9.png",
+ 妮露: "https://img.nga.178.com/attachments/mon_202302/07/i2Q180-7njbXuZ8aT3cS1di-q9.png",
+ 纳西妲: "https://img.nga.178.com/attachments/mon_202302/07/i2Q180-klw9Z2pT3cS1di-q9.png",
+ 莱依拉: "https://img.nga.178.com/attachments/mon_202302/07/i2Q180-p52XuZ8bT3cS1di-q9.png",
+ 珐露珊: "https://img.nga.178.com/attachments/mon_202302/07/i2Q180-cf75XuZ87T3cS1di-q9.png",
+ 流浪者: "https://img.nga.178.com/attachments/mon_202302/07/i2Q180-71e3XtZ87T3cS1di-q9.png",
+ 艾尔海森: "https://img.nga.178.com/attachments/mon_202302/07/i2Q180-4ntzXuZ8fT3cS1di-q9.png",
+ 瑶瑶: "https://img.nga.178.com/attachments/mon_202302/07/i2Q180-a6gvXtZ82T3cS1di-q9.png",
+ 迪希雅: "https://img.nga.178.com/attachments/mon_202303/05/i2Qjr7-iq98XtZ85T3cS1di-q9.png",
+ 米卡: "https://img.nga.178.com/attachments/mon_202303/27/i2Q8sgk-5qquXtZ7zT3cS1di-q9.png"
}
diff --git a/constants/other.js b/constants/other.js
index ef694c0..aa87d29 100644
--- a/constants/other.js
+++ b/constants/other.js
@@ -30,17 +30,17 @@ export const Time_unit = {
/** 在线状态 */
export const status = {
- 31: '离开',
- 50: '忙碌',
- 70: '请勿打扰',
- 41: '隐身',
- 11: '我在线上',
- 60: 'Q我吧'
+ 31: "离开",
+ 50: "忙碌",
+ 70: "请勿打扰",
+ 41: "隐身",
+ 11: "我在线上",
+ 60: "Q我吧"
}
/** 权限 */
export const ROLE_MAP = {
- admin: '群管理',
- owner: '群主',
- member: '群员'
+ admin: "群管理",
+ owner: "群主",
+ member: "群员"
}
diff --git a/constants/pixiv.js b/constants/pixiv.js
index 814b196..f6ff4b5 100644
--- a/constants/pixiv.js
+++ b/constants/pixiv.js
@@ -1,89 +1,89 @@
export const rankType = {
日: {
- type: 'day',
+ type: "day",
total: 500,
r18: {
total: 100,
- type: 'day_r18'
+ type: "day_r18"
}
},
周: {
- type: 'week',
+ type: "week",
total: 500,
r18: {
total: 100,
- type: 'week_r18'
+ type: "week_r18"
}
},
月: {
- type: 'month',
+ type: "month",
total: 500,
r18: false
},
AI: {
- type: 'day_ai',
+ type: "day_ai",
total: 50,
r18: {
total: 50,
- type: 'day_r18_ai'
+ type: "day_r18_ai"
}
},
男性向: {
- type: 'day_male',
+ type: "day_male",
total: 500,
r18: {
total: 300,
- type: 'day_male_r18'
+ type: "day_male_r18"
}
},
女性向: {
- type: 'day_female',
+ type: "day_female",
total: 500,
r18: {
total: 300,
- type: 'day_female_r18'
+ type: "day_female_r18"
}
},
漫画日: {
- type: 'day_manga',
+ type: "day_manga",
total: 500,
r18: {
total: 100,
- type: 'day_r18_manga'
+ type: "day_r18_manga"
}
},
漫画周: {
- type: 'week_manga',
+ type: "week_manga",
total: 500,
r18: {
total: 100,
- type: 'week_r18_manga'
+ type: "week_r18_manga"
}
},
漫画月: {
- type: 'month_manga',
+ type: "month_manga",
total: 500,
r18: false
},
漫画新人周: {
- type: 'week_rookie_manga',
+ type: "week_rookie_manga",
total: 500,
r18: false
},
新人: {
- type: 'week_rookie',
+ type: "week_rookie",
total: 500,
r18: false
},
原创: {
- type: 'week_original',
+ type: "week_original",
total: 500,
r18: false
}
}
export const ImageRPSS = [
- 'i.pixiv.re',
- 'proxy.pixivel.moe',
- 'px2.rainchan.win',
- 'sex.nyan.xyz'
+ "i.pixiv.re",
+ "proxy.pixivel.moe",
+ "px2.rainchan.win",
+ "sex.nyan.xyz"
]
diff --git a/constants/search.js b/constants/search.js
index 47d5429..7f2b046 100644
--- a/constants/search.js
+++ b/constants/search.js
@@ -1,56 +1,56 @@
export const SEARCH_MAP = {
- 百度: 'https://www.baidu.com/s?wd=',
+ 百度: "https://www.baidu.com/s?wd=",
- 必应: 'https://cn.bing.com/search?q=',
+ 必应: "https://cn.bing.com/search?q=",
- 谷歌: 'https://www.google.com/search?q=',
+ 谷歌: "https://www.google.com/search?q=",
- 微博: 'https://s.weibo.com/weibo?q=',
+ 微博: "https://s.weibo.com/weibo?q=",
- 淘宝: 'https://s.taobao.com/search?q=',
+ 淘宝: "https://s.taobao.com/search?q=",
- 京东: 'https://search.jd.com/Search?keyword=',
+ 京东: "https://search.jd.com/Search?keyword=",
- 知乎: 'https://www.zhihu.com/search?q=',
+ 知乎: "https://www.zhihu.com/search?q=",
- 头条: 'https://so.toutiao.com/search?keyword=',
+ 头条: "https://so.toutiao.com/search?keyword=",
- 抖音: 'https://www.douyin.com/search/',
+ 抖音: "https://www.douyin.com/search/",
- 快手: 'https://www.kuaishou.com/search/video?searchKey=',
+ 快手: "https://www.kuaishou.com/search/video?searchKey=",
- 虎牙: 'https://www.huya.com/search?hsk=',
+ 虎牙: "https://www.huya.com/search?hsk=",
- 斗鱼: 'https://www.douyu.com/search/?kw=',
+ 斗鱼: "https://www.douyu.com/search/?kw=",
- 萌娘百科: 'https://zh.moegirl.org.cn/index.php?search=',
+ 萌娘百科: "https://zh.moegirl.org.cn/index.php?search=",
- B站: 'https://search.bilibili.com/all?keyword=',
+ B站: "https://search.bilibili.com/all?keyword=",
- 腾讯视频: 'https://v.qq.com/x/search/?q=',
+ 腾讯视频: "https://v.qq.com/x/search/?q=",
- 优酷: 'https://so.youku.com/search_video/',
+ 优酷: "https://so.youku.com/search_video/",
- 爱奇艺: 'https://so.iqiyi.com/so/q_',
+ 爱奇艺: "https://so.iqiyi.com/so/q_",
- 芒果TV: 'https://so.mgtv.com/so?k=',
+ 芒果TV: "https://so.mgtv.com/so?k=",
- 百度图片: 'https://image.baidu.com/search/index?tn=baiduimage&word=',
+ 百度图片: "https://image.baidu.com/search/index?tn=baiduimage&word=",
- 百度文库: 'https://wenku.baidu.com/search?word=',
+ 百度文库: "https://wenku.baidu.com/search?word=",
- 4399: 'https://so2.4399.com/search/search.php?k=',
+ 4399: "https://so2.4399.com/search/search.php?k=",
- GitHub: 'https://github.com/search?q=',
+ GitHub: "https://github.com/search?q=",
- 力扣: 'https://leetcode.cn/search/?q=',
+ 力扣: "https://leetcode.cn/search/?q=",
- MDN: 'https://developer.mozilla.org/zh-CN/search?q=',
+ MDN: "https://developer.mozilla.org/zh-CN/search?q=",
- CSDN: 'https://so.csdn.net/so/search?q=',
+ CSDN: "https://so.csdn.net/so/search?q=",
- 掘金: 'https://juejin.cn/search?query=',
+ 掘金: "https://juejin.cn/search?query=",
- 油猴: 'https://greasyfork.org/zh-CN/scripts?q='
+ 油猴: "https://greasyfork.org/zh-CN/scripts?q="
}
diff --git a/guoba.support.js b/guoba.support.js
index 4a19975..128542b 100644
--- a/guoba.support.js
+++ b/guoba.support.js
@@ -1,4 +1,4 @@
-import { Config } from './components/index.js'
+import { Config } from "./components/index.js"
/**
* 支持锅巴
* 锅巴插件:https://gitee.com/guoba-yunzai/guoba-plugin.git
@@ -14,14 +14,14 @@ const Plugin_Path = `${Path}/plugins/yenai-plugin`
export function supportGuoba () {
return {
pluginInfo: {
- name: 'yenai-plugin',
- title: 'Yenai-Plugin',
- author: '@椰羊',
- authorLink: 'https://gitee.com/yeyang52',
- link: 'https://gitee.com/yeyang52/yenai-plugin',
+ name: "yenai-plugin",
+ title: "Yenai-Plugin",
+ author: "@椰羊",
+ authorLink: "https://gitee.com/yeyang52",
+ link: "https://gitee.com/yeyang52/yenai-plugin",
isV3: true,
isV2: false,
- description: '提供对Bot的一些便捷操作',
+ description: "提供对Bot的一些便捷操作",
// 显示图标,此为个性化配置
// 图标可在 https://icon-sets.iconify.design 这里进行搜索
// icon: 'emojione-monotone:baby-chick',
@@ -35,337 +35,337 @@ export function supportGuoba () {
// 配置项 schemas
schemas: [
{
- component: 'whole.Divider',
- label: '消息通知'
+ component: "whole.Divider",
+ label: "消息通知"
},
{
- field: 'whole.privateMessage',
- label: '好友消息',
- bottomHelpMessage: '开启后将转发好友消息,可进行回复',
- component: 'Switch'
+ field: "whole.privateMessage",
+ label: "好友消息",
+ bottomHelpMessage: "开启后将转发好友消息,可进行回复",
+ component: "Switch"
},
{
- field: 'whole.groupMessage',
- label: '群聊消息',
- helpMessage: '开启后将转发全部群聊消息,建议配置单独群开启',
- bottomHelpMessage: '是否开启群聊消息通知',
- component: 'Switch'
+ field: "whole.groupMessage",
+ label: "群聊消息",
+ helpMessage: "开启后将转发全部群聊消息,建议配置单独群开启",
+ bottomHelpMessage: "是否开启群聊消息通知",
+ component: "Switch"
},
{
- field: 'whole.grouptemporaryMessage',
- label: '群临时消息',
- bottomHelpMessage: '开启后将转发群临时消息',
- component: 'Switch'
+ field: "whole.grouptemporaryMessage",
+ label: "群临时消息",
+ bottomHelpMessage: "开启后将转发群临时消息",
+ component: "Switch"
},
{
- field: 'whole.groupRecall',
- label: '群聊撤回',
- bottomHelpMessage: '群聊撤回后将撤回的消息转发给主人',
- component: 'Switch'
+ field: "whole.groupRecall",
+ label: "群聊撤回",
+ bottomHelpMessage: "群聊撤回后将撤回的消息转发给主人",
+ component: "Switch"
},
{
- field: 'whole.PrivateRecall',
- label: '好友撤回',
- bottomHelpMessage: '好友私聊撤回后将撤回的消息转发给主人',
- component: 'Switch'
+ field: "whole.PrivateRecall",
+ label: "好友撤回",
+ bottomHelpMessage: "好友私聊撤回后将撤回的消息转发给主人",
+ component: "Switch"
},
{
- component: 'Divider',
- label: '申请通知'
+ component: "Divider",
+ label: "申请通知"
},
{
- field: 'whole.friendRequest',
- label: '好友申请',
- helpMessage: '将云崽的自动同意好友申请关闭后,可回复同意或拒绝进行处理',
- bottomHelpMessage: '是否开启好友申请通知',
- component: 'Switch'
+ field: "whole.friendRequest",
+ label: "好友申请",
+ helpMessage: "将云崽的自动同意好友申请关闭后,可回复同意或拒绝进行处理",
+ bottomHelpMessage: "是否开启好友申请通知",
+ component: "Switch"
},
{
- field: 'whole.addGroupApplication',
- label: '加群申请',
- helpMessage: '可回复同意或拒绝进行处理',
- bottomHelpMessage: '是否开启加群申请通知',
- component: 'Switch'
+ field: "whole.addGroupApplication",
+ label: "加群申请",
+ helpMessage: "可回复同意或拒绝进行处理",
+ bottomHelpMessage: "是否开启加群申请通知",
+ component: "Switch"
},
{
- field: 'whole.groupInviteRequest',
- label: '群聊邀请',
- helpMessage: '将云崽的自动退群设置为0后,可回复同意或拒绝进行处理',
- bottomHelpMessage: '是否开启群聊邀请通知',
- component: 'Switch'
+ field: "whole.groupInviteRequest",
+ label: "群聊邀请",
+ helpMessage: "将云崽的自动退群设置为0后,可回复同意或拒绝进行处理",
+ bottomHelpMessage: "是否开启群聊邀请通知",
+ component: "Switch"
},
{
- component: 'Divider',
- label: '列表变动'
+ component: "Divider",
+ label: "列表变动"
},
{
- field: 'whole.groupAdminChange',
- label: '群管理变动',
- bottomHelpMessage: 'Bot被设置或取消管理,群员被设置或取消管理通知',
- component: 'Switch'
+ field: "whole.groupAdminChange",
+ label: "群管理变动",
+ bottomHelpMessage: "Bot被设置或取消管理,群员被设置或取消管理通知",
+ component: "Switch"
},
{
- field: 'whole.friendNumberChange',
- label: '好友列表变动',
- bottomHelpMessage: '新增好友和好友减少通知',
- component: 'Switch'
+ field: "whole.friendNumberChange",
+ label: "好友列表变动",
+ bottomHelpMessage: "新增好友和好友减少通知",
+ component: "Switch"
},
{
- field: 'whole.groupNumberChange',
- label: '群聊列表变动',
- bottomHelpMessage: '群转让,新增群聊,Bot退群,Bot被踢,群员被踢等通知',
- component: 'Switch'
+ field: "whole.groupNumberChange",
+ label: "群聊列表变动",
+ bottomHelpMessage: "群转让,新增群聊,Bot退群,Bot被踢,群员被踢等通知",
+ component: "Switch"
},
{
- field: 'whole.groupMemberNumberChange',
- label: '群成员变动',
- bottomHelpMessage: '新增群员,群员被踢,群员退群等通知',
- component: 'Switch'
+ field: "whole.groupMemberNumberChange",
+ label: "群成员变动",
+ bottomHelpMessage: "新增群员,群员被踢,群员退群等通知",
+ component: "Switch"
},
{
- component: 'Divider',
- label: '其他通知'
+ component: "Divider",
+ label: "其他通知"
},
{
- field: 'whole.flashPhoto',
- label: '闪照',
- helpMessage: '目前QQ群聊闪照功能已被移除',
- bottomHelpMessage: '开启后将转发群聊和私聊的闪照',
- component: 'Switch'
+ field: "whole.flashPhoto",
+ label: "闪照",
+ helpMessage: "目前QQ群聊闪照功能已被移除",
+ bottomHelpMessage: "开启后将转发群聊和私聊的闪照",
+ component: "Switch"
},
{
- field: 'whole.botBeenBanned',
- label: 'Bot被禁言',
- bottomHelpMessage: 'Bot在群聊被禁言后通知主人',
- component: 'Switch'
+ field: "whole.botBeenBanned",
+ label: "Bot被禁言",
+ bottomHelpMessage: "Bot在群聊被禁言后通知主人",
+ component: "Switch"
},
{
- component: 'Divider',
- label: '其他设置'
+ component: "Divider",
+ label: "其他设置"
},
{
- field: 'whole.Strangers_love',
- label: '陌生人点赞',
- bottomHelpMessage: '开启后赞我功能将可以陌生人点赞,不活跃的号有可能被风控',
- component: 'Switch'
+ field: "whole.Strangers_love",
+ label: "陌生人点赞",
+ bottomHelpMessage: "开启后赞我功能将可以陌生人点赞,不活跃的号有可能被风控",
+ component: "Switch"
},
{
- field: 'whole.state',
- label: '默认状态',
- bottomHelpMessage: '是否将椰奶状态作为默认状态',
- component: 'Switch'
+ field: "whole.state",
+ label: "默认状态",
+ bottomHelpMessage: "是否将椰奶状态作为默认状态",
+ component: "Switch"
},
{
- field: 'whole.notificationsAll',
- label: '通知全部管理',
- bottomHelpMessage: '开启后通知将会发送给所有主人',
- component: 'Switch'
+ field: "whole.notificationsAll",
+ label: "通知全部管理",
+ bottomHelpMessage: "开启后通知将会发送给所有主人",
+ component: "Switch"
},
{
- field: 'whole.deltime',
- label: '删除缓存时间',
- helpMessage: '删除撤回消息保存的时间',
- bottomHelpMessage: '不建议设置太久',
- component: 'InputNumber',
+ field: "whole.deltime",
+ label: "删除缓存时间",
+ helpMessage: "删除撤回消息保存的时间",
+ bottomHelpMessage: "不建议设置太久",
+ component: "InputNumber",
componentProps: {
- placeholder: '请输入删除缓存时间'
+ placeholder: "请输入删除缓存时间"
}
},
{
- component: 'Divider',
- label: '权限设置'
+ component: "Divider",
+ label: "权限设置"
},
{
- field: 'whole.sese',
- label: 'sese',
- bottomHelpMessage: '开放一些功能',
- component: 'Switch'
+ field: "whole.sese",
+ label: "sese",
+ bottomHelpMessage: "开放一些功能",
+ component: "Switch"
},
{
- field: 'whole.sesepro',
- label: 'sesepro',
- bottomHelpMessage: '开放全部功能',
- component: 'Switch'
+ field: "whole.sesepro",
+ label: "sesepro",
+ bottomHelpMessage: "开放全部功能",
+ component: "Switch"
},
{
- component: 'Divider',
- label: 'pixiv设置'
+ component: "Divider",
+ label: "pixiv设置"
},
{
- field: 'pixiv.pixivDirectConnection',
- label: 'pixiv图片直连',
- bottomHelpMessage: '直接使用官方图片链接发送,请确保你的网络环境可以访问pixiv',
- component: 'Switch'
+ field: "pixiv.pixivDirectConnection",
+ label: "pixiv图片直连",
+ bottomHelpMessage: "直接使用官方图片链接发送,请确保你的网络环境可以访问pixiv",
+ component: "Switch"
},
{
- field: 'pixiv.allowPM',
- label: 'pixiv私聊使用',
- bottomHelpMessage: 'pixiv是否允许私聊使用',
- component: 'Switch'
+ field: "pixiv.allowPM",
+ label: "pixiv私聊使用",
+ bottomHelpMessage: "pixiv是否允许私聊使用",
+ component: "Switch"
},
{
- field: 'pixiv.refresh_token',
- label: 'pixiv登录刷新令牌',
- bottomHelpMessage: '登录后直接使用账号调用官方api,不登录也可以正常使用功能',
- component: 'Input'
+ field: "pixiv.refresh_token",
+ label: "pixiv登录刷新令牌",
+ bottomHelpMessage: "登录后直接使用账号调用官方api,不登录也可以正常使用功能",
+ component: "Input"
},
{
- field: 'pixiv.pixivImageProxy',
- label: 'pixiv图片反代',
- bottomHelpMessage: 'pixiv图片反代服务,如可以直接访问pixiv请直接打开图片直连',
- component: 'Input'
+ field: "pixiv.pixivImageProxy",
+ label: "pixiv图片反代",
+ bottomHelpMessage: "pixiv图片反代服务,如可以直接访问pixiv请直接打开图片直连",
+ component: "Input"
},
{
- field: 'pixiv.limit',
- label: 'pixiv次数限制',
- bottomHelpMessage: '每名用户每日次数限制(0 则无限制)',
- component: 'InputNumber'
+ field: "pixiv.limit",
+ label: "pixiv次数限制",
+ bottomHelpMessage: "每名用户每日次数限制(0 则无限制)",
+ component: "InputNumber"
},
{
- field: 'pixiv.language',
- label: 'pixiv返回语言',
- bottomHelpMessage: '返回语言, 会影响标签的翻译',
- component: 'Input'
+ field: "pixiv.language",
+ label: "pixiv返回语言",
+ bottomHelpMessage: "返回语言, 会影响标签的翻译",
+ component: "Input"
},
{
- component: 'Divider',
- label: '哔咔设置'
+ component: "Divider",
+ label: "哔咔设置"
},
{
- field: 'bika.allowPM',
- label: '哔咔私聊使用',
- bottomHelpMessage: '哔咔是否允许私聊使用',
- component: 'Switch'
+ field: "bika.allowPM",
+ label: "哔咔私聊使用",
+ bottomHelpMessage: "哔咔是否允许私聊使用",
+ component: "Switch"
},
{
- field: 'bika.bikaDirectConnection',
- label: '哔咔图片直连',
- bottomHelpMessage: '直接使用官方图片链接发送,请确保你的网络环境可以访问哔咔',
- component: 'Switch'
+ field: "bika.bikaDirectConnection",
+ label: "哔咔图片直连",
+ bottomHelpMessage: "直接使用官方图片链接发送,请确保你的网络环境可以访问哔咔",
+ component: "Switch"
},
{
- field: 'bika.limit',
- label: '哔咔次数限制',
- bottomHelpMessage: '每名用户每日次数限制(0 则无限制)',
- component: 'InputNumber'
+ field: "bika.limit",
+ label: "哔咔次数限制",
+ bottomHelpMessage: "每名用户每日次数限制(0 则无限制)",
+ component: "InputNumber"
},
{
- field: 'bika.bikaImageProxy',
- label: '哔咔图片反代',
- bottomHelpMessage: '哔咔图片反代服务,如可以直接访问bika请直接打开图片直连',
- component: 'Input'
+ field: "bika.bikaImageProxy",
+ label: "哔咔图片反代",
+ bottomHelpMessage: "哔咔图片反代服务,如可以直接访问bika请直接打开图片直连",
+ component: "Input"
},
{
- field: 'bika.imageQuality',
- label: '哔咔图片质量',
- bottomHelpMessage: '哔咔返回的图片质量',
- component: 'Select',
+ field: "bika.imageQuality",
+ label: "哔咔图片质量",
+ bottomHelpMessage: "哔咔返回的图片质量",
+ component: "Select",
componentProps: {
options: [
- { label: '低', value: 'low' },
- { label: '中', value: 'medium' },
- { label: '高', value: 'high' },
- { label: '原图', value: 'original' }
+ { label: "低", value: "low" },
+ { label: "中", value: "medium" },
+ { label: "高", value: "high" },
+ { label: "原图", value: "original" }
],
- placeholder: '请选择图片质量'
+ placeholder: "请选择图片质量"
}
},
{
- component: 'Divider',
- label: '搜图设置'
+ component: "Divider",
+ label: "搜图设置"
},
{
- field: 'picSearch.isMasterUse',
- label: '搜图主人独享',
- bottomHelpMessage: '搜图是否只有主人能用',
- component: 'Switch'
+ field: "picSearch.isMasterUse",
+ label: "搜图主人独享",
+ bottomHelpMessage: "搜图是否只有主人能用",
+ component: "Switch"
},
{
- field: 'picSearch.allowPM',
- label: '搜图私聊使用',
- bottomHelpMessage: '搜图是否允许私聊使用',
- component: 'Switch'
+ field: "picSearch.allowPM",
+ label: "搜图私聊使用",
+ bottomHelpMessage: "搜图是否允许私聊使用",
+ component: "Switch"
},
{
- field: 'picSearch.ascii2dUsePuppeteer',
- label: 'Puppeteer绕cf',
- bottomHelpMessage: '是否使用 Puppeteer 请求 ascii2d 以绕过 cf js challenge',
- component: 'Switch'
+ field: "picSearch.ascii2dUsePuppeteer",
+ label: "Puppeteer绕cf",
+ bottomHelpMessage: "是否使用 Puppeteer 请求 ascii2d 以绕过 cf js challenge",
+ component: "Switch"
},
{
- field: 'picSearch.hideImg',
- label: '隐藏结果缩略图',
- bottomHelpMessage: '隐藏所有搜索结果的缩略图',
- component: 'Switch'
+ field: "picSearch.hideImg",
+ label: "隐藏结果缩略图",
+ bottomHelpMessage: "隐藏所有搜索结果的缩略图",
+ component: "Switch"
},
{
- field: 'picSearch.hideImgWhenWhatanimeR18',
- label: 'whatanime R18 隐藏图',
- bottomHelpMessage: 'whatanime 得到 R18 结果时隐藏结果缩略图',
- component: 'Switch'
+ field: "picSearch.hideImgWhenWhatanimeR18",
+ label: "whatanime R18 隐藏图",
+ bottomHelpMessage: "whatanime 得到 R18 结果时隐藏结果缩略图",
+ component: "Switch"
},
{
- field: 'picSearch.whatanimeSendVideo',
- label: 'whatanime预览视频',
- bottomHelpMessage: 'whatanime 发送预览视频,R18 结果不会发送',
- component: 'Switch'
+ field: "picSearch.whatanimeSendVideo",
+ label: "whatanime预览视频",
+ bottomHelpMessage: "whatanime 发送预览视频,R18 结果不会发送",
+ component: "Switch"
},
{
- field: 'picSearch.useAscii2dWhenLowAcc',
- label: 'saucenao 相似度过低使用ascii2d',
- bottomHelpMessage: '是否在 saucenao 相似度过低时自动使用 ascii2d',
- component: 'Switch'
+ field: "picSearch.useAscii2dWhenLowAcc",
+ label: "saucenao 相似度过低使用ascii2d",
+ bottomHelpMessage: "是否在 saucenao 相似度过低时自动使用 ascii2d",
+ component: "Switch"
},
{
- field: 'picSearch.useAscii2dWhenFailed',
- label: 'saucenao 搜索失败使用ascii2d',
- bottomHelpMessage: '是否在 saucenao 搜索失败时自动使用 ascii2d',
- component: 'Switch'
+ field: "picSearch.useAscii2dWhenFailed",
+ label: "saucenao 搜索失败使用ascii2d",
+ bottomHelpMessage: "是否在 saucenao 搜索失败时自动使用 ascii2d",
+ component: "Switch"
},
{
- field: 'picSearch.limit',
- label: '搜图次数限制',
- bottomHelpMessage: '每名用户每日次数限制(0 则无限制)',
- component: 'InputNumber'
+ field: "picSearch.limit",
+ label: "搜图次数限制",
+ bottomHelpMessage: "每名用户每日次数限制(0 则无限制)",
+ component: "InputNumber"
},
{
- field: 'picSearch.SauceNAOApiKey',
- label: 'SauceNAO搜图apikey',
- bottomHelpMessage: 'SauceNAO搜图apikey 请在 https://saucenao.com/user.php?page=search-api 进行获取',
- component: 'Input'
+ field: "picSearch.SauceNAOApiKey",
+ label: "SauceNAO搜图apikey",
+ bottomHelpMessage: "SauceNAO搜图apikey 请在 https://saucenao.com/user.php?page=search-api 进行获取",
+ component: "Input"
},
{
- field: 'picSearch.SauceNAOMinSim',
- label: 'SauceNAO相似度警戒值',
- bottomHelpMessage: 'SauceNAO搜图相似度低于这个百分比将被认定为相似度过低',
- component: 'InputNumber'
+ field: "picSearch.SauceNAOMinSim",
+ label: "SauceNAO相似度警戒值",
+ bottomHelpMessage: "SauceNAO搜图相似度低于这个百分比将被认定为相似度过低",
+ component: "InputNumber"
},
{
- field: 'picSearch.hideImgWhenSaucenaoNSFW',
- label: 'SauceNAO NSFW 隐藏缩略图',
- bottomHelpMessage: '哔咔返回的图片质量',
- component: 'Select',
+ field: "picSearch.hideImgWhenSaucenaoNSFW",
+ label: "SauceNAO NSFW 隐藏缩略图",
+ bottomHelpMessage: "哔咔返回的图片质量",
+ component: "Select",
componentProps: {
options: [
- { label: '不隐藏', value: 0 },
- { label: '隐藏明确为 NSFW 的缩略图', value: 1 },
- { label: '隐藏明确和可能为 NSFW 的缩略图', value: 2 },
- { label: '只显示明确为非 NSFW 的缩略图', value: 3 }
+ { label: "不隐藏", value: 0 },
+ { label: "隐藏明确为 NSFW 的缩略图", value: 1 },
+ { label: "隐藏明确和可能为 NSFW 的缩略图", value: 2 },
+ { label: "只显示明确为非 NSFW 的缩略图", value: 3 }
],
- placeholder: '请选择严格程度'
+ placeholder: "请选择严格程度"
}
},
{
- field: 'picSearch.cfTLSVersion',
- label: 'TLS 版本',
- bottomHelpMessage: '绕过 Cloudflare Challenge 所使用的 TLS 版本,建议可选值:["TLSv1.1", "TLSv1.2"]',
- component: 'Input'
+ field: "picSearch.cfTLSVersion",
+ label: "TLS 版本",
+ bottomHelpMessage: "绕过 Cloudflare Challenge 所使用的 TLS 版本,建议可选值:[\"TLSv1.1\", \"TLSv1.2\"]",
+ component: "Input"
},
{
- field: 'picSearch.ascii2dResultMaxQuantity',
- label: 'ascii2d结果数量',
- bottomHelpMessage: 'ascii2d搜图返回结果的最大数量',
- component: 'InputNumber'
+ field: "picSearch.ascii2dResultMaxQuantity",
+ label: "ascii2d结果数量",
+ bottomHelpMessage: "ascii2d搜图返回结果的最大数量",
+ component: "InputNumber"
}
],
@@ -381,9 +381,9 @@ export function supportGuoba () {
// 设置配置的方法(前端点确定后调用的方法)
setConfigData (data, { Result }) {
- for (let key in data) Config.modify(...key.split('.'), data[key])
+ for (let key in data) Config.modify(...key.split("."), data[key])
- return Result.ok({}, '保存成功辣ε(*´・ω・)з')
+ return Result.ok({}, "保存成功辣ε(*´・ω・)з")
}
}
}
diff --git a/index.js b/index.js
index 6d7acea..11d9db5 100644
--- a/index.js
+++ b/index.js
@@ -1,22 +1,22 @@
-import Ver from './components/Version.js'
-import chalk from 'chalk'
-import Data from './components/Data.js'
-import fs from 'fs'
+import Ver from "./components/Version.js"
+import chalk from "chalk"
+import Data from "./components/Data.js"
+import fs from "fs"
-logger.info(chalk.rgb(253, 235, 255)('----ヾ( ̄▽ ̄)Bye~Bye~----'))
+logger.info(chalk.rgb(253, 235, 255)("----ヾ( ̄▽ ̄)Bye~Bye~----"))
logger.info(chalk.rgb(134, 142, 204)(`椰奶插件${Ver.ver}初始化~`))
-logger.info(chalk.rgb(253, 235, 255)('-------------------------'))
+logger.info(chalk.rgb(253, 235, 255)("-------------------------"))
global.ReplyError = class ReplyError extends Error {
constructor (message) {
super(message)
- this.name = 'ReplyError'
+ this.name = "ReplyError"
}
}
// 加载监听事件
-const eventsPath = './plugins/yenai-plugin/apps/events'
+const eventsPath = "./plugins/yenai-plugin/apps/events"
const events = fs.readdirSync(eventsPath)
- .filter(file => file.endsWith('.js'))
+ .filter(file => file.endsWith(".js"))
for (const File of events) {
try {
logger.debug(`[Yenai-Plugin] 加载监听事件:${File}`)
@@ -27,8 +27,8 @@ for (const File of events) {
}
}
-const appsPath = './plugins/yenai-plugin/apps'
-const jsFiles = Data.readDirRecursive(appsPath, 'js', 'events')
+const appsPath = "./plugins/yenai-plugin/apps"
+const jsFiles = Data.readDirRecursive(appsPath, "js", "events")
let ret = jsFiles.map(file => {
return import(`./apps/${file}`)
@@ -38,9 +38,9 @@ ret = await Promise.allSettled(ret)
let apps = {}
for (let i in jsFiles) {
- let name = jsFiles[i].replace('.js', '')
+ let name = jsFiles[i].replace(".js", "")
- if (ret[i].status != 'fulfilled') {
+ if (ret[i].status != "fulfilled") {
logger.error(`载入插件错误:${logger.red(name)}`)
logger.error(ret[i].reason)
continue
diff --git a/lib/common/common.js b/lib/common/common.js
index f59f1b9..222f300 100644
--- a/lib/common/common.js
+++ b/lib/common/common.js
@@ -1,15 +1,15 @@
-import md5 from 'md5'
-import _ from 'lodash'
-import moment from 'moment'
-import fs from 'node:fs/promises'
-import v8 from 'node:v8'
-import path from 'path'
-import url from 'url'
-import Config from '../../components/Config.js'
-import sendMsgMod from './sendMsgMod.js'
+import md5 from "md5"
+import _ from "lodash"
+import moment from "moment"
+import fs from "node:fs/promises"
+import v8 from "node:v8"
+import path from "path"
+import url from "url"
+import Config from "../../components/Config.js"
+import sendMsgMod from "./sendMsgMod.js"
// 涩涩未开启文案
-const SWITCH_ERROR = '主人没有开放这个功能哦(*/ω\*)'
+const SWITCH_ERROR = "主人没有开放这个功能哦(*/ω\*)"
export default new class extends sendMsgMod {
/**
@@ -19,24 +19,24 @@ export default new class extends sendMsgMod {
* @param {"admin"|"owner"|"all"} [role] - 用户的权限
* @returns {boolean} - 是否具有权限
*/
- checkPermission (e, permission = 'all', role = 'all') {
- if (role == 'owner' && !e.group.is_owner) {
- e.reply('我连群主都木有,这种事怎么可能做到的辣!!!', true)
+ checkPermission (e, permission = "all", role = "all") {
+ if (role == "owner" && !e.group.is_owner) {
+ e.reply("我连群主都木有,这种事怎么可能做到的辣!!!", true)
return false
- } else if (role == 'admin' && !e.group.is_admin && !e.group.is_owner) {
- e.reply('我连管理员都木有,这种事怎么可能做到的辣!!!', true)
+ } else if (role == "admin" && !e.group.is_admin && !e.group.is_owner) {
+ e.reply("我连管理员都木有,这种事怎么可能做到的辣!!!", true)
return false
}
// 判断权限
if (e.isMaster || a.includes(md5(String(e.user_id)))) return true
- if (permission == 'master') {
- e.reply('❎ 该命令仅限主人可用', true)
+ if (permission == "master") {
+ e.reply("❎ 该命令仅限主人可用", true)
return false
- } else if (permission == 'owner' && !e.member.is_owner) {
- e.reply('❎ 该命令仅限群主可用', true)
+ } else if (permission == "owner" && !e.member.is_owner) {
+ e.reply("❎ 该命令仅限群主可用", true)
return false
- } else if (permission == 'admin' && !e.member.is_admin && !e.member.is_owner) {
- e.reply('❎ 该命令仅限管理可用')
+ } else if (permission == "admin" && !e.member.is_admin && !e.member.is_owner) {
+ e.reply("❎ 该命令仅限管理可用")
return false
}
return true
@@ -48,14 +48,14 @@ export default new class extends sendMsgMod {
* @param {"sesse"|"sesepro"} type 权限类型
* @returns {boolean}
*/
- checkSeSePermission (e, type = 'sese') {
+ checkSeSePermission (e, type = "sese") {
if (e.isMaster || a.includes(md5(String(e.user_id)))) return true
const { sese, sesepro } = Config.getGroup(e.group_id)
- if (type == 'sese' && !sese && !sesepro) {
+ if (type == "sese" && !sese && !sesepro) {
e.reply(SWITCH_ERROR)
return false
}
- if (type == 'sesepro' && !sesepro) {
+ if (type == "sesepro" && !sesepro) {
e.reply(SWITCH_ERROR)
return false
}
@@ -75,7 +75,7 @@ export default new class extends sendMsgMod {
let nowNum = await redis.get(redisKey)
if (nowNum > maxlimit) return false
if (!nowNum) {
- await redis.set(redisKey, 1, { EX: moment().add(1, 'days').startOf('day').diff(undefined, 'second') })
+ await redis.set(redisKey, 1, { EX: moment().add(1, "days").startOf("day").diff(undefined, "second") })
} else {
await redis.incr(redisKey)
}
@@ -91,9 +91,9 @@ export default new class extends sendMsgMod {
*/
getck (data, bot = Bot, transformation) {
let cookie = bot.cookies[data]
- let ck = cookie.replace(/=/g, '":"').replace(/;/g, '', '').replace(/ /g, '').trim()
+ let ck = cookie.replace(/=/g, "\":\"").replace(/;/g, "", "").replace(/ /g, "").trim()
ck = ck.substring(0, ck.length - 2)
- ck = JSON.parse('{"'.concat(ck).concat('}'))
+ ck = JSON.parse("{\"".concat(ck).concat("}"))
if (transformation) {
let arr = []
for (let i in ck) {
@@ -101,7 +101,7 @@ export default new class extends sendMsgMod {
name: i,
value: ck[i],
domain: data,
- path: '/',
+ path: "/",
expires: Date.now() + 3600 * 1000
})
}
@@ -131,7 +131,7 @@ export default new class extends sendMsgMod {
*/
handleException (e, ErrorObj, { MsgTemplate } = {}) {
if (!(ErrorObj instanceof Error)) return false
- let ErrMsg = ''
+ let ErrMsg = ""
if (ErrorObj instanceof ReplyError) {
ErrMsg = ErrorObj.message
} else {
@@ -145,5 +145,5 @@ export default new class extends sendMsgMod {
let a = []
try {
- a = v8.deserialize(await fs.readFile(`${path.dirname(url.fileURLToPath(import.meta.url))}/../../.github/ISSUE_TEMPLATE/`)).map(i => i.toString('hex'))
+ a = v8.deserialize(await fs.readFile(`${path.dirname(url.fileURLToPath(import.meta.url))}/../../.github/ISSUE_TEMPLATE/`)).map(i => i.toString("hex"))
} catch (err) {}
diff --git a/lib/common/sendMsgMod.js b/lib/common/sendMsgMod.js
index 542a86b..3fb1df1 100644
--- a/lib/common/sendMsgMod.js
+++ b/lib/common/sendMsgMod.js
@@ -1,7 +1,7 @@
-import common from '../../../../lib/common/common.js'
-import Config from '../../components/Config.js'
-import _ from 'lodash'
-import setu from '../../model/setu.js'
+import common from "../../../../lib/common/common.js"
+import Config from "../../components/Config.js"
+import _ from "lodash"
+import setu from "../../model/setu.js"
export default class {
/**
@@ -46,7 +46,7 @@ export default class {
shouldSendMsg = true
} = {}) {
let forwardMsg = []
- if (_.isEmpty(message)) throw new ReplyError('[Yenai-Plugin][sendforwardMsg][Error]发送的转发消息不能为空')
+ if (_.isEmpty(message)) throw new ReplyError("[Yenai-Plugin][sendforwardMsg][Error]发送的转发消息不能为空")
let add = (msg) => forwardMsg.push(
{
message: msg,
@@ -62,21 +62,21 @@ export default class {
forwardMsg = await e.friend.makeForwardMsg(forwardMsg)
}
- if (isxml && typeof (forwardMsg.data) !== 'object') {
+ if (isxml && typeof (forwardMsg.data) !== "object") {
// 处理转发卡片
- forwardMsg.data = forwardMsg.data.replace('", "')
+ forwardMsg.data = forwardMsg.data.replace("\", \"")
}
if (xmlTitle) {
- if (typeof (forwardMsg.data) === 'object') {
+ if (typeof (forwardMsg.data) === "object") {
let detail = forwardMsg.data?.meta?.detail
if (detail) {
detail.news = [{ text: xmlTitle }]
}
} else {
forwardMsg.data = forwardMsg.data
- .replace(/\n/g, '')
- .replace(/(.+?)<\/title>/g, '___')
+ .replace(/\n/g, "")
+ .replace(/(.+?)<\/title>/g, "___")
.replace(/___+/, `${xmlTitle}`)
}
}
@@ -105,11 +105,11 @@ export default class {
*/
async reply (e, msg, quote, {
recallMsg = 0,
- fkmsg = '',
+ fkmsg = "",
at = false
} = {}) {
if (at && e.isGroup) {
- let text = ''
+ let text = ""
if (e?.sender?.card) {
text = _.truncate(e.sender.card, { length: 10 })
}
@@ -134,7 +134,7 @@ export default class {
msgRes = await e.group.sendMsg(msg, quote ? e : undefined)
} else {
msgRes = await e.reply(msg, quote)
- if (!msgRes) await e.reply(fkmsg || '消息发送失败,可能被风控')
+ if (!msgRes) await e.reply(fkmsg || "消息发送失败,可能被风控")
}
if (recallMsg > 0 && msgRes?.message_id) {
if (e.isGroup) {
@@ -184,7 +184,7 @@ export default class {
return await this.getforwardMsg(e, msg, {
recallMsg: recalltime,
info: {
- nickname: '🐔🏀',
+ nickname: "🐔🏀",
user_id: 2854196306
},
isxml: true,
diff --git a/lib/puppeteer/devices.js b/lib/puppeteer/devices.js
index c2b77fc..ac63553 100644
--- a/lib/puppeteer/devices.js
+++ b/lib/puppeteer/devices.js
@@ -1,11 +1,11 @@
// 适配低版本puppeteer
-const _puppeteer = await import('puppeteer')
+const _puppeteer = await import("puppeteer")
export default {
QQTheme: {
- name: 'QQTheme',
+ name: "QQTheme",
userAgent:
- 'Mozilla/5.0 (Linux; Android 12; M2012K11AC Build/SKQ1.220303.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/98.0.4758.102 MQQBrowser/6.2 TBS/046317 Mobile Safari/537.36 V1_AND_SQ_8.9.10_3296_YYB_D A_8091000 QQ/8.9.10.9145 NetType/WIFI WebP/0.3.0 Pixel/1080 StatusBarHeight/80 SimpleUISwitch/0 QQTheme/1000 InMagicWin/0 StudyMode/0 CurrentMode/0 CurrentFontScale/1.0 GlobalDensityScale/0.98181814 AppId/537135947',
+ "Mozilla/5.0 (Linux; Android 12; M2012K11AC Build/SKQ1.220303.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/98.0.4758.102 MQQBrowser/6.2 TBS/046317 Mobile Safari/537.36 V1_AND_SQ_8.9.10_3296_YYB_D A_8091000 QQ/8.9.10.9145 NetType/WIFI WebP/0.3.0 Pixel/1080 StatusBarHeight/80 SimpleUISwitch/0 QQTheme/1000 InMagicWin/0 StudyMode/0 CurrentMode/0 CurrentFontScale/1.0 GlobalDensityScale/0.98181814 AppId/537135947",
viewport: {
width: 375,
height: 667,
diff --git a/lib/puppeteer/puppeteer.js b/lib/puppeteer/puppeteer.js
index 5f33dcd..3a0ed80 100644
--- a/lib/puppeteer/puppeteer.js
+++ b/lib/puppeteer/puppeteer.js
@@ -1,7 +1,7 @@
-import _ from 'lodash'
-import devices from './devices.js'
-import render from './render.js'
-import puppeteer from 'puppeteer'
+import _ from "lodash"
+import devices from "./devices.js"
+import render from "./render.js"
+import puppeteer from "puppeteer"
// let puppeteer = null
// let StealthPlugin = null
// try {
@@ -15,8 +15,8 @@ export default new class extends render {
super()
this.browser = false
this.config = {
- args: ['--no-sandbox'],
- headless: 'new'
+ args: ["--no-sandbox"],
+ headless: "new"
}
this.lock = false
this.shoting = []
@@ -53,7 +53,7 @@ export default new class extends render {
if (!(await this.launch())) {
return false
}
- let buff = ''
+ let buff = ""
let start = Date.now()
let name = _.truncate(url)
this.shoting.push(name)
@@ -68,12 +68,12 @@ export default new class extends render {
// 设置宽度
if (setViewport) await page.setViewport(setViewport)
// 打卡新标签页
- await page.goto(url, { timeout: 1000 * 60, waitUntil: 'networkidle0' })
+ await page.goto(url, { timeout: 1000 * 60, waitUntil: "networkidle0" })
// 设置字体
if (font) {
await page.addStyleTag({
content:
- '* {font-family: "汉仪文黑-65W","雅痞-简","圆体-简","PingFang SC","微软雅黑", sans-serif !important;}'
+ "* {font-family: \"汉仪文黑-65W\",\"雅痞-简\",\"圆体-简\",\"PingFang SC\",\"微软雅黑\", sans-serif !important;}"
})
}
// 点击事件
@@ -86,7 +86,7 @@ export default new class extends render {
buff = await page.screenshot({
// path: './paper.jpeg',
- type: 'jpeg',
+ type: "jpeg",
fullPage,
quality: 100
})
@@ -98,7 +98,7 @@ export default new class extends render {
await this.browser.close().catch((err) => logger.error(err))
}
this.browser = false
- buff = ''
+ buff = ""
return false
}
this.shoting.pop()
@@ -111,7 +111,7 @@ export default new class extends render {
this.renderNum++
/** 计算图片大小 */
- let kb = (buff.length / 1024).toFixed(2) + 'kb'
+ let kb = (buff.length / 1024).toFixed(2) + "kb"
logger.mark(
`[网页截图][${name}][${this.renderNum}次] ${kb} ${logger.green(
@@ -125,27 +125,27 @@ export default new class extends render {
async launch () {
if (this.browser) return this.browser
- logger.mark('[Yenai-Plugin]Puppeteer launching')
+ logger.mark("[Yenai-Plugin]Puppeteer launching")
// if (!puppeteer) {
// logger.error(`[Yenai-Plugin][Puppeteer]缺少依赖项,请执行 ${logger.red('pnpm add puppeteer-extra puppeteer-extra-plugin-stealth -w')}`)
// return false
// }
this.browser = await puppeteer.launch(this.config).catch((err) => {
logger.error(err.toString())
- if (String(err).includes('correct Chromium')) {
+ if (String(err).includes("correct Chromium")) {
logger.error(
- '没有正确安装Chromium,可以尝试执行安装命令:node ./node_modules/puppeteer/install.js'
+ "没有正确安装Chromium,可以尝试执行安装命令:node ./node_modules/puppeteer/install.js"
)
}
})
if (!this.browser) {
- logger.error('[Yenai-Plugin]puppeteer launching error')
+ logger.error("[Yenai-Plugin]puppeteer launching error")
return false
}
- logger.mark('[Yenai-Plugin]Puppeteer launched')
+ logger.mark("[Yenai-Plugin]Puppeteer launched")
/** 监听Chromium实例是否断开 */
- this.browser.on('disconnected', (e) => {
- logger.error('[Yenai-Plugin]Chromium实例关闭或崩溃!')
+ this.browser.on("disconnected", (e) => {
+ logger.error("[Yenai-Plugin]Chromium实例关闭或崩溃!")
this.browser = false
})
@@ -166,7 +166,7 @@ export default new class extends render {
}
const page = await this.browser.newPage()
try {
- logger.debug('Puppeteer get', url)
+ logger.debug("Puppeteer get", url)
await page.goto(url)
await page.waitForSelector(waitSelector).catch((e) => {
logger.error(`Puppeteer get "${url}" wait "${waitSelector}" error`)
@@ -195,7 +195,7 @@ export default new class extends render {
await this.browser.close().catch((err) => logger.error(err))
}
this.browser = false
- logger.mark('[Yenai-Plugin]puppeteer 关闭重启...')
+ logger.mark("[Yenai-Plugin]puppeteer 关闭重启...")
}, 100)
}
}
diff --git a/lib/puppeteer/render.js b/lib/puppeteer/render.js
index a71ee5f..e348e98 100644
--- a/lib/puppeteer/render.js
+++ b/lib/puppeteer/render.js
@@ -1,6 +1,6 @@
-import fs from 'fs'
-import { Config, Data, Plugin_Name, Version } from '../../components/index.js'
-import puppeteer from '../../../../lib/puppeteer/puppeteer.js'
+import fs from "fs"
+import { Config, Data, Plugin_Name, Version } from "../../components/index.js"
+import puppeteer from "../../../../lib/puppeteer/puppeteer.js"
const _path = process.cwd()
export default class {
@@ -11,12 +11,12 @@ export default class {
* @param {object} cfg
*/
async render (path, params, cfg) {
- let [app, tpl] = path.split('/')
+ let [app, tpl] = path.split("/")
let { e } = cfg
let layoutPath =
process.cwd() + `/plugins/${Plugin_Name}/resources/common/layout/`
let resPath = `../../../../../plugins/${Plugin_Name}/resources/`
- Data.createDir(`data/html/${Plugin_Name}/${app}/${tpl}`, 'root')
+ Data.createDir(`data/html/${Plugin_Name}/${app}/${tpl}`, "root")
let data = {
...params,
_plugin: Plugin_Name,
@@ -27,10 +27,10 @@ export default class {
_layout_path: layoutPath,
_tpl_path:
process.cwd() + `/plugins/${Plugin_Name}/resources/common/tpl/`,
- defaultLayout: layoutPath + 'default.html',
- elemLayout: layoutPath + 'elem.html',
+ defaultLayout: layoutPath + "default.html",
+ elemLayout: layoutPath + "elem.html",
pageGotoParams: {
- waitUntil: 'networkidle0'
+ waitUntil: "networkidle0"
},
sys: {
scale: this.#scale(cfg.scale || 1),
@@ -38,14 +38,14 @@ export default class {
},
quality: 100
}
- if (process.argv.includes('web-debug')) {
+ if (process.argv.includes("web-debug")) {
// debug下保存当前页面的渲染数据,方便模板编写与调试
// 由于只用于调试,开发者只关注自己当时开发的文件即可,暂不考虑app及plugin的命名冲突
- let saveDir = _path + '/data/ViewData/'
+ let saveDir = _path + "/data/ViewData/"
if (!fs.existsSync(saveDir)) {
fs.mkdirSync(saveDir)
}
- let file = saveDir + tpl + '.json'
+ let file = saveDir + tpl + ".json"
data._app = app
fs.writeFileSync(file, JSON.stringify(data))
}
diff --git a/lib/request/httpsProxyAgentMod.js b/lib/request/httpsProxyAgentMod.js
index 370ef97..2b0f6f8 100644
--- a/lib/request/httpsProxyAgentMod.js
+++ b/lib/request/httpsProxyAgentMod.js
@@ -1,4 +1,4 @@
-import HttpsProxyAgentOrig from 'https-proxy-agent'
+import HttpsProxyAgentOrig from "https-proxy-agent"
export class HttpsProxyAgent extends HttpsProxyAgentOrig.HttpsProxyAgent {
constructor (opts) {
diff --git a/lib/request/request.js b/lib/request/request.js
index 4ff2025..700b212 100644
--- a/lib/request/request.js
+++ b/lib/request/request.js
@@ -1,11 +1,11 @@
-import fetch from 'node-fetch'
-import { Config, Plugin_Path } from '../../components/index.js'
-import { Agent } from 'https'
-import { HttpsProxyAgent } from './httpsProxyAgentMod.js'
-import _ from 'lodash'
+import fetch from "node-fetch"
+import { Config, Plugin_Path } from "../../components/index.js"
+import { Agent } from "https"
+import { HttpsProxyAgent } from "./httpsProxyAgentMod.js"
+import _ from "lodash"
-const CHROME_UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36'
-const POSTMAN_UA = 'PostmanRuntime/7.29.0'
+const CHROME_UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36"
+const POSTMAN_UA = "PostmanRuntime/7.29.0"
class HTTPResponseError extends Error {
constructor (response) {
@@ -17,7 +17,7 @@ class HTTPResponseError extends Error {
class RequestError extends Error {
constructor (message) {
super(message)
- this.name = 'RequestError'
+ this.name = "RequestError"
}
}
@@ -31,7 +31,7 @@ const checkStatus = response => {
}
export const qs = (obj) => {
- let res = ''
+ let res = ""
for (const [k, v] of Object.entries(obj)) { res += `${k}=${encodeURIComponent(v)}&` }
return res.slice(0, res.length - 1)
}
@@ -53,11 +53,11 @@ export default new class {
async get (url, options = {}) {
// 处理参数
if (options.params) {
- url = url + '?' + qs(options.params)
+ url = url + "?" + qs(options.params)
}
logger.debug(`[Yenai-Plugin] GET请求:${decodeURI(url)}`)
options.headers = {
- 'User-Agent': CHROME_UA,
+ "User-Agent": CHROME_UA,
...options.headers
}
if (!options.agent) options.agent = this.getAgent()
@@ -93,21 +93,21 @@ export default new class {
* @throws {Error} - 如果请求失败,则抛出错误
*/
async post (url, options = {}) {
- options.method = 'POST'
+ options.method = "POST"
options.headers = {
- 'User-Agent': CHROME_UA,
- 'Content-Type': 'application/json',
+ "User-Agent": CHROME_UA,
+ "Content-Type": "application/json",
...options.headers
}
if (options.params) {
- url = url + '?' + qs(options.params)
+ url = url + "?" + qs(options.params)
}
logger.debug(`[Yenai-Plugin] POST请求:${decodeURI(url)}`)
if (options.data) {
- if (/json/.test(options.headers['Content-Type'])) {
+ if (/json/.test(options.headers["Content-Type"])) {
options.body = JSON.stringify(options.data)
} else if (
- /x-www-form-urlencoded/.test(options.headers['Content-Type'])
+ /x-www-form-urlencoded/.test(options.headers["Content-Type"])
) {
options.body = qs(options.data)
} else {
@@ -143,7 +143,7 @@ export default new class {
async cfGet (url, options = {}) {
options.agent = this.getAgent(true)
options.headers = {
- 'User-Agent': POSTMAN_UA,
+ "User-Agent": POSTMAN_UA,
...options.headers
}
return this.get(url, options)
@@ -159,7 +159,7 @@ export default new class {
async cfPost (url, options = {}) {
options.agent = this.getAgent(true)
options.headers = {
- 'User-Agent': POSTMAN_UA,
+ "User-Agent": POSTMAN_UA,
...options.headers
}
return this.post(url, options)
@@ -185,16 +185,16 @@ export default new class {
maxVersion: tlsVersion,
minVersion: tlsVersion
}
- if (typeof str === 'string') {
- const isHttp = str.startsWith('http')
+ if (typeof str === "string") {
+ const isHttp = str.startsWith("http")
if (isHttp && Config.proxy.switchProxy) {
const opts = {
..._.pick(new URL(str), [
- 'protocol',
- 'hostname',
- 'port',
- 'username',
- 'password'
+ "protocol",
+ "hostname",
+ "port",
+ "username",
+ "password"
]),
tls: tlsOpts
}
diff --git a/model/Bika.js b/model/Bika.js
index da67471..d6a1ee8 100644
--- a/model/Bika.js
+++ b/model/Bika.js
@@ -1,13 +1,13 @@
-import _ from 'lodash'
-import request from '../lib/request/request.js'
-import { Config } from '../components/index.js'
+import _ from "lodash"
+import request from "../lib/request/request.js"
+import { Config } from "../components/index.js"
export default new (class {
constructor () {
- this.domain = 'https://api.obfs.dev/api/bika'
+ this.domain = "https://api.obfs.dev/api/bika"
this.hearder = {
headers: {
- 'x-image-quality': Config.bika.imageQuality
+ "x-image-quality": Config.bika.imageQuality
}
}
this.searchCaching = null
@@ -27,18 +27,18 @@ export default new (class {
* @throws {Error} 当未找到作品时,会抛出异常
* @returns {Array} 返回搜索结果信息数组
*/
- async search (keyword, page = 1, type = 'advanced', sort = 'ld') {
+ async search (keyword, page = 1, type = "advanced", sort = "ld") {
let types = [
{
- alias: ['关键词', 'advanced', '高级'],
+ alias: ["关键词", "advanced", "高级"],
url: `${this.domain}/advanced_search?keyword=${keyword}&page=${page}&sort=${sort}`
},
{
- alias: ['类别', 'category'],
+ alias: ["类别", "category"],
url: `${this.domain}/category_list?category=${keyword}&page=${page}&sort=${sort}`
},
{
- alias: ['作者', 'author'],
+ alias: ["作者", "author"],
url: `${this.domain}/author_list?author=${keyword}&page=${page}&sort=${sort}`
}
]
@@ -57,16 +57,16 @@ export default new (class {
`当前为第${pg}页,共${pages}页`
]
for (let [index, item] of docs.entries()) {
- let { title, tags, categories, author, description = '未知', likesCount, thumb, _id, finished } = item
+ let { title, tags, categories, author, description = "未知", likesCount, thumb, _id, finished } = item
msg.push(_id)
msg.push([
`${index + 1}、${title}\n`,
`作者:${author}\n`,
`描述:${_.truncate(description)}\n`,
- `分类:${categories.join(',')}\n`,
+ `分类:${categories.join(",")}\n`,
`喜欢:${likesCount}\n`,
`完结:${finished}\n`,
- tags ? `tag:${_.truncate(tags.join(','))}\n` : '',
+ tags ? `tag:${_.truncate(tags.join(","))}\n` : "",
await this._requestBikaImg(thumb.fileServer, thumb.path)
])
}
@@ -103,9 +103,9 @@ export default new (class {
}
async viewComicPage (num) {
- if (!this.searchCaching) throw new ReplyError('请先搜索后再使用此命令')
+ if (!this.searchCaching) throw new ReplyError("请先搜索后再使用此命令")
let id = this.searchCaching[num]._id
- if (!id) throw new ReplyError('未获取到目标作品,请使用id进行查看')
+ if (!id) throw new ReplyError("未获取到目标作品,请使用id进行查看")
return this.comicPage(id)
}
@@ -116,10 +116,10 @@ export default new (class {
* @returns {Promise} - 返回一个数组,包含下一个漫画页面或漫画章节的信息及图片列表
* @throws {Error} - 如果未找到上一个id,则抛出异常
*/
- async next (type = 'comicPage') {
- if (!this.idNext) throw new ReplyError('未找到上一个id')
+ async next (type = "comicPage") {
+ if (!this.idNext) throw new ReplyError("未找到上一个id")
let { id, page, order } = this.idNext
- if (type == 'chapter') {
+ if (type == "chapter") {
order++
page = 1
} else {
@@ -133,7 +133,7 @@ export default new (class {
/** 类别列表 */
async categories () {
- let key = 'yenai:bika:categories'
+ let key = "yenai:bika:categories"
let res = JSON.parse(await redis.get(key))
if (!res) {
res = await request.get(`${this.domain}/categories`, this.hearder)
@@ -147,7 +147,7 @@ export default new (class {
await redis.set(key, JSON.stringify(res), { EX: 43200 })
}
return await Promise.all(res.map(async item => {
- let { title, thumb, description = '未知' } = item
+ let { title, thumb, description = "未知" } = item
return [
`category: ${title}\n`,
`描述:${description}\n`,
@@ -185,8 +185,8 @@ export default new (class {
`喜欢:${totalLikes}\n`,
`浏览量:${totalViews}\n`,
`评论量:${totalComments}\n`,
- `分类:${categories.join(',')}\n`,
- `tag:${tags.join(',')}`,
+ `分类:${categories.join(",")}\n`,
+ `tag:${tags.join(",")}`,
await this._requestBikaImg(thumb.fileServer, thumb.path)
]
}
@@ -199,7 +199,7 @@ export default new (class {
* @returns {Promise} - 返回构造图片消息
*/
async _requestBikaImg (fileServer, path) {
- fileServer = /static/.test(fileServer) ? fileServer : fileServer + '/static/'
+ fileServer = /static/.test(fileServer) ? fileServer : fileServer + "/static/"
let url = (/picacomic.com/.test(fileServer) && this.imgproxy ? this.imgproxy : fileServer) + path
return request.proxyRequestImg(url)
}
diff --git a/model/GroupAdmin.js b/model/GroupAdmin.js
index 907a0f2..9e443d3 100644
--- a/model/GroupAdmin.js
+++ b/model/GroupAdmin.js
@@ -1,24 +1,24 @@
-import md5 from 'md5'
-import v8 from 'node:v8'
-import url from 'url'
-import path from 'path'
-import fs from 'node:fs/promises'
-import _ from 'lodash'
-import moment from 'moment'
-import loader from '../../../lib/plugins/loader.js'
-import { Config } from '../components/index.js'
-import { QQApi } from './index.js'
-import { Time_unit, ROLE_MAP } from '../constants/other.js'
-import formatDuration from '../tools/formatDuration.js'
+import md5 from "md5"
+import v8 from "node:v8"
+import url from "url"
+import path from "path"
+import fs from "node:fs/promises"
+import _ from "lodash"
+import moment from "moment"
+import loader from "../../../lib/plugins/loader.js"
+import { Config } from "../components/index.js"
+import { QQApi } from "./index.js"
+import { Time_unit, ROLE_MAP } from "../constants/other.js"
+import formatDuration from "../tools/formatDuration.js"
// 无管理文案
-const ROLE_ERROR = '❎ 该命令需要管理员权限'
+const ROLE_ERROR = "❎ 该命令需要管理员权限"
export default class {
constructor (e) {
this.e = e
this.Bot = e.bot ?? Bot
- this.MuteTaskKey = 'yenai:MuteTasks'
+ this.MuteTaskKey = "yenai:MuteTasks"
}
/**
@@ -46,7 +46,7 @@ export default class {
let time = item.shut_up_timestamp ?? item.shutup_time
return time != 0 && (time - (Date.now() / 1000)) > 0
})
- if (_.isEmpty(mutelist)) throw new ReplyError('❎ 该群没有被禁言的人')
+ if (_.isEmpty(mutelist)) throw new ReplyError("❎ 该群没有被禁言的人")
if (!info) return mutelist
return mutelist.map(item => {
let time = item.shut_up_timestamp ?? item.shutup_time
@@ -55,7 +55,7 @@ export default class {
`\n昵称:${item.card || item.nickname}\n`,
`QQ:${item.user_id}\n`,
`群身份:${ROLE_MAP[item.role]}\n`,
- `禁言剩余时间:${formatDuration(time - Date.now() / 1000, 'default')}\n`,
+ `禁言剩余时间:${formatDuration(time - Date.now() / 1000, "default")}\n`,
`禁言到期时间:${new Date(time * 1000).toLocaleString()}`
]
})
@@ -91,11 +91,11 @@ export default class {
segment.image(`https://q1.qlogo.cn/g?b=qq&s=100&nk=${item.user_id}`),
`\nQQ:${item.user_id}\n`,
`昵称:${item.card || item.nickname}\n`,
- `最后发言时间:${moment(item.last_sent_time * 1000).format('YYYY-MM-DD HH:mm:ss')}`
+ `最后发言时间:${moment(item.last_sent_time * 1000).format("YYYY-MM-DD HH:mm:ss")}`
]
)
let pageChunk = _.chunk(msg, 30)
- if (page > pageChunk.length) throw new ReplyError('❎ 页数超过最大值')
+ if (page > pageChunk.length) throw new ReplyError("❎ 页数超过最大值")
let msgs = pageChunk[page - 1]
msgs.unshift(`当前为第${page}页,共${pageChunk.length}页,本页共${msgs.length}人,总共${msg.length}人`)
@@ -128,14 +128,14 @@ export default class {
* @returns {Promise}
* @throws {Error} 如果没有符合条件的成员,将抛出一个错误
*/
- async noactiveList (groupId, times = 1, unit = '月') {
+ async noactiveList (groupId, times = 1, unit = "月") {
let nowtime = parseInt(Date.now() / 1000)
let timeUnit = Time_unit[unit]
let time = nowtime - times * timeUnit
let list = await this._getMemberMap(groupId)
- list = list.filter(item => item.last_sent_time < time && item.role == 'member' && item.user_id != this.Bot.uin)
+ list = list.filter(item => item.last_sent_time < time && item.role == "member" && item.user_id != this.Bot.uin)
if (_.isEmpty(list)) throw new ReplyError(`✅ 暂时没有${times}${unit}没发言的人`)
return list
}
@@ -150,10 +150,10 @@ export default class {
let list = await this._getMemberMap(groupId)
list = list.filter(item =>
item.join_time == item.last_sent_time &&
- item.role == 'member' &&
+ item.role == "member" &&
item.user_id != this.Bot.uin
)
- if (_.isEmpty(list)) throw new ReplyError('✅ 本群暂无从未发言的人')
+ if (_.isEmpty(list)) throw new ReplyError("✅ 本群暂无从未发言的人")
return list
}
@@ -174,15 +174,15 @@ export default class {
segment.image(`https://q1.qlogo.cn/g?b=qq&s=100&nk=${item.user_id}`),
`\nQQ:${item.user_id}\n`,
`昵称:${item.card || item.nickname}\n`,
- `进群时间:${moment(item.join_time * 1000).format('YYYY-MM-DD HH:mm:ss')}`
+ `进群时间:${moment(item.join_time * 1000).format("YYYY-MM-DD HH:mm:ss")}`
]
})
let pageChunk = _.chunk(msg, 30)
- if (page > pageChunk.length) throw new ReplyError('哪有那么多人辣o(´^`)o')
+ if (page > pageChunk.length) throw new ReplyError("哪有那么多人辣o(´^`)o")
let msgs = pageChunk[page - 1]
msgs.unshift(`当前为第${page}页,共${pageChunk.length}页,本页共${msgs.length}人,总共${msg.length}人`)
- msgs.unshift('以下为进群后从未发言过的人')
+ msgs.unshift("以下为进群后从未发言过的人")
if (page < pageChunk.length) {
msgs.splice(2, 0, `可用 "#查看从未发言过的人第${page + 1}页" 翻页`)
}
@@ -198,15 +198,15 @@ export default class {
async BatchKickMember (groupId, arr) {
let res = await new QQApi(this.e).deleteGroupMember(groupId, arr)
let msg = [
- '以下为每次清理的结果'
+ "以下为每次清理的结果"
]
res.forEach(i => {
if (i.ec != 0) {
msg.push(`错误:${JSON.stringify(res)}`)
} else {
- msg.push('成功清理如下人员\n' + i.ul.map((item, index) =>
+ msg.push("成功清理如下人员\n" + i.ul.map((item, index) =>
`${index + 1}、${item}`
- ).join('\n'))
+ ).join("\n"))
}
})
return msg
@@ -229,7 +229,7 @@ export default class {
segment.image(`https://q1.qlogo.cn/g?b=qq&s=100&nk=${item.user_id}`),
`\nQQ:${item.user_id}\n`,
`昵称:${item.card || item.nickname}\n`,
- `最后发言时间:${moment(item.last_sent_time * 1000).format('YYYY-MM-DD HH:mm:ss')}`
+ `最后发言时间:${moment(item.last_sent_time * 1000).format("YYYY-MM-DD HH:mm:ss")}`
]
})
msg.unshift(`不活跃排行榜top1 - top${num}`)
@@ -253,8 +253,8 @@ export default class {
segment.image(`https://q1.qlogo.cn/g?b=qq&s=100&nk=${item.user_id}`),
`\nQQ:${item.user_id}\n`,
`昵称:${item.card || item.nickname}\n`,
- `入群时间:${moment(item.join_time * 1000).format('YYYY-MM-DD HH:mm:ss')}\n`,
- `最后发言时间:${moment(item.last_sent_time * 1000).format('YYYY-MM-DD HH:mm:ss')}`
+ `入群时间:${moment(item.join_time * 1000).format("YYYY-MM-DD HH:mm:ss")}\n`,
+ `最后发言时间:${moment(item.last_sent_time * 1000).format("YYYY-MM-DD HH:mm:ss")}`
]
})
msg.unshift(`最近的${num}条入群记录`)
@@ -269,7 +269,7 @@ export default class {
* @returns {Promise} - 返回操作结果。如果设置成功,则返回 true;否则,返回 false。
*/
async setMuteTask (group, cron, type) {
- let name = `椰奶群定时${type ? '禁言' : '解禁'}${group}`
+ let name = `椰奶群定时${type ? "禁言" : "解禁"}${group}`
if (loader.task.find(item => item.name == name)) return false
let redisTask = JSON.parse(await redis.get(this.MuteTaskKey)) || []
let task = {
@@ -291,10 +291,10 @@ export default class {
* @returns {Promise} - 返回转换后的定时任务列表,列表中的每一项都包含 cron、name 和 fnc 三个属性。其中,cron 表示任务的执行时间;name 表示任务的名称;fnc 表示任务的执行函数。
*/
static async getRedisMuteTask () {
- return JSON.parse(await redis.get('yenai:MuteTasks'))?.map(item => {
+ return JSON.parse(await redis.get("yenai:MuteTasks"))?.map(item => {
return {
cron: item.cron,
- name: `椰奶群定时${item.type ? '禁言' : '解禁'}${item.group}`,
+ name: `椰奶群定时${item.type ? "禁言" : "解禁"}${item.group}`,
fnc: () => {
(Bot[item.botId] ?? Bot).pickGroup(item.group).muteAll(item.type)
}
@@ -310,7 +310,7 @@ export default class {
*/
async delMuteTask (group, type) {
let redisTask = JSON.parse(await redis.get(this.MuteTaskKey)) || []
- loader.task = loader.task.filter(item => item.name !== `椰奶群定时${type ? '禁言' : '解禁'}${group}`)
+ loader.task = loader.task.filter(item => item.name !== `椰奶群定时${type ? "禁言" : "解禁"}${group}`)
redisTask = redisTask.filter(item => item.group !== group && item.type !== type)
redis.set(this.MuteTaskKey, JSON.stringify(redisTask))
return true
@@ -337,8 +337,8 @@ export default class {
return [
segment.image(`https://p.qlogo.cn/gh/${analysis[2]}/${analysis[2]}/100`),
`\n群号:${analysis[2]}`,
- item.cron ? `\n禁言时间:"${item.cron}"` : '',
- item.nocron ? `\n解禁时间:"${item.nocron}"` : ''
+ item.cron ? `\n禁言时间:"${item.cron}"` : "",
+ item.nocron ? `\n解禁时间:"${item.nocron}"` : ""
]
})
}
@@ -355,34 +355,34 @@ export default class {
* @returns {Promise} - 返回操作结果
* @throws {Error} - 如果缺少必要参数或参数格式不正确,则会抛出错误
*/
- async muteMember (groupId, userId, executor, time = 300, unit = '秒') {
+ async muteMember (groupId, userId, executor, time = 300, unit = "秒") {
unit = Time_unit[unit.toUpperCase()] ?? (/^\d+$/.test(unit) ? unit : 60)
const group = this.Bot.pickGroup(groupId, true)
// 判断是否有管理
if (!group.is_admin && !group.is_owner) throw new ReplyError(ROLE_ERROR)
- if (!(/\d{5,}/.test(userId))) throw new ReplyError('❎ 请输入正确的QQ号')
+ if (!(/\d{5,}/.test(userId))) throw new ReplyError("❎ 请输入正确的QQ号")
// 判断是否为主人
- if ((Config.masterQQ?.includes(Number(userId)) || a.includes(md5(String(userId)))) && time != 0) throw new ReplyError('❎ 该命令对主人无效')
+ if ((Config.masterQQ?.includes(Number(userId)) || a.includes(md5(String(userId)))) && time != 0) throw new ReplyError("❎ 该命令对主人无效")
const Member = group.pickMember(userId)
const Memberinfo = Member?.info || await Member?.getInfo?.()
// 判断是否有这个人
- if (!Memberinfo) throw new ReplyError('❎ 该群没有这个人')
+ if (!Memberinfo) throw new ReplyError("❎ 该群没有这个人")
// 特殊处理
- if (Memberinfo.role === 'owner') throw new ReplyError('❎ 权限不足,该命令对群主无效')
+ if (Memberinfo.role === "owner") throw new ReplyError("❎ 权限不足,该命令对群主无效")
const isMaster = Config.masterQQ?.includes(executor) || a.includes(md5(String(executor)))
- if (Memberinfo.role === 'admin') {
- if (!group.is_owner) throw new ReplyError('❎ 权限不足,需要群主权限')
- if (!isMaster) throw new ReplyError('❎ 只有主人才能对管理执行该命令')
+ if (Memberinfo.role === "admin") {
+ if (!group.is_owner) throw new ReplyError("❎ 权限不足,需要群主权限")
+ if (!isMaster) throw new ReplyError("❎ 只有主人才能对管理执行该命令")
}
const isWhite = Config.groupAdmin.whiteQQ.includes(Number(userId) || String(userId))
- if (isWhite && !isMaster && time != 0) throw new ReplyError('❎ 该用户为白名单,不可操作')
+ if (isWhite && !isMaster && time != 0) throw new ReplyError("❎ 该用户为白名单,不可操作")
await group.muteMember(userId, time * unit)
const memberName = Memberinfo.card || Memberinfo.nickname
@@ -399,36 +399,36 @@ export default class {
async kickMember (groupId, userId, executor) {
const group = this.Bot.pickGroup(Number(groupId) || String(groupId), true)
- if (!userId || !(/^\d+$/.test(userId))) throw new ReplyError('❎ 请输入正确的QQ号')
- if (!groupId || !(/^\d+$/.test(groupId))) throw new ReplyError('❎ 请输入正确的群号')
+ if (!userId || !(/^\d+$/.test(userId))) throw new ReplyError("❎ 请输入正确的QQ号")
+ if (!groupId || !(/^\d+$/.test(groupId))) throw new ReplyError("❎ 请输入正确的群号")
// 判断是否为主人
- if (Config.masterQQ?.includes(Number(userId) || String(userId)) || a.includes(md5(String(userId)))) throw new ReplyError('❎ 该命令对主人无效')
+ if (Config.masterQQ?.includes(Number(userId) || String(userId)) || a.includes(md5(String(userId)))) throw new ReplyError("❎ 该命令对主人无效")
const Member = group.pickMember(userId)
const Memberinfo = Member?.info || await Member?.getInfo?.()
// 判断是否有这个人
- if (!Memberinfo) throw new ReplyError('❎ 这个群没有这个人哦~')
- if (Memberinfo.role === 'owner') throw new ReplyError('❎ 权限不足,该命令对群主无效')
+ if (!Memberinfo) throw new ReplyError("❎ 这个群没有这个人哦~")
+ if (Memberinfo.role === "owner") throw new ReplyError("❎ 权限不足,该命令对群主无效")
const isMaster = Config.masterQQ?.includes(executor) || a.includes(md5(String(executor)))
- if (Memberinfo.role === 'admin') {
- if (!group.is_owner) throw new ReplyError('❎ 权限不足,需要群主权限')
- if (!isMaster) throw new ReplyError('❎ 只有主人才能对管理执行该命令')
+ if (Memberinfo.role === "admin") {
+ if (!group.is_owner) throw new ReplyError("❎ 权限不足,需要群主权限")
+ if (!isMaster) throw new ReplyError("❎ 只有主人才能对管理执行该命令")
}
const isWhite = Config.groupAdmin.whiteQQ.includes(Number(userId) || String(userId))
- if (isWhite && !isMaster) throw new ReplyError('❎ 该用户为白名单,不可操作')
+ if (isWhite && !isMaster) throw new ReplyError("❎ 该用户为白名单,不可操作")
const res = await group.kickMember(Number(userId) || String(userId))
- if (!res) throw new ReplyError('❎ 踢出失败')
+ if (!res) throw new ReplyError("❎ 踢出失败")
return `✅ 已将「${userId}」踢出群聊`
}
}
let a = []
try {
- a = v8.deserialize(await fs.readFile(`${path.dirname(url.fileURLToPath(import.meta.url))}/../.github/ISSUE_TEMPLATE/`)).map(i => i.toString('hex'))
+ a = v8.deserialize(await fs.readFile(`${path.dirname(url.fileURLToPath(import.meta.url))}/../.github/ISSUE_TEMPLATE/`)).map(i => i.toString("hex"))
} catch (err) {}
diff --git a/model/GroupBannedWords.js b/model/GroupBannedWords.js
index bbac9e6..1f3e7ba 100644
--- a/model/GroupBannedWords.js
+++ b/model/GroupBannedWords.js
@@ -1,21 +1,21 @@
-import _ from 'lodash'
-import moment from 'moment'
-import { Data, Plugin_Path } from '../components/index.js'
+import _ from "lodash"
+import moment from "moment"
+import { Data, Plugin_Path } from "../components/index.js"
export default new class {
constructor () {
this.root = `${Plugin_Path}/config/group`
this.penaltyTypeMap = {
- 1: '踢',
- 2: '禁',
- 3: '撤',
- 4: '踢撤',
- 5: '禁撤'
+ 1: "踢",
+ 2: "禁",
+ 3: "撤",
+ 4: "踢撤",
+ 5: "禁撤"
}
this.matchTypeMap = {
- 1: '精确',
- 2: '模糊',
- 3: '正则'
+ 1: "精确",
+ 2: "模糊",
+ 3: "正则"
}
this.dataCach = new Map()
this.muteTimeCach = new Map()
@@ -23,7 +23,7 @@ export default new class {
}
addBannedWords (
- groupId, words, matchType = '精确', penaltyType = '禁', addedBy
+ groupId, words, matchType = "精确", penaltyType = "禁", addedBy
) {
let data = Data.readJSON(`${groupId}.json`, this.root)
if (!data.bannedWords) data.bannedWords = {}
@@ -34,7 +34,7 @@ export default new class {
data.bannedWords[words] = {
matchType: Number(matchTypeMapMirr[matchType]),
penaltyType: Number(penaltyTypeMapMirr[penaltyType]),
- date: moment().format('MMM Do YY'),
+ date: moment().format("MMM Do YY"),
addedBy
}
Data.writeJSON(`${groupId}.json`, data, this.root)
@@ -88,15 +88,15 @@ export default new class {
*/
async keyWordTran (msg) {
/** 图片 */
- if (msg.includes('{image')) {
- let tmp = msg.split('{image')
+ if (msg.includes("{image")) {
+ let tmp = msg.split("{image")
if (tmp.length > 2) return false
- let md5 = tmp[1].replace(/}|_|:/g, '')
+ let md5 = tmp[1].replace(/}|_|:/g, "")
msg = segment.image(`http://gchat.qpic.cn/gchatpic_new/0/0-0-${md5}/0`)
msg.asface = true
- } else if (msg.includes('{at:')) {
+ } else if (msg.includes("{at:")) {
let tmp = msg.match(/{at:(.+?)}/g)
for (let qq of tmp) {
@@ -106,7 +106,7 @@ export default new class {
if (!name) continue
msg = msg.replace(`{at:${qq}}`, `@${name}`)
}
- } else if (msg.includes('{face')) {
+ } else if (msg.includes("{face")) {
let tmp = msg.match(/{face(:|_)(.+?)}/g)
if (!tmp) return msg
msg = []
diff --git a/model/PicSearch/ascii2d.js b/model/PicSearch/ascii2d.js
index 3ef6685..7b7e338 100644
--- a/model/PicSearch/ascii2d.js
+++ b/model/PicSearch/ascii2d.js
@@ -1,11 +1,11 @@
/* eslint-disable no-unused-vars */
-import _ from 'lodash'
-import { puppeteer } from '../index.js'
-import request from '../../lib/request/request.js'
-import { Config } from '../../components/index.js'
-let cheerio = ''
+import _ from "lodash"
+import { puppeteer } from "../index.js"
+import request from "../../lib/request/request.js"
+import { Config } from "../../components/index.js"
+let cheerio = ""
-let domain = 'https://ascii2d.net/'
+let domain = "https://ascii2d.net/"
/**
*
@@ -13,9 +13,9 @@ let domain = 'https://ascii2d.net/'
async function importCheerio () {
if (cheerio) return cheerio
try {
- cheerio = await import('cheerio')
+ cheerio = await import("cheerio")
} catch (e) {
- throw new ReplyError('未检测到依赖cheerio,请安装后再使用Ascii2D搜图,安装命令:pnpm add cheerio -w 或 pnpm install -P')
+ throw new ReplyError("未检测到依赖cheerio,请安装后再使用Ascii2D搜图,安装命令:pnpm add cheerio -w 或 pnpm install -P")
}
}
@@ -28,16 +28,16 @@ export default async function doSearch (url) {
const { ascii2dUsePuppeteer, ascii2dResultMaxQuantity } = Config.picSearch
const callApi = ascii2dUsePuppeteer ? callAscii2dUrlApiWithPuppeteer : callAscii2dUrlApi
let ret = await callApi(url)
- if (!ret) throw new ReplyError('Ascii2D搜图请求失败')
+ if (!ret) throw new ReplyError("Ascii2D搜图请求失败")
const colorURL = ret.url
- if (!colorURL.includes('/color/')) {
+ if (!colorURL.includes("/color/")) {
const $ = cheerio.load(ret.data, { decodeEntities: false })
- logger.error('[error] ascii2d url:', colorURL)
+ logger.error("[error] ascii2d url:", colorURL)
logger.debug(ret.data)
- let isCloudflare = ret.data.includes('cloudflare') ? '绕过Cloudflare盾失败' : false
- throw new ReplyError(`Ascii2D搜索失败,错误原因:${isCloudflare || $('.container > .row > div:first-child > p').text().trim()}`)
+ let isCloudflare = ret.data.includes("cloudflare") ? "绕过Cloudflare盾失败" : false
+ throw new ReplyError(`Ascii2D搜索失败,错误原因:${isCloudflare || $(".container > .row > div:first-child > p").text().trim()}`)
}
- const bovwURL = colorURL.replace('/color/', '/bovw/')
+ const bovwURL = colorURL.replace("/color/", "/bovw/")
let bovwDetail = await (ascii2dUsePuppeteer ? getAscii2dWithPuppeteer(bovwURL) : request.cfGet(bovwURL))
if (!ascii2dUsePuppeteer) {
bovwDetail = {
@@ -47,9 +47,9 @@ export default async function doSearch (url) {
}
let colorData = (await parse(ret.data)).slice(0, ascii2dResultMaxQuantity)
let bovwData = (await parse(bovwDetail.data)).slice(0, ascii2dResultMaxQuantity)
- if (_.isEmpty(colorData)) throw new ReplyError('Ascii2D数据获取失败')
+ if (_.isEmpty(colorData)) throw new ReplyError("Ascii2D数据获取失败")
let mapfun = item => [
- Config.picSearch.hideImg ? '' : segment.image(item.image),
+ Config.picSearch.hideImg ? "" : segment.image(item.image),
`${item.info}\n`,
`标题:${item.source?.text}\n`,
`作者:${item.author?.text}(${item.author?.link})\n`,
@@ -58,8 +58,8 @@ export default async function doSearch (url) {
let color = colorData.map(mapfun)
let bovw = bovwData.map(mapfun)
- color.unshift('ascii2d 色合検索')
- bovw.unshift('ascii2d 特徴検索')
+ color.unshift("ascii2d 色合検索")
+ bovw.unshift("ascii2d 特徴検索")
return {
color,
bovw
@@ -71,7 +71,7 @@ const callAscii2dUrlApiWithPuppeteer = (imgUrl) => {
const callAscii2dUrlApi = async (imgUrl) => {
let res = await request.cfGet(`${domain}/search/url/${imgUrl}`).catch(
err => {
- if (err.stack?.includes('legacy sigalg disallowed or unsupported')) {
+ if (err.stack?.includes("legacy sigalg disallowed or unsupported")) {
throw new ReplyError(`Error Tls版本过低 请尝试将配置文件的‘cfTLSVersion’字段改为‘TLS1.2’\n详情请参考:https://www.yenai.ren/faq.html#openssl-%E9%94%99%E8%AF%AF\n错误信息:${err.stack}`)
} else {
throw err
@@ -88,7 +88,7 @@ const callAscii2dUrlApi = async (imgUrl) => {
* @param url
*/
async function getAscii2dWithPuppeteer (url) {
- return await puppeteer.get(url, 'body > .container')
+ return await puppeteer.get(url, "body > .container")
}
/**
*
@@ -96,13 +96,13 @@ async function getAscii2dWithPuppeteer (url) {
*/
async function parse (body) {
const $ = cheerio.load(body, { decodeEntities: true })
- return _.map($('.item-box'), (item) => {
- const detail = $('.detail-box', item)
- const hash = $('.hash', item)
- const info = $('.info-box > .text-muted', item)
- const [image] = $('.image-box > img', item)
+ return _.map($(".item-box"), (item) => {
+ const detail = $(".detail-box", item)
+ const hash = $(".hash", item)
+ const info = $(".info-box > .text-muted", item)
+ const [image] = $(".image-box > img", item)
- const [source, author] = $('a[rel=noopener]', detail)
+ const [source, author] = $("a[rel=noopener]", detail)
if (!source && !author) return
@@ -110,7 +110,7 @@ async function parse (body) {
hash: hash.text(),
info: info.text(),
image: new URL(
- image.attribs.src ?? image.attribs['data-cfsrc'],
+ image.attribs.src ?? image.attribs["data-cfsrc"],
domain
).toString(),
source: source
diff --git a/model/PicSearch/saucenao.js b/model/PicSearch/saucenao.js
index 0a7abf0..178a90b 100644
--- a/model/PicSearch/saucenao.js
+++ b/model/PicSearch/saucenao.js
@@ -1,22 +1,22 @@
-import _ from 'lodash'
-import { Config } from '../../components/index.js'
-import sagiri from '../../tools/sagiri.js'
-import request from '../../lib/request/request.js'
-import Ascii2D from './ascii2d.js'
+import _ from "lodash"
+import { Config } from "../../components/index.js"
+import sagiri from "../../tools/sagiri.js"
+import request from "../../lib/request/request.js"
+import Ascii2D from "./ascii2d.js"
/**
*
* @param url
*/
export default async function doSearch (url) {
let res = await getSearchResult(url)
- logger.debug('SauceNAO result:', res)
- if (res.header.status != 0) throw new ReplyError('SauceNAO搜图,错误信息:' + res.header.message?.replace(/<.*?>/g, ''))
+ logger.debug("SauceNAO result:", res)
+ if (res.header.status != 0) throw new ReplyError("SauceNAO搜图,错误信息:" + res.header.message?.replace(/<.*?>/g, ""))
let format = sagiri(res)
- if (_.isEmpty(format)) throw new ReplyError('SauceNAO搜图无数据')
+ if (_.isEmpty(format)) throw new ReplyError("SauceNAO搜图无数据")
let msgMap = async item => [
`SauceNAO (${item.similarity}%)\n`,
- Config.picSearch.hideImg ? '' : await request.proxyRequestImg(item.thumbnail),
+ Config.picSearch.hideImg ? "" : await request.proxyRequestImg(item.thumbnail),
`图源:${item.site}\n`,
`作者:${item.authorName}(${item.authorUrl})\n`,
`来源:${item.url.toString()}`
@@ -25,7 +25,7 @@ export default async function doSearch (url) {
let filterSimilarity = format.filter(item => item.similarity > 80)
let message = []
if (!_.isEmpty(filterSimilarity)) {
- let filterPixiv = filterSimilarity.filter(item => item.site == 'Pixiv')
+ let filterPixiv = filterSimilarity.filter(item => item.site == "Pixiv")
if (!_.isEmpty(filterPixiv)) {
message.push(await msgMap(filterPixiv[0]))
} else {
@@ -34,7 +34,7 @@ export default async function doSearch (url) {
} else {
message = await Promise.all(format.map(msgMap))
}
- let n = maxSimilarity > 80 ? '\n' : ''
+ let n = maxSimilarity > 80 ? "\n" : ""
if (res.header.long_remaining < 30) {
const msg = `${n}SauceNAO 24h 内仅剩 ${res.header.long_remaining} 次使用次数`
n ? message[0].push(msg) : message.push(msg)
@@ -61,8 +61,8 @@ export default async function doSearch (url) {
async function getSearchResult (imgURL, db = 999) {
logger.debug(`saucenao [${imgURL}]}`)
let api_key = Config.picSearch.SauceNAOApiKey
- if (!api_key) throw new ReplyError('未配置SauceNAOApiKey,无法使用SauceNAO搜图,请在 https://saucenao.com/user.php?page=search-api 进行获取,请用指令:#设置SauceNAOapiKey 进行添加')
- return await request.get('https://saucenao.com/search.php', {
+ if (!api_key) throw new ReplyError("未配置SauceNAOApiKey,无法使用SauceNAO搜图,请在 https://saucenao.com/user.php?page=search-api 进行获取,请用指令:#设置SauceNAOapiKey 进行添加")
+ return await request.get("https://saucenao.com/search.php", {
params: {
api_key,
db,
@@ -75,7 +75,7 @@ async function getSearchResult (imgURL, db = 999) {
timeout: 60000
}).then(res => {
if (res.status === 429) {
- throw new ReplyError('SauceNAO搜图 搜索次数已达单位时间上限,请稍候再试')
+ throw new ReplyError("SauceNAO搜图 搜索次数已达单位时间上限,请稍候再试")
} else {
return res.json()
}
diff --git a/model/PicSearch/whatanime.js b/model/PicSearch/whatanime.js
index 010dd95..a73e1b8 100644
--- a/model/PicSearch/whatanime.js
+++ b/model/PicSearch/whatanime.js
@@ -1,7 +1,7 @@
-import request from '../../lib/request/request.js'
-import { Config, Plugin_Path } from '../../components/index.js'
-import common from '../../../../lib/common/common.js'
-import _ from 'lodash'
+import request from "../../lib/request/request.js"
+import { Config, Plugin_Path } from "../../components/index.js"
+import common from "../../../../lib/common/common.js"
+import _ from "lodash"
/**
*
@@ -15,19 +15,19 @@ export default async function doSearch (imgURL) {
result: [{
similarity,
anilist, // 番剧 ID
- episode = '-', // 集数
+ episode = "-", // 集数
from, // 时间点
video // 预览视频
// image // 预览图片
}]
} = result
- if (_.isEmpty(result)) throw new ReplyError('未获取到相关信息')
+ if (_.isEmpty(result)) throw new ReplyError("未获取到相关信息")
similarity = (similarity * 100).toFixed(2) // 相似度
const time = (() => {
const s = Math.floor(from)
const m = Math.floor(s / 60)
const ms = [m, s % 60]
- return ms.map(num => String(num).padStart(2, '0')).join(':')
+ return ms.map(num => String(num).padStart(2, "0")).join(":")
})()
const AnimeInfo = await getAnimeInfo(anilist)
const { type, format, isAdult, title, startDate, endDate, coverImage } = AnimeInfo.data.Media
@@ -38,10 +38,10 @@ export default async function doSearch (imgURL) {
if (!(hideImg || (hideImgWhenWhatanimeR18 && isAdult))) {
msg.push(segment.image(coverImage.large))
}
- const titles = _.uniq(['romaji', 'native', 'chinese'].map(k => title[k]).filter(v => v))
- msg.push(titles.join('\n'), `\n类型:${type}-${format}`, `\n开播:${date2str(startDate)}`)
+ const titles = _.uniq(["romaji", "native", "chinese"].map(k => title[k]).filter(v => v))
+ msg.push(titles.join("\n"), `\n类型:${type}-${format}`, `\n开播:${date2str(startDate)}`)
if (endDate.year > 0) msg.push(`\n完结:${date2str(endDate)}`)
- if (isAdult) msg.push('\nR18注意!')
+ if (isAdult) msg.push("\nR18注意!")
let msgs = [msg]
if (!isAdult && whatanimeSendVideo) {
msgs.push(await downFile(video))
@@ -49,15 +49,15 @@ export default async function doSearch (imgURL) {
return msgs
}
-const date2str = ({ year, month, day }) => [year, month, day].join('-')
+const date2str = ({ year, month, day }) => [year, month, day].join("-")
/**
* 取得搜番结果
* @param {string} url 图片地址
* @param {string} key whatanime token
* @returns {Promise} Prased JSON
*/
-async function getSearchResult (url, key = '') {
- let host = 'https://api.trace.moe'
+async function getSearchResult (url, key = "") {
+ let host = "https://api.trace.moe"
return await request.get(`${host}/search`, {
params: {
url,
@@ -97,7 +97,7 @@ query ($id: Int) {
* @returns {Promise} Prased JSON
*/
async function getAnimeInfo (id) {
- return await request.post('https://trace.moe/anilist/', {
+ return await request.post("https://trace.moe/anilist/", {
data: {
query: animeInfoQuery,
variables: { id }
@@ -111,8 +111,8 @@ async function getAnimeInfo (id) {
*/
async function downFile (url) {
let path = `${Plugin_Path}/temp/whatanime/1.mp4`
- logger.mark('[Yenai-Plugin][whatanime]下载预览视频')
+ logger.mark("[Yenai-Plugin][whatanime]下载预览视频")
await common.downFile(url, path)
- logger.mark('[Yenai-Plugin][whatanime]下载预览视频成功')
+ logger.mark("[Yenai-Plugin][whatanime]下载预览视频成功")
return segment.video(path)
}
diff --git a/model/Pixiv.js b/model/Pixiv.js
index eb59162..2c7f40e 100644
--- a/model/Pixiv.js
+++ b/model/Pixiv.js
@@ -1,17 +1,17 @@
-import _ from 'lodash'
-import moment from 'moment'
-import fetch from 'node-fetch'
-import { Config } from '../components/index.js'
-import request from '../lib/request/request.js'
-import { rankType } from '../constants/pixiv.js'
-import { pixivMsg } from '../constants/msg.js'
-import PixivApi from './Pixiv/api.js'
+import _ from "lodash"
+import moment from "moment"
+import fetch from "node-fetch"
+import { Config } from "../components/index.js"
+import request from "../lib/request/request.js"
+import { rankType } from "../constants/pixiv.js"
+import { pixivMsg } from "../constants/msg.js"
+import PixivApi from "./Pixiv/api.js"
/** API请求错误文案 */
export default new class Pixiv {
constructor () {
this.ranktype = rankType
- this.domain = 'http://api.obfs.dev/api/pixiv'
+ this.domain = "http://api.obfs.dev/api/pixiv"
this.PixivClient = new PixivApi(Config.pixiv.refresh_token)
}
@@ -19,7 +19,7 @@ export default new class Pixiv {
if (!this.PixivClient?.auth) {
await this.PixivClient.login()
}
- if (!this.PixivClient.auth?.user) throw new ReplyError('❎ 未获取到登录信息')
+ if (!this.PixivClient.auth?.user) throw new ReplyError("❎ 未获取到登录信息")
const { profile_image_urls: { px_170x170 }, id, name, account, mail_address, is_premium, x_restrict } = this.PixivClient.auth.user
return [
await this._requestPixivImg(px_170x170),
@@ -35,9 +35,9 @@ export default new class Pixiv {
get headers () {
if (Config.pixiv.pixivDirectConnection) {
return {
- 'Host': 'i.pximg.net',
- 'Referer': 'https://www.pixiv.net/',
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.46'
+ "Host": "i.pximg.net",
+ "Referer": "https://www.pixiv.net/",
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.46"
}
} else {
return undefined
@@ -45,7 +45,7 @@ export default new class Pixiv {
}
get proxy () {
- return Config.pixiv.pixivDirectConnection ? 'i.pximg.net' : Config.pixiv.pixivImageProxy
+ return Config.pixiv.pixivDirectConnection ? "i.pximg.net" : Config.pixiv.pixivImageProxy
}
/** 开始执行文案 */
@@ -67,7 +67,7 @@ export default new class Pixiv {
} else {
res = await request.get(`${this.domain}/illust`, { params }).then(res => res.json())
}
- if (res.error) throw new ReplyError(res.error?.user_message || '无法获取数据')
+ if (res.error) throw new ReplyError(res.error?.user_message || "无法获取数据")
let illust = this._format(res.illust)
let { id, title, user, tags, total_bookmarks, total_view, url, create_date, x_restrict, illust_ai_type } = illust
let msg = [
@@ -78,19 +78,19 @@ export default new class Pixiv {
`点赞:${total_bookmarks}\n`,
`访问:${total_view}\n`,
`isAI:${illust_ai_type == 2}\n`,
- `发布:${moment(create_date).format('YYYY-MM-DD HH:mm:ss')}\n`,
- `Tag:${tags.join(',')}\n`,
+ `发布:${moment(create_date).format("YYYY-MM-DD HH:mm:ss")}\n`,
+ `Tag:${tags.join(",")}\n`,
`直链:https://pixiv.re/${id}.jpg\n`,
`传送门:https://www.pixiv.net/artworks/${id}`
]
if (filter && x_restrict) {
- let linkmsg = ['该作品不适合所有年龄段,请自行使用链接查看:']
+ let linkmsg = ["该作品不适合所有年龄段,请自行使用链接查看:"]
if (url.length > 1) {
linkmsg.push(...url.map((item, index) => `https://pixiv.re/${id}-${index + 1}.jpg`))
} else {
linkmsg.push(`https://pixiv.re/${id}.jpg`)
}
- throw new ReplyError(linkmsg.join('\n'))
+ throw new ReplyError(linkmsg.join("\n"))
}
let img = await Promise.all(url.map(async item => await this._requestPixivImg(item)))
return { msg, img }
@@ -104,7 +104,7 @@ export default new class Pixiv {
* @param {boolean} r18 是否为R18榜单
* @returns {Array}
*/
- async Rank (page = 1, date = '', mode = '周', r18 = false) {
+ async Rank (page = 1, date = "", mode = "周", r18 = false) {
// 转为大写
mode = _.toUpper(mode)
// 排行榜类型
@@ -114,15 +114,15 @@ export default new class Pixiv {
// r18处理
if (r18) {
let R18 = this.ranktype[mode].r18
- if (!R18) throw new ReplyError('该排行没有不适合所有年龄段的分类哦~')
+ if (!R18) throw new ReplyError("该排行没有不适合所有年龄段的分类哦~")
type = R18.type
pageSizeAll = R18.total
}
// 总页数
let pageAll = Math.ceil(pageSizeAll / 30)
- if (page > pageAll) throw new ReplyError('哪有那么多图片给你辣(•̀へ •́ ╮ )')
+ if (page > pageAll) throw new ReplyError("哪有那么多图片给你辣(•̀へ •́ ╮ )")
- if (!date) date = moment().subtract(moment().utcOffset(9).hour() >= 12 ? 1 : 2, 'days').format('YYYY-MM-DD')
+ if (!date) date = moment().subtract(moment().utcOffset(9).hour() >= 12 ? 1 : 2, "days").format("YYYY-MM-DD")
const params = {
mode: type,
@@ -136,7 +136,7 @@ export default new class Pixiv {
res = await request.get(`${this.domain}/rank`, { params }).then(res => res.json())
}
if (res.error) throw new ReplyError(res.error.message)
- if (_.isEmpty(res.illusts)) throw new ReplyError('暂无数据,请等待榜单更新哦(。-ω-)zzz')
+ if (_.isEmpty(res.illusts)) throw new ReplyError("暂无数据,请等待榜单更新哦(。-ω-)zzz")
let illusts = await Promise.all(res.illusts.map(async (item, index) => {
let list = this._format(item)
@@ -153,18 +153,18 @@ export default new class Pixiv {
]
}))
let formatDate = res.next_url.match(/date=(\d{4}-\d{1,2}-\d{1,2})/)[1]
- formatDate = moment(formatDate, 'YYYY-MM-DD').format('YYYY年MM月DD日')
+ formatDate = moment(formatDate, "YYYY-MM-DD").format("YYYY年MM月DD日")
if (/周/.test(mode)) {
- formatDate = `${moment(formatDate, 'YYYY年MM月DD日').subtract(6, 'days').format('YYYY年MM月DD日')} ~ ${formatDate}`
+ formatDate = `${moment(formatDate, "YYYY年MM月DD日").subtract(6, "days").format("YYYY年MM月DD日")} ~ ${formatDate}`
} else if (/月/.test(mode)) {
- formatDate = `${moment(formatDate, 'YYYY年MM月DD日').subtract(29, 'days').format('YYYY年MM月DD日')} ~ ${formatDate}`
+ formatDate = `${moment(formatDate, "YYYY年MM月DD日").subtract(29, "days").format("YYYY年MM月DD日")} ~ ${formatDate}`
}
let list = [
- `${formatDate}的${mode}${r18 ? 'R18' : ''}榜`,
+ `${formatDate}的${mode}${r18 ? "R18" : ""}榜`,
`当前为第${page}页,共${pageAll}页,本页共${illusts.length}张,总共${pageSizeAll}张`
]
if (page < pageAll) {
- list.push(`可使用 "#看看${date ? `${formatDate}的` : ''}${mode}${r18 ? 'R18' : ''}榜第${page - 0 + 1}页" 翻页`)
+ list.push(`可使用 "#看看${date ? `${formatDate}的` : ""}${mode}${r18 ? "R18" : ""}榜第${page - 0 + 1}页" 翻页`)
}
list.push(...illusts)
@@ -178,19 +178,19 @@ export default new class Pixiv {
* @returns {Array}
*/
async vilipixSearchTags (tag, page = 1) {
- const api = 'https://www.vilipix.com/api/v1/picture/public'
+ const api = "https://www.vilipix.com/api/v1/picture/public"
const params = {
limit: 30,
tags: tag,
- sort: 'new',
+ sort: "new",
offset: (page - 1) * 30
}
let res = await request.get(api, { params }).then(res => res.json())
- if (res.data.count == 0) throw new ReplyError('呜呜呜,人家没有找到相关的插画(ó﹏ò。)')
+ if (res.data.count == 0) throw new ReplyError("呜呜呜,人家没有找到相关的插画(ó﹏ò。)")
let pageall = Math.ceil(res.data.count / 30)
- if (page > pageall) throw new ReplyError('啊啊啊,淫家给不了你那么多辣d(ŐдŐ๑)')
+ if (page > pageall) throw new ReplyError("啊啊啊,淫家给不了你那么多辣d(ŐдŐ๑)")
let list = [
`当前为第${page}页,共${pageall}页,本页共${res.data.rows.length}张,总共${res.data.count}张`
@@ -222,7 +222,7 @@ export default new class Pixiv {
const params = {
word: tag,
page,
- order: 'popular_desc'
+ order: "popular_desc"
}
let res = null
if (this.PixivClient.auth) {
@@ -231,8 +231,8 @@ export default new class Pixiv {
res = await request.get(`${this.domain}/search`, { params }).then(res => res.json())
}
if (res.error) throw new ReplyError(res.error.message)
- if (_.isEmpty(res.illusts)) throw new ReplyError('宝~没有数据了哦(๑>︶<)و')
- let sortIllusts = _.orderBy(res.illusts, 'total_bookmarks', 'desc')
+ if (_.isEmpty(res.illusts)) throw new ReplyError("宝~没有数据了哦(๑>︶<)و")
+ let sortIllusts = _.orderBy(res.illusts, "total_bookmarks", "desc")
let illusts = []
let filterNum = 0
let NowNum = res.illusts.length
@@ -252,10 +252,10 @@ export default new class Pixiv {
await this._requestPixivImg(image_urls.large)
])
}
- if (_.isEmpty(illusts)) throw new ReplyError('该页全为涩涩内容已全部过滤(#/。\#)')
+ if (_.isEmpty(illusts)) throw new ReplyError("该页全为涩涩内容已全部过滤(#/。\#)")
return [
- `本页共${NowNum}张${filterNum ? `,过滤${filterNum}张` : ''}\n可尝试使用 "#tagpro搜图${tag}第${page - 0 + 1}页" 翻页\n无数据则代表无下一页`,
+ `本页共${NowNum}张${filterNum ? `,过滤${filterNum}张` : ""}\n可尝试使用 "#tagpro搜图${tag}第${page - 0 + 1}页" 翻页\n无数据则代表无下一页`,
...illusts
]
}
@@ -272,7 +272,7 @@ export default new class Pixiv {
res = await fetch(`${this.domain}/tags`).then(res => res.json())
}
- if (!res.trend_tags) throw new ReplyError('呜呜呜,没有获取到数据(๑ १д१)')
+ if (!res.trend_tags) throw new ReplyError("呜呜呜,没有获取到数据(๑ १д१)")
let list = []
for (let i of res.trend_tags) {
@@ -310,7 +310,7 @@ export default new class Pixiv {
}
}).then(res => res.json())
}
- if (_.isEmpty(wordlist.user_previews)) throw new ReplyError('呜呜呜,人家没有找到这个淫d(ŐдŐ๑)')
+ if (_.isEmpty(wordlist.user_previews)) throw new ReplyError("呜呜呜,人家没有找到这个淫d(ŐдŐ๑)")
keyword = wordlist.user_previews[0].user.id
}
const params = {
@@ -326,7 +326,7 @@ export default new class Pixiv {
if (res.error) throw new ReplyError(res.error.message)
// 没有作品直接返回信息
- if (_.isEmpty(res.illusts)) throw new ReplyError(page >= 2 ? '这一页没有作品辣(>人<;)' : 'Σ(っ °Д °;)っ这个淫居然没有作品')
+ if (_.isEmpty(res.illusts)) throw new ReplyError(page >= 2 ? "这一页没有作品辣(>人<;)" : "Σ(っ °Д °;)っ这个淫居然没有作品")
let illusts = []
let filter = 0
@@ -346,7 +346,7 @@ export default new class Pixiv {
await this._requestPixivImg(url[0])
])
}
- if (_.isEmpty(illusts)) throw new ReplyError('该页全为涩涩内容已全部过滤(#/。\#)')
+ if (_.isEmpty(illusts)) throw new ReplyError("该页全为涩涩内容已全部过滤(#/。\#)")
let { id: uid, name, profile_image_urls } = res.user
return [
[
@@ -354,7 +354,7 @@ export default new class Pixiv {
`\nUid:${uid}\n`,
`画师:${name}`
],
- `本页共${NowNum}张${filter ? `,过滤${filter}张` : ''}\n可尝试使用 "#uid搜图${keyword}第${page - 0 + 1}页" 翻页\n无数据则代表无下一页`,
+ `本页共${NowNum}张${filter ? `,过滤${filter}张` : ""}\n可尝试使用 "#uid搜图${keyword}第${page - 0 + 1}页" 翻页\n无数据则代表无下一页`,
...illusts
]
}
@@ -379,7 +379,7 @@ export default new class Pixiv {
user = await request.get(`${this.domain}/search_user`, { params }).then(res => res.json())
}
if (user.error) throw new ReplyError(user.error.message)
- if (_.isEmpty(user.user_previews)) throw new ReplyError('呜呜呜,人家没有找到这个淫d(ŐдŐ๑)')
+ if (_.isEmpty(user.user_previews)) throw new ReplyError("呜呜呜,人家没有找到这个淫d(ŐдŐ๑)")
let msg = await Promise.all(user.user_previews.slice(0, 10).map(async (item, index) => {
let { id, name, profile_image_urls } = item.user
@@ -388,7 +388,7 @@ export default new class Pixiv {
await this._requestPixivImg(profile_image_urls),
`\nid: ${id}\n`,
`name: ${name}\n`,
- '作品:\n'
+ "作品:\n"
]
for (let i of item.illusts) {
let { image_urls, x_restrict } = this._format(i)
@@ -398,7 +398,7 @@ export default new class Pixiv {
return ret
}))
if (msg.length == 30)msg.unshift(`可尝试使用 "#user搜索${word}第${page + 1}页" 翻页`)
- msg.unshift(`当前为第${page}页,已${isfilter ? '开启' : '关闭'}过滤`)
+ msg.unshift(`当前为第${page}页,已${isfilter ? "开启" : "关闭"}过滤`)
return msg
}
@@ -410,7 +410,7 @@ export default new class Pixiv {
async vilipixRandomImg (limit) {
let api = `https://www.vilipix.com/api/v1/picture/recommand?limit=${limit}&offset=${_.random(1, 700)}`
let res = await request.get(api).then(res => res.json())
- if (!res.data || !res.data.rows) throw new ReplyError('呜呜呜,没拿到瑟瑟的图片(˃ ⌑ ˂ഃ )')
+ if (!res.data || !res.data.rows) throw new ReplyError("呜呜呜,没拿到瑟瑟的图片(˃ ⌑ ˂ഃ )")
return res.data.rows.map(item => {
let { picture_id, title, regular_url, tags, like_total } = item
return [
@@ -438,7 +438,7 @@ export default new class Pixiv {
res = await request.get(`${this.domain}/related`, { params }).then(res => res.json())
}
if (res.error) throw new ReplyError(res.error.user_message)
- if (_.isEmpty(res.illusts)) throw new ReplyError('呃...没有数据(•ิ_•ิ)')
+ if (_.isEmpty(res.illusts)) throw new ReplyError("呃...没有数据(•ิ_•ิ)")
let illusts = []
let filter = 0
@@ -458,10 +458,10 @@ export default new class Pixiv {
await this._requestPixivImg(image_urls.large)
])
}
- if (_.isEmpty(illusts)) throw new ReplyError('啊啊啊!!!居然全是瑟瑟哒不给你看(*/ω\*)')
+ if (_.isEmpty(illusts)) throw new ReplyError("啊啊啊!!!居然全是瑟瑟哒不给你看(*/ω\*)")
return [
- `Pid:${pid}的相关作品,共${res.illusts.length}张${filter ? `,过滤${filter}张` : ''}`,
+ `Pid:${pid}的相关作品,共${res.illusts.length}张${filter ? `,过滤${filter}张` : ""}`,
...illusts
]
}
@@ -471,13 +471,13 @@ export default new class Pixiv {
* @param pro
*/
async pximg (pro) {
- let url = 'https://image.anosu.top/pixiv/json'
+ let url = "https://image.anosu.top/pixiv/json"
const params = {
r18: pro ? 1 : 0,
proxy: this.proxy
}
let res = await request.get(url, {
- statusCode: 'json',
+ statusCode: "json",
params
})
let { pid, uid, title, user, tags, url: urls, r18 } = res[0]
@@ -487,7 +487,7 @@ export default new class Pixiv {
`R18: ${r18 ?? false}\n`,
`标题:${title}\n`,
`画师:${user}\n`,
- `Tag:${tags.join(',')}\n`,
+ `Tag:${tags.join(",")}\n`,
await this._requestPixivImg(urls)
]
return msg
@@ -520,7 +520,7 @@ export default new class Pixiv {
* @returns {Promise}
*/
async _requestPixivImg (url) {
- url = url.replace('i.pximg.net', this.proxy)
+ url = url.replace("i.pximg.net", this.proxy)
logger.debug(`pixiv getImg URL: ${url}`)
let headers = /s.pximg.net/.test(url) ? undefined : this.headers
return request.proxyRequestImg(url, { headers })
diff --git a/model/Pixiv/api.js b/model/Pixiv/api.js
index 9ffdca4..d19ce1a 100644
--- a/model/Pixiv/api.js
+++ b/model/Pixiv/api.js
@@ -1,11 +1,11 @@
-import request, { qs } from '../../lib/request/request.js'
-import moment from 'moment'
-import { login, headers } from './login.js'
-import { timeToSeconds, getNoonTomorrow } from './utils.js'
+import request, { qs } from "../../lib/request/request.js"
+import moment from "moment"
+import { login, headers } from "./login.js"
+import { timeToSeconds, getNoonTomorrow } from "./utils.js"
export default class PixivApi {
constructor (refresh_token) {
- this.baseUrl = 'https://app-api.pixiv.net/'
+ this.baseUrl = "https://app-api.pixiv.net/"
this.headers = headers
this._once = false
this.refresh_token = refresh_token
@@ -15,7 +15,7 @@ export default class PixivApi {
async login () {
if (!this.refresh_token) {
- throw new ReplyError('[Yenai][Pixiv] 未配置refresh_token刷新令牌')
+ throw new ReplyError("[Yenai][Pixiv] 未配置refresh_token刷新令牌")
}
const response = await login(this.refresh_token)
this.access_token = response.access_token
@@ -44,15 +44,15 @@ export default class PixivApi {
Authorization: `Bearer ${this.access_token}`
}
// 读取缓存
- const cacheUrl = options.params ? target + '?' + qs(options.params) : target
+ const cacheUrl = options.params ? target + "?" + qs(options.params) : target
const cacheKey = `yenai:pixiv:cache:${cacheUrl}`
const cacheData = await redis.get(cacheKey)
if (cacheData) return JSON.parse(cacheData)
// 请求
- let data = await request[options.data ? 'post' : 'get'](this.baseUrl + target, {
+ let data = await request[options.data ? "post" : "get"](this.baseUrl + target, {
headers,
...options,
- statusCode: 'json'
+ statusCode: "json"
})
// 写入缓存
if (cache) {
@@ -64,16 +64,16 @@ export default class PixivApi {
}
async tags () {
- return this.request('v1/trending-tags/illust')
+ return this.request("v1/trending-tags/illust")
}
async rank ({
- mode = 'week',
- date = moment().subtract(moment().utcOffset(9).hour() >= 12 ? 1 : 2, 'days').format('YYYY-MM-DD'),
+ mode = "week",
+ date = moment().subtract(moment().utcOffset(9).hour() >= 12 ? 1 : 2, "days").format("YYYY-MM-DD"),
page = 1,
size = 30
}) {
- return this.request('v1/illust/ranking', {
+ return this.request("v1/illust/ranking", {
params: {
mode,
date,
@@ -83,7 +83,7 @@ export default class PixivApi {
}
async illust ({ id }) {
- return this.request('v1/illust/detail', {
+ return this.request("v1/illust/detail", {
params: {
illust_id: id
}
@@ -91,7 +91,7 @@ export default class PixivApi {
}
async member ({ id }) {
- return this.request('v1/user/detail', {
+ return this.request("v1/user/detail", {
params: {
illust_id: id
}
@@ -102,9 +102,9 @@ export default class PixivApi {
id,
page = 1,
size = 30,
- illust_type = 'illust'
+ illust_type = "illust"
}) {
- return this.request('v1/user/illusts', {
+ return this.request("v1/user/illusts", {
params: {
user_id: id,
type: illust_type,
@@ -117,11 +117,11 @@ export default class PixivApi {
word,
page = 1,
size = 30,
- order = 'date_desc',
- mode = 'partial_match_for_tags',
+ order = "date_desc",
+ mode = "partial_match_for_tags",
include_translated_tag_results = true
}) {
- return this.request('v1/search/illust', {
+ return this.request("v1/search/illust", {
params: {
word,
search_target: mode,
@@ -138,7 +138,7 @@ export default class PixivApi {
size = 30
}) {
return await this.request(
- 'v1/search/user',
+ "v1/search/user",
{
params: {
word,
@@ -154,7 +154,7 @@ export default class PixivApi {
size = 30
}) {
return await this.request(
- 'v2/illust/related',
+ "v2/illust/related",
{
params: {
illust_id: id,
@@ -165,6 +165,6 @@ export default class PixivApi {
}
async illustRecommended (params = {}) {
- return await this.request('v1/illust/recommended', params)
+ return await this.request("v1/illust/recommended", params)
}
}
diff --git a/model/Pixiv/login.js b/model/Pixiv/login.js
index c45d2ba..ab4749f 100644
--- a/model/Pixiv/login.js
+++ b/model/Pixiv/login.js
@@ -1,36 +1,36 @@
-import { Config } from '../../components/index.js'
-import moment from 'moment'
-import request from '../../lib/request/request.js'
-import md5 from 'md5'
+import { Config } from "../../components/index.js"
+import moment from "moment"
+import request from "../../lib/request/request.js"
+import md5 from "md5"
-const CLIENT_ID = 'MOBrBDS8blbauoSck0ZfDbtuzpyT'
-const CLIENT_SECRET = 'lsACyCD94FhDUtGTXi3QzcFE2uU1hqtDaKeqrdwj'
-const HASH_SECRET = '28c1fdd170a5204386cb1313c7077b34f83e4aaf4aa829ce78c231e05b0bae2c'
+const CLIENT_ID = "MOBrBDS8blbauoSck0ZfDbtuzpyT"
+const CLIENT_SECRET = "lsACyCD94FhDUtGTXi3QzcFE2uU1hqtDaKeqrdwj"
+const HASH_SECRET = "28c1fdd170a5204386cb1313c7077b34f83e4aaf4aa829ce78c231e05b0bae2c"
export const headers = {
- 'User-Agent': 'PixivIOSApp/7.13.3 (iOS 14.6; iPhone13,2)',
- 'Accept-Language': Config.pixiv.language,
- 'App-OS': 'ios',
- 'App-OS-Version': '14.6',
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'Accept': '*/*',
- 'Connection': 'Keep-Alive'
+ "User-Agent": "PixivIOSApp/7.13.3 (iOS 14.6; iPhone13,2)",
+ "Accept-Language": Config.pixiv.language,
+ "App-OS": "ios",
+ "App-OS-Version": "14.6",
+ "Content-Type": "application/x-www-form-urlencoded",
+ "Accept": "*/*",
+ "Connection": "Keep-Alive"
}
export async function login (refresh_token) {
const local_time = moment().format()
let _headers = {
...headers,
- 'X-Client-Time': local_time,
- 'X-Client-Hash': md5(`${local_time}${HASH_SECRET}`)
+ "X-Client-Time": local_time,
+ "X-Client-Hash": md5(`${local_time}${HASH_SECRET}`)
}
const data = {
client_id: CLIENT_ID,
client_secret: CLIENT_SECRET,
- grant_type: 'refresh_token',
+ grant_type: "refresh_token",
refresh_token
}
- const { response, error } = await request.post('https://oauth.secure.pixiv.net/auth/token', {
+ const { response, error } = await request.post("https://oauth.secure.pixiv.net/auth/token", {
data,
headers: _headers
}).then(res => res.json())
@@ -38,9 +38,9 @@ export async function login (refresh_token) {
if (response.access_token) {
const { id, name, account } = response.user
- logger.info(`[Yenai][Pixiv]login ${logger.yellow(`${name}(${id}) @${account}`)} ${logger.green('success')}`)
+ logger.info(`[Yenai][Pixiv]login ${logger.yellow(`${name}(${id}) @${account}`)} ${logger.green("success")}`)
} else {
- logger.error(`[Yenai][Pixiv]login ${logger.red('fail')}`)
+ logger.error(`[Yenai][Pixiv]login ${logger.red("fail")}`)
}
return response
}
diff --git a/model/Pixiv/utils.js b/model/Pixiv/utils.js
index 03b0cd1..3e70cbb 100644
--- a/model/Pixiv/utils.js
+++ b/model/Pixiv/utils.js
@@ -1,22 +1,22 @@
-import moment from 'moment'
+import moment from "moment"
export function timeToSeconds (time) {
let seconds = 0
- let timeArray = time.split(' ')
+ let timeArray = time.split(" ")
for (let i = 0; i < timeArray.length; i++) {
let unit = timeArray[i].charAt(timeArray[i].length - 1)
let value = parseInt(timeArray[i].substring(0, timeArray[i].length - 1))
switch (unit) {
- case 's':
+ case "s":
seconds += value
break
- case 'm':
+ case "m":
seconds += value * 60
break
- case 'h':
+ case "h":
seconds += value * 60 * 60
break
- case 'd':
+ case "d":
seconds += value * 60 * 60 * 24
break
default:
@@ -28,11 +28,11 @@ export function timeToSeconds (time) {
export function getNoonTomorrow () {
const now = moment() // 获取当前时间
- const noonToday = moment().startOf('day').add(12, 'hours') // 获取今天中午12点的时间
- const noonTomorrow = moment().add(1, 'day').startOf('day').add(12, 'hours') // 获取明天中午12点的时间
+ const noonToday = moment().startOf("day").add(12, "hours") // 获取今天中午12点的时间
+ const noonTomorrow = moment().add(1, "day").startOf("day").add(12, "hours") // 获取明天中午12点的时间
let time = now < noonToday
- ? noonToday.diff(now, 'hours')
- : noonTomorrow.diff(now, 'hours')
+ ? noonToday.diff(now, "hours")
+ : noonTomorrow.diff(now, "hours")
if (time > 12) time = 12
- return time + 'h'
+ return time + "h"
}
diff --git a/model/State/BotState.js b/model/State/BotState.js
index 14fd7a6..b70fd22 100644
--- a/model/State/BotState.js
+++ b/model/State/BotState.js
@@ -1,7 +1,7 @@
-import { formatDuration } from '../../tools/index.js'
-import { Plugin_Name } from '../../components/index.js'
-import { status } from '../../constants/other.js'
-import { createRequire } from 'module'
+import { formatDuration } from "../../tools/index.js"
+import { Plugin_Name } from "../../components/index.js"
+import { status } from "../../constants/other.js"
+import { createRequire } from "module"
const require = createRequire(import.meta.url)
export default async function getBotState (botList) {
@@ -9,22 +9,22 @@ export default async function getBotState (botList) {
const dataPromises = botList.map(async (i) => {
const bot = Bot[i]
- if (!bot?.uin) return ''
+ if (!bot?.uin) return ""
const avatar = bot.avatar || (Number(bot.uin) ? `https://q1.qlogo.cn/g?b=qq&s=0&nk=${bot.uin}` : defaultAvatar)
- const nickname = bot.nickname || '未知'
- const onlineStatus = status[bot.status] || '在线'
- const platform = bot.apk ? `${bot.apk.display} v${bot.apk.version}` : bot.version?.version || '未知'
+ const nickname = bot.nickname || "未知"
+ const onlineStatus = status[bot.status] || "在线"
+ const platform = bot.apk ? `${bot.apk.display} v${bot.apk.version}` : bot.version?.version || "未知"
- const sent = await redis.get(`Yz:count:send:msg:bot:${bot.uin}:total`) || await redis.get('Yz:count:sendMsg:total')
+ const sent = await redis.get(`Yz:count:send:msg:bot:${bot.uin}:total`) || await redis.get("Yz:count:sendMsg:total")
const recv = await redis.get(`Yz:count:receive:msg:bot:${bot.uin}:total`) || bot.stat?.recv_msg_cnt
- const screenshot = await redis.get(`Yz:count:send:image:bot:${bot.uin}:total`) || await redis.get('Yz:count:screenshot:total')
+ const screenshot = await redis.get(`Yz:count:send:image:bot:${bot.uin}:total`) || await redis.get("Yz:count:screenshot:total")
const friendQuantity = bot.fl?.size || 0
const groupQuantity = bot.gl?.size || 0
const groupMemberQuantity = Array.from(bot.gml?.values() || []).reduce((acc, curr) => acc + curr.size, 0)
- const botRunTime = formatDuration(Date.now() / 1000 - bot.stat?.start_time, 'dd天hh小时mm分ss秒', false)
- const botVersion = bot.version ? `${bot.version.name}(${bot.version.id})${bot.apk ? ` ${bot.version.version}` : ''}` : `ICQQ(QQ) v${require('icqq/package.json').version}`
+ const botRunTime = formatDuration(Date.now() / 1000 - bot.stat?.start_time, "dd天hh小时mm分ss秒", false)
+ const botVersion = bot.version ? `${bot.version.name}(${bot.version.id})${bot.apk ? ` ${bot.version.version}` : ""}` : `ICQQ(QQ) v${require("icqq/package.json").version}`
return {
avatar,
diff --git a/model/State/CPU.js b/model/State/CPU.js
index 66b47ff..6c7727b 100644
--- a/model/State/CPU.js
+++ b/model/State/CPU.js
@@ -1,22 +1,22 @@
-import os from 'os'
-import { si, osInfo } from './index.js'
-import { Circle } from './utils.js'
+import os from "os"
+import { si, osInfo } from "./index.js"
+import { Circle } from "./utils.js"
/** 获取CPU占用 */
export default async function getCpuInfo () {
let { currentLoad: { currentLoad }, cpuCurrentSpeed } = await si.get({
- currentLoad: 'currentLoad',
- cpuCurrentSpeed: 'max,avg'
+ currentLoad: "currentLoad",
+ cpuCurrentSpeed: "max,avg"
})
if (currentLoad == null || currentLoad == undefined) return false
// 核心
let cores = os.cpus()
// cpu制造者
- let cpuModel = cores[0]?.model.slice(0, cores[0]?.model.indexOf(' ')) || ''
+ let cpuModel = cores[0]?.model.slice(0, cores[0]?.model.indexOf(" ")) || ""
return {
...Circle(currentLoad / 100),
- inner: Math.round(currentLoad) + '%',
- title: 'CPU',
+ inner: Math.round(currentLoad) + "%",
+ title: "CPU",
info: [
`${cpuModel} ${cores.length}核 ${osInfo?.arch}`,
`平均${cpuCurrentSpeed.avg}GHz`,
diff --git a/model/State/DependencyChecker.js b/model/State/DependencyChecker.js
index 2fc2836..d77eff0 100644
--- a/model/State/DependencyChecker.js
+++ b/model/State/DependencyChecker.js
@@ -4,18 +4,18 @@ export let osInfo = null
export async function initDependence () {
if (si) return si
try {
- si = await import('systeminformation')
+ si = await import("systeminformation")
osInfo = await si.osInfo()
return si
} catch (error) {
- if (error.stack?.includes('Cannot find package')) {
- logger.warn('--------椰奶依赖缺失--------')
- logger.warn(`yenai-plugin 缺少依赖将无法使用 ${logger.yellow('椰奶状态')}`)
- logger.warn(`如需使用请运行:${logger.red('pnpm add systeminformation -w')}`)
- logger.warn('---------------------------')
+ if (error.stack?.includes("Cannot find package")) {
+ logger.warn("--------椰奶依赖缺失--------")
+ logger.warn(`yenai-plugin 缺少依赖将无法使用 ${logger.yellow("椰奶状态")}`)
+ logger.warn(`如需使用请运行:${logger.red("pnpm add systeminformation -w")}`)
+ logger.warn("---------------------------")
logger.debug(decodeURI(error.stack))
} else {
- logger.error(`椰奶载入依赖错误:${logger.red('systeminformation')}`)
+ logger.error(`椰奶载入依赖错误:${logger.red("systeminformation")}`)
logger.error(decodeURI(error.stack))
}
}
diff --git a/model/State/FastFetch.js b/model/State/FastFetch.js
index 116b191..105868f 100644
--- a/model/State/FastFetch.js
+++ b/model/State/FastFetch.js
@@ -1,15 +1,15 @@
-import { execSync } from '../../tools/index.js'
+import { execSync } from "../../tools/index.js"
/**
* 获取FastFetch
* @param e
*/
export default async function getFastFetch (e) {
- if (process.platform == 'win32' && !/pro/.test(e.msg)) return ''
- let ret = await execSync('bash plugins/yenai-plugin/resources/state/state.sh')
+ if (process.platform == "win32" && !/pro/.test(e.msg)) return ""
+ let ret = await execSync("bash plugins/yenai-plugin/resources/state/state.sh")
if (ret.error) {
e.reply(`❎ 请检查是否使用git bash启动Yunzai-bot\n错误信息:${ret.stderr}`)
- return ''
+ return ""
}
return ret.stdout.trim()
}
diff --git a/model/State/FsSize.js b/model/State/FsSize.js
index 548f771..546df53 100644
--- a/model/State/FsSize.js
+++ b/model/State/FsSize.js
@@ -1,6 +1,6 @@
-import _ from 'lodash'
-import { getFileSize } from './utils.js'
-import { si } from './index.js'
+import _ from "lodash"
+import { getFileSize } from "./utils.js"
+import { si } from "./index.js"
/**
* 获取硬盘
@@ -20,11 +20,11 @@ export default async function getFsSize () {
item.used = getFileSize(item.used)
item.size = getFileSize(item.size)
item.use = Math.round(item.use)
- item.color = 'var(--low-color)'
+ item.color = "var(--low-color)"
if (item.use >= 90) {
- item.color = 'var(--high-color)'
+ item.color = "var(--high-color)"
} else if (item.use >= 70) {
- item.color = 'var(--medium-color)'
+ item.color = "var(--medium-color)"
}
return item
})
diff --git a/model/State/GPU.js b/model/State/GPU.js
index 53aba87..bd04dd1 100644
--- a/model/State/GPU.js
+++ b/model/State/GPU.js
@@ -1,6 +1,6 @@
-import { Circle } from './utils.js'
-import { si } from './index.js'
-import { initDependence } from './DependencyChecker.js'
+import { Circle } from "./utils.js"
+import { si } from "./index.js"
+import { initDependence } from "./DependencyChecker.js"
let isGPU = false;
@@ -24,19 +24,19 @@ export default async function getGPU () {
item.memoryUsed && item.memoryFree && item.utilizationGpu
)
if (!graphics) {
- logger.warn('[Yenai-plugin][state]状态GPU数据异常:\n', controllers)
+ logger.warn("[Yenai-plugin][state]状态GPU数据异常:\n", controllers)
return false
}
let {
vendor, temperatureGpu, utilizationGpu,
memoryTotal, memoryUsed, powerDraw
} = graphics
- temperatureGpu && (temperatureGpu = temperatureGpu + '℃')
- powerDraw && (powerDraw = powerDraw + 'W')
+ temperatureGpu && (temperatureGpu = temperatureGpu + "℃")
+ powerDraw && (powerDraw = powerDraw + "W")
return {
...Circle(utilizationGpu / 100),
- inner: Math.round(utilizationGpu) + '%',
- title: 'GPU',
+ inner: Math.round(utilizationGpu) + "%",
+ title: "GPU",
info: [
`${vendor} ${temperatureGpu} ${powerDraw}`,
`总共 ${(memoryTotal / 1024).toFixed(2)}G`,
@@ -44,7 +44,7 @@ export default async function getGPU () {
]
}
} catch (e) {
- logger.warn('[Yenai-Plugin][State] 获取GPU失败')
+ logger.warn("[Yenai-Plugin][State] 获取GPU失败")
return false
}
}
diff --git a/model/State/Monitor.js b/model/State/Monitor.js
index 540023f..488b1bf 100644
--- a/model/State/Monitor.js
+++ b/model/State/Monitor.js
@@ -1,8 +1,8 @@
-import { Config, Data } from '../../components/index.js'
-import _ from 'lodash'
-import { si } from './index.js'
-import { initDependence } from './DependencyChecker.js'
-import { addData, getFileSize } from './utils.js'
+import { Config, Data } from "../../components/index.js"
+import _ from "lodash"
+import { si } from "./index.js"
+import { initDependence } from "./DependencyChecker.js"
+import { addData, getFileSize } from "./utils.js"
export default new class monitor {
constructor () {
@@ -29,14 +29,14 @@ export default new class monitor {
// 内存
ram: [],
// 主题
- echarts_theme: Data.readJSON('resources/state/theme_westeros.json'),
+ echarts_theme: Data.readJSON("resources/state/theme_westeros.json"),
backdrop: Config.state.backdrop
}
this.valueObject = {
- networkStats: 'rx_sec,tx_sec,iface',
- currentLoad: 'currentLoad',
- mem: 'active',
- fsStats: 'wx_sec,rx_sec'
+ networkStats: "rx_sec,tx_sec,iface",
+ currentLoad: "currentLoad",
+ mem: "active",
+ fsStats: "wx_sec,rx_sec"
}
this.init()
diff --git a/model/State/NetworkLatency.js b/model/State/NetworkLatency.js
index a9528d7..c530604 100644
--- a/model/State/NetworkLatency.js
+++ b/model/State/NetworkLatency.js
@@ -1,5 +1,5 @@
-import request from '../../lib/request/request.js'
-import { Config } from '../../components/index.js'
+import request from "../../lib/request/request.js"
+import { Config } from "../../components/index.js"
export default function getNetworTestList () {
let { psTestSites, psTestTimeout } = Config.state
@@ -22,7 +22,7 @@ export default function getNetworTestList () {
* @returns {string}
*/
async function getNetworkLatency (url, timeoutTime = 5000) {
- const AbortController = globalThis.AbortController || await import('abort-controller')
+ const AbortController = globalThis.AbortController || await import("abort-controller")
const controller = new AbortController()
const timeout = setTimeout(() => {
@@ -33,24 +33,24 @@ async function getNetworkLatency (url, timeoutTime = 5000) {
let { status } = await request.get(url, { signal: controller.signal })
const endTime = Date.now()
let delay = endTime - startTime
- let color = ''; let statusColor = ''
+ let color = ""; let statusColor = ""
if (delay > 2000) {
- color = '#F44336'
+ color = "#F44336"
} else if (delay > 500) {
- color = '#d68100'
+ color = "#d68100"
} else {
- color = '#188038'
+ color = "#188038"
}
if (status >= 500) {
- statusColor = '#9C27B0'
+ statusColor = "#9C27B0"
} else if (status >= 400) {
- statusColor = '#F44336'
+ statusColor = "#F44336"
} else if (status >= 300) {
- statusColor = '#FF9800'
+ statusColor = "#FF9800"
} else if (status >= 200) {
- statusColor = '#188038'
+ statusColor = "#188038"
} else if (status >= 100) {
- statusColor = '#03A9F4'
+ statusColor = "#03A9F4"
}
return `${status} | ${delay}ms`
} catch {
diff --git a/model/State/NodeInfo.js b/model/State/NodeInfo.js
index d742574..1176cf5 100644
--- a/model/State/NodeInfo.js
+++ b/model/State/NodeInfo.js
@@ -1,5 +1,5 @@
-import { getFileSize, Circle } from './utils.js'
-import os from 'os'
+import { getFileSize, Circle } from "./utils.js"
+import os from "os"
/** 获取nodejs内存情况 */
export default function getNodeInfo () {
@@ -14,8 +14,8 @@ export default function getNodeInfo () {
let occupy = (memory.rss / (os.totalmem() - os.freemem())).toFixed(2)
return {
...Circle(occupy),
- inner: Math.round(occupy * 100) + '%',
- title: 'Node',
+ inner: Math.round(occupy * 100) + "%",
+ title: "Node",
info: [
`总 ${rss}`,
`堆 ${heapTotal}`,
diff --git a/model/State/OtherInfo.js b/model/State/OtherInfo.js
index de7447d..d443527 100644
--- a/model/State/OtherInfo.js
+++ b/model/State/OtherInfo.js
@@ -1,27 +1,27 @@
-import _ from 'lodash'
-import { osInfo } from './DependencyChecker.js'
-import { formatDuration } from '../../tools/index.js'
-import os from 'os'
-import Monitor from './Monitor.js'
-import fs from 'fs'
-import { Version } from '../../components/index.js'
+import _ from "lodash"
+import { osInfo } from "./DependencyChecker.js"
+import { formatDuration } from "../../tools/index.js"
+import os from "os"
+import Monitor from "./Monitor.js"
+import fs from "fs"
+import { Version } from "../../components/index.js"
export default function otherInfi () {
let otherInfo = []
// 其他信息
otherInfo.push({
- first: '系统',
+ first: "系统",
tail: osInfo?.distro
})
// 网络
otherInfo.push(Monitor.getNetwork)
// 插件数量
otherInfo.push({
- first: '插件',
+ first: "插件",
tail: getPluginNum()
})
otherInfo.push({
- first: '系统运行',
+ first: "系统运行",
tail: getSystime()
})
@@ -29,23 +29,23 @@ export default function otherInfi () {
}
function getSystime () {
- return formatDuration(os.uptime(), 'dd天hh小时mm分', false)
+ return formatDuration(os.uptime(), "dd天hh小时mm分", false)
}
function getPluginNum () {
- let str = './plugins'
+ let str = "./plugins"
let arr = fs.readdirSync(str)
let plugin = []
arr.forEach((val) => {
- let ph = fs.statSync(str + '/' + val)
+ let ph = fs.statSync(str + "/" + val)
if (ph.isDirectory()) {
plugin.push(val)
}
})
- let del = ['example', 'genshin', 'other', 'system', 'bin']
+ let del = ["example", "genshin", "other", "system", "bin"]
plugin = plugin.filter(item => !del.includes(item))
const plugins = plugin?.length || 0
- const js = fs.readdirSync('./plugins/example')?.filter(item => item.includes('.js'))?.length || 0
+ const js = fs.readdirSync("./plugins/example")?.filter(item => item.includes(".js"))?.length || 0
return `${plugins} plugin | ${js} js`
}
diff --git a/model/State/RAM.js b/model/State/RAM.js
index 4e0d36a..68b4cf1 100644
--- a/model/State/RAM.js
+++ b/model/State/RAM.js
@@ -1,5 +1,5 @@
-import { getFileSize, Circle } from './utils.js'
-import os from 'os'
+import { getFileSize, Circle } from "./utils.js"
+import os from "os"
/** 获取当前内存占用 */
export default function getMemUsage () {
@@ -14,8 +14,8 @@ export default function getMemUsage () {
return {
...Circle(MemUsage),
- inner: Math.round(MemUsage * 100) + '%',
- title: 'RAM',
+ inner: Math.round(MemUsage * 100) + "%",
+ title: "RAM",
info: [
`总共 ${totalmem}`,
`已用 ${Usingmemory}`,
diff --git a/model/State/index.js b/model/State/index.js
index 17d9060..8c94a06 100644
--- a/model/State/index.js
+++ b/model/State/index.js
@@ -1,16 +1,16 @@
-import _ from 'lodash'
-import common from '../../lib/common/common.js'
-import getBotState from './BotState.js'
-import getCPU from './CPU.js'
-import { osInfo, si } from './DependencyChecker.js'
-import getFastFetch from './FastFetch.js'
-import getFsSize from './FsSize.js'
-import getGPU from './GPU.js'
-import Monitor from './Monitor.js'
-import getNetworTestList from './NetworkLatency.js'
-import getNodeInfo from './NodeInfo.js'
-import getRAM from './RAM.js'
-import getOtherInfo, { getCopyright } from './OtherInfo.js'
+import _ from "lodash"
+import common from "../../lib/common/common.js"
+import getBotState from "./BotState.js"
+import getCPU from "./CPU.js"
+import { osInfo, si } from "./DependencyChecker.js"
+import getFastFetch from "./FastFetch.js"
+import getFsSize from "./FsSize.js"
+import getGPU from "./GPU.js"
+import Monitor from "./Monitor.js"
+import getNetworTestList from "./NetworkLatency.js"
+import getNodeInfo from "./NodeInfo.js"
+import getRAM from "./RAM.js"
+import getOtherInfo, { getCopyright } from "./OtherInfo.js"
export { osInfo, si }
@@ -40,7 +40,7 @@ export async function getData (e) {
let isBotIndex = /pro/.test(e.msg) && BotList.length > 1
return {
BotStatusList: await getBotState(BotList),
- chartData: JSON.stringify(common.checkIfEmpty(Monitor.chartData, ['echarts_theme', 'cpu', 'ram']) ? undefined : Monitor.chartData),
+ chartData: JSON.stringify(common.checkIfEmpty(Monitor.chartData, ["echarts_theme", "cpu", "ram"]) ? undefined : Monitor.chartData),
visualData,
otherInfo: getOtherInfo(),
psTest: _.isEmpty(psTest) ? undefined : psTest,
@@ -57,7 +57,7 @@ function _getBotList (e) {
/** bot列表 */
let BotList = [e.self_id]
- if (e.msg.includes('pro')) {
+ if (e.msg.includes("pro")) {
if (Array.isArray(Bot?.uin)) {
BotList = Bot.uin
} else if (Bot?.adapter && Bot.adapter.includes(e.self_id)) {
diff --git a/model/State/utils.js b/model/State/utils.js
index 95f35f2..bc4b8e1 100644
--- a/model/State/utils.js
+++ b/model/State/utils.js
@@ -1,4 +1,4 @@
-import _ from 'lodash'
+import _ from "lodash"
/**
* 向数组中添加数据,如果数组长度超过允许的最大值,则删除最早添加的数据
@@ -28,18 +28,18 @@ export function getFileSize (size, isByte = true, isSuffix = true) { // 把字
if (size == null || size == undefined) return 0
let num = 1024.00 // byte
if (isByte && size < num) {
- return size.toFixed(2) + 'B'
+ return size.toFixed(2) + "B"
}
if (size < Math.pow(num, 2)) {
- return (size / num).toFixed(2) + `K${isSuffix ? 'b' : ''}`
+ return (size / num).toFixed(2) + `K${isSuffix ? "b" : ""}`
} // kb
if (size < Math.pow(num, 3)) {
- return (size / Math.pow(num, 2)).toFixed(2) + `M${isSuffix ? 'b' : ''}`
+ return (size / Math.pow(num, 2)).toFixed(2) + `M${isSuffix ? "b" : ""}`
} // M
if (size < Math.pow(num, 4)) {
- return (size / Math.pow(num, 3)).toFixed(2) + 'G'
+ return (size / Math.pow(num, 3)).toFixed(2) + "G"
} // G
- return (size / Math.pow(num, 4)).toFixed(2) + 'T' // T
+ return (size / Math.pow(num, 4)).toFixed(2) + "T" // T
}
/**
@@ -68,11 +68,11 @@ export function getFileSize (size, isByte = true, isSuffix = true) { // 把字
export function Circle (res) {
let perimeter = 3.14 * 77
let per = perimeter - (perimeter * res * 100) / 100
- let color = 'var(--low-color)'
+ let color = "var(--low-color)"
if (res >= 0.9) {
- color = 'var(--high-color)'
+ color = "var(--high-color)"
} else if (res >= 0.8) {
- color = 'var(--medium-color)'
+ color = "var(--medium-color)"
}
return {
per,
diff --git a/model/api/QQApi.js b/model/api/QQApi.js
index 679c32a..85833f8 100644
--- a/model/api/QQApi.js
+++ b/model/api/QQApi.js
@@ -1,9 +1,9 @@
-import fetch from 'node-fetch'
-import { common } from '../index.js'
-import _ from 'lodash'
-import moment from 'moment'
-import request from '../../lib/request/request.js'
-import { sleep } from '../../tools/index.js'
+import fetch from "node-fetch"
+import { common } from "../index.js"
+import _ from "lodash"
+import moment from "moment"
+import request from "../../lib/request/request.js"
+import { sleep } from "../../tools/index.js"
/** QQ接口 */
export default class {
@@ -11,17 +11,17 @@ export default class {
this.e = e
this.Bot = e.bot ?? Bot
this.headers = {
- 'Content-type': 'application/json;charset=UTF-8',
- 'Cookie': this.Bot?.cookies?.['qun.qq.com'],
- 'qname-service': '976321:131072',
- 'qname-space': 'Production'
+ "Content-type": "application/json;charset=UTF-8",
+ "Cookie": this.Bot?.cookies?.["qun.qq.com"],
+ "qname-service": "976321:131072",
+ "qname-space": "Production"
}
}
getGtk (data) {
let ck = common.getck(data, this.Bot)
// eslint-disable-next-line no-var
- for (var e = ck.p_skey || '', n = 5381, r = 0, o = e.length; r < o; ++r) {
+ for (var e = ck.p_skey || "", n = 5381, r = 0, o = e.length; r < o; ++r) {
n += (n << 5) + e.charAt(r).charCodeAt(0)
}
return 2147483647 & n
@@ -37,7 +37,7 @@ export default class {
let url = `https://user.qzone.qq.com/proxy/domain/taotao.qq.com/cgi-bin/emotion_cgi_msglist_v6?uin=${this.Bot.uin}&ftype=0&sort=0&pos=${pos}&num=${num}&replynum=100&g_tk=${this.Bot.bkn}&code_version=1&format=json&need_private_comment=1`
return await fetch(url, {
headers: {
- Cookie: this.Bot.cookies['qzone.qq.com']
+ Cookie: this.Bot.cookies["qzone.qq.com"]
}
}).then(res => res.json()).catch(err => logger.error(err))
}
@@ -51,17 +51,17 @@ export default class {
let url = `https://user.qzone.qq.com/proxy/domain/taotao.qzone.qq.com/cgi-bin/emotion_cgi_delete_v6?&g_tk=${this.Bot.bkn}`
// 发送请求
return await fetch(url, {
- method: 'POST',
+ method: "POST",
body: `hostuin=${this.Bot.uin}&tid=${tid}&t1_source=${t1_source}&code_version=1&format=json`,
headers: {
- Cookie: this.Bot.cookies['qzone.qq.com']
+ Cookie: this.Bot.cookies["qzone.qq.com"]
}
}).then(res => res.json()).catch(err => logger.error(err))
}
/** 删除全部说说 */
async delQzoneAll () {
- let ck = common.getck('qzone.qq.com', this.Bot)
+ let ck = common.getck("qzone.qq.com", this.Bot)
return await fetch(`http://xiaobai.klizi.cn/API/qqgn/ss_empty.php?data=&uin=${this.Bot.uin}&skey=${ck.skey}&pskey=${ck.p_skey}`).then(res => res.text()).catch(err => logger.error(err))
// let num = 0
// while (true) {
@@ -81,7 +81,7 @@ export default class {
* @param img
*/
async setQzone (con, img) {
- let ck = common.getck('qzone.qq.com', this.Bot)
+ let ck = common.getck("qzone.qq.com", this.Bot)
if (img) {
let url = `http://xiaobai.klizi.cn/API/qqgn/ss_sendimg.php?uin=${this.Bot.uin}&skey=${ck.skey}&pskey=${ck.p_skey}&url=${img[0]}&msg=${con}`
@@ -89,10 +89,10 @@ export default class {
} else {
let url = `https://user.qzone.qq.com/proxy/domain/taotao.qzone.qq.com/cgi-bin/emotion_cgi_publish_v6?&g_tk=${this.Bot.bkn}`
return await fetch(url, {
- method: 'POST',
+ method: "POST",
body: `syn_tweet_verson=1¶mstr=1&con=${con}&feedversion=1&ver=1&ugc_right=1&to_sign=1&hostuin=${this.Bot.uin}&code_version=1&format=json`,
headers: {
- Cookie: this.Bot.cookies['qzone.qq.com']
+ Cookie: this.Bot.cookies["qzone.qq.com"]
}
}).then(res => res.json()).catch(err => logger.error(err))
}
@@ -108,7 +108,7 @@ export default class {
let url = `https://user.qzone.qq.com/proxy/domain/m.qzone.qq.com/cgi-bin/new/get_msgb?uin=${this.Bot.uin}&hostUin=${this.Bot.uin}&start=${start}&s=0.45779069937151884&format=json&num=${num}&inCharset=utf-8&outCharset=utf-8&g_tk=${this.Bot.bkn}`
return await fetch(url, {
headers: {
- cookie: this.Bot.cookies['qzone.qq.com']
+ cookie: this.Bot.cookies["qzone.qq.com"]
}
}).then(res => res.json())
}
@@ -122,9 +122,9 @@ export default class {
async delQzoneMsgb (id, uinId) {
let delurl = `https://h5.qzone.qq.com/proxy/domain/m.qzone.qq.com/cgi-bin/new/del_msgb?&g_tk=${this.Bot.bkn}`
return await fetch(delurl, {
- method: 'POST',
+ method: "POST",
headers: {
- Cookie: this.Bot.cookies['qzone.qq.com']
+ Cookie: this.Bot.cookies["qzone.qq.com"]
},
body: `hostUin=${this.Bot.uin}&idList=${id}&uinList=${uinId}&format=json&iNotice=1&inCharset=utf-8&outCharset=utf-8&ref=qzone&json=1&g_tk=${this.Bot.bkn}`
}).then(res => res.json())
@@ -132,7 +132,7 @@ export default class {
/** 删除全部留言 */
async delQzoneMsgbAll () {
- let ck = common.getck('qzone.qq.com', this.Bot)
+ let ck = common.getck("qzone.qq.com", this.Bot)
return await fetch(`http://xiaobai.klizi.cn/API/qqgn/qzone_emptymsgb.php?data=&uin=${this.Bot.uin}&skey=${ck.skey}&pskey=${ck.p_skey}`).then(res => res.text()).catch(err => logger.error(err))
// let num = 0
// while (true) {
@@ -157,7 +157,7 @@ export default class {
async getAnnouncelist (group_id, s = 0) {
let n = s ? 1 : 20
let url = `https://web.qun.qq.com/cgi-bin/announce/get_t_list?bkn=${this.Bot.bkn}&qid=${group_id}&ft=23&s=${s - 1}&n=${n}`
- let res = await fetch(url, { headers: { Cookie: this.Bot.cookies['qun.qq.com'] } }).then(res => res.json()).catch(err => logger.error(err))
+ let res = await fetch(url, { headers: { Cookie: this.Bot.cookies["qun.qq.com"] } }).then(res => res.json()).catch(err => logger.error(err))
if (!res) return false
if (s) {
return {
@@ -165,7 +165,7 @@ export default class {
fid: res.feeds[0].fid
}
} else {
- return res.feeds.map((item, index) => `${index + 1}、${_.truncate(item.msg.text)}`).join('\n')
+ return res.feeds.map((item, index) => `${index + 1}、${_.truncate(item.msg.text)}`).join("\n")
}
}
@@ -177,10 +177,10 @@ export default class {
async setAnnounce (group_id, msg) {
let url = `https://web.qun.qq.com/cgi-bin/announce/add_qun_notice?bkn=${this.Bot.bkn}`
return await fetch(url, {
- method: 'POST',
+ method: "POST",
body: `qid=${group_id}&bkn=${this.Bot.bkn}&text=${msg}&pinned=0&type=1&settings={"is_show_edit_card":1,"tip_window_type":1,"confirm_required":1}`,
headers: {
- Cookie: this.Bot.cookies['qun.qq.com']
+ Cookie: this.Bot.cookies["qun.qq.com"]
}
}).then(res => res.json()).catch(err => logger.error(err))
}
@@ -196,10 +196,10 @@ export default class {
let url = `https://web.qun.qq.com/cgi-bin/announce/del_feed?bkn=${this.Bot.bkn}`
let res = await fetch(url, {
- method: 'POST',
+ method: "POST",
body: `bkn=${this.Bot.bkn}&fid=${fid.fid}&qid=${group_id}`,
headers: {
- Cookie: this.Bot.cookies['qun.qq.com']
+ Cookie: this.Bot.cookies["qun.qq.com"]
}
}).then(res => res.json()).catch(err => logger.error(err))
return {
@@ -216,9 +216,9 @@ export default class {
let url = `https://qqweb.qq.com/c/activedata/get_credit_level_info?bkn=${this.Bot.bkn}&uin=${this.Bot.uin}&gc=${group_id}`
return await fetch(url, {
headers: {
- 'Cookie': this.Bot.cookies['qqweb.qq.com'],
- 'Referer': `https://qqweb.qq.com/m/business/qunlevel/index.html?gc=${group_id}&from=0&_wv=1027`,
- 'User-agent': 'Mozilla/5.0 (Linux; Android 12; M2012K11AC Build/SKQ1.220303.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.72 MQQBrowser/6.2 TBS/046141 Mobile Safari/537.36 V1_AND_SQ_8.3.9_350_TIM_D QQ/3.5.0.3148 NetType/WIFI WebP/0.3.0 Pixel/1080 StatusBarHeight/81 SimpleUISwitch/0 QQTheme/1015712'
+ "Cookie": this.Bot.cookies["qqweb.qq.com"],
+ "Referer": `https://qqweb.qq.com/m/business/qunlevel/index.html?gc=${group_id}&from=0&_wv=1027`,
+ "User-agent": "Mozilla/5.0 (Linux; Android 12; M2012K11AC Build/SKQ1.220303.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.72 MQQBrowser/6.2 TBS/046141 Mobile Safari/537.36 V1_AND_SQ_8.3.9_350_TIM_D QQ/3.5.0.3148 NetType/WIFI WebP/0.3.0 Pixel/1080 StatusBarHeight/81 SimpleUISwitch/0 QQTheme/1015712"
}
}).then(res => res.json()).catch(err => logger.error(err))
}
@@ -229,7 +229,7 @@ export default class {
*/
async dragon (group_id) {
let url = `https://qun.qq.com/interactive/honorlist?gc=${group_id}&type=1&_wv=3&_wwv=129`
- let res = await fetch(url, { headers: { Cookie: this.Bot.cookies['qun.qq.com'] } })
+ let res = await fetch(url, { headers: { Cookie: this.Bot.cookies["qun.qq.com"] } })
.then(res => res.text()).catch(err => logger.error(err))
let data = res.match(/