feat: 显示更多群成员资料信息

This commit is contained in:
Clansty 2024-05-09 01:39:22 +08:00
parent bffde61890
commit 853f041668
5 changed files with 64 additions and 10 deletions

View File

@ -97,7 +97,20 @@
<span class="badge badge-<%= role %> <%= title && 'badge-hasTitle' %>"><%= title || role %></span>
<%= name %>
</div>
<div class="secondary"><%= userId %></div>
<% if(nickname !== name) { %>
<div class="secondary"><%= nickname %></div>
<% } %>
<div class="secondary"><%= userId %>
<% if(qid){ %>
<span style="padding-left: 1em">QID: <%= qid %></span>
<% } %>
<% if(email){ %>
<span style="padding-left: 1em"><%= email %></span>
<% } %>
</div>
<% if(location) { %>
<div class="secondary"><%= location %></div>
<% } %>
<div class="detailItem">
<div class="secondary">加入时间</div>
<%= joinTime %>
@ -106,6 +119,10 @@
<div class="secondary">上次发言时间</div>
<%= lastSentTime %>
</div>
<div class="detailItem">
<div class="secondary">注册时间</div>
<%= regTime %>
</div>
</div>
</div>
</body>

View File

@ -23,6 +23,7 @@ export default ((fastify, opts, done) => {
reply.code(404);
return 'Member not found';
}
const profile = await pair.qq.client.getProfile(member.user_id);
reply.type('text/html');
return template({
@ -32,6 +33,12 @@ export default ((fastify, opts, done) => {
role: member.role,
joinTime: format(new Date(member.join_time * 1000), 'YYYY-MM-DD HH:mm'),
lastSentTime: format(new Date(member.last_sent_time * 1000), 'YYYY-MM-DD HH:mm'),
regTime: format(new Date(profile.regTimestamp * 1000), 'YYYY-MM-DD HH:mm'),
location: [profile.country, profile.province, profile.city].join(' ').trim(),
nickname: member.nickname,
email: profile.email,
qid: profile.QID,
signature: profile.signature,
});
});

View File

@ -4,9 +4,8 @@ import {
Friend,
Group,
GroupMessageEvent,
LogLevel, MessageElem,
Platform, PrivateMessage,
PrivateMessageEvent, Sendable,
LogLevel, Platform, PrivateMessage,
PrivateMessageEvent,
} from '@icqqjs/icqq';
import random from '../utils/random';
import fs from 'fs';
@ -14,7 +13,7 @@ import fsP from 'fs/promises';
import { Config } from '@icqqjs/icqq/lib/client';
import dataPath from '../helpers/dataPath';
import os from 'os';
import { Converter, Image, LongMsgElem, rand2uuid } from '@icqqjs/icqq/lib/message';
import { Converter, Image, rand2uuid } from '@icqqjs/icqq/lib/message';
import { randomBytes } from 'crypto';
import { gzip, timestamp } from '@icqqjs/icqq/lib/common';
import { pb } from '@icqqjs/icqq/lib/core';

View File

@ -1,3 +1,34 @@
diff --git a/lib/common.d.ts b/lib/common.d.ts
index d27f6298a041607768ee58b0d1e75c8bdcedafe1..a31f71a429a8395f727793e8f14445bf3b502a0c 100644
--- a/lib/common.d.ts
+++ b/lib/common.d.ts
@@ -54,5 +54,10 @@ export interface UserProfile {
signature: string;
/** 自定义的QID */
QID: string;
+ nickname: string;
+ country: string;
+ province: string;
+ city: string;
+ email: string;
}
export * from "./core/constants";
diff --git a/lib/internal/internal.js b/lib/internal/internal.js
index ee137c44c92b947dcc7d851bb04f319c9a070f68..6d129f1dada9e2af13b7bb5282eeafbefab816be 100644
--- a/lib/internal/internal.js
+++ b/lib/internal/internal.js
@@ -86,6 +86,11 @@ async function getUserProfile(uin = this.uin) {
});
// 有需要自己加!
return {
+ nickname: String(profile[20002]),
+ country: String(profile[20003]),
+ province: String(profile[20004]),
+ city: String(profile[20020]),
+ email: String(profile[20011]),
signature: String(profile[102]),
regTimestamp: profile[20026],
QID: String(profile[27394])
diff --git a/lib/message/converter.js b/lib/message/converter.js
index 27a659a3290fadd990a1a980918515a6ded4978f..d6156587a02b1ed441ac8d2a3e2104e6343306b2 100644
--- a/lib/message/converter.js

View File

@ -6,7 +6,7 @@ settings:
patchedDependencies:
'@icqqjs/icqq@1.2.0':
hash: c76wgceu6sitx4yhmgukfhsioq
hash: 6yho2mmridqmfssxk3qnzdaelu
path: patches/@icqqjs__icqq@1.2.0.patch
importers:
@ -27,7 +27,7 @@ importers:
version: 7.0.3
'@icqqjs/icqq':
specifier: 1.2.0
version: 1.2.0(patch_hash=c76wgceu6sitx4yhmgukfhsioq)
version: 1.2.0(patch_hash=6yho2mmridqmfssxk3qnzdaelu)
'@prisma/client':
specifier: 5.13.0
version: 5.13.0(prisma@5.13.0)
@ -102,7 +102,7 @@ importers:
version: 0.2.2
telegram:
specifier: https://github.com/clansty/gramjs/releases/download/2.19.10%2Brevert_media/telegram-2.19.10.tgz
version: '@github.com/clansty/gramjs/releases/download/2.19.10%252525252Brevert_media/telegram-2.19.10.tgz'
version: '@github.com/clansty/gramjs/releases/download/2.19.10%25252525252Brevert_media/telegram-2.19.10.tgz'
tmp-promise:
specifier: ^3.0.3
version: 3.0.3
@ -805,7 +805,7 @@ packages:
glob: 10.3.12
dev: false
/@icqqjs/icqq@1.2.0(patch_hash=c76wgceu6sitx4yhmgukfhsioq):
/@icqqjs/icqq@1.2.0(patch_hash=6yho2mmridqmfssxk3qnzdaelu):
resolution: {integrity: sha512-/BypCM8jlQC2OtoyVuf6aYuMBNJ122zez5gt4MOTsEetCrouxX1zVE2yGv6bbAOkzFA4JuMnwrIJL+pr2hP2ag==, tarball: https://npm.pkg.github.com/download/@icqqjs/icqq/1.2.0/a2f26dae19b894a37865e730fc639e251f169d17}
engines: {node: '>= v14'}
dependencies:
@ -5747,7 +5747,7 @@ packages:
- utf-8-validate
dev: false
'@github.com/clansty/gramjs/releases/download/2.19.10%252525252Brevert_media/telegram-2.19.10.tgz':
'@github.com/clansty/gramjs/releases/download/2.19.10%25252525252Brevert_media/telegram-2.19.10.tgz':
resolution: {tarball: https://github.com/clansty/gramjs/releases/download/2.19.10%2Brevert_media/telegram-2.19.10.tgz}
name: telegram
version: 2.19.10