1
0
Fork 0
mirror of https://github.com/muerwre/vk-tg-bot.git synced 2025-04-25 06:56:40 +07:00

#4 added duplicate check for wall_post_new

This commit is contained in:
Fedor Katurov 2021-05-04 14:58:39 +07:00
parent e73ab3cb4f
commit f75e3068a0
8 changed files with 75 additions and 16 deletions

View file

@ -35,19 +35,29 @@ export class PostgresDB implements Storage {
getEvent = async (
type: VkEvent,
id: number,
eventId: number,
groupId: number,
channel: string
) => {
return await this.events.findOne({ type, id, groupId, channel });
return await this.events.findOne({ type, eventId, groupId, channel });
};
createEvent = async (event) => {
const result = this.events.create({
...event,
createEvent = async (
type: VkEvent,
eventId: number,
groupId: number,
channel: string,
tgMessageId: number
) => {
const event = this.events.create({
type,
eventId,
groupId,
channel,
tgMessageId,
});
return result[0];
return await this.events.save(event);
};
getLikesFor = async (channel, messageId) => {