# Discord Integration

The Motels plugin offers Discord integration, allowing you to send notifications about various motel-related events to your Discord server using webhooks.

### Configuration

To set up the Discord integration, you need to configure the `discord-hook` section in your `config.yml` file. Here's a breakdown of the configuration options:

```yaml
discord-hook:
  enabled: false
  messages:
    # Event configurations...
```

#### General Settings

* `enabled`: Set to `true` to enable Discord integration, or `false` to disable it.

#### Event Configurations

For each event type, you can configure the following settings:

```yaml
event-name:
  webhook-url: "your_webhook_url_here"
  enabled: true
  title: "Embed Title"
  subtitle: "Embed Subtitle"
  msg: "Embed Message"
```

* `webhook-url`: The Discord webhook URL for this specific event.
* `enabled`: Set to `true` to enable notifications for this event, or `false` to disable them.
* `title`: The title of the Discord embed.
* `subtitle`: The subtitle or field name in the Discord embed.
* `msg`: The main message content of the embed.

### Available Events

#### 1. Motel Purchase

```yaml
buy:
  webhook-url: "webhookurl"
  enabled: true
  title: "Motels"
  subtitle: "Motel bought"
  msg: "Player: %buyer% bought motel %region% for %price% coins"
```

#### 2. Motel Sale

```yaml
sell:
  enabled: true
  webhook-url: "webhookurl"
  title: "Motels"
  subtitle: "Motel sold"
  msg: "Player: %seller% sold the motel %region%"
```

#### 3. Motel Expiration

```yaml
expired:
  webhook-url: "webhookurl"
  enabled: true
  title: "Motels"
  subtitle: "Motel expired"
  msg: "Motel: %region% expired in: %date% and was owned by: %owner%"
```

#### 4. Rent Extension

```yaml
extend:
  webhook-url: "webhookurl"
  enabled: true
  title: "Motels"
  subtitle: "Motel rent extended"
  msg: "Player: %owner% extended motel: %region% rent to %date%"
```

#### 5. Expired Vault Access

```yaml
expired-vault-logs:
  webhook-url: "webhookurl"
  enabled: true
  title: "Expired Vault: %vaultnumber% | Room: %motelid% | (%action%)"
  subtitle: "Expired Vault Access"
  msg: "Player: %player% %action%ed the expired vault.\nContents:\n%contents%"
```

#### 6. Vault Access

```yaml
vault-logs:
  webhook-url: "webhookurl"
  enabled: true
  title: "Vault: %vaultnumber% | Room: %motelid% | Owner: %owner% | (%action%)"
  subtitle: "Vault Access"
  msg: "Player: %player% %action%ed the vault.\nContents:\n%contents%"
```

### Placeholders

Each event type supports specific placeholders that will be replaced with actual values when the notification is sent:

* `%buyer%`: The name of the player buying a motel
* `%seller%`: The name of the player selling a motel
* `%owner%`: The name of the motel owner
* `%region%`: The motel region or ID
* `%price%`: The price of the motel
* `%date%`: The expiration or extension date
* `%player%`: The name of the player accessing a vault
* `%action%`: The action performed (e.g., "Open" or "Close")
* `%motelid%`: The ID of the motel
* `%vaultnumber%`: The number of the vault
* `%contents%`: The contents of the vault

### Note on Vault Contents

When logging vault access, the plugin will format the list of items in the vault. Each item will be listed with its name (or type if no custom name) and quantity. For expired vaults, all formatting will be stripped from item names.

Remember to replace `"webhookurl"` with your actual Discord webhook URLs for each event you want to enable.
