Git Product home page Git Product logo

devman_notification_bot's Introduction

Devman Notification Bot

Get notifications when your lessons are reviewed!

How to install

Python should already be installed. This project is tested on Python 3.10 and 3.11. You may use other versions as you will, but YMMV.

Clone the repo / download code

Using virtual environment virtualenv/venv is recommended for project isolation.

Install requirements:

pip install -r requirements.txt

Set up environmental variables.
Create .env file in root folder and write down the following variables:

  • DEVMAN_AUTH - Devman API user access token. Get it from the API docs.
  • TELEGRAM_BOT_TOKEN - Access token of your bot. You get one from BotFather Telegram bot when you create a bot.
  • TELEGRAM_LOGGING_BOT_TOKEN - same as above, but used for sending logs. Can be the same bot or separate as the main one.
  • TELEGRAM_USER_ID - Your numeric Telegram ID to send logging messages. Can be checked by writing to special user info bot.
  • LOG_LEVEL - (Optional) Sets the threshold for this logger. Accepts numbers or strings (such as 10 or "DEBUG" for DEBUG level)

Running on Windows note

If run on Windows, long-polling requests won't allow to stop the program (by using Ctrl+C) until they finish. Thus, using WSL might be useful.

Using Docker

The project contains Dockerfile to build Docker container. If you already have Docker installed, after cloning the repository, run the following:

docker build -t notification-bot .

-t notification-bot is setting the tag to the container for the ease of further use. . tells docker to look for Dockerfile in the current path (so make sure to run the command from the root folder of the project)

After the container is built, run it:

docker run -d --env-file ./.env --name notification_bot notification_bot

-d runs the container in the background allowing you to continue using the terminal.
--env-file ./.env tells docker to load enviromental variables from .env file. You can also use another path and/or file or simply state the variables by using -e argument (e.g. -e VAR1=value). Note that when using --env-file, .env file should be strictly written in VAR=value format, without quotation marks or spaces (so, not VAR="value" or VAR = value) as docker won't parse the variables correctly otherwise.
--name notification_bot sets the name of the container.
notification_bot is the tag of the container you've set on the previous step with -t.

How to use

Run the script:

python main.py

If that's your first interaction with your bot, send it a /start command, or it won't be able to send you messages.

And you're all set! When you get updates on your submitted lessons, you'll receive a message from the bot.

Project Goals

The code is written for educational purposes on online-course for web-developers dvmn.org.

devman_notification_bot's People

Contributors

mrdave avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.