Git Product home page Git Product logo

chessbot's Introduction

The PvP chess bot for the Telegram

Travis (.org) GitHub search hit counter GitHub code size in bytes

Overview

A simple PvP chess game based on inline message and edit a reply markup of a chess board. The board built with callback buttons of inline-keyboard. Bot uses the node-chess package, which is driven by the algebraic notation of moves (PGN).

Features:

  • Inline query to start the game.
  • PvP - play with friends.
  • Bot works in any group or private chat.
  • All moves stored in the DB, so you can play a few games simultaneously.

[Demo](https://t.me/chessy_bot) (WIP version)

Usage

To play chess simply type @chessy_bot[SPACE] to your telegram message input box.

Then choose a side you want to play with. You will see an inline message with a chess board and a "Join to game" at the bottom.

When someone join your game, this will be displayed in the status message. Also the "Join to game" button will become "Settings".

Now everything is ready to start the game. To move your pieces just select a piece you want to move and then select a destination from displayed available to move squares.

WARNING!!!

The board is rotating each turn by default! The active player always placed at the bottom!

Install and run own bot instance

First clone this repository and install dependencies. Run in the terminal:

git clone [email protected]:Piterden/chessbot.git
cd chessbot
npm i

Then you have to create and fill up a new .env file:

cp .env.example .env
editor .env

Next migrate the DB:

npm run knex migrate:latest

Then run the dev mode:

npm run dev

Built With

  • Telegraf.js - Telegram bot framework for Node.js.
  • Node-Chess - A simple node.js library for parsing and validating chess board position with an algebraic move parser.
  • Knex - A query builder for PostgreSQL, MySQL and SQLite3, designed to be flexible, portable, and fun to use.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

chessbot's People

Contributors

gitter-badger avatar kolay-v avatar mminovv avatar piterden avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

chessbot's Issues

TypeError: leaveHandler is not a function

I started dockerizing and made these modifications:

master...lucaszanella:master

Now I'm getting

web_1    | [nodemon] starting `node src/index.js`
web_1    | /home/node/app/src/scenes/game/index.js:11
web_1    |   .leave(...leaveHandler())
web_1    |             ^
web_1    | 
web_1    | TypeError: leaveHandler is not a function

Is the code complete? Can't find all the handlers in

module.exports = new Scene('game')
  .leave(...leaveHandler())
  .enter(...startHandler())
  .action(...movesHandler())
  .action(...actionsHandler())

on the code

Feature: Notification after a move was made

At the moment, I have to check my self if the other person has done the next turn (if the other person doesn't send me a message). It would be really cool if the bot would (optional) send a message notifies you when it is your turn again.

Problems with colors and rotation

Hello, I just discovered this bot after watching The Queen's Gambit and I've been playing with a friend. The icons are just very difficult to understand. The difference between black and white are very subtle.

I think a good way to overcome this would be to create a second and optional set of pieces with emojis. A girl for queen, a boy for king, and the rest could be decided. Remember that these emojis have a very black option and a very white option, so it'll have a good contrast.

Also the rotation confused me a lot. I tried to fix so it would not rotate but it didn't work.

Support and donate buttons also did not work.

Thanks!

Black pieces are white (on Android, Redmi Note 10 Pro)

Hi,
As you can see, all black pieces (besides the pawns) are white for me. Friends I'm playing with don't have this issue, so I think it depends on the font set that either Android system or Telegram itself uses. Can this issue be fixed by somehow selecting an other don't?
Regards, Marc

Screenshot_2023-01-18-23-12-55-214-edit_org telegram messenger

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.