Hey GW2 Twitch streamers, I rewrote some functionality of my Phantombot plugin which is written in JavaScript into PHP for use with Nightbot. I deployed it on Heroku and it is ready to use by everyone!
This server-side script is making use of Nightbot's dynamic response system (mostly $(urlfetch)) with which you are able to fetch the resources from the Guild Wars 2 API forwarded by my Heroku App.
Do not worry! ArenaNet will never make an API with which third-party tools would be able to edit something on your account from outside of the game!
The API is purely for “viewing” ressources!
How to add commands to Nightbot.
With chat:
"!commands add !command_name command_response"
or
"!addcom !command_name command_response"
With interface:
beta.nightbot.tv/commands/custom
Here's what the command_response should contain for Nightbot to reply with your current rank in sPvP:
$(urlfetch http://guildwars2nightbot.herokuapp.com/guildwars2.php?GW2apiKey=YourApiKeyHere&command=rank)
- Replace YourApiKeyHere with your GW2 API key. You can create one here: https://account.arena.net/applications
- Specify a command after the &command= query parameter at the end of the URL in the $(urlfetch) method.
In the example above I specified "rank" as for the current rank in the current season.
Note:
- You CAN write custom text before and after $(urlfetch) in the response!
- Do NOT forget to close any opening parantheses '(' with a closing ')' at the end!
List of commands you can specify after the &command= query parameter (I.e. Copy a bold line and paste it after &command=):
- rank
Example output: "Platinum - matchmaking rating: 1566 「234 ᴍᴍʀ left for a rank promotion to Legendary 」"