mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-12 07:50:25 +00:00
Add timeout parameter to file and packet API methods
Introduces an optional timeout parameter (defaulting to 20000ms) to various file and packet API methods for improved control over request duration. Updates all relevant method calls and internal usages to support the new timeout argument, including OneBot message API calls with a shorter timeout for file, video, and ptt URL retrieval.
This commit is contained in:
@@ -150,7 +150,7 @@ export class OneBotMsgApi {
|
||||
if (this.core.apis.PacketApi.packetStatus) {
|
||||
let url;
|
||||
try {
|
||||
url = await this.core.apis.FileApi.getFileUrl(msg.chatType, msg.peerUid, element.fileUuid, element.file10MMd5)
|
||||
url = await this.core.apis.FileApi.getFileUrl(msg.chatType, msg.peerUid, element.fileUuid, element.file10MMd5, 1500)
|
||||
} catch (error) {
|
||||
url = '';
|
||||
}
|
||||
@@ -393,7 +393,7 @@ export class OneBotMsgApi {
|
||||
if (!videoDownUrl) {
|
||||
if (this.core.apis.PacketApi.packetStatus) {
|
||||
try {
|
||||
videoDownUrl = await this.core.apis.FileApi.getVideoUrlPacket(msg.peerUid, element.fileUuid);
|
||||
videoDownUrl = await this.core.apis.FileApi.getVideoUrlPacket(msg.peerUid, element.fileUuid, 1500);
|
||||
} catch (e) {
|
||||
this.core.context.logger.logError('获取视频url失败', (e as Error).stack);
|
||||
videoDownUrl = element.filePath;
|
||||
@@ -424,7 +424,7 @@ export class OneBotMsgApi {
|
||||
let pttUrl = '';
|
||||
if (this.core.apis.PacketApi.packetStatus) {
|
||||
try {
|
||||
pttUrl = await this.core.apis.FileApi.getPttUrl(msg.peerUid, element.fileUuid);
|
||||
pttUrl = await this.core.apis.FileApi.getPttUrl(msg.peerUid, element.fileUuid, 1500);
|
||||
} catch (e) {
|
||||
this.core.context.logger.logError('获取语音url失败', (e as Error).stack);
|
||||
pttUrl = element.filePath;
|
||||
|
||||
Reference in New Issue
Block a user