template-bot

April 30, 2018 ยท View on GitHub

๐Ÿš€ Kick-start a Telegram bot with telegraf.js and sao.

Features

Usage

Install SAO first:

$ npm i sao -g

Or for crazy junkies:

$ sudo npm i sao -g

Then create a new bot:

$ sao piterden/template-bot my-new-bot --update --force-npm
$ cd my-new-bot

Or for npm@5 you \wo sao install:

$ npx sao piterden/template-bot my-new-bot --update --force-npm
$ cd my-new-bot

The .env file:

NODE_ENV=development

BOT_TOKEN=
BOT_NAME=

DB_HOST=127.0.0.1
DB_PORT=3306
DB_CLIENT=mysql
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
DB_CHARSET=utf8mb4
DB_MIGRATIONS_TABLE=migrations

DEBUG_COLORS=true
DEBUG_SHOW_HIDDEN=true
DEBUG_DEPTH=10

The bot's default structure:

 โ”œโ”€โ”€ migrations/
 โ”œโ”€โ”€ src/
 โ”‚  โ”œโ”€โ”€ handlers/
 โ”‚  โ”‚  โ”œโ”€โ”€ help/
 โ”‚  โ”‚  โ”‚  โ””โ”€โ”€ index.js
 โ”‚  โ”‚  โ”œโ”€โ”€ settings/
 โ”‚  โ”‚  โ”‚  โ””โ”€โ”€ index.js
 โ”‚  โ”‚  โ”œโ”€โ”€ start/
 โ”‚  โ”‚  โ”‚  โ””โ”€โ”€ index.js
 โ”‚  โ”‚  โ””โ”€โ”€ index.js
 โ”‚  โ”œโ”€โ”€ helpers/
 โ”‚  โ”‚  โ”œโ”€โ”€ debug/
 โ”‚  โ”‚  โ”‚  โ””โ”€โ”€ index.js
 โ”‚  โ”‚  โ””โ”€โ”€ index.js
 โ”‚  โ”œโ”€โ”€ keyboards/
 โ”‚  โ”‚  โ””โ”€โ”€ index.js
 โ”‚  โ”œโ”€โ”€ scenes/
 โ”‚  โ”‚  โ””โ”€โ”€ index.js
 โ”‚  โ””โ”€โ”€ index.js
 โ”œโ”€โ”€ .gitignore
 โ”œโ”€โ”€ knexfile.js
 โ”œโ”€โ”€ LICENSE
 โ”œโ”€โ”€ README.md
 โ””โ”€โ”€ package.json