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:
parent
2318fc3c15
commit
cac278c217
|
@ -14,7 +14,8 @@ Chat channels are created automatically when adding the first user and deleted
|
||||||
The following channel prefixes exist:
|
The following channel prefixes exist:
|
||||||
|
|
||||||
- `@`: A PM. This will PM the user after the `@`.
|
- `@`: 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 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
|
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.
|
same name, the message will display as a chat message in the channel.
|
||||||
|
|
2
init.lua
2
init.lua
|
@ -118,7 +118,7 @@ chat_channels.send_message = function(msg, c)
|
||||||
minetest.send_chat_message('[off] ' .. msg)
|
minetest.send_chat_message('[off] ' .. msg)
|
||||||
return true, 'Message sent!'
|
return true, 'Message sent!'
|
||||||
elseif c:sub(1, 2) == '@/' then
|
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
|
if c == '@/s' then
|
||||||
minetest.display_chat_message('-' .. main_channel .. '- <' ..
|
minetest.display_chat_message('-' .. main_channel .. '- <' ..
|
||||||
localplayer .. '> (s) ' .. msg)
|
localplayer .. '> (s) ' .. msg)
|
||||||
|
|
Loading…
Reference in New Issue