The AutoLFM Public API allows external addons to query broadcast state, subscribe to state changes, and integrate with the AutoLFM broadcaster.
Access via: local api = AutoLFM.API
Returns the current broadcast message being sent to chat.
function AutoLFM.API.GetBroadcastMessage()Returns:
string- The broadcast message, or empty string if none
Example:
local msg = AutoLFM.API.GetBroadcastMessage()
print("Currently broadcasting: " .. msg)Checks if the broadcaster is currently running.
function AutoLFM.API.IsBroadcasting()Returns:
boolean-trueif broadcasting is active
Example:
if AutoLFM.API.IsBroadcasting() then
print("AutoLFM is broadcasting")
endReturns the current broadcast interval in seconds.
function AutoLFM.API.GetBroadcastInterval()Returns:
number- Interval in seconds (30-120)
Example:
local interval = AutoLFM.API.GetBroadcastInterval()
print("Broadcasting every " .. interval .. " seconds")Returns the number of messages sent in the current session.
function AutoLFM.API.GetMessagesSent()Returns:
number- Message count
Example:
local count = AutoLFM.API.GetMessagesSent()
print("Messages sent so far: " .. count)Returns all currently selected dungeon names.
function AutoLFM.API.GetSelectedDungeons()Returns:
table- Array of dungeon names (empty if none selected)
Example:
local dungeons = AutoLFM.API.GetSelectedDungeons()
for i = 1, #dungeons do
print("Selected: " .. dungeons[i])
endReturns the currently selected raid name.
function AutoLFM.API.GetSelectedRaid()Returns:
string|nil- Raid name ornilif no raid selected
Example:
local raid = AutoLFM.API.GetSelectedRaid()
if raid then
print("Raid selected: " .. raid)
endReturns the selected roles (Tank, Heal, DPS).
function AutoLFM.API.GetSelectedRoles()Returns:
table- Array of role strings:{"TANK"},{"HEAL"},{"DPS"}, or combinations
Example:
local roles = AutoLFM.API.GetSelectedRoles()
if #roles > 0 then
print("Selected roles: " .. table.concat(roles, ", "))
endReturns the current selection mode.
function AutoLFM.API.GetSelectionMode()Returns:
string- One of:"dungeons"- Dungeons selected"raid"- Raid selected"quests"- Quests selected"custom"- Custom message mode"none"- Nothing selected
Example:
local mode = AutoLFM.API.GetSelectionMode()
if mode == "raid" then
print("Raid mode active")
endReturns the current group size.
function AutoLFM.API.GetGroupSize()Returns:
number- Group size (1-40, where 1 = solo)
Example:
local size = AutoLFM.API.GetGroupSize()
print("Group size: " .. size)Returns the current group type.
function AutoLFM.API.GetGroupType()Returns:
string- One of:"solo"- Playing alone"party"- In a party (2-5 players)"raid"- In a raid (10+ players)
Example:
local groupType = AutoLFM.API.GetGroupType()
print("Group type: " .. groupType)Checks if the player is the group leader.
function AutoLFM.API.IsGroupLeader()Returns:
boolean-trueif player is leader (or solo)
Example:
if AutoLFM.API.IsGroupLeader() then
print("You are the group leader")
endChecks if dark mode is enabled.
function AutoLFM.API.IsDarkModeEnabled()Returns:
boolean-trueif dark mode is active
Example:
if AutoLFM.API.IsDarkModeEnabled() then
print("Dark mode is active")
endChecks if dry run mode is enabled (messages not sent to chat).
function AutoLFM.API.IsDryRunEnabled()Returns:
boolean-trueif dry run mode is active
Example:
if AutoLFM.API.IsDryRunEnabled() then
print("Dry run mode: messages preview only, not sent")
endReturns the dungeon difficulty filters.
function AutoLFM.API.GetDungeonFilters()Returns:
table- Table with color names as keys and boolean values- Keys:
"GRAY","GREEN","YELLOW","ORANGE","RED" - Values:
true= visible,false= filtered out
- Keys:
Example:
local filters = AutoLFM.API.GetDungeonFilters()
if filters["RED"] then
print("Showing red (hardest) dungeons")
endReturns the broadcast interval setting from persistent storage.
function AutoLFM.API.GetBroadcastIntervalSetting()Returns:
number- Interval in seconds (30-120, default 60)
Example:
local interval = AutoLFM.API.GetBroadcastIntervalSetting()
print("User set interval to: " .. interval .. " seconds")Subscribes to broadcast state changes.
function AutoLFM.API.OnBroadcastStateChanged(listenerId, callback)Parameters:
listenerId(string) - Unique listener identifier for this subscriptioncallback(function) - Function called when state changes:function(newValue)
Returns:
boolean-trueif subscription successful
Example:
AutoLFM.API.OnBroadcastStateChanged("MyAddon.OnBroadcast", function(newValue)
print("Broadcast state changed!")
end)Subscribes to selection state changes (dungeons, raid, roles, custom message).
function AutoLFM.API.OnSelectionChanged(listenerId, callback)Parameters:
listenerId(string) - Unique listener identifier for this subscriptioncallback(function) - Function called when state changes:function(newValue)
Returns:
boolean-trueif subscription successful
Example:
AutoLFM.API.OnSelectionChanged("MyAddon.OnSelection", function(newValue)
print("AutoLFM selection changed!")
end)Subscribes to group state changes (size, type, leader status).
function AutoLFM.API.OnGroupStateChanged(listenerId, callback)Parameters:
listenerId(string) - Unique listener identifier for this subscriptioncallback(function) - Function called when state changes:function(newValue)
Returns:
boolean-trueif subscription successful
Example:
AutoLFM.API.OnGroupStateChanged("MyAddon.OnGroupChange", function(newValue)
if AutoLFM.API.GetGroupSize() >= 5 then
print("Party is now full!")
end
end)Unsubscribes from state changes.
function AutoLFM.API.Unsubscribe(listenerId)Parameters:
listenerId(string) - Listener identifier to remove
Returns:
boolean-trueif unsubscription successful
Example:
AutoLFM.API.Unsubscribe("MyAddon.OnBroadcast")Returns a complete snapshot of all broadcast, selection, group, and settings state.
function AutoLFM.API.GetSnapshot()Returns:
table- State snapshot with structure:{ broadcast = { message = string, isRunning = boolean, interval = number, messagesSent = number }, selection = { dungeons = table, raid = string|nil, roles = table, mode = string }, group = { size = number, type = string, isLeader = boolean }, settings = { darkMode = boolean, dryRun = boolean, dungeonFilters = table } }
Example:
local snapshot = AutoLFM.API.GetSnapshot()
print("Broadcasting: " .. snapshot.broadcast.message)
print("Group size: " .. snapshot.group.size)
print("Dry run enabled: " .. tostring(snapshot.settings.dryRun))-- Example addon integrating with AutoLFM
if not AutoLFM or not AutoLFM.API then
return -- AutoLFM not loaded
end
-- Subscribe to selection changes
AutoLFM.API.OnSelectionChanged("MyIntegration", function()
local dungeons = AutoLFM.API.GetSelectedDungeons()
local raid = AutoLFM.API.GetSelectedRaid()
if raid then
print("Raiding: " .. raid)
elseif #dungeons > 0 then
print("Running dungeons: " .. table.concat(dungeons, ", "))
end
end)
-- Check if broadcasting before doing something
if AutoLFM.API.IsBroadcasting() then
local msg = AutoLFM.API.GetBroadcastMessage()
print("AutoLFM is broadcasting: " .. msg)
end
-- Get current snapshot for diagnostics
local snapshot = AutoLFM.API.GetSnapshot()
print("Full state: " .. stringify(snapshot))- Availability: The API is available after PLAYER_ENTERING_WORLD event
- Read-Only: The public API only provides read access and subscriptions, not command dispatch
- State Updates: State is centralized in Maestro; external addons should subscribe to changes rather than polling
- Listener IDs: Must be unique across all addons using the API to avoid conflicts
- Callbacks: Callbacks should complete quickly to avoid blocking the addon