Upgrade Scripts Docs

#Discord Webhooks

Every points movement and every redemption can post to Discord. Each event type has its own webhook URL, so admin actions can go to a staff-only channel while purchases go to an economy log.

#Setup

Config.Webhooks = {
    Enabled = false,
    Username = 'Upgrade Rewards',
    AvatarURL = '',

    DefaultURL = '',

    Events = {
        PlaytimePoints = { enabled = true, url = '' },
        ReferralPoints = { enabled = true, url = '' },
        LootPoints     = { enabled = true, url = '' },
        LootClaim      = { enabled = true, url = '' },
        Redeem         = { enabled = true, url = '' },
        Refunds        = { enabled = true, url = '' },
        AdminPoints    = { enabled = true, url = '' },
        AdminXP        = { enabled = true, url = '' },
        ExportPoints   = { enabled = true, url = '' },
        ExportXP       = { enabled = true, url = '' },
        LevelUp        = { enabled = true, url = '' },
    },
}

Set Enabled = true, then for each section either give it a url of its own or leave the url empty to fall back to DefaultURL. A section is skipped entirely if it is disabled, or if both its own URL and DefaultURL are empty.

Username and AvatarURL control how the bot appears in Discord. Leave AvatarURL empty to use the webhook's own avatar.

#The events

  • PlaytimePoints - the playtime timer paid out. Includes the level bonus that was applied and the XP granted.
  • ReferralPoints - a referral code was redeemed. Posts once for each side, naming who redeemed whose code. With referral maturity enabled, the referrer's post arrives when the reward matures.
  • LootPoints - reward points rolled out of a loot case.
  • LootClaim - the item, cash or vehicle a player received from a loot case.
  • Redeem - a shop purchase: items, cash, vehicles, loot cases and jail release.
  • Refunds - points returned after a loot claim failed or expired.
  • AdminPoints - points added or removed from the admin panel. Names the admin and their identifier.
  • AdminXP - XP granted or a level set from the admin panel. Also names the admin.
  • ExportPoints - points added or removed by another resource through the exports, naming the calling resource.
  • ExportXP - XP granted by another resource through the AddXP export.
  • LevelUp - a player reached a new level, including any level rewards they were granted.

#What a post contains

Each embed names the player and their server id, their identifier, the signed amount, the resulting balance, and a plain-English description of where it came from - the playtime timer, which admin, which referral code, which loot case, or which resource.

#If nothing arrives

Turn on Config.Debug and the resource prints the HTTP status of any webhook that does not return a success code. The usual causes are a URL that was copied incompletely, or a webhook that has since been deleted in Discord.

The config check on start also warns if Enabled is true while no URL is set anywhere.

Treat webhook URLs as secrets. Anyone who has one can post to that channel, so do not paste your config.lua into a support ticket or a public channel without removing them first.