Skip to content

Olderestin/coin-flip-telegram-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test task: Telegram bot for tossing a coin

This bot is built using the python-telegram-bot library and provides three commands: Flip, Stats and About.

Description of commands:

1. Flip

The Flip command is intended for flipping a coin. The bot simulates a random coin toss and responds with the result - "Heads" or "Tails".

2. Stats

The Stats command displays coin toss statistics for each user. The bot tracks the number of flips and results for each user.

3. About

The About command displays information about the bot.


Launch the bot:

Through virtual environment

  1. Clone the repository:
    git clone https://github.com/Olderestin/coin-flip-telegram-bot.git
    
  2. Navigate to the project directory:
    cd coin-flip-telegram-bot
    
  3. Create virtual environment:
    python -m venv venv
    
  4. Activate venv:
    venv\Scripts\activate
    
  5. Install pip:
    python -m pip install --upgrade pip
    
  6. Install dependencies:
    pip install -r requirements.txt
    
  7. Create a .env file based on the provided example (don't forget to insert the token there):
    cd src
    cp .env.example .env
    
  8. Run the bot:
    python main.py
    

Through Docker

  1. Clone the repository:
    git clone https://github.com/Olderestin/coin-flip-telegram-bot.git
    
  2. Navigate to the project directory:
    cd coin-flip-telegram-bot/src    
    
  3. Create a .env file based on the provided example (don't forget to insert the token there):
    cp .env.example .env
    
  4. Run bot with docker:
    cd ..
    docker compose up
    

Note:

  • sqlite3 database is used to save usage statistics. Database folder src/storage

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages