[CustomAPI] Guild Wars 2 commands

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 」”

  • stats&profession=$(query)

Example output: “Rank 80 | 1775 total games | W/L ratio: 1.3”
Example output if specified prof.: “necromancer | 1581 total games | Win rate: 55.4%”

  • wallet&coins_format=1

Example output: “13g 30s 42c and 1.722.187 Karma”
Example output if coins_format equals 1: “13,30.42g and 1.722.187 Karma”

  • build_pvp&character=$(querystring)

Example output: https://gw2tool.net/en/yP2endN4IJ/builds/../gw2skills-pvp/Nekres

  • build_pve&character=$(querystring)

Example output: https://gw2tool.net/en/yP2endN4IJ/builds/../gw2skills-pve/Nekres

  • build_wvw&character=$(querystring)

Example output: https://gw2tool.net/en/yP2endN4IJ/builds/../gw2skills-wvw/Nekres

  • characters or chars

Example output: (Returns a list of all your owned character names separated by comma.)


You are now able to call ‘stats’ with profession abbreviations as argument if &profession=$(query) is set!
1. Example: “!YourStatsCommand necro”
Output: “necromancer | 1578 total games | Win rate: 56.7%”

2. Example: “!YourStatsCommand druid”
Output: “ranger | 129 total games | Win rate: 63.3%”

3. Example: “!YourStatsCommand”
Output: “Rank 80 | 1772 total games | W/L ratio: 1.3”

Here is a list of all abbreviations. I included the most common english and german abbreviations.

elementalist = ‘elementarmagier’, ‘sturmbote’, ‘elementalist’, ‘tempest’, ‘ele’, ‘temp’;
engineer = ‘ingenieur’, ‘schrotter’, ‘engineer’, ‘scrapper’, ‘engi’;
guardian = ‘wächter’, ‘drachenjäger’, ‘guardian’, ‘dragonhunter’, ‘guard’, ‘dh’;
mesmer = ‘chronomant’, ‘mesmer’, ‘chronomancer’, ‘mes’, ‘chrono’, ‘boonbot’, ‘mez’;
necromancer = ‘nekromant’, ‘schnitter’, ‘necromancer’, ‘reaper’, ‘necro’, ‘nec’, ‘nekro’, ‘nek’;
ranger = ‘waldläufer’, ‘waldi’, ‘ranger’, ‘druid’, ‘drood’, ‘drool’, ‘druide’;
revenant = ‘widergänger’, ‘revenant’, ‘herald’, ‘rev’, ‘revvy’;
thief = ‘dieb’, ‘draufgänger’, ‘schurke’, ‘thief’, ‘daredevil’, ‘dd’, ‘teef’, ‘rogue’;
warrior = ‘krieger’, ‘warrior’, ‘berserker’, ‘warr’, ‘war’, ‘zerk’, ‘zerker’;

For a more detailed Bot I suggest running Phantombot with my phantombot gw2 plugin found here:

1 Like

UPDATE

I updated this CustomAPI to support the new Guild Wars 2 ranking system after season 5.

  • Added characters or chars
    (Returns a list of all your owned character names separated by commas.)

All commands are tested and working as intended (June 15, 2017)

1 Like