mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
8083ae4091 | ||
![]() |
465b7eaf6e | ||
![]() |
0a6a67738e |
@@ -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",
|
||||
|
@@ -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 // 一串加密的字符串
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user