What's your idea?
現状squareMessage.sendは返信機能あり
talkMessage.sendには返信機能がない
squareMessage.send
|
/** |
|
* Sends to message. |
|
*/ |
|
async send( |
|
input: string | { |
|
text?: string; |
|
contentType?: ContentType; |
|
contentMetadata?: Record<string, string>; |
|
relatedMessageId?: string; |
|
location?: Location; |
|
}, |
|
): Promise<void> { |
|
if (typeof input === "string") { |
|
return this.reply({ |
|
text: input, |
|
}); |
|
} |
|
|
|
await this.#client.base.square.sendMessage({ |
|
relatedMessageId: this.raw.message.to, |
|
squareChatMid: this.raw.message.to, |
|
text: input.text, |
|
}); |
|
} |
talkMessage.send
|
/** |
|
* Sends to message. |
|
*/ |
|
async send( |
|
input: string | { |
|
e2ee?: boolean; |
|
text?: string; |
|
contentType?: ContentType; |
|
contentMetadata?: Record<string, string>; |
|
relatedMessageId?: string; |
|
location?: Location; |
|
}, |
|
): Promise<Message> { |
|
if (typeof input === "string") { |
|
return this.reply({ |
|
text: input, |
|
}); |
|
} |
|
|
|
let to: string; |
|
if (this.to.type === "GROUP" || this.to.type === "ROOM") { |
|
to = this.to.id; // this.to means it is group. |
|
} else { |
|
// Personal chats |
|
to = this.isMyMessage ? this.to.id : this.from.id; |
|
} |
|
return await this.#client.base.talk.sendMessage({ |
|
text: input.text, |
|
to, |
|
e2ee: input.e2ee, |
|
}); |
|
} |
使用したことはないが、CHRLINE-PatchはTalkService.sendMessageがあり、
squareとtalkのsendは同じ関数が使われている
そのため、squareMessageとtalkMessageのsendの挙動を一緒にしたい
https://github.com/WEDeach/CHRLINE-Patch/blob/5567fb7a05927fb2581dcfed7cce5215b4ec9e87/CHRLINE/services/TalkService.py#L46-L158
余談
ちなみに、SquareService.sendSquareMessageというものもあるが、
"""Send message for square chat (OLD)."""と書かれており、古いものになっている
https://github.com/WEDeach/CHRLINE-Patch/blob/5567fb7a05927fb2581dcfed7cce5215b4ec9e87/CHRLINE/services/SquareService.py#L165-L204
実装の提案のメモ
msg.square.send() のように msg から square を取得し、square に対して send() する
https://discord.com/channels/1255359848644608035/1275045387794645067/1398713793239973989
What's your idea?
現状squareMessage.sendは返信機能あり
talkMessage.sendには返信機能がない
squareMessage.send
linejs/packages/linejs/client/features/message/square.ts
Lines 67 to 90 in 423925e
talkMessage.send
linejs/packages/linejs/client/features/message/talk.ts
Lines 74 to 105 in 423925e
使用したことはないが、CHRLINE-PatchはTalkService.sendMessageがあり、
squareとtalkのsendは同じ関数が使われている
そのため、squareMessageとtalkMessageのsendの挙動を一緒にしたい
https://github.com/WEDeach/CHRLINE-Patch/blob/5567fb7a05927fb2581dcfed7cce5215b4ec9e87/CHRLINE/services/TalkService.py#L46-L158
余談
ちなみに、SquareService.sendSquareMessageというものもあるが、"""Send message for square chat (OLD)."""と書かれており、古いものになっている
https://github.com/WEDeach/CHRLINE-Patch/blob/5567fb7a05927fb2581dcfed7cce5215b4ec9e87/CHRLINE/services/SquareService.py#L165-L204
実装の提案のメモ
msg.square.send()のようにmsgからsquareを取得し、squareに対してsend()するhttps://discord.com/channels/1255359848644608035/1275045387794645067/1398713793239973989