View Single Post
02-14-14, 03:24 AM   #4
pelf
Sentient Plasmoid
 
pelf's Avatar
Premium Member
Join Date: May 2008
Posts: 133
This is dry-coded, so it might not be 100% right, but something like this should add the slash commands you're looking for. This would have to be put into an addon or run at load-time by something like WowLua or _DevPad.

Code:
local function PrintError(message)
	DEFAULT_CHAT_FRAME:AddMessage(msg, 1, 0, 0)
end

local function GetAltModule()
	if not Prat then
		PrintError("Prat is not loaded!")
		return
	end
	
	local module = Prat:GetModule("AltNames", true)
	
	if not module then
		PrintError("The AltNames module is not loaded!")
		return
	end
	
	return module
end

SLASH_PRAT_ADDALT1 = "/addalt"
SlashCmdList["PRAT_ADDALT"] = function(args)
	local alt, main = strmatch(args, '(%S+)%s+(%S+)')
	
	if not main or not alt then
		PrintError("Invalid arguments to /addalt! Syntax is: /addalt ALT MAIN")
		return
	end

	local altModule = GetAltModule()	
	if not altModule then return end
	
	altModule:addAlt(alt.." "..main)	
end

SLASH_PRAT_DELALT1 = "/delalt"
SlashCmdList["PRAT_DELALT"] = function(alt)
	if not alt then
		PrintError("Invalid arguments to /delalt! Syntax is : /delalt ALT")
		return
	end
	
	local altModule = GetAltModule()	
	if not altModule then return end
	
	altModule:delAlt(alt)
end

Last edited by pelf : 02-14-14 at 03:58 AM. Reason: removed color escape, used parameters
  Reply With Quote