(Classic) Open Guild Window With Keybind

I’m so used to being able to open my Guild window with a single keypress, I’m trying to create an addon for Classic that does the same thing.

However, there are issues:

  1. I have to open the social window at least once when I log in, or it won’t work.
  2. I’m trying to get it to open the window if it’s not visible, and close it when it is, but that doesn’t work either; when I press the button, I just hear a clicking noise and nothing appears.

This is what I’ve got so far, codewise:

local GuildWindowKeyFrame = CreateFrame("Frame", "GuildWindowKeyFrame", UIParent)

local function GuildWindowKeyFramePrint(self, key)

 guildName, guildRankName, guildRankIndex = GetGuildInfo("player");
 --local frameVis = FriendsFrame:IsShown()

 	if key == tostring(GWKConfig.KeyToUse) then
 		if guildName == nil then
 			DEFAULT_CHAT_FRAME:AddMessage("|cFFABCDEF[Guild Window Keybind]|r |cFFFF0000[Error]|r You are not in a guild.")
 		elseif guildName ~= nil then
 			--if frameVis == false then
 				FriendsFrame:Show()
 				FriendsFrameTab3:Click()
 			--elseif frameVis == true then
 				--FriendsFrame:Hide()
 			--end
 		end
 	end
 end
  
 GuildWindowKeyFrame:SetScript("OnKeyDown", GuildWindowKeyFramePrint)
 GuildWindowKeyFrame:SetPropagateKeyboardInput(true)

I’ve commented out the parts related to checking the visibility of the window, because it won’t work if they’re uncommented.

I hope this is clear enough; if you have any questions, don’t hesitate to ask.

Any and all help is appreciated.

You want to use an addon instead of just a keybind? I don’t understand the difference here

1 Like

Never mind, I’ve just found the keybinding for it.

I thought there wasn’t one, hence why I wanted to make an addon.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.