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:
SLASH_GUILDNOTEINVITE1="/gnoteinv" -- change this to whatever you like
SlashCmdList["GUILDNOTEINVITE"]=function(input)
if input=="all" then
print("Inviting EVERYONE!")
elseif input~="" then
print("Inviting guild members matching: "..input)
elseif input=="" then
return
end
local indexargs,keyargs,sentall,sent={strsplit(" ",input)},{}
for k,v in next,indexargs do
keyargs[strlower(v)]=true
end
for i=1,(GetNumGuildMembers()) do
local name,_,_,_,_,_,note,_,online,_,class=GetGuildRosterInfo(i)
if online then
if input=="all" then
InviteUnit(name)
sentall=true
else
local noteparts={strsplit(" ",note)}
for k,v in next,noteparts do
if keyargs[strlower(v)] then
InviteUnit(name)
sent=true
print("Invited |c"..RAID_CLASS_COLORS[class].colorStr..name.."|r"..": "..v)
end
end
end
end
end
print((sent or sentall) and "Invites sent!" or "No members matched arguments!")
end