A Telegram bot to generate messages using Markov chains
Creating a bot is done through @BotFather. See the official documentation for more details.
Make sure to disable privacy mode, otherwise the bot won't be able to store user messages to generate its replies from.
-
Install dependencies:
yarn install
-
Add your bot token from BotFather to the
.env
file in the project directory:TOKEN=<insert your Telegram bot token here>
yarn run dev:start
yarn run build
Build files will be output to build/prod
.
The steps below should be done in the deployment environment.
-
Copy the contents of the
build/prod
folder to the desired location on the server. -
Follow the steps in the Project installation section.
-
Apply database migrations:
yarn run prod:apply-migrations
-
Run the bot:
node index.cjs
The process of adding the bot user is the same as adding any other user.
By default, the bot replies with a generated message when it is @mentioned.
For more information on how to adjust reply settings see Bot configuration.
Send /settings
in the group chat to access the bot's settings menu and configure its settings for that group.
- Reply on mention: Reply when the bot is mentioned.
- Reply randomly: Send a message when the number of messages sent in the group reaches a certain amount since the bot's last message.
- Admin-only settings: Allow setting changes only by group admins.
- Admin-only bot commands: Allow the bot's commands to be used only by group admins.