# Commands and exports

## Commands

| Command | Who | Does |
|---|---|---|
| `/phone` | Everyone | Open and close the phone (renamed with `command` in the config) |
| `phonecheck` | Admins, console | Print the start-up report again |
| `phoneverify <app> <username> <1 or 0>` | Admins, console | Give or take a verified badge on a social account |
| `phonepassword <app> <username> <password>` | Admins, console | Reset a social account's password |
| `phoneprune <days>` | Admins, console | Delete texts, calls, mail and posts older than that many days |

> [!DANGER]
> `phoneprune` can't be undone. Nothing is ever deleted by itself otherwise.

Admins are players with the `lwk_phone.admin` ace.

## Server exports

Names follow LB Phone's where the meaning is the same, so scripts written for that phone need little changing.

| Export | Returns | Does |
|---|---|---|
| `GetEquippedPhoneNumber(source)` | `string \| nil` | The number of the phone they're using |
| `GetSourceFromNumber(number)` | `number \| nil` | Who has that phone |
| `HasPhoneItem(source)` | `boolean` | Whether they carry a phone |
| `IsInCall(source)` | `boolean` | |
| `SendNotification(sourceOrNumber, notification)` | | `{ app, title, content }` |
| `SendMessage(from, to, text)` | | A text. `from` can be a name such as `'Bank'` |
| `SendMail(mail)` | | `{ to, sender, subject, message }` |
| `AddTransaction(number, amount, label)` | | A line in Wallet history. Move the money yourself |
| `CreateCall(source, call)` | | `{ number, video, hidden }` |

```lua
exports.lwk_phone:SendMessage('Bank', '555-0142', 'Your card was declined.')
exports.lwk_phone:SendMail({ to = 'jane@lsmail.net', sender = 'City Hall', subject = 'Permit', message = 'Approved.' })
```

## Client exports

| Export | Returns | Does |
|---|---|---|
| `IsOpen()` | `boolean` | |
| `ToggleOpen(open)` | | `true`, `false`, or `nil` to toggle |
| `SendNotification(notification)` | | `{ app, title, content }` |
| `AddCustomApp(app)` | | See [Community apps](/docs/lwk_phone/community-apps) |
| `RemoveCustomApp(identifier)` | | |
| `SendCustomAppMessage(identifier, data)` | | Data to your app's page |
| `usePhone` | | The inventory item's use handler; point your item at it |
