Add basic GMCPHandler module, track GMCP initialization, room data

main
AreiaAard 4 years ago
parent 465e74e0c7
commit a7540a61cc

@ -511,6 +511,23 @@ end
--------------------------------------------------
-- GMCPHandler
--------------------------------------------------
GMCPHandler = {}
function GMCPHandler.initialize()
GMCPHandler.gmcpInitialized = false
GMCPHandler.prevRoom = {}
end
function GMCPHandler.received_room(room)
GMCPHandler.prevRoom = room
end
-------------------------------------------------- --------------------------------------------------
-- Utility -- Utility
-------------------------------------------------- --------------------------------------------------
@ -529,6 +546,7 @@ function Utility.initialize()
Main.initialize, Main.initialize,
Settings.initialize, Settings.initialize,
Consider.initialize, Consider.initialize,
GMCPHandler.initialize,
} }
for _, initializer in ipairs(initializers) do for _, initializer in ipairs(initializers) do
initializer() initializer()
@ -600,6 +618,12 @@ end
function OnPluginBroadcast(msg, id, name, text) function OnPluginBroadcast(msg, id, name, text)
if (id == "3e7dedbe37e44942dd46d264") then if (id == "3e7dedbe37e44942dd46d264") then
if (not GMCPHandler.gmcpInitialized) then
GMCPHandler.gmcpInitialized = true
end
if (text == "room.info") then
GMCPHandler.received_room(gmcp("room.info"))
end
end end
end end
]]> ]]>

Loading…
Cancel
Save