Skip to main content

A simple Json object to Bot library built on top of a osonbot library

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jsonbot-1.0.7.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jsonbot-1.0.7-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file jsonbot-1.0.7.tar.gz.

File metadata

  • Download URL: jsonbot-1.0.7.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for jsonbot-1.0.7.tar.gz
Algorithm Hash digest
SHA256 974223cf9f64a31db764a14c2ca595015c3874280e58c2ab00d73ba94aef0c9c
MD5 6c23c78601ed8498493a509d1698ce18
BLAKE2b-256 c3781a2ac18d20080f6ed3b24b2d9d54a97b535a47ceaae5a95b5a2f3077502c

See more details on using hashes here.

File details

Details for the file jsonbot-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: jsonbot-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for jsonbot-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 e92b5dae7bb5ec910e4d68f58d935239346a8c9c0cba63b49ace239e6c36ec36
MD5 cf1f114817301d50876fb4fc240c430f
BLAKE2b-256 040240d05c6ae852f6fac71e1b069ec9ea1836bba71f5b036e9da4f3337a6a01

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page