Skip to content

francofrizzo/marcos-bot-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MarcosBot

MarcosBot is a Telegram bot that generates random messages based on what it has read before. It is specially interesting when added to group chats.

This Typescript implementation is an adaptation of a previous Python version of the bot. The new code is more organized and clear, but some features have not been ported yet; those are detailed in the Issues section.

How it works

For generating the messages, the bot uses a Markov chain. Each word used in the chat is represented by a state in the chain. The usage of two words together in a message results in the link between those words being strengthened.

New messages are generated by a random walk on the system, which means that every word is directly related only with its immediately previous and next words. Therefore, the messages are vaguely resembling of typical messages in the chat, but frequently incoherent or unexpectedly comic.

Running the bot

After installing Node.js and the required packages (npm install), the code must be compiled (npm run build).

You must create a Telegram Bot and get its Telegram Bot API token; you will be prompted to enter it the first time you run the bot. Afterwards, you can change it by modifying the file local/config.json.

Then, you can start listening to messages by simply running npm run app.

About

Telegram bot that generates random messages using a Markov chain, now for Node.js

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published