tg-blackjack

module
v0.0.0-...-d73c5c4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2022 License: MIT

README

Telegram Blackjack Bot

Go Report Card Tests License

Here is the demo of Blackjack bot:

This is a bot with whom you can play Blackjack. This bot can be easily added to group chats and everyone will have an opportunity to play and compete with friends for the best score. In my opinion playing Blackjack with this bot is a cool way to kill your time.

This bot follows all Blackjack rules, expect there's no bets and no "soft 17 rule" (because I think that bot can play better without it). Basically this is 1-1 game with dealer, but it won't be a problem if multiple players join the same game (type /draw command). It doesn't matter how many players are in game, every one of them is playing against dealer.

Database structure

Under the hood, this project has MongoDB. This database has only one collection - chats. Chat's document contains telegram_chat_id, players' statistics, current deck and active_game (storing previous games makes no sense to me) which has only 2 fields - dealer hand and players' hands, and whether dealer has only his cards, players have fields username, stop and busted.
chat's document

Commands

Docker-compose

Run the application

make up

Down the application

make down

Tests

Run unit tests

make test

Integration Tests

Run integration tests

make integration-tests

Linters

Run linters (you have to have golangci-lint installed on your PC)

make lint

Directories

Path Synopsis
cmd
app
internal
app
repository/mocks
Package mock_repository is a generated GoMock package.
Package mock_repository is a generated GoMock package.
services/mocks
Package mock_services is a generated GoMock package.
Package mock_services is a generated GoMock package.
telegram/handlers/mocks
Package mock_handlers is a generated GoMock package.
Package mock_handlers is a generated GoMock package.
telegram/mocks
Package mock_telegram is a generated GoMock package.
Package mock_telegram is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL