mirror of
https://github.com/mt-mods/mail.git
synced 2025-08-12 01:08:15 -04:00
Implement non-player recipients
This commit is contained in:
parent
721d882c26
commit
3046f46414
6 changed files with 118 additions and 57 deletions
16
api.md
16
api.md
|
@ -42,6 +42,22 @@ mail.register_on_receive(function(m)
|
|||
end)
|
||||
```
|
||||
|
||||
# Recipient handler
|
||||
Recipient handlers are registered using
|
||||
|
||||
```lua
|
||||
mail.register_recipient_handler(function(sender, name)
|
||||
end)
|
||||
```
|
||||
|
||||
where `name` is the name of a single recipient.
|
||||
|
||||
The recipient handler should return
|
||||
* `nil` if the handler does not handle messages sent to the particular recipient,
|
||||
* `true, player` (where `player` is a string or a list of strings) if the mail should be redirected to `player`,
|
||||
* `true, deliver` if the mail should be delivered by calling `deliver` with the message, or
|
||||
* `false, reason` (where `reason` is optional or, if provided, a string) if the recipient explicitly rejects the mail.
|
||||
|
||||
# Internals
|
||||
|
||||
mod-storage entry for a player (indexed by playername and serialized with json):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue