From 8ac79a06a8f4840c2bc9c92999ab6b91f24ccdd8 Mon Sep 17 00:00:00 2001 From: Francesco Esposito <33671357+franjsco@users.noreply.github.com> Date: Mon, 31 Jan 2022 16:42:21 +0100 Subject: [PATCH] Edit readme --- README.md | 47 ++++++++++++++++++------- pub-redis-example.js => test-publish.js | 0 2 files changed, 35 insertions(+), 12 deletions(-) rename pub-redis-example.js => test-publish.js (100%) diff --git a/README.md b/README.md index be0b06a..9f7ac25 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,45 @@ # NotificamBot -Telegram bot to reiceve notifications. +Telegram bot to receive notifications reads from a queue (pub/sub on Redis). -Notificambot reads notifications from a queue (pub/sub on redis). +## Configuration + +Rename .env.sample in .env and configure it: + + +| KEY |DESCRIPTION | +|-- | --| +| BOT_TOKEN | Telegram Bot Token created with @BotFather | +| CHAT_ID | Your chat id with the bot (you can configure this after the first launch of the bot from client) | +| REDIS_CHANELL | Channel where the bot reads| +| REDIS_HOST | Host redis (don't touch if you use docker-compose). +| REDIS_PASSWORD| Redis password | -## Configuration -1. Create telegram bot with **@BotFather**. -2. Clone this repository. -3. Start a redis instance on localhost. -4. Install dependencies with `npm install`. -5. Configure env file (and rename from `env.sampe` to `.env`). -6. Launch with `node src/server.js` +## Usage + +1. Clone the project with +```sh +git clone https://github.com/franjsco/NotificamBot.git +``` + +2. Build docker image and run it with docker-compose: +```sh +docker-compose up --build +``` -You can configure templates into `src/templates.js`. +3. Search your bot on telegram and start it. The chat id will be displayed on the terminal +Copy it into .env and stop (CTRL+C) and start containers. -## Test +```sh +docker-compose up +``` -You can perform a test with command: `node pub-redis-example.js` +4. Now you can perform a test. +```sh +node test-publish.js +``` + +5. You can send notifications to the bot by connecting to the container redis instance from any application and post messages to the configured queue. diff --git a/pub-redis-example.js b/test-publish.js similarity index 100% rename from pub-redis-example.js rename to test-publish.js