Clone this repository:
$ git clone https://github.com/forfuturellc/mau.git
Change into the cloned repo and install dependencies:
# Change directory.
$ cd mau/
# Install 'production' dependencies.
# You may leave out '--only=prod' if you want to develop.
$ npm install --only=prod
Change into the example/
directory:
$ cd example/
Some additional dependencies are required to run the examples. You'll need to install them:
# For ALL examples.
$ npm install tgfancy
# For example #2.
$ npm install http-proxy ngrok
You will also need Redis for example #2.
- Example #1: A single Telegram bot
- Example #2: Multiple Telegram bots
Example #1: A single Telegram bot:
# Add your Telegram bot's token to the environment.
$ export TELEGRAM_TOKEN=xxxxx
# Run the bot.
# Leave out 'NO_REDIS=1' if you want to use Redis.
$ NO_REDIS=1 node example/telegram.js
Time to Play: Send your bot a message.
Example #2: Multiple Telegram bots:
You MUST have Redis installed. Port is assumed
to be 6379
. Port can be changed using environment variable
REDIS_PORT
.
# In a separate shell, start a bot instance
# listening on port 9101.
$ export TELEGRAM_TOKEN=xxxxx
$ node example/telegram.js 9101
# In another separate shell, start another instance
# listening on port 9102.
$ export TELEGRAM_TOKEN=xxxxx
$ node example/telegram.js 9102
# ... Run more instances if you wish ...
# In another separate shell, start the proxy
# listening on port 9100, proxying to ports 9101 and 9102.
# Append the port numbers of any additional instances you have started. Mind the commas.
# Leave out `PROXY_PORT=9100` to have proxy listen on its default port i.e. 9100.
$ export TELEGRAM_TOKEN=xxxxx
$ PROXY_PORT=9100 node example/proxy.js 9101,9102
Time to Play: Send your bot a message.