Skip to content

A simple JSON description of the telegram bot API which updates itself every day.

License

Notifications You must be signed in to change notification settings

ferrisgram/telegram-bot-api-spec

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

telegram-bot-api-spec

This repo provides the necessary scripts to scrape the telegram bot api docs for method, types, and docstrings.

The main usecase of having this data is expected to be to generate automated libraries which follow the bot api documentation to the letter. Assuming the docs are correct, autogenerated libraries provide the following:

  • Easy to update. Simply re-generate the code using the new JSON spec.
  • Typo free. All methods/fields are guaranteed to be correct.
  • No missing fields. If its in the spec, its in your code!

The output of this script api.json, is formatted as such:

{
  "methods": {
    <method name> : {
      "name": // string, method name
      "href": // string, link to docs
      "returns": // array of string, possible return types
      "description": // array of string, documentation lines
      "fields": [
        {
          "name": // string, field name
          "types": // array of string, possible field types
          "required": // bool, whether field is required
          "description": // string, documentation for field
        },
        ...
      ], // array of fields
      "subtypes": // array of string, all the types that subtype this item (eg, InputMedia has subtypes InputMediaAnimation, InputMediaDocument etc)
      "subtype_of": // array of string, all the "parent" types of this type (eg, InputMediaAnimation is a subtype of InputMedia)
    },
    ...
  }, // map of method name -> method details
  "types": {
    <type name> : {
      "name": // string, type name
      "href": // string, link to docs
      "description": // array of string, documentation lines
      "fields": [
        {
          "name": // string, field name
          "types": // array of string, possible field types
          "required": // bool, whether field is required
          "description": // string, documentation for field
        },
        ...
      ], // array of type fields
    },
    ...  
  } // map of type name -> type details
}

About

A simple JSON description of the telegram bot API which updates itself every day.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%