Available methods
Friendly Methods VS Raw API Methods
GramJS provides two types of methods. friendly methods are a wrapper around Raw API ones that will take care of most things that need to be added manually if the Raw API counterpart was used.
The signature also won't change between updates while Raw API methods are known to change constantly.
So in short only use Raw API methods if you either there isn't a friendly method counterpart or you need more control over it
Friendly Methods
You can access these methods using client.method_name
. There isn't a list of them currently but since GramJS uses TS they can be found easily. An example would be the send_message method used like so
A full list of friendly methods will be added soon to the docs.
Raw API Methods
Raw API methods are generated automatically from the .tl files which can be found in tl/static/api.tl
these methods are generated on each run on Nodejs and are cached in the browser after the first run so make sure to delete the cache if you update the tl schema.
Alongside the methods, a definition file is generated containing all the available methods and their signature.
To use Raw methods you need to import {Api} first
Then you'll need to create the request you want from it's class. All methods are classes that accept args relevant to their signatures. An example would be
Your IDE of choice should help you with the name of the args.
Finally, to send the request you would need to use the .invoke()
of client
The type of result is different depending on the sent request.
A full list of methods will be coming soon to the docs for now you can console.log the variable to inspect it.
Last updated