@@ -156,7 +156,7 @@ export class Note {
156
156
constructor (
157
157
public mid : string ,
158
158
private client : Client ,
159
- ) { }
159
+ ) { }
160
160
161
161
public createPost ( options : {
162
162
text ?: string ;
@@ -214,7 +214,7 @@ export class Square {
214
214
public createdAt : Date ;
215
215
public me : SquareMember ;
216
216
public authority : LINETypes . SquareAuthority ;
217
- public note : LINETypes . NoteStatus ;
217
+ public noteStatus : LINETypes . NoteStatus ;
218
218
public status : LINETypes . SquareStatus ;
219
219
public memberCount : number ;
220
220
public joinRequestCount : number ;
@@ -223,7 +223,7 @@ export class Square {
223
223
224
224
public feature : LINETypes . SquareFeatureSet ;
225
225
226
- public noteClient : Note ;
226
+ public note : Note ;
227
227
228
228
constructor (
229
229
public rawSouce : LINETypes . GetSquareResponse ,
@@ -253,8 +253,8 @@ export class Square {
253
253
254
254
this . me = new SquareMember ( myMembership , client ) ;
255
255
this . authority = squareAuthority ;
256
- this . note = noteStatus ;
257
- this . noteClient = new Note ( this . mid , this . client ) ;
256
+ this . noteStatus = noteStatus ;
257
+ this . note = new Note ( this . mid , this . client ) ;
258
258
this . feature = squareFeatureSet as LINETypes . SquareFeatureSet ;
259
259
this . status = squareStatus ;
260
260
this . memberCount = squareStatus . memberCount ;
@@ -269,10 +269,6 @@ export class Square {
269
269
static async from ( squareMid : string , client : Client ) {
270
270
return new this ( await client . getSquare ( { squareMid } ) , client ) ;
271
271
}
272
-
273
- public getNote ( ) : Note {
274
- return this . noteClient ;
275
- }
276
272
}
277
273
278
274
/**
@@ -320,22 +316,51 @@ export class SquareChat {
320
316
static async from ( squareChatMid : string , client : Client ) {
321
317
return new this ( await client . getSquareChat ( { squareChatMid } ) , client ) ;
322
318
}
319
+
320
+ public async getMembers ( ) : Promise < SquareMember [ ] > {
321
+ const r = await this . client . getSquareChatMembers ( { squareChatMid : this . mid , continueRequest : true } ) ;
322
+ return r . squareChatMembers . map ( e => new SquareMember ( e , this . client ) ) ;
323
+ }
324
+
325
+ /**
326
+ * @description Send msg to square.
327
+ */
328
+ public send (
329
+ options :
330
+ | string
331
+ | {
332
+ text ?: string ;
333
+ contentType ?: number ;
334
+ contentMetadata ?: LooseType ;
335
+ relatedMessageId ?: string ;
336
+ location ?: LINETypes . Location ;
337
+ } ,
338
+ ) : Promise < LINETypes . SendMessageResponse > {
339
+ if ( typeof options === "string" ) {
340
+ return this . send ( { text : options } ) ;
341
+ } else {
342
+ const _options : LooseType = options ;
343
+ _options . squareChatMid = this . mid ;
344
+ return this . client . sendSquareMessage ( _options ) ;
345
+ }
346
+ }
347
+
323
348
}
324
349
325
350
/**
326
351
* @description LINE squareMember (Openchat user) utils
327
352
*/
328
353
export class SquareMember {
329
- mid : string ;
330
- squareMid : string ;
331
- displayName : string ;
332
- profileImageObsHash : string ;
333
- ableToReceiveMessage : boolean ;
334
- membershipState : LINETypes . SquareMembershipState ;
335
- role : LINETypes . SquareMemberRole ;
336
- revision : number ;
337
- preference : LINETypes . SquarePreference ;
338
- joinMessage ?: string ;
354
+ public mid : string ;
355
+ public squareMid : string ;
356
+ public displayName : string ;
357
+ public profileImageObsHash : string ;
358
+ public ableToReceiveMessage : boolean ;
359
+ public membershipState : LINETypes . SquareMembershipState ;
360
+ public role : LINETypes . SquareMemberRole ;
361
+ public revision : number ;
362
+ public preference : LINETypes . SquarePreference ;
363
+ public joinMessage ?: string ;
339
364
constructor (
340
365
public rawMember : LINETypes . SquareMember ,
341
366
private client : Client ,
@@ -510,14 +535,14 @@ export class User {
510
535
options :
511
536
| string
512
537
| {
513
- text ?: string ;
514
- contentType ?: number ;
515
- contentMetadata ?: LooseType ;
516
- relatedMessageId ?: string ;
517
- location ?: LINETypes . Location ;
518
- chunk ?: string [ ] | Buffer [ ] ;
519
- e2ee ?: boolean ;
520
- } ,
538
+ text ?: string ;
539
+ contentType ?: number ;
540
+ contentMetadata ?: LooseType ;
541
+ relatedMessageId ?: string ;
542
+ location ?: LINETypes . Location ;
543
+ chunk ?: string [ ] | Buffer [ ] ;
544
+ e2ee ?: boolean ;
545
+ } ,
521
546
) : Promise < LINETypes . Message > {
522
547
if ( typeof options === "string" ) {
523
548
return this . send ( { text : options } ) ;
@@ -534,7 +559,7 @@ export class User {
534
559
public async updateStatus ( ) {
535
560
this . updateStatusFrom (
536
561
( await this . client . getContactsV2 ( { mids : [ this . mid ] } ) ) . contacts [
537
- this . mid
562
+ this . mid
538
563
] ,
539
564
) ;
540
565
}
@@ -579,7 +604,7 @@ export class Group {
579
604
public preventedJoinByTicket : boolean ;
580
605
public invitationTicket : string ;
581
606
public notificationDisabled : boolean ;
582
- public noteClient : Note ;
607
+ public note : Note ;
583
608
584
609
/**
585
610
* @description Generate from groupMid or {Chat}.
@@ -662,7 +687,7 @@ export class Group {
662
687
const { groupExtra } = chat . extra ;
663
688
this . preventedJoinByTicket = groupExtra . preventedJoinByTicket ;
664
689
this . invitationTicket = groupExtra . invitationTicket ;
665
- this . noteClient = new Note ( this . mid , client ) ;
690
+ this . note = new Note ( this . mid , client ) ;
666
691
}
667
692
668
693
/**
@@ -672,14 +697,14 @@ export class Group {
672
697
options :
673
698
| string
674
699
| {
675
- text ?: string ;
676
- contentType ?: number ;
677
- contentMetadata ?: LooseType ;
678
- relatedMessageId ?: string ;
679
- location ?: LINETypes . Location ;
680
- chunk ?: string [ ] | Buffer [ ] ;
681
- e2ee ?: boolean ;
682
- } ,
700
+ text ?: string ;
701
+ contentType ?: number ;
702
+ contentMetadata ?: LooseType ;
703
+ relatedMessageId ?: string ;
704
+ location ?: LINETypes . Location ;
705
+ chunk ?: string [ ] | Buffer [ ] ;
706
+ e2ee ?: boolean ;
707
+ } ,
683
708
) : Promise < LINETypes . Message > {
684
709
if ( typeof options === "string" ) {
685
710
return this . send ( { text : options } ) ;
@@ -722,10 +747,6 @@ export class Group {
722
747
public kick ( mid : string ) : Promise < LINETypes . DeleteOtherFromChatResponse > {
723
748
return this . client . deleteOtherFromChat ( { to : this . mid , mid : mid } ) ;
724
749
}
725
-
726
- public getNote ( ) : Note {
727
- return this . noteClient ;
728
- }
729
750
}
730
751
731
752
/**
@@ -1686,14 +1707,14 @@ export class TalkMessage extends ClientMessage {
1686
1707
public async send (
1687
1708
options :
1688
1709
| {
1689
- text ?: string | undefined ;
1690
- contentType ?: number | undefined ;
1691
- contentMetadata ?: LooseType ;
1692
- relatedMessageId ?: string | undefined ;
1693
- location ?: LooseType ;
1694
- chunk ?: string [ ] | undefined ;
1695
- e2ee ?: boolean | undefined ;
1696
- }
1710
+ text ?: string | undefined ;
1711
+ contentType ?: number | undefined ;
1712
+ contentMetadata ?: LooseType ;
1713
+ relatedMessageId ?: string | undefined ;
1714
+ location ?: LooseType ;
1715
+ chunk ?: string [ ] | undefined ;
1716
+ e2ee ?: boolean | undefined ;
1717
+ }
1697
1718
| string ,
1698
1719
) : Promise < TalkMessage > {
1699
1720
if ( typeof options === "string" ) {
@@ -1719,14 +1740,14 @@ export class TalkMessage extends ClientMessage {
1719
1740
public async reply (
1720
1741
options :
1721
1742
| {
1722
- text ?: string | undefined ;
1723
- contentType ?: number | undefined ;
1724
- contentMetadata ?: LooseType ;
1725
- relatedMessageId ?: string | undefined ;
1726
- location ?: LooseType ;
1727
- chunk ?: string [ ] | undefined ;
1728
- e2ee ?: boolean | undefined ;
1729
- }
1743
+ text ?: string | undefined ;
1744
+ contentType ?: number | undefined ;
1745
+ contentMetadata ?: LooseType ;
1746
+ relatedMessageId ?: string | undefined ;
1747
+ location ?: LooseType ;
1748
+ chunk ?: string [ ] | undefined ;
1749
+ e2ee ?: boolean | undefined ;
1750
+ }
1730
1751
| string ,
1731
1752
) : Promise < TalkMessage > {
1732
1753
if ( typeof options === "string" ) {
@@ -1850,11 +1871,11 @@ export class SquareMessage extends ClientMessage {
1850
1871
public send (
1851
1872
options :
1852
1873
| {
1853
- text ?: string | undefined ;
1854
- contentType ?: LooseType ;
1855
- contentMetadata ?: LooseType ;
1856
- relatedMessageId ?: string | undefined ;
1857
- }
1874
+ text ?: string | undefined ;
1875
+ contentType ?: LooseType ;
1876
+ contentMetadata ?: LooseType ;
1877
+ relatedMessageId ?: string | undefined ;
1878
+ }
1858
1879
| string ,
1859
1880
safe : boolean = true ,
1860
1881
) : Promise < SquareMessage > {
@@ -1881,11 +1902,11 @@ export class SquareMessage extends ClientMessage {
1881
1902
public reply (
1882
1903
options :
1883
1904
| {
1884
- text ?: string | undefined ;
1885
- contentType ?: LooseType ;
1886
- contentMetadata ?: LooseType ;
1887
- relatedMessageId ?: string | undefined ;
1888
- }
1905
+ text ?: string | undefined ;
1906
+ contentType ?: LooseType ;
1907
+ contentMetadata ?: LooseType ;
1908
+ relatedMessageId ?: string | undefined ;
1909
+ }
1889
1910
| string ,
1890
1911
safe : boolean = true ,
1891
1912
) : Promise < SquareMessage > {
0 commit comments