Experimental account_name to tell where people chat from

This commit is contained in:
AliasAlreadyTaken 2022-02-26 04:54:05 +01:00
parent 7072487bc1
commit a02bcef7ad
1 changed files with 4 additions and 4 deletions

View File

@ -77,9 +77,9 @@ local function receive()
if result.succeeded then
local data = core.parse_json(result.data)
for _, v in ipairs(data) do
if v.username and v.text then
if v.username and v.text and v.account then
core.log("action", "[MOD] yl_matterbridge : Received " .. dump(data))
yl_matterbridge.receive_from_bridge(v.username, v.text)
yl_matterbridge.receive_from_bridge(v.username, v.text, v.account)
end
end
else
@ -94,8 +94,8 @@ end
-- Overwrite these function in your chat mod, if you want to govern sending and receveiving yourself
-- Don't forget to add an optional dependency to yl_matterbridge
function yl_matterbridge.receive_from_bridge(user_name, message_text)
core.chat_send_all("<<" .. user_name .. ">> " .. message_text)
function yl_matterbridge.receive_from_bridge(user_name, message_text, account_name)
core.chat_send_all("<"..account_name.."|" .. user_name .. "> " .. message_text)
end
function yl_matterbridge.send_to_bridge(user_name, message_text)