1.0.17 • Published 2 years ago

jdi-flow-bot v1.0.17

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
2 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

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11-SNAPSHOT

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago