Sending an Invite

We have everything we need and now for the easy bit! We’re going to piece everything together in our OnChat() method and invite potential customers to our group.

function PortalWhere:OnChat(text, playerName, _, _, shortPlayerName, _, _, _, _, _, _, guid)
    if self:WantsPortal(playerName, guid, text) then
        InviteUnit(playerName)
    end
end

Job Done

There you have it – a working auto-inviter AddOn for portal mages. Congratulations on making it to the end of this article but your work doesn’t have to stop here. There are many improvements that could be made to this AddOn. You could create a GUI with a real On / Off button and maybe even keep a history of how many times you’ve teleported players. You can also make it automatically open up a trade window to prompt the punter to give you the gold or welcome them if they join the group – everyone loves a spammy mage. I’ll leave those things as an exercise to the reader.

A Humble Request

You’re free to do whatever you like with this code (under the MIT license) but I’d like to make a humble request – Please don’t just copy & paste this code and upload it as it is to Curse or another AddOn site. At least add something to it so we don’t end up with 10 copies of the same AddOn in the Twitch app. Oh, and please credit the author!

It’s on Github

You can find the complete source code on Github.

Last modified: June 22, 2020

Author

Comments

Write a Reply or Comment

Your email address will not be published.