Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

JsonBot

Installation

pip install jsonbot

Usage

from jsonbot import JsonBot

JsonBot("token", {
    "messages": {
        "/start", {"response": "hello *{first_name}*", "parse_mode": "MarkdownV2"},
        "/help": {"response": "Hello how can i help you"}
    }
}).run()

you can generate code to osonbot library itself (supports only osonbot library, and can not generate fully)

from jsonbot import JsonBot

JsonBot("token", {
    "/start", {"response": "hello *{first_name}*", "parse_mode": "MarkdownV2"},
    "/help": {"response": "Hello how can i help you"}
}).generate_code(library="osonbot", file="main.py")

Handling Inline Messages

from jsonbot import JsonBot

JsonBot("token", {
    "inline_messages": {
        "callback_data1", {"response": "you clicked the first inline button"},
        "callback_data2": {"response": "you clicked the sedond inline button"}
    }
}).run()

Send message to specific user by his/her ID

from jsonbot import JsonBot

JsonBot("token", {
    "messages": {
        "/start", {"response": "hello *{first_name}*", "parse_mode": "MarkdownV2"},
        "/send": {"id": 123456789, "response": "This is a message for a specific user"}
    }
}).run()

Done for now

About

this is a telegram bot library for making telegram bot easier build on top of osonbot. It uses json dictionary to construct a bot.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages