WoWInterface - View Single Post - Guild Note Group Inviter
View Single Post
01-25-18, 05:21 PM   #4
A Molten Giant
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 529
I have similar code for both slash command argument matching and guild member iteration, so I threw together something that does what you want, case insensitive. You can invite anyone matching one or more arguments, so if you have people organized as "member", "trial", "weekday", "weekend", and so on, you can do /gnoteinv weekend member and it'll invite everyone with "weekend" or "member" in their notes. If you want to invite everyone, use /gnoteinv all. Nothing happens if there's no arguments and the code will tell you if no one matched your arguments as well. I even added some flair with class colored names.

You can change the slash command in the top line.

Go to https://addon.bool.no, paste the code below into the big box, name this whatever you want in the top box, then download and install like any other addon. You can drop the other addon altogether or reinstall it to default for its original rank invite function.

As a final note, the way this is implemented, you must have the notes spaced, which I assumed isn't an issue. "Weekend raider 939" will match weekend, but "Weekendraider939" will not.

Lua Code:
  1. SLASH_GUILDNOTEINVITE1="/gnoteinv" -- change this to whatever you like
  2. SlashCmdList["GUILDNOTEINVITE"]=function(input)
  3.     if input=="all" then
  4.         print("Inviting EVERYONE!")
  5.     elseif input~="" then
  6.         print("Inviting guild members matching: "..input)
  7.     elseif input=="" then
  8.         return
  9.     end
  10.     local indexargs,keyargs,sentall,sent={strsplit(" ",input)},{}
  11.     for k,v in next,indexargs do
  12.         keyargs[strlower(v)]=true
  13.     end
  14.     for i=1,(GetNumGuildMembers()) do
  15.         local name,_,_,_,_,_,note,_,online,_,class=GetGuildRosterInfo(i)
  16.         if online then
  17.             if input=="all" then
  18.                 InviteUnit(name)
  19.                 sentall=true
  20.             else
  21.                 local noteparts={strsplit(" ",note)}
  22.                 for k,v in next,noteparts do
  23.                     if keyargs[strlower(v)] then
  24.                         InviteUnit(name)
  25.                         sent=true
  26.                         print("Invited |c"..RAID_CLASS_COLORS[class].colorStr..name.."|r"..": "..v)
  27.                     end
  28.                 end
  29.             end
  30.         end
  31.     end
  32.     print((sent or sentall) and "Invites sent!" or "No members matched arguments!")
  33. end

Last edited by Kanegasi : 01-25-18 at 05:29 PM.
  Reply With Quote