Coder Social home page Coder Social logo

telegram-chess's Introduction

Telegram Chess Inline Bot

About

  • A simple and efficient Telegram bot for playing chess, built using Aiogram.
  • This bot operates in inline mode, allowing users to play chess with other chat participants.
  • All moves are reflected and updated in the original message, ensuring a seamless gaming experience.

Dependencies

This project utilizes the python-chess library by niklasf for chess logic and operations.

Try Before Install

Want to give it a shot before installing? It's easy! Simply type @nujno_mnogo_rabot in any chat on Telegram and click "Play Chess".

Telegram_Z43QP52CSi

Installation

1. Install via pip

pip install telegram-chess

2. Manual Installation

  • Download the telegram_chess.py file.
  • Place it in your project directory.

Usage with Aiogram 3.0.1

from aiogram import Bot, Dispatcher, Router, types, F
from aiogram.enums import ParseMode
from aiogram.types import Message, InlineQuery
import asyncio

from telegram_chess import TelegramChess

TOKEN = "BOT_TOKEN_GOES_HERE" 
bot = Bot(token=TOKEN, parse_mode=ParseMode.HTML)
dp = Dispatcher()

chess_game = TelegramChess()

@dp.inline_query()
async def inline_echo(inline_query: types.InlineQuery):
    await chess_game.answer_with_inline_chess_query(inline_query)

@dp.callback_query(F.data.startswith(chess_game.chess_data_start))
async def handle_callback(callback_query: types.CallbackQuery):
    await chess_game.make_move(callback_query, bot)

async def on_startup():
    print("Welcome to Chess Bot by @EnMind")

async def main() -> None:
    await dp.start_polling(bot)
    await on_startup()

if __name__ == "__main__":
    asyncio.run(main())

Enjoy playing chess with your friends on Telegram!

telegram-chess's People

Contributors

smaiht 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.