Api class
You can use an Api class to send a message to another users and more
Why do you need an Api class?
Get Api class in controller
import { OnCommand, Controller, GetApi, Api } from 'nestgram';
import { AppService } from './app.service';
@Controller()
export class AppController {
@GetApi() api: Api;
constructor(private readonly appService?: AppService) {}
@OnCommand('start')
async start(): Promise<string> {
await this.api.send('userId', 'Hello!'); // send message
return 'Hello, world!';
}
}.send Api method take arguments:
Argument
Description
Required
1
2
3
4
Api methods
Get Api for different token
Last updated