gramjs
gramjs copied to clipboard
Can't reply on message
I trying paste in replyToMsgId my message's id
But i have a error Required object replyTo of messages.SendMessage is undefined
and TypeScript error like
Type '{ replyToMsgId: number; }' is not assignable to type 'TypeInputReplyTo'. Type '{ replyToMsgId: number; }' is missing the following properties from type 'InputReplyToMessage': CONSTRUCTOR_ID, SUBCLASS_OF_ID, classType, className, and 3 more.
my code:
const sentMessage: Api.Updates = await this.client.invoke( new Api.messages.SendMessage({ peer: username, message, replyTo: { replyToMsgId: +replyMessageId, }, }), );
how i should use this for reply?
If anyone else is having problem replying to messages, the docs seem wrong. Got it to work by using:
await client.invoke(
new Api.messages.SendMessage({
peer: peer,
replyTo: new Api.InputReplyToMessage({
replyToMsgId: <id>
}),
message: message
})
);