All pastes #83135 Raw Edit

Stuff

public lua v1 · immutable
·published 2006-07-09 11:06 UTC
rendered paste body
ChannelKeys = AceLibrary("AceAddon-2.0"):new("AceDB-2.0","AceConsole-2.0")ChannelKeys:RegisterDB("ChannelKeysDB", "ChannelKeysDBPerChar")ChannelKeys:RegisterChatCommand({ "/channelkeys", "/ck" }, {    type = 'group',    name = "Channels",    desc = "Set channels.",    args = {	chan = {		type = 'group',		name = "Channel One",		desc = "Set Channels",		args = {			one = {				type = 'text',				name = "Channel One",				desc = "Set Channel One",				usage = "<channel>",				get = function()					return ChannelKeys.db.profile.ChanOne				end,				set = function(ChanOne)					ChannelKeys.db.profile.ChanOne = ChanOne				end,				},			two = {				type = 'text',				name = "Channel Two",				desc = "Set Channel Two.",				usage = "<channel>",				get = function()					return ChannelKeys.db.profile.ChanTwo				end,				set = function(ChanTwo)					ChannelKeys.db.profile.ChanOne = ChanTwo				end,				},			three = {				type = 'text',				name = "Channel Three",				desc = "Set Channel Three.",				usage = "<channel>",				get = function()					return ChannelKeys.db.profile.ChanThree				end,				set = function(ChanThree)					ChannelKeys.db.profile.ChanThree = ChanThree				end,				},			four = {				type = 'text',				name = "Channel Four",				desc = "Set Channel Four.",				usage = "<channel>",				get = function()					return ChannelKeys.db.profile.ChanFour				end,				set = function(ChanFour)					ChannelKeys.db.profile.ChanFour = ChanFour				end,				},			five = {				type = 'text',				name = "Channel Five",				desc = "Set Channel Five.",				usage = "<channel>",				get = function()					return ChannelKeys.db.profile.ChanFive				end,				set = function(ChanFive)					ChannelKeys.db.profile.ChanFive = ChanFive				end,				},							}		}	}})function ChannelKeys:SendToChat(prefix)    	if (not ChatFrameEditBox:IsVisible()) then		ChatFrame_OpenChat(prefix)	else		ChatFrameEditBox:SetText(prefix)	end;	ChatEdit_ParseText(ChatFrame1.editBox,0)endfunction ChannelKeys:CheckChan(Chan)	if Chan ~= nil  then 		local i,ChanID,ChanName			for i = 1,10,1 do			ChanID,ChanName = GetChannelName(i)			if (ChanID ~= 0 and ChanName ~= nil) then				if string.find(ChanName,Chan,1,true) ~= nil then 					return i 				end			end		end	else 		ace:print("ololol BORKED?!")		ace:print("test"..Chan)	end	return 0endfunction ChannelKeys:Doit(Chan)	local channel = self.db.profile[Chan]	if channel ~= nil then		local ChanName = self:CheckChan(channel);		if (ChanName > 0) then			self:SendToChat("/"..ChanName.." ")		else			--ace:print("Channel does not exist.")		end	else		ace:print(Chan.." is not set")	endend