Skip to content

WebHooks

Daniel Norris edited this page Nov 7, 2022 · 5 revisions

First you must ensure that the enable-web-hooks setting in config.yml is set to true.

Then you need to create a webhooks directory in the same folder as the config (i.e. config/ReforgedGTS/webhooks/)

In this directory you will add the JSON files for each different type of WebHook.

There are three different types of event that have a related webhook:

  • publisher - For when trades are created
  • purchaser - For when trades are purchased
  • remover - For when trades are removed

For each of these you'll need two files. One for the items and one for the Pokemon.

Which means if you had all enabled your file system would look like this:

config/
   ReforgedGTS/
       webhooks/
           publisher-pokemon.json
           publisher-item.json
           purchaser-pokemon.json
           purchaser-item.json
           remover-pokemon.json
           remover-item.json
       config.yml
       locale.yml
       guis.yml

Each JSON file contains the embed information.

Here is an example for the publisher-pokemon.json file:

publisher-pokemon.json EXAMPLE
{
   "url": "WEBHOOK-URL-HERE",
   "username":"Reforged GTS",
   "avatar_url": "https://play.pokemonshowdown.com/sprites/ani/%species_lower%.gif",
   "tts": false,
   "icon_url":"https://play.pokemonshowdown.com/sprites/ani/%species_lower%.gif",
   "embeds":[
      {
         "title":"NEW LISTING",
         "description": "By %seller%",
         "url": "https://google.com",
         "color":65280,
         "footer":{
            "icon_url":"",
            "text":"Reforged GTS"
         },
         "thumbnail":{
            "url":"https://play.pokemonshowdown.com/sprites/ani/%species_lower%.gif"
         },
         "author":{
            "name":"Reforged GTS - New Listing",
            "url":"https://discordapp.com",
            "icon_url":"https://pixelmonmod.com/w/images/logo/Fullcolor-50x50.png"
         },
         "fields":[
            {
               "name":"Listing Information -",
               "value":"Seller: **%seller%** \\nPrice: **$%price%** \\nExpiration: %expires_in%",
               "inline":false
            },
            {
               "name":"Info:",
               "value":"Pokemon: %species%\\nGender: %gender%\\nLevel: %level%\\nAbility: %ability%\\nUntradeable: %untradeable%\\nUnbreedable: %unbreedable%",
               "inline":true
            },
            {
               "name":"Stats:",
               "value":"Level: %level%\\nForm: %form%\\nShiny: %shiny%\\nNature: %nature%\\nFriendship: %friendship%",
               "inline":true
            },
            {
               "name":"----",
               "value":"----",
               "inline":false
            },
            {
               "name":"IVs:",
               "value":"%iv_hp%/%iv_attack%/%iv_defence%/%iv_spattack%/%iv_spdefence%/%iv_speed% (%iv_percentage%%)    ",
               "inline":true
            },
            {
               "name":"EVs:",
               "value":"%ev_hp%/%ev_attack%/%ev_defence%/%ev_spattack%/%ev_spdefence%/%ev_speed%",
               "inline":true
            }
         ]
      }
   ]
}

Placeholders for Pokemon Trades:

  • %seller% - The name of the seller
  • %expires_in% - The time until it expires
  • %price% - The price
  • %species% - The species name
  • %species_lower% - The lowercase species name
  • %friendship% - The friendship percentage level
  • %level%- Pokemon level
  • %gender% - The gender
  • %unbreedable% - If the pokemon is unbreedable
  • %nature% - The nature
  • %ability% - The ability name
  • %untradeable% - If the pokemon is untradeable
  • %iv_percentage% - The total IV percentage
  • %iv_hp% - HP IV of the pokemon
  • %iv_attack% - Attack IV of the pokemon
  • %iv_defence% - Defence IV of the pokemon
  • %iv_spattack% - Special Attack IV of the pokemon
  • %iv_spdefence% - Special Defence IV of the pokemon
  • %iv_speed% - Speed IV of the pokemon
  • %ev_hp% - HP EV of the pokemon
  • %ev_attack% - Attack EV of the pokemon
  • %ev_defence% - Defence EV of the pokemon
  • %ev_spattack% - Special Attack EV of the pokemon
  • %ev_spdefence% - Special Defence EV of the pokemon
  • %ev_speed% - Speed EV of the pokemon
  • %move_1% - The move in slot 1
  • %move_2% - The move in slot 2
  • %move_3% - The move in slot 3
  • %move_4% - The move in slot 4
  • %mew_cloned% - The times mew has been cloned
  • %trio_gemmed% - The times the trio has been gemmed
  • %shiny% - if the pokemon is shiny
  • %form% - Form of the pokemon
  • %size% - Size of the pokemon
  • %custom_texture% - Custom texture of the pokemon

Placeholders for Item Trades:

  • %seller% - The name of the seller
  • %expires_in% - The time until the trade expires
  • %price% - Price of the trade
  • %item% - Name of the item
  • %amount% - The amount of the item
Clone this wiki locally