Skip to content

Commit

Permalink
兼容trss (#723)
Browse files Browse the repository at this point in the history
Co-authored-by: Jin1c on imini <[email protected]>
  • Loading branch information
Jin1c-3 and Jin1c on imini authored Oct 29, 2024
1 parent aa2ac7b commit 2b9734c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions apps/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,14 @@ export class Update extends plugin {
* @returns
*/
async makeForwardMsg (title, msg, end) {
let nickname = (this.e.bot ?? Bot).nickname
const _bot = this.e.bot ?? Bot
let nickname = _bot.nickname
if (this.e.isGroup) {
let info = await (this.e.bot ?? Bot).getGroupMemberInfo(this.e.group_id, (this.e.bot ?? Bot).uin)
let info = await _bot?.pickMember?.(this.e.group_id, _bot.uin) || await _bot?.getGroupMemberInfo?.(this.e.group_id, _bot.uin)
nickname = info.card || info.nickname
}
let userInfo = {
user_id: (this.e.bot ?? Bot).uin,
user_id: _bot.uin,
nickname
}

Expand Down
2 changes: 1 addition & 1 deletion model/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ async function collectTools (e) {
}
let systemAddition = ''
if (e.isGroup) {
let botInfo = await e.bot.getGroupMemberInfo(e.group_id, getUin(e), true)
let botInfo = await e.bot?.pickMember?.(e.group_id, getUin(e), true) || await e.bot?.getGroupMemberInfo?.(e.group_id, getUin(e), true)
if (botInfo.role !== 'member') {
// 管理员才给这些工具
tools.push(...[new EditCardTool(), new JinyanTool(), new KickOutTool(), new HandleMessageMsgTool(), new SetTitleTool()])
Expand Down
4 changes: 2 additions & 2 deletions utils/tools/QueryUserinfoTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export class QueryUserinfoTool extends AbstractTool {
try {
let { qq } = opts
qq = isNaN(qq) || !qq ? e.sender.user_id : parseInt(qq.trim())
if (e.isGroup && typeof e.bot.getGroupMemberInfo === 'function') {
let user = await e.bot.getGroupMemberInfo(e.group_id, qq || e.sender.user_id, true)
if (e.isGroup) {
let user = await e.bot?.pickMember?.(e.group_id, qq || e.sender.user_id, true) || await e.bot?.getGroupMemberInfo?.(e.group_id, qq || e.sender.user_id, true)
// let mm = await e.group.getMemberMap()
// let user = mm.get(qq) || e.sender.user_id
let master = (await getMasterQQ())[0]
Expand Down

0 comments on commit 2b9734c

Please sign in to comment.