Compare commits

..

11 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
linyuchen
f9a3b60192 ver: 2.0.3 2024-01-28 10:54:57 +08:00
linyuchen
15ea558721 doc update 2024-01-28 10:54:26 +08:00
linyuchen
35c9ffc0b0 Merge branch 'dev' 2024-01-28 10:42:46 +08:00
linyuchen
7dde7cbc2b fix: 发送file://文件时会误删除原文件 2024-01-28 10:41:48 +08:00
linyuchen
515fc8afb4 Merge pull request #7 from Rotten-LKZ/dev
feat: github actions for automatically publishing releases
2024-01-28 10:37:06 +08:00
Rotten-LKZ
f341e9f6e1 fix: cannot start with GITHUB 2024-01-28 03:42:11 +08:00
Rotten-LKZ
bfdb2835c6 feat: github actions for automatically publishing releases 2024-01-28 03:22:01 +08:00
linyuchen
05c4d693e0 fix: 上报消息添加raw_message和font字段 2024-01-25 14:42:44 +08:00
6 changed files with 53 additions and 15 deletions

36
.github/workflows/publish.yml vendored Normal file
View File

@@ -0,0 +1,36 @@
name: "publish"
on:
push:
tags:
- "v*"
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup node
uses: actions/setup-node@v2
with:
node-version: 18
- name: install dependenies
run: npm install
- name: build
run: npm run build
- name: zip
run: |
sudo apt install zip -y
cp manifest.json ./dist/manifest.json
zip LLOneBot.zip ./dist/* -j
- name: publish
uses: ncipollo/release-action@v1
with:
artifacts: "LLOneBot.zip"
draft: true
token: ${{ secrets.RELEASE_TOKEN }}

View File

@@ -1,9 +1,10 @@
# LLOneBot API
注意:本文档对应的是 LiteLoader 1.0.0及以上版本如果你使用的是旧版本请切换到本项目v1分支查看文档
将NTQQLiteLoaderAPI封装成OneBot11/12标准的API, V12没有完整测试
*注意:本文档对应的是 LiteLoader 1.0.0及以上版本如果你使用的是旧版本请切换到本项目v1分支查看文档*
## 安装方法
1.安装[NTQQLiteLoader](https://liteloaderqqnt.github.io/guide/install.html)

View File

@@ -4,14 +4,14 @@
"name": "LLOneBot",
"slug": "LLOneBot",
"description": "LiteLoaderQQNT的OneBotApi",
"version": "2.0.1",
"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

@@ -1,7 +1,6 @@
import {log} from "./utils";
const express = require("express");
const bodyParser = require('body-parser');
import {sendIPCRecallQQMsg, sendIPCSendQQMsg} from "./IPCSend";
import {OnebotGroupMemberRole, PostDataAction, PostDataSendMsg, SendMessage} from "../common/types";
import {friends, groups, selfInfo} from "./data";
@@ -146,8 +145,7 @@ export function startExpress(port: number) {
const app = express();
// 中间件用于解析POST请求的请求体
app.use(express.urlencoded({extended: true, limit: "500mb"}));
app.use(bodyParser({limit: '500mb'}))
app.use(express.json());
app.use(express.json({limit: '500mb'}));
function parseToOnebot12(action: PostDataAction) {
app.post('/' + action, (req: any, res: any) => {

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: {
@@ -116,7 +117,9 @@ async function handleNewMessage(messages: MessageElement[]) {
detail_type: message.peer.chatType,
message_id: message.raw.msgId,
sub_type: "",
message: []
message: [],
raw_message: "",
font: 14
}
if (message.peer.chatType == "group") {
let group_id = message.peer.uid
@@ -130,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
@@ -227,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;
@@ -243,9 +246,9 @@ async function listenSendMessage(postData: PostDataSendMsg) {
localFilePath = url.split("file://")[1]
} else {
localFilePath = await window.llonebot.downloadFile({uri: url, localFilePath: localFilePath})
sendFiles.push(localFilePath);
}
message.file = localFilePath
sendFiles.push(localFilePath);
} else if (message.type == "reply") {
let msgId = message.data?.id || message.msgId
let replyMessage = msgHistory.find(msg => msg.raw.msgId == msgId)