Commit 6dd81b06 authored by Дмитрий Малюгин's avatar Дмитрий Малюгин 🕓
Browse files

Merge branch 'feature/telegram-bot' into 'main'

Feature Telegram bot

See merge request !3
parents d42f60cc e16a2a55
Loading
Loading
Loading
Loading

.env

deleted100644 → 0
+0 −14
Original line number Diff line number Diff line
PORT=5000
FILES_PORT=5001
DB_NAME=Shelf_note
DB_USER=postgres
DB_PASSWORD=xoxo2002!
DB_HOST=localhost
DB_PORT=5432
# prisma db push
# при запуске с родного ноутбука
 DATABASE_URL="postgresql://postgres:xoxo2002!@localhost:5432/Shelf_note"

# при запуске с рабочего ноутбука
# DATABASE_URL="postgresql://postgres.wrwwvdgppriodcdoyohp:Xoxo2002!qwe@aws-0-eu-central-1.pooler.supabase.com:6543/postgres?pgbouncer=true"
DIRECT_URL="postgresql://postgres.wrwwvdgppriodcdoyohp:Xoxo2002!qwe@aws-0-eu-central-1.pooler.supabase.com:5432/postgres"
+2006 −142

File changed.

Preview size limit exceeded, changes collapsed.

+3 −2
Original line number Diff line number Diff line
{
  "name": "ShelfNote_backend",
  "version": "1.0.0",
  "main": "index.js",
  "main": "src/index.js",
  "repository": "https://gl.iqdev.team/d.malygin/shelfnote_backend",
  "author": "Дмитрий Малюгин <d.malygin@iqdev.digital>",
  "license": "MIT",
  "type": "module",
  "scripts": {
    "start": "nodemon index.js"
    "start": "nodemon src/index.js"
  },
  "dependencies": {
    "@prisma/client": "^5.18.0",
    "cors": "^2.8.5",
    "dotenv": "^16.4.5",
    "node-telegram-bot-api": "^0.66.0",
    "pg": "^8.12.0",
    "pg-hstore": "^2.3.4",
    "ws": "^8.18.0"

src/helpers/index.js

0 → 100644
+11 −0
Original line number Diff line number Diff line
import { bot } from '../telegramBot/index.js';

export const validateMessage = async (response, command, alternateCommand, chatId) => {
  const regExp = /[a-zA-Zа-яА-Я]/g;
  const isValid = regExp.test(response);
  if (isValid) {
    await bot.sendMessage(chatId, command);
  } else {
    await bot.sendMessage(chatId, alternateCommand);
  }
};
Loading