From a7540a61cc50d87b5ce66309f23b6affafa4b9c5 Mon Sep 17 00:00:00 2001 From: AreiaAard Date: Sun, 18 Apr 2021 14:53:26 -0400 Subject: [PATCH] Add basic GMCPHandler module, track GMCP initialization, room data --- areia_consider.xml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/areia_consider.xml b/areia_consider.xml index 5bcfe55..98f83b1 100644 --- a/areia_consider.xml +++ b/areia_consider.xml @@ -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 -------------------------------------------------- @@ -529,6 +546,7 @@ function Utility.initialize() Main.initialize, Settings.initialize, Consider.initialize, + GMCPHandler.initialize, } for _, initializer in ipairs(initializers) do initializer() @@ -600,6 +618,12 @@ end function OnPluginBroadcast(msg, id, name, text) 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 ]]>