Home

Awesome

GameJay Bot

A combination Telegram Bot plus Server for GameJay web-based games.

The games are designed for drop-in functionality and minimal friction to learn and play. Largely inspired by the games featured in GamePigeon, an iOS Messages games app.

To Develop

Structure and Flow

This repository holds the combined code for the Telegram bot and the server that hosts the bot's webhook and, more importantly, the API for processing games and running their backend logic.

@gamejaybot Telegram Bot

The code for the Telegram bot is in src/bot.ts. This is all dedicated to processing commands and responses sent to the bot. It defines the inline query logic for getting a list of all the registered games in any chat, without the need to add the bot to the chat.

If in development, it also starts the bot's polling for commands/responses, as opposed to using the more efficient webhook system.

GameJay Server

The code for the GameJay server is under src/server. This is where most of the work is done. server.ts starts the server, sets up all the API routing chunks for every game (imported from other files for organizational purposes), and does some other custodial stuff like setting up the API docs page. If in production, it also imports the Telegram bot and sets the webhook to point to the server so the bot can run in webhook mode.

src/server/routes.ts contains routes that are common to all games; things like turn-logic and scoring

For each supported game, there will be a folder under src/server that contains routes and logic specific to that game.

The Actual Games

Each game is intended to be a completely separately hosted website. This backend server will handle sending the right URL for the requested game to the user, and will process the game logic for each session of each game. Every game's site should have a URL that points back to this server so that it knows where to send the updates for the game session.

Environment

Dev-Ops

Start Development Server

npm install
npm run dev

Build & Deploy

npm run build
npm start