0.1.17 • Published 12 months ago

tg-builder v0.1.17

Weekly downloads
-
License
ISC
Repository
github
Last release
12 months ago

🤖TG Builder

tg-builder provides an intuitive builder pattern that allows developers to:

  • Combine Multiple Bots: Run and manage several bots from a single codebase, each with their individual or shared functionalities.
  • Shared Logic: Easily reuse logic across different bots, making your code more DRY (Don't Repeat Yourself).
  • Modularity: Break down complex bot functionalities into manageable pieces, ensuring clean and readable code.
  • Scalability: As your bot ecosystem grows, tg-builder scales with you, making it effortless to add or modify existing bots.

By adopting the builder pattern, tg-builder ensures your bots are more maintainable, organized, and efficient.

📦 Installation

Using npm:

npm install tg-builder

Using yarn:

yarn add tg-builder

⚙️ Configuration

Before you start, you need to create a configuration file named tg.json in your project's root. This file should contain the token and name of the bot you want to set up.

Replace xxxxxxxxxxxxxxxxxxxx with your actual bot tokens.

🛑 Remember, always keep your bot tokens secret and never expose them in publicly accessible places or repositories.

📖 Getting Started

1. Importing Modules

Begin by importing the essential modules:

import { BotsLoader, CommandBuilder, ActionBuilder } from 'tg-builder'

2. Defining Commands

Leverage the CommandBuilder to define the commands for your bot:

3. Defining Actions

Utilize the ActionBuilder to define telegram callback actions:

4. Loading and Launching the Bot

Make use of BotsLoader to add your bot and get it running:

🚀 Example

Here's a glimpse of a bot providing a text-based RPG game experience:

📄 Definitions

1. Command

2. Action

With tg-builder, bot development becomes a structured, readable, and maintainable endeavor. Dive in to explore more functionalities and elevate your bot development journey!

0.1.17

12 months ago

0.1.16

1 year ago

0.1.15

1 year ago

0.1.13

1 year ago

0.1.12

1 year ago

0.1.11

1 year ago

0.1.10

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago