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

#4 storing events in db

This commit is contained in:
Fedor Katurov 2021-05-05 12:14:31 +07:00
parent a78fc0bfe3
commit a6e6209770
5 changed files with 38 additions and 12 deletions

View file

@ -51,7 +51,7 @@ export class VkEventHandler<
/**
* Checks for duplicates
*/
getEventFromDB = async (id?: number): Promise<Event | undefined> => {
getEvent = async (id?: number): Promise<Event | undefined> => {
if (!id) {
return undefined;
}
@ -62,13 +62,18 @@ export class VkEventHandler<
/**
* Creates event record in DB
*/
storeInDB = async (id: number, tgMessageId: number) => {
createEvent = async (
id: number,
tgMessageId: number,
text: Record<any, any>
) => {
return await this.db.createEvent(
this.type,
id,
this.group.id,
this.channel,
tgMessageId
tgMessageId,
text
);
};
}