Skip to content

Commit

Permalink
fix(contexts): сheck that reply peer id is not equal to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
negezor committed Jan 22, 2023
1 parent c23d3f2 commit df327c6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/vk-io/src/structures/contexts/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,8 @@ class MessageContext<S = ContextDefaultState>
this[kAttachments] = transformAttachments(message.attachments || [], this.api);

if (message.reply_message) {
const replyPeerId = message.reply_message.peer_id || 0;

this[kReplyMessage] = new MessageContext({
api: this.api,
upload: this.upload,
Expand All @@ -829,9 +831,11 @@ class MessageContext<S = ContextDefaultState>
payload: {
client_info: this.clientInfo,
message: {
// @ts-expect-error may missing in reply message
peer_id: this.peerId,
...message.reply_message
...message.reply_message,

peer_id: replyPeerId !== 0
? replyPeerId
: this.peerId
}
}
});
Expand Down

0 comments on commit df327c6

Please sign in to comment.