Send location (live) or venue

You can send location and live location

Send location

You can create a location using the Location class and send it using the MessageSend class-method

Location class-method take arguments:

Argument
Description
Required
1

Latitude of the location

Required

2

Longitude of the location

Required

3

Optional

app.controller.ts
import { Controller, Location, MessageSend, OnCommand } from 'nestgram';
import { AppService } from './app.service';

@Controller()
export class AppController {
  constructor(private readonly appService: AppService) {}

  @OnCommand('start')
  sendLocation(): MessageSend {
    return new MessageSend(new Location(33.9859004, 102.348783));
  }
}

Send live location

You can pass options to the Location class as the 3rd argument and set the live_period (meaning you are sending the live location). To edit the live location, use the Edit class-method and LiveLocation class-mark. To stop the live location, use the .stopLiveLocation API method

If you want to know what arguments an API method takes, see the IDE hint

Send venue

You can also send venue - it's a location with a name. To send a venue, use Venue class-method

Venue class-method take arguments:

Argument
Description
Required
1

Latitude of the venue

Required

2

Longitude of the venue

Required

3

Title of the venue

Required

4

Address of the venue

Required

5

Optional

Last updated