Allow multi-word chatcommand channels.

• Allows multi-word chatcommand channels, separated by a '.'.
    · Example: '@/test.test2' will run '/test test2'.
This commit is contained in:
luk3yx 2018-10-16 16:41:45 +13:00
parent 2318fc3c15
commit cac278c217
2 changed files with 7 additions and 6 deletions

View File

@ -14,7 +14,8 @@ Chat channels are created automatically when adding the first user and deleted
The following channel prefixes exist:
- `@`: A PM. This will PM the user after the `@`.
- `@/`: A chatcommand. This will run the chatcommand after the `@`.
- `@/`: A chatcommand. This will run the chatcommand after the `@`. Any
instances of `.` in this command will be replaced with ` `.
- `#`: A channel. This is just a group PM prefixed with the channel name. If
a user in the channel uses chat_channels and has you in a channel with the
same name, the message will display as a chat message in the channel.

View File

@ -118,7 +118,7 @@ chat_channels.send_message = function(msg, c)
minetest.send_chat_message('[off] ' .. msg)
return true, 'Message sent!'
elseif c:sub(1, 2) == '@/' then
minetest.run_server_chatcommand(c:sub(3), msg)
minetest.run_server_chatcommand(c:sub(3):gsub('%.', ' '), msg)
if c == '@/s' then
minetest.display_chat_message('-' .. main_channel .. '- <' ..
localplayer .. '> (s) ' .. msg)