mirror of
https://github.com/Jerryplusy/crystelf-plugin.git
synced 2025-07-04 14:19:19 +00:00
适配lgr的发送文件
This commit is contained in:
parent
89b19efaf1
commit
1ac1af9e32
@ -207,7 +207,7 @@ export class xzq extends plugin {
|
|||||||
e.reply('下载超时', true);
|
e.reply('下载超时', true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
ok = await this.upload(e, file);
|
ok = await this.upload(e, file, book_info);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
this.clearCache(false, true, String(e.message_id));
|
this.clearCache(false, true, String(e.message_id));
|
||||||
e.reply('上传失败', true);
|
e.reply('上传失败', true);
|
||||||
@ -219,14 +219,22 @@ export class xzq extends plugin {
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
async upload(e, filePath) {
|
async upload(e, filePath, bookInfo) {
|
||||||
try {
|
try {
|
||||||
let res;
|
let res;
|
||||||
if (e.isGroup) {
|
if (e.isGroup) {
|
||||||
if (e.group.sendFile) res = await e.group.sendFile(filePath);
|
res = e.bot.sendApi('upload_group_file', {
|
||||||
else if (e.group.fs && e.group.fs.upload) res = await e.group.fs.upload(filePath);
|
group_id: e.group_id,
|
||||||
} else if (e.friend && e.friend.sendFile) {
|
file: filePath,
|
||||||
res = await e.friend.sendFile(filePath);
|
name: bookInfo.book_name,
|
||||||
|
folder: 'fanqie',
|
||||||
|
});
|
||||||
|
} else if (e.friend) {
|
||||||
|
res = e.bot.sendApi('upload_private_file', {
|
||||||
|
user_id: e.user_id,
|
||||||
|
file: filePath,
|
||||||
|
name: bookInfo.book_name,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (res) {
|
if (res) {
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user