# Send location (live) or venue

## Send location

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

#### Location class-method take arguments:

<table><thead><tr><th width="244.01398233580966" data-type="number">Argument</th><th>Description</th><th>Required</th></tr></thead><tbody><tr><td>1</td><td>Latitude of the location</td><td><strong>Required</strong></td></tr><tr><td>2</td><td>Longitude of the location</td><td><strong>Required</strong></td></tr><tr><td>3</td><td><a href="https://core.telegram.org/bots/api#sendlocation">Options</a></td><td>Optional</td></tr></tbody></table>

{% code title="app.controller.ts" %}

```typescript
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));
  }
}
```

{% endcode %}

## 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

{% code title="app.controller.ts" %}

```typescript
import {
  Answer,
  Controller,
  Edit, GetAnswer,
  Keyboard,
  KeyboardTypes,
  LiveLocation,
  Location,
  MessageSend,
  OnClick,
  OnCommand,
} from 'nestgram';

import { AppService } from './app.service';

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

  @OnCommand('start')
  sendLocation() {
    return new MessageSend(
      new Location(33.9859004, 102.348783, { live_period: 60 }), // live for 1 minute
      new Keyboard(KeyboardTypes.underTheMessage)
        .btn('Edit', 'edit').row()
        .btn('Stop', 'stop'),
    );
  }

  @OnClick('edit')
  editLocation() {
    return new Edit(new LiveLocation(33.986797, 102.347931));
  }

  @OnClick('stop')
  stopLocation(@GetAnswer() answer: Answer) {
    return answer.stopLiveLocation();
  }
}
```

{% endcode %}

{% hint style="info" %}
If you want to know what arguments an API method takes, see the IDE hint
{% endhint %}

## 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:

<table><thead><tr><th width="238.11859838274933" data-type="number">Argument</th><th width="297.65556806464485">Description</th><th>Required</th></tr></thead><tbody><tr><td>1</td><td>Latitude of the venue</td><td><strong>Required</strong></td></tr><tr><td>2</td><td>Longitude of the venue</td><td><strong>Required</strong></td></tr><tr><td>3</td><td>Title of the venue</td><td><strong>Required</strong></td></tr><tr><td>4</td><td>Address of the venue</td><td><strong>Required</strong></td></tr><tr><td>5</td><td><a href="https://core.telegram.org/bots/api#sendvenue">Options</a></td><td>Optional</td></tr></tbody></table>

{% code title="app.controller.ts" %}

```typescript
import { Controller, Venue, MessageSend, OnCommand } from 'nestgram';
import { AppService } from './app.service';

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

  @OnCommand('start')
  helloMessage(): MessageSend {
    return new MessageSend(
      new Venue(33.9859004, 102.348783, 'Address')
    )
  }
}
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://degreetpro.gitbook.io/nestgram/messages/send-location-live-or-venue.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
