-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
252 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,5 @@ venv | |
|
||
# python identifiers | ||
.python-version | ||
.pytest_cache/ | ||
.pytest_cache/ | ||
.coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
language: python | ||
python: | ||
- "3.6" | ||
- "3.7" | ||
- "3.8" | ||
before_install: | ||
- pip install pip -U | ||
- pip install -r requirements-dev.txt -U | ||
script: | ||
- ./analyse-code.sh | ||
after_success: | ||
- coveralls | ||
notifications: | ||
email: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,66 @@ | ||
# Guess the melody quiz game telegram bot | ||
A quiz game telegram bot written in python with powerful [pyTelegramBotAPI](https://github.com/eternnoir/pyTelegramBotAPI) library. | ||
[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/) | ||
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) | ||
|
||
## Run a quiz melody game telegram bot | ||
[![Build Status](https://travis-ci.org/vyahello/guess-the-melody-bot.svg?branch=master)](https://travis-ci.org/vyahello/guess-the-melody-bot) | ||
[![Coverage Status](https://coveralls.io/repos/github/vyahello/guess-the-melody-bot/badge.svg?branch=master)](https://coveralls.io/github/vyahello/guess-the-melody-bot?branch=master) | ||
[![Forks](https://img.shields.io/github/forks/vyahello/guess-the-melody-bot)](https://github.com/vyahello/guess-the-melody-bot/network/members) | ||
[![Stars](https://img.shields.io/github/stars/vyahello/guess-the-melody-bot)](https://github.com/vyahello/guess-the-melody-bot/stargazers) | ||
[![Issues](https://img.shields.io/github/issues/vyahello/guess-the-melody-bot)](https://github.com/vyahello/guess-the-melody-bot/issues) | ||
[![GitHub watchers](https://img.shields.io/github/watchers/vyahello/guess-the-melody-bot.svg)](https://GitHub.com/vyahello/guess-the-melody-bot/graphs/watchers/) | ||
[![GitHub contributors](https://img.shields.io/github/contributors/vyahello/guess-the-melody-bot.svg)](https://GitHub.com/vyahello/guess-the-melody-bot/graphs/contributors/) | ||
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE.md) | ||
|
||
# Guess the melody telegram bot game | ||
> A quiz telegram bot game written in python | ||
> | ||
> ![Screenshot](quiz/demo/bot.png) | ||
## Tools | ||
- python 3.6+ | ||
- [pyTelegramBotAPI](https://github.com/eternnoir/pyTelegramBotAPI) | ||
- code analysis | ||
- [pytest](https://pypi.org/project/pytest/) | ||
- [black](https://black.readthedocs.io/en/stable/) | ||
|
||
## Usage | ||
Run script from the root directory of the project: | ||
```bash | ||
~ python quiz.py | ||
➜ python -m quiz --run | ||
Running quiz bot (press ctrl+c to escape) | ||
... | ||
``` | ||
Please specify your telegram `API key` to be able to use bot. | ||
|
||
## Run unittests | ||
Run script from the root directory of the project: | ||
## Development notes | ||
|
||
Project has Travis CI integration using [.travis.yml](.travis.yml) file thus code analysis (`black`) and unittests (`pytest`) will be run automatically | ||
after every made change to the repository. | ||
|
||
To be able to run code analysis, please execute command below: | ||
```bash | ||
~ pytest -s -v | ||
➜ ./analyse-code.sh | ||
``` | ||
|
||
## Demo | ||
![Screenshot](bot.png) | ||
|
||
# Contributing | ||
- clone the repository | ||
- configure Git for the first time after cloning with your name and email | ||
```bash | ||
git config --local user.name "Volodymyr Yahello" | ||
git config --local user.email "vyahello@gmail.com" | ||
``` | ||
- `python3.6` is required to run the code | ||
- run `pip install -r requirements.txt` to install all required python packages | ||
## Release notes | ||
|
||
* 0.1.1 | ||
* Add Travis CI tool | ||
* 0.1.0 | ||
* Distribute initial version on a bot | ||
|
||
### Meta | ||
|
||
Author – Volodymyr Yahello | ||
|
||
Distributed under the `MIT` license. See [LICENSE](LICENSE.md) for more information. | ||
|
||
You can reach out me at: | ||
* [vyahello@gmail.com](vyahello@gmail.com) | ||
* [https://github.com/vyahello](https://github.com/vyahello) | ||
* [https://www.linkedin.com/in/volodymyr-yahello-821746127](https://www.linkedin.com/in/volodymyr-yahello-821746127) | ||
|
||
### Contributing | ||
1. clone the repository | ||
2. configure Git for the first time after cloning with your `name` and `email` | ||
3. `pip install -r requirements.txt` to install all project dependencies | ||
4. `pip install -r requirements-dev.txt` to install all dev project dependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env bash | ||
|
||
PACKAGE="quiz" | ||
|
||
|
||
check-black() { | ||
printf "Start black analysis ...\n" && ( black --check ${PACKAGE} ) | ||
} | ||
|
||
|
||
check-unittests() { | ||
printf "Start unittests analysis ...\n" && pytest | ||
} | ||
|
||
|
||
main() { | ||
check-black && check-unittests | ||
} | ||
|
||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[tool.black] | ||
line-length = 120 | ||
target-version = ["py36", "py37", "py38"] | ||
exclude = ''' | ||
/( | ||
\.pytest_cache | ||
)/ | ||
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[pytest] | ||
testpaths = tests/ | ||
python_files=*.py | ||
python_functions=test_* | ||
addopts = -rsxX | ||
-v | ||
--cov=quiz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from typing import Any | ||
import click | ||
from bprint import bprint | ||
from quiz.handler import bot | ||
|
||
|
||
@click.command() | ||
@click.option("--run", "-r", default=False, show_default=True, is_flag=True, help="Allows to run telegram bot app") | ||
def main(run: bool, **kwargs: Any) -> None: | ||
"""Runs telegram bot app.""" | ||
if run: | ||
bprint("Running quiz bot (press ctrl+c to escape)") | ||
bot.polling(none_stop=True, **kwargs) | ||
else: | ||
bprint("Nothing to run.") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.