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", "name": "LLOneBot",
"slug": "LLOneBot", "slug": "LLOneBot",
"description": "LiteLoaderQQNT的OneBotApi", "description": "LiteLoaderQQNT的OneBotApi",
"version": "2.0.3", "version": "2.0.4",
"thumbnail": "./icon.png", "thumbnail": "./icon.png",
"authors": [{ "authors": [{
"name": "linyuchen", "name": "linyuchen",
"link": "https://github.com/linyuchen" "link": "https://github.com/linyuchen"
}], }],
"repository": { "repository": {
"repo": "linyuchen/LLOneBot", "repo": "linyuchen/LiteLoaderQQNT-OneBotApi",
"branch": "main", "branch": "main",
"release": { "release": {
"tag": "latest", "tag": "latest",

View File

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

View File

@@ -102,6 +102,7 @@ async function getGroupMember(group_qq: string, member_uid: string) {
async function handleNewMessage(messages: MessageElement[]) { async function handleNewMessage(messages: MessageElement[]) {
// console.log("llonebot 收到消息:", messages);
for (let message of messages) { for (let message of messages) {
let onebot_message_data: any = { let onebot_message_data: any = {
self: { self: {
@@ -132,10 +133,10 @@ async function handleNewMessage(messages: MessageElement[]) {
card: groupMember!.cardName, card: groupMember!.cardName,
role: OnebotGroupMemberRole[groupMember!.role] role: OnebotGroupMemberRole[groupMember!.role]
} }
console.log("收到群消息", onebot_message_data) // console.log("收到群消息", onebot_message_data)
} else if (message.peer.chatType == "private") { } else if (message.peer.chatType == "private" || message.peer.chatType == "friend") {
onebot_message_data["user_id"] = message.peer.uid onebot_message_data["user_id"] = message.raw.senderUin;
let friend = await getFriend(message.sender.uid) let friend = await getFriend(message.raw.senderUin)
onebot_message_data.sender = { onebot_message_data.sender = {
user_id: friend!.uin, user_id: friend!.uin,
nickname: friend!.nickName nickname: friend!.nickName
@@ -229,7 +230,7 @@ async function listenSendMessage(postData: PostDataSendMsg) {
} else if (message.type == "text") { } else if (message.type == "text") {
message.content = message.data?.text || message.content message.content = message.data?.text || message.content
} else if (message.type == "image" || message.type == "voice" || message.type == "record") { } 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 url = message.data?.file || message.file
let uri = new URL(url); let uri = new URL(url);
let ext: string; let ext: string;