💄 优化
This commit is contained in:
@@ -162,7 +162,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
/** 禁言 */
|
||||
async muteMember (e) {
|
||||
if (!common.Authentication(e, 'admin', 'admin')) return
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
let qq = e.message.find(item => item.type == 'at')?.qq
|
||||
let reg = `#禁言\\s?((\\d+)\\s)?(${Numreg})?(${TimeUnitReg})?`
|
||||
let regRet = e.msg.match(new RegExp(reg))
|
||||
@@ -174,7 +174,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
/** 解禁 */
|
||||
async noMuteMember (e) {
|
||||
if (!common.Authentication(e, 'admin', 'admin')) return
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
|
||||
let qq = e.message.find(item => item.type == 'at')?.qq
|
||||
let regRet = e.msg.match(/#解禁(\d+)/)
|
||||
@@ -186,7 +186,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
/** 全体禁言 */
|
||||
async muteAll (e) {
|
||||
if (!common.Authentication(e, 'admin', 'admin')) return
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
|
||||
let type = /全体禁言/.test(e.msg)
|
||||
let res = await e.group.muteAll(type)
|
||||
@@ -196,7 +196,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 踢群员
|
||||
async kickMember (e) {
|
||||
if (!common.Authentication(e, 'admin', 'admin')) return
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
|
||||
let qq = e.message.find(item => item.type == 'at')?.qq
|
||||
if (!qq) qq = e.msg.replace(/#|踢/g, '').trim()
|
||||
@@ -225,7 +225,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 设置管理
|
||||
async SetAdmin (e) {
|
||||
if (!common.Authentication(e, 'master', 'owner')) return
|
||||
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()
|
||||
@@ -243,7 +243,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 匿名
|
||||
async AllowAnony (e) {
|
||||
if (!common.Authentication(e, 'admin', 'admin')) return
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
|
||||
let type = /(允许|开启)匿名/.test(e.msg)
|
||||
let res = await e.group.allowAnony(type)
|
||||
@@ -253,7 +253,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 发群公告
|
||||
async AddAnnounce (e) {
|
||||
if (!common.Authentication(e, 'admin', 'admin')) return
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
// 获取发送的内容
|
||||
let msg = e.msg.replace(/#|发群公告/g, '').trim()
|
||||
if (!msg) return e.reply('❎ 公告不能为空')
|
||||
@@ -275,7 +275,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 删群公告
|
||||
async DelAnnounce (e) {
|
||||
if (!common.Authentication(e, 'admin', 'admin')) return
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
let msg = e.msg.replace(/#|删群公告/, '').trim()
|
||||
if (!msg) return e.reply('❎ 序号不可为空')
|
||||
|
||||
@@ -291,7 +291,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 修改头衔
|
||||
async adminsetTitle (e) {
|
||||
if (!common.Authentication(e, 'master', 'owner')) return
|
||||
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, '')
|
||||
@@ -305,7 +305,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 申请头衔
|
||||
async SetGroupSpecialTitle (e) {
|
||||
if (!common.Authentication(e, 'all', 'owner')) return
|
||||
if (!common.checkPermission(e, 'all', 'owner')) return
|
||||
|
||||
let Title = e.msg.replace(/#|申请头衔/g, '')
|
||||
// 屏蔽词处理
|
||||
@@ -359,7 +359,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 替换幸运字符
|
||||
async qun_luckyuse (e) {
|
||||
if (!common.Authentication(e, 'admin', 'admin')) return
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
let id = e.msg.replace(/#|替换(幸运)?字符/g, '')
|
||||
let res = await new QQApi(e).equipLucky(e.group_id, id)
|
||||
|
||||
@@ -370,7 +370,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 开启或关闭群字符
|
||||
async qun_luckyset (e) {
|
||||
if (!common.Authentication(e, 'admin', 'admin')) return
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
|
||||
let res = await new QQApi(e).swichLucky(e.group_id, /开启/.test(e.msg))
|
||||
if (!res) return e.reply(API_ERROR)
|
||||
@@ -392,7 +392,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 解除全部禁言
|
||||
async relieveAllMute (e) {
|
||||
if (!common.Authentication(e, 'admin', 'admin')) return
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
new Ga(e).releaseAllMute()
|
||||
.then(() => e.reply('已经把全部的禁言解除辣╮( •́ω•̀)╭'))
|
||||
.catch(err => err.reply(err.message))
|
||||
@@ -400,7 +400,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 查看和清理多久没发言的人
|
||||
async noactive (e) {
|
||||
if (!common.Authentication(e, 'admin', 'admin')) return
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
|
||||
let regRet = noactivereg.exec(e.msg)
|
||||
regRet[2] = common.translateChinaNum(regRet[2] || 1)
|
||||
@@ -444,7 +444,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 查看和清理从未发言的人
|
||||
async neverspeak (e) {
|
||||
if (!common.Authentication(e, 'admin', 'admin')) return
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
let list = null
|
||||
try {
|
||||
list = await new Ga(e).getNeverSpeak(e.group_id)
|
||||
@@ -492,7 +492,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 发送通知
|
||||
async Send_notice (e) {
|
||||
if (!common.Authentication(e, 'admin', 'admin')) return
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
|
||||
e.message[0].text = e.message[0].text.replace('#发通知', '').trim()
|
||||
if (!e.message[0].text) e.message.shift()
|
||||
@@ -503,7 +503,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 设置定时群禁言
|
||||
async timeMute (e) {
|
||||
if (!common.Authentication(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()
|
||||
@@ -578,7 +578,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 群发言榜单
|
||||
async SpeakRank (e) {
|
||||
if (!common.Authentication(e, 'all', 'admin')) return
|
||||
if (!common.checkPermission(e, 'all', 'admin')) return
|
||||
|
||||
// 图片截图
|
||||
let screenshot = await puppeteer.Webpage({
|
||||
@@ -645,7 +645,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
// 群数据
|
||||
async groupData (e) {
|
||||
if (!common.Authentication(e, 'all', 'admin')) return
|
||||
if (!common.checkPermission(e, 'all', 'admin')) return
|
||||
|
||||
// 浏览器截图
|
||||
let screenshot = await puppeteer.Webpage({
|
||||
@@ -690,7 +690,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
/** 开启或关闭加群通知 */
|
||||
async handleGroupAdd (e) {
|
||||
if (!common.Authentication(e, 'admin', 'admin')) return
|
||||
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('❎ 本群加群申请通知已处于开启状态')
|
||||
@@ -701,7 +701,7 @@ export class GroupAdmin extends plugin {
|
||||
|
||||
/** 加精 */
|
||||
async setEssenceMessage (e) {
|
||||
if (!common.Authentication(e, 'admin', 'admin')) return
|
||||
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 res = await Bot.setEssenceMessage(source.message_id)
|
||||
|
||||
@@ -130,7 +130,7 @@ export class NewGroupBannedWords extends plugin {
|
||||
}
|
||||
|
||||
async add (e) {
|
||||
if (!common.Authentication(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('需要添加的屏蔽词为空')
|
||||
@@ -159,7 +159,7 @@ export class NewGroupBannedWords extends plugin {
|
||||
}
|
||||
|
||||
async del (e) {
|
||||
if (!common.Authentication(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('需要删除的屏蔽词为空')
|
||||
@@ -212,7 +212,7 @@ export class NewGroupBannedWords extends plugin {
|
||||
}
|
||||
|
||||
async muteTime (e) {
|
||||
if (!common.Authentication(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`)
|
||||
@@ -227,7 +227,7 @@ export class NewGroupBannedWords extends plugin {
|
||||
// 返回已有的头衔屏蔽词列表
|
||||
return e.reply(`现有的头衔屏蔽词如下:${shieldingWords.join('\n')}`)
|
||||
}
|
||||
if (!common.Authentication(e, 'admin', 'admin')) return false
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return false
|
||||
// 获取用户输入的要增加或删除的屏蔽词
|
||||
let message = e.msg.replace(/#|(增加|减少)头衔屏蔽词/g, '').trim().split(',')
|
||||
// 判断用户是要增加还是删除屏蔽词
|
||||
@@ -274,7 +274,7 @@ export class NewGroupBannedWords extends plugin {
|
||||
|
||||
// 修改头衔匹配模式
|
||||
async ProhibitedTitlePattern (e) {
|
||||
if (!common.Authentication(e, 'admin', 'admin')) return false
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return false
|
||||
let res = GroupBannedWords.setTitleFilterModeChange(e.group_id)
|
||||
e.reply(`✅ 已修改匹配模式为${res ? '精确' : '模糊'}匹配`)
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ export class NewGroupVerify extends plugin {
|
||||
|
||||
// 重新验证
|
||||
async cmdReverify (e) {
|
||||
if (!common.Authentication(e, 'admin', 'admin')) return
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
|
||||
if (!this.verifycfg.openGroup.includes(e.group_id)) return e.reply('当前群未开启验证哦~', true)
|
||||
|
||||
@@ -61,7 +61,7 @@ export class NewGroupVerify extends plugin {
|
||||
|
||||
// 绕过验证
|
||||
async cmdPass (e) {
|
||||
if (!common.Authentication(e, 'admin', 'admin')) return
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
|
||||
if (!this.verifycfg.openGroup.includes(e.group_id)) return e.reply('当前群未开启验证哦~', true)
|
||||
|
||||
@@ -98,7 +98,7 @@ export class NewGroupVerify extends plugin {
|
||||
|
||||
// 开启验证
|
||||
async handelverify (e) {
|
||||
if (!common.Authentication(e, 'admin', 'admin')) return
|
||||
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('❎ 本群验证已处于开启状态')
|
||||
@@ -109,7 +109,7 @@ export class NewGroupVerify extends plugin {
|
||||
|
||||
// 切换验证模式
|
||||
async setmode (e) {
|
||||
if (!common.Authentication(e, 'master')) return
|
||||
if (!common.checkPermission(e, 'master')) return
|
||||
let value = this.verifycfg.mode == '模糊' ? '精确' : '模糊'
|
||||
Config.modify('groupverify', 'mode', value)
|
||||
e.reply(`✅ 已切换验证模式为${value}验证`)
|
||||
@@ -117,7 +117,7 @@ export class NewGroupVerify extends plugin {
|
||||
|
||||
// 设置验证超时时间
|
||||
async setovertime (e) {
|
||||
if (!common.Authentication(e, 'master')) return
|
||||
if (!common.checkPermission(e, 'master')) return
|
||||
let overtime = e.msg.match(/\d+/g)
|
||||
Config.modify('groupverify', 'time', Number(overtime))
|
||||
e.reply(`✅ 已将验证超时时间设置为${overtime}秒`)
|
||||
|
||||
@@ -129,7 +129,7 @@ export class NewHandle extends plugin {
|
||||
let sourceMsg = source.raw_message?.split('\n')
|
||||
if (!sourceMsg) return e.reply('❎ 获取原消息失败,请使用"同意xxx"进行处理')
|
||||
if (e.isGroup) {
|
||||
if (!common.Authentication(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)
|
||||
@@ -291,7 +291,7 @@ export class NewHandle extends plugin {
|
||||
]
|
||||
return common.getforwardMsg(e, msg)
|
||||
}
|
||||
if (!common.Authentication(e, 'admin', 'admin')) return
|
||||
if (!common.checkPermission(e, 'admin', 'admin')) return
|
||||
let yes = /同意/.test(e.msg)
|
||||
|
||||
if (/全部/.test(e.msg)) {
|
||||
|
||||
@@ -34,7 +34,7 @@ export class NewPicSearch extends plugin {
|
||||
}
|
||||
|
||||
async SauceNAO (e) {
|
||||
if (!await this.Authentication(e)) return
|
||||
if (!await this._Authentication(e)) return
|
||||
if (!await this.handelImg(e, 'SauceNAO')) return
|
||||
await PicSearch.SauceNAO(e.img[0])
|
||||
.then(async res => {
|
||||
@@ -52,7 +52,7 @@ export class NewPicSearch extends plugin {
|
||||
}
|
||||
|
||||
async Ascii2D (e) {
|
||||
if (!await this.Authentication(e)) return
|
||||
if (!await this._Authentication(e)) 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 }))
|
||||
@@ -60,7 +60,7 @@ export class NewPicSearch extends plugin {
|
||||
}
|
||||
|
||||
async WhatAnime (e) {
|
||||
if (!await this.Authentication(e)) return
|
||||
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/'))
|
||||
.then(async res => {
|
||||
@@ -80,7 +80,7 @@ export class NewPicSearch extends plugin {
|
||||
e.reply('OK')
|
||||
}
|
||||
|
||||
async Authentication (e) {
|
||||
async _Authentication (e) {
|
||||
if (e.isMaster) return true
|
||||
const { allowPM, limit, isMasterUse } = Config.picSearch
|
||||
if (isMasterUse) {
|
||||
|
||||
@@ -42,7 +42,7 @@ export class SeSe extends plugin {
|
||||
}
|
||||
|
||||
async setuRandom (e) {
|
||||
if (!await this.Authentication(e)) return
|
||||
if (!await this._Authentication(e)) return
|
||||
|
||||
const cdTime = setu.getRemainingCd(e.user_id, e.group_id)
|
||||
|
||||
@@ -66,7 +66,7 @@ export class SeSe extends plugin {
|
||||
|
||||
// tag搜图
|
||||
async setuTag (e) {
|
||||
if (!await this.Authentication(e)) return
|
||||
if (!await this._Authentication(e)) return
|
||||
|
||||
let cdTime = setu.getRemainingCd(e.user_id, e.group_id)
|
||||
if (cdTime) return e.reply(` ${setu.CDMsg}你的CD还有${cdTime}`, false, { at: true })
|
||||
@@ -97,7 +97,7 @@ export class SeSe extends plugin {
|
||||
.catch(err => e.reply(err.message))
|
||||
}
|
||||
|
||||
async Authentication (e) {
|
||||
async _Authentication (e) {
|
||||
if (e.isMaster) return true
|
||||
if (!Config.setu.allowPM && !e.isGroup) {
|
||||
e.reply('主人已禁用私聊该功能')
|
||||
|
||||
@@ -20,7 +20,7 @@ export default new class newCommon {
|
||||
* @param {'admin'|'owner'|'all'} [role='all'] - 用户的权限
|
||||
* @return {boolean} - 是否具有权限
|
||||
*/
|
||||
Authentication (e, permission = 'all', role = 'all') {
|
||||
checkPermission (e, permission = 'all', role = 'all') {
|
||||
if (role == 'owner' && !e.group.is_owner) {
|
||||
e.reply('我连群主都木有,这种事怎么可能做到的辣!!!', true)
|
||||
return false
|
||||
|
||||
@@ -39,12 +39,33 @@ body {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
img {
|
||||
.tb .avatar {
|
||||
position: relative;
|
||||
height: 100px;
|
||||
width: 100px;
|
||||
border-radius: 50%;
|
||||
margin-right: 20px;
|
||||
/* box-shadow: 1px 1px 3px 0 #000; */
|
||||
}
|
||||
|
||||
.tb .avatar img {
|
||||
width: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.tb .avatar::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
z-index: -1;
|
||||
margin: -3px;
|
||||
border-radius: 50%;
|
||||
box-shadow: 1px 1px 3px 0 #000;
|
||||
background: linear-gradient(135deg, #d3cce3, #e9e4f0);
|
||||
/* background-size: 120%; */
|
||||
}
|
||||
|
||||
hr {
|
||||
|
||||
@@ -6,8 +6,11 @@
|
||||
{{block 'main'}}
|
||||
<div class="box">
|
||||
<div class="tb">
|
||||
<img src="{{portrait}}" alt="头像"
|
||||
onerror="this.src= '{{_res_path}}state/img/default_avatar.png'; this.onerror = null;">
|
||||
<div class="avatar">
|
||||
<img src="{{portrait}}"
|
||||
onerror="this.src= '{{_res_path}}state/img/default_avatar.png'; this.onerror = null;">
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<h1>{{nickname}}</h1>
|
||||
<hr noshade>
|
||||
|
||||
Reference in New Issue
Block a user