| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
function command_redirect(account, text) |
| 13 |
|
| 14 |
local args = split_command(text, 2) |
| 15 |
|
| 16 |
if not args[1] or not args[2] then |
| 17 |
api.describe_command(account.name, args[0]) |
| 18 |
return -1 |
| 19 |
end |
| 20 |
|
| 21 |
|
| 22 |
local dest = api.account_get_by_name(args[1]) |
| 23 |
|
| 24 |
if next(dest) == nil or dest.online == "false" then |
| 25 |
api.message_send_text(account.name, message_type_error, account.name, localize(account.name, "User \"{}\" is offline", args[1])) |
| 26 |
return -1 |
| 27 |
end |
| 28 |
|
| 29 |
api.message_send_text(dest.name, message_type_info, dest.name, args[2]) |
| 30 |
|
| 31 |
return 0 |
| 32 |
end |