✨ 优化转发消息卡片标题
This commit is contained in:
@@ -3,7 +3,6 @@ import fetch from 'node-fetch'
|
||||
import _ from 'lodash'
|
||||
import { Config } from '../components/index.js'
|
||||
import { common, uploadRecord, QQApi, funApi } from '../model/index.js'
|
||||
import { xiurenTypeId } from '../model/api/funApi.js'
|
||||
import { successImgs, faildsImgs, heisiType } from '../constants/fun.js'
|
||||
|
||||
/** API请求错误文案 */
|
||||
@@ -80,7 +79,7 @@ export class Fun extends plugin {
|
||||
fnc: 'acg'
|
||||
},
|
||||
{
|
||||
reg: `^#来点(${Object.keys(xiurenTypeId).join('|')})$`,
|
||||
reg: `^#来点(${Object.keys(funApi.xiurenTypeId).join('|')})$`,
|
||||
fnc: 'xiuren'
|
||||
}
|
||||
|
||||
|
||||
@@ -379,7 +379,10 @@ export class GroupAdmin extends plugin {
|
||||
// 获取禁言列表
|
||||
async Mutelist (e) {
|
||||
new Ga(e).getMuteList(e.group_id, true)
|
||||
.then(res => common.getforwardMsg(e, res, { isxml: true }))
|
||||
.then(res => common.getforwardMsg(e, res, {
|
||||
isxml: true,
|
||||
xmlTitle: '禁言列表'
|
||||
}))
|
||||
.catch(err => e.reply(err.message))
|
||||
}
|
||||
|
||||
@@ -429,7 +432,10 @@ export class GroupAdmin extends plugin {
|
||||
`请发送:#确认清理${regRet[2]}${regRet[3]}没发言的人`
|
||||
])
|
||||
}
|
||||
common.getforwardMsg(e, msg, { isxml: true })
|
||||
common.getforwardMsg(e, msg, {
|
||||
isxml: true,
|
||||
xmlTitle: e.msg.replace(/#|查看|清理/g, '')
|
||||
})
|
||||
}
|
||||
|
||||
// 查看和清理从未发言的人
|
||||
@@ -460,7 +466,10 @@ export class GroupAdmin extends plugin {
|
||||
let page = e.msg.match(new RegExp(Numreg))
|
||||
page = page ? common.translateChinaNum(page[0]) : 1
|
||||
new Ga(e).getNeverSpeakInfo(e.group_id, page)
|
||||
.then(res => common.getforwardMsg(e, res, { isxml: true }))
|
||||
.then(res => common.getforwardMsg(e, res, {
|
||||
isxml: true,
|
||||
xmlTitle: e.msg.replace(/#|查看|清理/g, '')
|
||||
}))
|
||||
.catch(err => e.reply(err.message))
|
||||
}
|
||||
|
||||
|
||||
@@ -68,14 +68,14 @@ export class NewGroupBannedWords extends plugin {
|
||||
const type = groupBannedWords.data[rawBannedWords]
|
||||
const muteTime = GroupBannedWords.getMuteTime(e.group_id)
|
||||
const punishments = {
|
||||
'1': async () => await e.member.kick(),
|
||||
'2': async () => await e.member.mute(muteTime),
|
||||
'3': async () => await e.recall(),
|
||||
'4': async () => {
|
||||
1: async () => await e.member.kick(),
|
||||
2: async () => await e.member.mute(muteTime),
|
||||
3: async () => await e.recall(),
|
||||
4: async () => {
|
||||
await e.member.kick()
|
||||
await e.recall()
|
||||
},
|
||||
'5': async () => {
|
||||
5: async () => {
|
||||
await e.member.mute(muteTime)
|
||||
await e.recall()
|
||||
}
|
||||
|
||||
@@ -22,3 +22,14 @@ export const heisiType = {
|
||||
网红: { type: 'mcn', page: 36 },
|
||||
美足: { type: 'meizu', page: 9 }
|
||||
}
|
||||
|
||||
export const xiurenTypeId = {
|
||||
秀人: {
|
||||
id: 117,
|
||||
maxPage: 88
|
||||
},
|
||||
足控: {
|
||||
id: 229,
|
||||
maxPage: 8
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ export default new class newCommon {
|
||||
* @param {number} options.info.user_id - 转发人QQ
|
||||
* @param {string|array} [options.fkmsg] - 风控消息,不传则默认消息
|
||||
* @param {Boolean} [options.isxml] - 是否处理卡片,若为true则处理卡片
|
||||
* @param {Boolean} [options.isxmlMsg] - 处理卡片显示的消息
|
||||
* @param {Boolean} [options.xmlTitle] - XML 标题
|
||||
* @param {Boolean} [options.oneMsg] - 用于只有一条消息,不用再转成二维数组
|
||||
* @param {Boolean | import('icqq').Anonymous} [options.anony] - 匿名消息,若为true则发送匿名消息
|
||||
* @returns {Promise<import('icqq').MessageRet>} 消息发送结果的Promise对象
|
||||
@@ -225,13 +225,20 @@ export default new class newCommon {
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 获取配置的撤回时间发送转发消息
|
||||
* @param {*} e oicq
|
||||
* @param {array} msg 发送的消息
|
||||
* @param {string} fkmsg 风控消息
|
||||
* @param {object} data 其他参数
|
||||
* @return {object} 消息是否发送成功的对象
|
||||
*/
|
||||
* 转发消息并根据权限撤回
|
||||
* @async
|
||||
* @param {Object} e - 反馈的对象
|
||||
* @param {string|Object} msg - 要发送的消息字符串或对象
|
||||
* @param {Object} [data={}] - 附加的数据对象
|
||||
* @param {number} [data.recallMsg] - 消息撤回时间
|
||||
* @param {Object} [data.info] - 附加消息信息
|
||||
* @param {string} [data.info.nickname] - 用户昵称
|
||||
* @param {number} [data.info.user_id] - 用户ID
|
||||
* @param {boolean} [data.isxml=true] - 是否特殊处理转发消息
|
||||
* @param {string} [data.xmlTitle] - XML 标题
|
||||
* @param {Object} [data.anony] - 附加的匿名数据对象
|
||||
* @returns {Promise<any>} - Promise 对象,返回函数 `getforwardMsg()` 的返回值
|
||||
*/
|
||||
async recallSendForwardMsg (e, msg, data = {}) {
|
||||
let recalltime = setu.getRecallTime(e.group_id)
|
||||
let anony = Config.Notice.anonymous
|
||||
@@ -242,7 +249,7 @@ export default new class newCommon {
|
||||
user_id: 2854196306
|
||||
},
|
||||
isxml: true,
|
||||
xmlTitle: '涩批(//// ^ ////)',
|
||||
xmlTitle: e.msg,
|
||||
anony,
|
||||
...data
|
||||
})
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
import fetch from 'node-fetch'
|
||||
import md5 from 'md5'
|
||||
import _ from 'lodash'
|
||||
import request from '../../lib/request/request.js'
|
||||
import md5 from 'md5'
|
||||
import fetch from 'node-fetch'
|
||||
import { langType } from '../../constants/youdao.js'
|
||||
import request from '../../lib/request/request.js'
|
||||
import { puppeteer } from '../index.js'
|
||||
import { xiurenTypeId } from '../../constants/fun.js'
|
||||
|
||||
const API_ERROR = '出了点小问题,待会再试试吧'
|
||||
export const xiurenTypeId = {
|
||||
秀人: {
|
||||
id: 117,
|
||||
maxPage: 88
|
||||
}
|
||||
}
|
||||
|
||||
export default new class {
|
||||
constructor () {
|
||||
this.xiurenTypeId = xiurenTypeId
|
||||
}
|
||||
|
||||
/** 有道翻译 */
|
||||
async youdao (msg, to = 'auto', from = 'auto') {
|
||||
if (to != 'auto') to = langType.find(item => item.label == to)?.code
|
||||
@@ -188,7 +189,7 @@ export default new class {
|
||||
)
|
||||
})
|
||||
// 可扩展
|
||||
let handleType = xiurenTypeId[type]
|
||||
let handleType = this.xiurenTypeId[type]
|
||||
let homeUrl = `https://www.lisiku1.com/forum-${handleType.id}-${_.random(1, handleType.maxPage)}.html`
|
||||
let html = await request.get(homeUrl).then(res => res.text())
|
||||
let $ = cheerio.load(html)
|
||||
|
||||
Reference in New Issue
Block a user