How to create a script
You need a code editor
Actually any text editor can be used to create Botfather scripts. We recomment you to use a code editor with syntax highlighting such as Visual Studio Code, Atom, or Sublime Text. There are many more code editors, but we plan to release extensions for those three at some point in the future.
The script file
Every time you want to write a script
start by creating a folder for it. This folder will contain the actual bot script and assets such as images, called templates, which can be used for object detection using the Vision API.
Once you have folder for your script open your code editor and create a new file. That file will be your script file and can be named anything (eg.
script.js), just make sure it has
Pick an API
Which API to choose obviously depends on what you want to automated. We recomment to use the Browser API if you just want to mess around. By the way: You can pick multiple APIs if you want to. The work at the same time.
Expore the APIs methods
Now it’s time to look through the APIs documentation, thats how real programmers find what they need. Feel free to contact us if there is a function or API you need and we’ll consider implementing it.
Take a look at what can be control using the API you choosed. Using the Browser API you could for example load a youtube video and then pause and resume it.
Vision is key
Sooner or later you want to advance your bot and reac to things on the screen. To accomplish this the Android, Browser and Desktop APIs have a
.takeScreenshot() method which returns and Image. The returned image can be used with the Vision API to find objects and react to them (eg. by clicking on them).
Thats actually all you need to get started. Feel free to explore scripts published by others to see how they work and take inspiration.