1.0.17 • Published 3 years ago

jdi-flow-bot v1.0.17

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
3 years ago

Flow bot

Is a simple framework for creating Telegram bots based on intuitive json flows 1. Add bot to your project using npm install --save-dev jdi-flow-bot 2. Create json flow for your bot: flow = { screens: BotScreen[], events: BotEvent[] } 3. Run flow bot using your json screen flow

import flow from './flow-bot/screens/flow.json';
import {FlowBot} from 'jdi-flow-bot/flow-bot';
import 'dotenv/config';

new FlowBot(process.env.BOT_TOKEN, flow).start();

Screen file example:

{
  "screens": [
    {
      "command": "/start",
      "description": "Start screen",
      "image": "start1.jpg",
      "text": "Hello world",
      "buttons": [
        [
          { "text": "Sun", "callback_data": "sun" }
        ],
        [
          { "text": "Sky", "callback_data": "sky" },
          { "text": "Water", "callback_data": "water" }
        ]
      ]
    },
    {
      "command": "/sun",
      "image": "sun.jpg",
      "text": "Some info about sun",
      "buttons": [ [ { "text":  "Back", "callback_data":  "start"} ] ]
    },
     {
        "command": "/sky",
        "image": "sky.jpg",
        "text": "Some info about sky",
        "buttons": [ [
           { "text":  "Sun", "callback_data":  "sun"},
           { "text":  "Back", "callback_data":  "start"}
        ] ]
     },
     {
        "command": "/water",
        "image": "water.jpg",
        "text": "Some info about water",
        "buttons": [ 
           [ { "text":  "Sky", "callback_data":  "sky"} ],
           [ { "text":  "Back", "callback_data":  "start"} ],
        ]
     }
  ],
  "events": [ ]
}
1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11-SNAPSHOT

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago