mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 13:17:32 +00:00
feat: 查询其他人&设置允许/禁止查询其他人
This commit is contained in:
parent
8981fa84e9
commit
606109f4b3
7 changed files with 29 additions and 17 deletions
|
|
@ -2,6 +2,7 @@ import MysZZZApi from './mysapi.js';
|
|||
import { getCk } from './common.js';
|
||||
import _ from 'lodash';
|
||||
import NoteUser from '../../genshin/model/mys/NoteUser.js';
|
||||
import settings from '../lib/settings.js';
|
||||
|
||||
export class ZZZPlugin extends plugin {
|
||||
/**
|
||||
|
|
@ -10,7 +11,10 @@ export class ZZZPlugin extends plugin {
|
|||
*/
|
||||
async getUID() {
|
||||
let user = this.e;
|
||||
if (this.e.at) {
|
||||
const query = settings.getConfig('config').query;
|
||||
const allow = _.get(query, 'others', true);
|
||||
if (this.e.at && allow) {
|
||||
this.e.user_id = this.e.at;
|
||||
user = this.e.at;
|
||||
}
|
||||
this.User = await NoteUser.create(user);
|
||||
|
|
@ -29,9 +33,6 @@ export class ZZZPlugin extends plugin {
|
|||
async getAPI() {
|
||||
let uid = await this.getUID();
|
||||
if (!uid) return false;
|
||||
if (this.e.at) {
|
||||
this.e.user_id = this.e.at;
|
||||
}
|
||||
const ck = await getCk(this.e);
|
||||
if (!ck || Object.keys(ck).filter(k => ck[k].ck).length === 0) {
|
||||
await this.reply('尚未绑定cookie,请先绑定cookie');
|
||||
|
|
@ -69,8 +70,9 @@ export class ZZZPlugin extends plugin {
|
|||
if (!userData) return false;
|
||||
userData = userData?.list[0];
|
||||
let avatar = this.e.bot.avatar;
|
||||
// 头像
|
||||
if (this.e.member?.getAvatarUrl) {
|
||||
if (this.e?.user_id) {
|
||||
avatar = `https://q1.qlogo.cn/g?b=qq&s=0&nk=${this.e.user_id}`;
|
||||
} else if (this.e.member?.getAvatarUrl) {
|
||||
avatar = await this.e.member.getAvatarUrl();
|
||||
} else if (this.e.friend?.getAvatarUrl) {
|
||||
avatar = await this.e.friend.getAvatarUrl();
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ function render(e, renderPath, renderData = {}, cfg = {}) {
|
|||
return {
|
||||
player: e?.playerCard?.player,
|
||||
avatar: e?.playerCard?.avatar,
|
||||
qqId: e?.at || e.user_id,
|
||||
...data,
|
||||
_res_path: resPath,
|
||||
_layout_path: layoutPath,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue