Fix replies via user token

This commit is contained in:
Inex Code 2020-12-05 10:23:15 +00:00
parent 9c33ff22e7
commit 27d5e06585

View file

@ -178,7 +178,7 @@ export class VkPuppet {
try { try {
await client.updates.start(); await client.updates.start();
} catch (err) { } catch (err) {
log.error("Failed to initialize update listener", err) log.error("Failed to initialize update listener", err);
} }
} }
@ -303,7 +303,7 @@ export class VkPuppet {
message: asUser ? `${asUser.displayname}: ${await this.stripReply(data.body)}` : await this.stripReply(data.body), message: asUser ? `${asUser.displayname}: ${await this.stripReply(data.body)}` : await this.stripReply(data.body),
random_id: new Date().getTime(), random_id: new Date().getTime(),
forward: p.data.isUserToken ? undefined : `{"peer_id":${Number(room.roomId)},"conversation_message_ids":${Number(eventId)},"is_reply": true}`, forward: p.data.isUserToken ? undefined : `{"peer_id":${Number(room.roomId)},"conversation_message_ids":${Number(eventId)},"is_reply": true}`,
reply_to: p.data.isUserToken ? Number(room.roomId) : undefined, reply_to: p.data.isUserToken ? Number(eventId) : undefined,
}); });
await this.puppet.eventSync.insert(room, data.eventId!, await this.puppet.eventSync.insert(room, data.eventId!,
p.data.isUserToken ? response[0]["message_id"].toString() : response[0]["conversation_message_id"].toString()); p.data.isUserToken ? response[0]["message_id"].toString() : response[0]["conversation_message_id"].toString());