Skip to content

Aswincloud/word-game-bot

Word Game Bot

Word Game Bot hosts games of word chain in Telegram groups.

Maintained by Aswin. This is a fork of jonowo/on9wordchainbot, migrated to aiogram v3 and extended with a database-backed admin and group-authorization system.

Telegram Links

Installation

Requirements

Python 3.10+
PostgreSQL 11+
2 Telegram bots

It is highly recommended that you turn off privacy mode for the bot via @BotFather, which is on by default. Otherwise, leaving privacy mode on, the bot will only receive players' answers when they reply to the bot.

Configuration

Copy config.json.template to config.json, then edit the following constants in config.json:

  • TOKEN*: A Telegram bot token.
  • ON9BOT_TOKEN*: Another Telegram bot token for the virtual player bot.
  • DB_URI: A PostgresSQL database URI.
  • PROVIDER_TOKEN*#: A Telegram payment provider token.
  • OWNER_ID: Telegram user id of the bot owner.
  • ADMIN_GROUP_ID^: Telegram group id of the bot admin group. Error messages and word addition requests are sent here.
  • OFFICIAL_GROUP_ID^: Telegram group id of the official group of the bot.
  • WORD_ADDITION_CHANNEL_ID^: Telegram channel id of the channel to announce word additions.
  • VIP: A list of Telegram user ids designated as VIPs.
  • VIP_GROUP: A list of Telegram group ids designated as VIP groups.

*: Obtained via BotFather.
#: Optional if payment-related functions are commented out.
^: Set to the same throwaway group if these features are not used.

Table Creation

Create the required tables in your PostgreSQL database by running init.sql.

Deployment

Install and update dependencies with pip install -Ur requirements.txt.
Run python -m on9wordchainbot.

Roadmap

  • Switch from Markdown to HTML completely
  • Fix slow db queries
  • Fix slow /trend generation
  • Rewrite to be more event-driven and principled
  • Notify admin group when on maint mode and last game finishes
  • Some kind of observability (dashboard?)
  • Rate limiting
  • Set up webhook?
  • Make required letter game more reasonable
  • Group leaderboard

Development

pip install -r requirements-dev.txt

Type checking: python -m mypy .

About

Telegram word chain game bot (aiogram v3). Fork of jonowo/on9wordchainbot with DB-backed admin & group authorization.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages