declineInvite_conf = { ["ENABLED"] = true, }; function declineInvite_OnLoad() SlashCmdList["declineInvite"] = declineInvite_SlashCmd; SLASH_declineInvite1 = "/declineinvite"; SLASH_declineInvite2 = "/di"; DEFAULT_CHAT_FRAME:AddMessage("Loaded declineIvite addon."); end function declineInvite_SlashCmd(a, msg) if( declineInvite_conf["ENABLED"] ) then declineInvite_conf["ENABLED"] = false; DEFAULT_CHAT_FRAME:AddMessage("declineInvite disabled."); else declineInvite_conf["ENABLED"] = true; DEFAULT_CHAT_FRAME:AddMessage("declineInvite enabled."); end; end local timeInvited = nil; local timeDeclineDelay = 2 + math.random(7); function declineInvite_OnUpdate() if( timeInvited ~= nil and os.difftime(os.time(), timeInvited) > timeDeclineDelay ) then -- Decline the invite DeclineGroup(); timeInvited = nil; timeDeclineDelay = 2 + math.random(7); end if( timeInvited ~= nil and os.difftime(os.time(), timeInvited) > timeDeclineDelay ) then StaticPopup_OnClick(StaticPopup1, 2); timeInvited = nil; timeDeclineDelay = 2 + math.random(7); end if( timeInvited ~= nil and os.difftime(os.time(), timeInvited) > timeDeclineDelay ) then StaticPopup_OnClick(StaticPopup1, 2); CancelDuel() timeInvited = nil; timeDeclineDelay = 2 + math.random(7); end end function declineInvite_OnEvent(event) if( declineInvite_conf["ENABLED"] == false ) then return; end; if( event == "PARTY_INVITE_REQUEST" ) then DEFAULT_CHAT_FRAME:AddMessage("Enqueued a decline for party invite in " .. timeDeclineDelay .. " seconds."); PlaySoundByPath("Interface/AddOns/declineInvite/Sound/crit.mp3"); timeInvited = os.time(); end if( event == "GUILD_INVITE_REQUEST" ) then DEFAULT_CHAT_FRAME:AddMessage("Enqueued a decline for guild invite in " .. timeDeclineDelay .. " seconds."); DEFAULT_CHAT_FRAME:AddMessage("guildinvite: "..StaticPopup_Visible("GUILD_INVITE")) PlaySoundByPath("Interface/AddOns/declineInvite/Sound/alarm2.wav"); timeInvited = os.time(); end if( event == "DUEL_REQUESTED" ) then DEFAULT_CHAT_FRAME:AddMessage("Enqueued a decline for duel request in " .. timeDeclineDelay .. " seconds."); PlaySoundByPath("Interface/AddOns/declineInvite/Sound/alarm2.wav"); timeInvited = os.time(); end end