Compare commits

..

3 Commits

Author SHA1 Message Date
linyuchen
8083ae4091 Merge branch 'dev'
# Conflicts:
#	manifest.json
2024-01-30 04:11:43 +08:00
linyuchen
465b7eaf6e chore: ver 2.0.4 2024-01-30 04:11:01 +08:00
linyuchen
0a6a67738e fix: cant not get sender info from friend message 2024-01-30 03:46:31 +08:00
3 changed files with 10 additions and 9 deletions

View File

@@ -4,14 +4,14 @@
"name": "LLOneBot",
"slug": "LLOneBot",
"description": "LiteLoaderQQNT的OneBotApi",
"version": "2.0.3",
"version": "2.0.4",
"thumbnail": "./icon.png",
"authors": [{
"name": "linyuchen",
"link": "https://github.com/linyuchen"
}],
"repository": {
"repo": "linyuchen/LLOneBot",
"repo": "linyuchen/LiteLoaderQQNT-OneBotApi",
"branch": "main",
"release": {
"tag": "latest",

View File

@@ -44,7 +44,7 @@ export type Group = {
}
export type Peer = {
chatType: "private" | "group"
chatType: "private" | "group" | "friend"
name: string
uid: string // qq号
}
@@ -53,6 +53,7 @@ export type MessageElement = {
raw: {
msgId: string,
msgSeq: string,
senderUin: string; // 发送者QQ号
elements: {
replyElement: {
senderUid: string, // 原消息发送者QQ号
@@ -98,7 +99,6 @@ export type MessageElement = {
}
}[]
}
peer: Peer,
sender: {
uid: string // 一串加密的字符串

View File

@@ -102,6 +102,7 @@ async function getGroupMember(group_qq: string, member_uid: string) {
async function handleNewMessage(messages: MessageElement[]) {
// console.log("llonebot 收到消息:", messages);
for (let message of messages) {
let onebot_message_data: any = {
self: {
@@ -132,10 +133,10 @@ async function handleNewMessage(messages: MessageElement[]) {
card: groupMember!.cardName,
role: OnebotGroupMemberRole[groupMember!.role]
}
console.log("收到群消息", onebot_message_data)
} else if (message.peer.chatType == "private") {
onebot_message_data["user_id"] = message.peer.uid
let friend = await getFriend(message.sender.uid)
// console.log("收到群消息", onebot_message_data)
} else if (message.peer.chatType == "private" || message.peer.chatType == "friend") {
onebot_message_data["user_id"] = message.raw.senderUin;
let friend = await getFriend(message.raw.senderUin)
onebot_message_data.sender = {
user_id: friend!.uin,
nickname: friend!.nickName
@@ -229,7 +230,7 @@ async function listenSendMessage(postData: PostDataSendMsg) {
} else if (message.type == "text") {
message.content = message.data?.text || message.content
} else if (message.type == "image" || message.type == "voice" || message.type == "record") {
// todo: 收到的应该是uri格式的需要转成本地的, uri格式有三种http, file, base64
// 收到的是uri格式的需要转成本地的, uri格式有三种http, file, base64
let url = message.data?.file || message.file
let uri = new URL(url);
let ext: string;