mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
33688e9e5c | ||
![]() |
de8c2e1168 | ||
![]() |
2a1fc07b94 | ||
![]() |
c1b6daaf32 | ||
![]() |
02c973fe5e |
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 4,
|
"manifest_version": 4,
|
||||||
"type": "extension",
|
"type": "extension",
|
||||||
"name": "LLOneBot v3.20.2",
|
"name": "LLOneBot v3.20.4",
|
||||||
"slug": "LLOneBot",
|
"slug": "LLOneBot",
|
||||||
"description": "使你的NTQQ支持OneBot11协议进行QQ机器人开发, 不支持商店在线更新",
|
"description": "使你的NTQQ支持OneBot11协议进行QQ机器人开发, 不支持商店在线更新",
|
||||||
"version": "3.20.2",
|
"version": "3.20.4",
|
||||||
"icon": "./icon.jpg",
|
"icon": "./icon.jpg",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
@@ -40,11 +40,12 @@ import {OB11GroupTitleEvent} from "./event/notice/OB11GroupTitleEvent";
|
|||||||
import {OB11GroupCardEvent} from "./event/notice/OB11GroupCardEvent";
|
import {OB11GroupCardEvent} from "./event/notice/OB11GroupCardEvent";
|
||||||
import {OB11GroupDecreaseEvent} from "./event/notice/OB11GroupDecreaseEvent";
|
import {OB11GroupDecreaseEvent} from "./event/notice/OB11GroupDecreaseEvent";
|
||||||
|
|
||||||
|
let lastRKeyUpdateTime = 0;
|
||||||
|
|
||||||
export class OB11Constructor {
|
export class OB11Constructor {
|
||||||
static async message(msg: RawMessage): Promise<OB11Message> {
|
static async message(msg: RawMessage): Promise<OB11Message> {
|
||||||
let config = getConfigUtil().getConfig();
|
let config = getConfigUtil().getConfig();
|
||||||
const {enableLocalFile2Url, ob11: {messagePostFormat}} = getConfigUtil().getConfig()
|
const {enableLocalFile2Url, ob11: {messagePostFormat}} = config;
|
||||||
const message_type = msg.chatType == ChatType.group ? "group" : "private";
|
const message_type = msg.chatType == ChatType.group ? "group" : "private";
|
||||||
const resMsg: OB11Message = {
|
const resMsg: OB11Message = {
|
||||||
self_id: parseInt(selfInfo.uin),
|
self_id: parseInt(selfInfo.uin),
|
||||||
@@ -140,21 +141,27 @@ export class OB11Constructor {
|
|||||||
// message_data["data"]["path"] = element.picElement.sourcePath
|
// message_data["data"]["path"] = element.picElement.sourcePath
|
||||||
const url = element.picElement.originImageUrl
|
const url = element.picElement.originImageUrl
|
||||||
const fileMd5 = element.picElement.md5HexStr
|
const fileMd5 = element.picElement.md5HexStr
|
||||||
let currentRKey = config.imageRKey || "CAQSKAB6JWENi5LMk0kc62l8Pm3Jn1dsLZHyRLAnNmHGoZ3y_gDZPqZt-64"
|
const fileUuid = element.picElement.fileUuid
|
||||||
|
// let currentRKey = config.imageRKey || "CAQSKAB6JWENi5LMk0kc62l8Pm3Jn1dsLZHyRLAnNmHGoZ3y_gDZPqZt-64"
|
||||||
|
let currentRKey = "CAQSKAB6JWENi5LMk0kc62l8Pm3Jn1dsLZHyRLAnNmHGoZ3y_gDZPqZt-64"
|
||||||
if (url) {
|
if (url) {
|
||||||
if (url.startsWith("/download")) {
|
if (url.startsWith("/download")) {
|
||||||
if (url.includes("&rkey=")) {
|
if (url.includes("&rkey=")) {
|
||||||
// 正则提取rkey
|
// 正则提取rkey
|
||||||
const rkey = url.match(/&rkey=([^&]+)/)[1]
|
// const rkey = url.match(/&rkey=([^&]+)/)[1]
|
||||||
// log("图片url已有rkey", rkey)
|
// // log("图片url已有rkey", rkey)
|
||||||
if (rkey != currentRKey){
|
// if (rkey != currentRKey){
|
||||||
config.imageRKey = rkey
|
// config.imageRKey = rkey
|
||||||
getConfigUtil().setConfig(config)
|
// if (Date.now() - lastRKeyUpdateTime > 1000 * 60) {
|
||||||
}
|
// lastRKeyUpdateTime = Date.now()
|
||||||
message_data["data"]["url"] = IMAGE_HTTP_HOST_NT + url
|
// getConfigUtil().setConfig(config)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
message_data["data"]["url"] = IMAGE_HTTP_HOST + url
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
message_data["data"]["url"] = IMAGE_HTTP_HOST_NT + url + "&rkey=" + currentRKey
|
// 有可能会碰到appid为1406的,这个不能使用新的NT域名,并且需要把appid改为1407才可访问
|
||||||
|
message_data["data"]["url"] = `${IMAGE_HTTP_HOST}/download?appid=1407&fileid=${fileUuid}&rkey=${currentRKey}&spec=0`
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
message_data["data"]["url"] = IMAGE_HTTP_HOST + url
|
message_data["data"]["url"] = IMAGE_HTTP_HOST + url
|
||||||
|
@@ -1 +1 @@
|
|||||||
export const version = "3.20.2"
|
export const version = "3.20.4"
|
Reference in New Issue
Block a user