Skip to content

Commit 1c5af07

Browse files
Merge pull request #10 from yumi-team/reply
feat: upload with reply msg
2 parents 31358e4 + fbc0b81 commit 1c5af07

File tree

5 files changed

+165
-52
lines changed

5 files changed

+165
-52
lines changed

DOCS.md

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ await client.markAsRead(threadId)
409409
# Media
410410

411411
<a name="sendImage"></a>
412-
## client.sendImage(threadId, data, filename, caption?)
412+
## client.sendImage(threadId, data, filename, options?)
413413

414414
Send an image.
415415

@@ -418,7 +418,9 @@ __Parameters__
418418
* `threadId`: bigint - Thread ID
419419
* `data`: Buffer - Image data
420420
* `filename`: string - Filename
421-
* `caption?`: string - Caption (optional)
421+
* `options?`: string | object - Caption string or options object
422+
* `caption?`: string - Caption
423+
* `replyToId?`: string - Message ID to reply to
422424

423425
__Returns__
424426

@@ -430,13 +432,20 @@ __Example__
430432
import { readFileSync } from 'fs'
431433

432434
const image = readFileSync('photo.jpg')
435+
// Simple caption
433436
await client.sendImage(threadId, image, 'photo.jpg', 'Nice photo!')
437+
438+
// With reply
439+
await client.sendImage(threadId, image, 'photo.jpg', {
440+
caption: 'Nice photo!',
441+
replyToId: 'mid.xxx'
442+
})
434443
```
435444

436445
---
437446

438447
<a name="sendVideo"></a>
439-
## client.sendVideo(threadId, data, filename, caption?)
448+
## client.sendVideo(threadId, data, filename, options?)
440449

441450
Send a video.
442451

@@ -445,7 +454,9 @@ __Parameters__
445454
* `threadId`: bigint - Thread ID
446455
* `data`: Buffer - Video data
447456
* `filename`: string - Filename
448-
* `caption?`: string - Caption (optional)
457+
* `options?`: string | object - Caption string or options object
458+
* `caption?`: string - Caption
459+
* `replyToId?`: string - Message ID to reply to
449460

450461
__Returns__
451462

@@ -456,12 +467,18 @@ __Example__
456467
```typescript
457468
const video = readFileSync('video.mp4')
458469
await client.sendVideo(threadId, video, 'video.mp4', 'Cool video!')
470+
471+
// With reply
472+
await client.sendVideo(threadId, video, 'video.mp4', {
473+
caption: 'Cool video!',
474+
replyToId: 'mid.xxx'
475+
})
459476
```
460477

461478
---
462479

463480
<a name="sendVoice"></a>
464-
## client.sendVoice(threadId, data, filename)
481+
## client.sendVoice(threadId, data, filename, options?)
465482

466483
Send a voice message.
467484

@@ -470,6 +487,8 @@ __Parameters__
470487
* `threadId`: bigint - Thread ID
471488
* `data`: Buffer - Audio data
472489
* `filename`: string - Filename
490+
* `options?`: object - Options
491+
* `replyToId?`: string - Message ID to reply to
473492

474493
__Returns__
475494

@@ -480,12 +499,15 @@ __Example__
480499
```typescript
481500
const voice = readFileSync('voice.mp3')
482501
await client.sendVoice(threadId, voice, 'voice.mp3')
502+
503+
// With reply
504+
await client.sendVoice(threadId, voice, 'voice.mp3', { replyToId: 'mid.xxx' })
483505
```
484506

485507
---
486508

487509
<a name="sendFile"></a>
488-
## client.sendFile(threadId, data, filename, mimeType, caption?)
510+
## client.sendFile(threadId, data, filename, mimeType, options?)
489511

490512
Send any file.
491513

@@ -495,7 +517,9 @@ __Parameters__
495517
* `data`: Buffer - File data
496518
* `filename`: string - Filename
497519
* `mimeType`: string - MIME type (e.g., 'application/pdf')
498-
* `caption?`: string - Caption (optional)
520+
* `options?`: string | object - Caption string or options object
521+
* `caption?`: string - Caption
522+
* `replyToId?`: string - Message ID to reply to
499523

500524
__Returns__
501525

@@ -506,19 +530,27 @@ __Example__
506530
```typescript
507531
const pdf = readFileSync('document.pdf')
508532
await client.sendFile(threadId, pdf, 'document.pdf', 'application/pdf', 'Document')
533+
534+
// With reply
535+
await client.sendFile(threadId, pdf, 'document.pdf', 'application/pdf', {
536+
caption: 'Document',
537+
replyToId: 'mid.xxx'
538+
})
509539
```
510540

511541
---
512542

513543
<a name="sendSticker"></a>
514-
## client.sendSticker(threadId, stickerId)
544+
## client.sendSticker(threadId, stickerId, options?)
515545

516546
Send a sticker.
517547

518548
__Parameters__
519549

520550
* `threadId`: bigint - Thread ID
521551
* `stickerId`: bigint - Sticker ID
552+
* `options?`: object - Options
553+
* `replyToId?`: string - Message ID to reply to
522554

523555
__Returns__
524556

@@ -529,6 +561,9 @@ __Example__
529561
```typescript
530562
// Send thumbs up sticker
531563
await client.sendSticker(threadId, 369239263222822n)
564+
565+
// Reply with sticker
566+
await client.sendSticker(threadId, 369239263222822n, { replyToId: 'mid.xxx' })
532567
```
533568

534569
---

DOCS_VI.md

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ await client.markAsRead(threadId)
409409
# Media
410410

411411
<a name="sendImage"></a>
412-
## client.sendImage(threadId, data, filename, caption?)
412+
## client.sendImage(threadId, data, filename, options?)
413413

414414
Gửi ảnh.
415415

@@ -418,7 +418,9 @@ __Tham số__
418418
* `threadId`: bigint - ID của thread
419419
* `data`: Buffer - Dữ liệu ảnh
420420
* `filename`: string - Tên file
421-
* `caption?`: string - Caption (tùy chọn)
421+
* `options?`: string | object - Chuỗi caption hoặc object tùy chọn
422+
* `caption?`: string - Caption
423+
* `replyToId?`: string - ID tin nhắn cần reply
422424

423425
__Trả về__
424426

@@ -430,13 +432,20 @@ __Ví dụ__
430432
import { readFileSync } from 'fs'
431433

432434
const image = readFileSync('photo.jpg')
435+
// Caption đơn giản
433436
await client.sendImage(threadId, image, 'photo.jpg', 'Ảnh đẹp!')
437+
438+
// Với reply
439+
await client.sendImage(threadId, image, 'photo.jpg', {
440+
caption: 'Ảnh đẹp!',
441+
replyToId: 'mid.xxx'
442+
})
434443
```
435444

436445
---
437446

438447
<a name="sendVideo"></a>
439-
## client.sendVideo(threadId, data, filename, caption?)
448+
## client.sendVideo(threadId, data, filename, options?)
440449

441450
Gửi video.
442451

@@ -445,7 +454,9 @@ __Tham số__
445454
* `threadId`: bigint - ID của thread
446455
* `data`: Buffer - Dữ liệu video
447456
* `filename`: string - Tên file
448-
* `caption?`: string - Caption (tùy chọn)
457+
* `options?`: string | object - Chuỗi caption hoặc object tùy chọn
458+
* `caption?`: string - Caption
459+
* `replyToId?`: string - ID tin nhắn cần reply
449460

450461
__Trả về__
451462

@@ -456,12 +467,18 @@ __Ví dụ__
456467
```typescript
457468
const video = readFileSync('video.mp4')
458469
await client.sendVideo(threadId, video, 'video.mp4', 'Video hay!')
470+
471+
// Với reply
472+
await client.sendVideo(threadId, video, 'video.mp4', {
473+
caption: 'Video hay!',
474+
replyToId: 'mid.xxx'
475+
})
459476
```
460477

461478
---
462479

463480
<a name="sendVoice"></a>
464-
## client.sendVoice(threadId, data, filename)
481+
## client.sendVoice(threadId, data, filename, options?)
465482

466483
Gửi tin nhắn thoại.
467484

@@ -470,6 +487,8 @@ __Tham số__
470487
* `threadId`: bigint - ID của thread
471488
* `data`: Buffer - Dữ liệu audio
472489
* `filename`: string - Tên file
490+
* `options?`: object - Tùy chọn
491+
* `replyToId?`: string - ID tin nhắn cần reply
473492

474493
__Trả về__
475494

@@ -480,12 +499,15 @@ __Ví dụ__
480499
```typescript
481500
const voice = readFileSync('voice.mp3')
482501
await client.sendVoice(threadId, voice, 'voice.mp3')
502+
503+
// Với reply
504+
await client.sendVoice(threadId, voice, 'voice.mp3', { replyToId: 'mid.xxx' })
483505
```
484506

485507
---
486508

487509
<a name="sendFile"></a>
488-
## client.sendFile(threadId, data, filename, mimeType, caption?)
510+
## client.sendFile(threadId, data, filename, mimeType, options?)
489511

490512
Gửi file bất kỳ.
491513

@@ -495,7 +517,9 @@ __Tham số__
495517
* `data`: Buffer - Dữ liệu file
496518
* `filename`: string - Tên file
497519
* `mimeType`: string - MIME type (ví dụ: 'application/pdf')
498-
* `caption?`: string - Caption (tùy chọn)
520+
* `options?`: string | object - Chuỗi caption hoặc object tùy chọn
521+
* `caption?`: string - Caption
522+
* `replyToId?`: string - ID tin nhắn cần reply
499523

500524
__Trả về__
501525

@@ -506,19 +530,27 @@ __Ví dụ__
506530
```typescript
507531
const pdf = readFileSync('document.pdf')
508532
await client.sendFile(threadId, pdf, 'document.pdf', 'application/pdf', 'Tài liệu')
533+
534+
// Với reply
535+
await client.sendFile(threadId, pdf, 'document.pdf', 'application/pdf', {
536+
caption: 'Tài liệu',
537+
replyToId: 'mid.xxx'
538+
})
509539
```
510540

511541
---
512542

513543
<a name="sendSticker"></a>
514-
## client.sendSticker(threadId, stickerId)
544+
## client.sendSticker(threadId, stickerId, options?)
515545

516546
Gửi sticker.
517547

518548
__Tham số__
519549

520550
* `threadId`: bigint - ID của thread
521551
* `stickerId`: bigint - ID của sticker
552+
* `options?`: object - Tùy chọn
553+
* `replyToId?`: string - ID tin nhắn cần reply
522554

523555
__Trả về__
524556

@@ -529,6 +561,9 @@ __Ví dụ__
529561
```typescript
530562
// Gửi sticker thumbs up
531563
await client.sendSticker(threadId, 369239263222822n)
564+
565+
// Reply bằng sticker
566+
await client.sendSticker(threadId, 369239263222822n, { replyToId: 'mid.xxx' })
532567
```
533568

534569
---

0 commit comments

Comments
 (0)