Add API callback specifically for players receiving mail

This commit is contained in:
y5nw 2024-01-13 20:18:20 +01:00
parent 3046f46414
commit c7f631664e
3 changed files with 21 additions and 5 deletions

9
api.md
View file

@ -34,7 +34,7 @@ local success, error = mail.send({
```
# Hooks
On-receive mail hook:
Generic on-receive mail hook:
```lua
mail.register_on_receive(function(m)
@ -42,6 +42,13 @@ mail.register_on_receive(function(m)
end)
```
Player-specific on-receive mail hook:
```lua
mail.register_on_player_receive(function(player, msg)
-- "player" is the name of a recipient; "msg" is a mail object (see "Mail format")
end)
```
# Recipient handler
Recipient handlers are registered using