mirror of
https://github.com/Jerryplusy/crystelf-plugin.git
synced 2025-10-14 05:39:18 +00:00
fix:增加进群验证判断
This commit is contained in:
parent
ec0ad4101f
commit
a175b88faf
@ -1,4 +1,5 @@
|
||||
import configControl from '../lib/config/configControl.js';
|
||||
import ConfigControl from '../lib/config/configControl.js';
|
||||
|
||||
export class carbonAuthSetting extends plugin {
|
||||
constructor() {
|
||||
@ -35,6 +36,11 @@ export class carbonAuthSetting extends plugin {
|
||||
async enableAuth(e) {
|
||||
if (!(e.sender.role === 'owner' || e.sender.role === 'admin' || e.isMaster))
|
||||
return e.reply('只有群主或管理员可以设置验证..', true);
|
||||
const botMember = await e.group?.pickMember?.(e.bot.uin);
|
||||
const info = botMember?.info || (await botMember?.getInfo?.());
|
||||
if (info.role !== 'admin' || info.role !== 'owner') {
|
||||
return e.reply(`${ConfigControl.get('profile')?.nickName}不是管理,没法帮你验证啦..`, true);
|
||||
}
|
||||
const { cfg, groupCfg } = await this._getCfg(e);
|
||||
groupCfg.enable = true;
|
||||
await this._saveCfg(e, cfg, groupCfg);
|
||||
|
@ -210,6 +210,12 @@ export class CarbonAuth extends plugin {
|
||||
let atElem = (e.message || []).find((m) => m.type === 'at');
|
||||
if (!atElem || !atElem.qq) return e.reply('你要验证谁?', true);
|
||||
const targetId = Number(atElem.qq);
|
||||
const member = await e.group.pickMember(targetId);
|
||||
if (member.role === 'owner' || member.role === 'admin') {
|
||||
return e.reply('这对吗', true);
|
||||
}
|
||||
const key = `${e.group_id}_${targetId}`;
|
||||
if (this.pending.get(key)) return e.reply('这孩子已经在验证了..', true);
|
||||
await this.auth(e, e.group_id, targetId);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user