1. A note to new members who are making their first purchase

    Once you have made your first purchase you will be unable to instantly download. Due to the recent influx of fraudulent purchases we now need to verify your account before we can grant access to download.
    To verify your account/purchase please email admin@chaoscode.io from the email address your PayPal account is registered to and state your ChaosCode username and the name of the plugin you have purchased.
    Once this is done access to your download your purchase will be granted.

    Please be aware that the verification process may take up to 24 hours!

    We apologise for any inconvenience this may cause
    Dismiss Notice

DiscordRewards 0.1.4

Reward players with items, kits and commands for being a member of your Discord

  1. DiscordRewards

    k1lly0u
    Reward players with items, kits and commands for being a member of your Discord

    - Send users validation tokens via a bot in your Discord that they must enter in game to gain access to the reward store
    - Set re-validation times so users must regularly validate via your discord to continue receiving rewards
    - Give players groups and permissions when validated, and remove them when the re-validation period has expired
    - Give players roles in your Discord when validated, and remove them when the re-validation period has expired
    - Run commands when a user has been validated
    - Give rewards via a UI reward selector, or disable it and only give groups/permissions or run commands
    - Add as many or as little items, kits and commands to the reward selector as you want
    - Set cool down times for each reward or use a global cool down that affects all rewards, which allows users to either select 1 reward at a time, or have access to multiple rewards

    discord1.png discord2.png discord3.png

    This plugin requires the Discord extension available on uMod -> https://umod.org/extensions/discord

    Using the plugin
    Users can access rewards by typing /discord in chat.

    If they have not yet validated they will be prompted to provide their Discord details by typing "/discord <discord username> <discord ID>"
    ex. "/discord k1lly0u 6215"
    exa.png

    Once they have provided their details your bot will DM them a validation token (a unique 4 digit number)
    valida.png

    Users then must enter that in game by typing "/discord <token>"
    ex. "/discord 9706"

    Once they have done that they will have access to the rewards selector

    Creating a Bot account
    In order to validate users in your Discord you must create a bot account. This is quite a simple task;
    1) Make sure you are logged in on the Discord website -> https://discordapp.com/
    2) Navigate to the Applications page -> https://discordapp.com/developers/applications/
    3) Click "Create an application"
    myapps.png
    4) Name your application and save the changes
    5) You should now see something like the picture below. Note the "CLIENT ID", this is the "Bot Client ID" field in your config
    app2.png
    6) Click the "Bot" button on the left hand side, then click "Add Bot". This will create a bot for your application
    7) Name your bot, toggle "Public Bot" to the off position, and give the bot the "Send Messages" permission and the "Manage Roles" permission if you are planning on giving Discord roles as rewards.
    Click to reveal the bots "Token". This is the "Bot Token" field in your config.
    bot.png
    8) Save your changes and exit. Your bot is now ready to join your Discord.


    Inviting your bot to your Discord
    Now you have created your bot you need to invite it to your Discord server.

    Code (Text):
    https://discordapp.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&scope=bot&permissions=2048
    Copy the link above and replace "YOUR_CLIENT_ID" with the client ID we saw in step 5. Paste this link in your browser and you will be prompted to select a server for the bot from the list of servers you own.

    Select the server you want the bot to join and hit Authorize.
    auth.png

    Thats it, your bot is now on your server. Make sure you have pasted the required details in to your DiscordRewards config so the plugin can communicate with your Discord server!


    Adding/Removing/Editing Rewards
    The reward setup is very similar to ServerRewards if you are familiar with it. Using the console commands provided below you can add/remove/edit your rewards.

    Item icons are used retrieved automatically via ImageLibrary, and Kit/Command icons can be set if you specify a URL. You can also replace item icons with custom images the same way.
    Alternatively you can host these images on your Rust server in your "oxide/data/DiscordRewards/Images" folder. If you are using that method then only specify the filename in the icon field for that item

    You can add or remove multiple commands in your command rewards after you have created the initial command by typing discord.rewards edit command edit <add/remove> "command"

    Commands have 5 parameters you can insert in to them that will be replaced by the users information
    $player.id - The users Steam ID
    $player.name - The users display name
    $player.x, $player.y, $player.z - The users position

    By placing any of those in your command they will be replaced with the respective information of the player using the command

    All rewards require a cooldown even if you are using the global cooldown option


    Alternative Rewards
    Alternative rewards can include the user being added to specified user groups, giving them roles on your Discord, granting the user permissions, or running commands when the user has validated

    Permissions, Groups and Discord Roles only last as long as the user has a valid token (see Revalidation Interval below). Once the validation time has expired users are automatically removed from the groups and the permissions are revoked until they perform the validation process again

    To add Discord roles simply put the name of the role exactly as typed in Discord in the "Discord roles to grant on successful validation" section of your config

    Commands are run 1 time when the user has completed validation. Like the commands available via the reward selector there are 5 parameters you can insert in to them that will be replaced by the users information

    $player.id - The users Steam ID
    $player.name - The users display name
    $player.x, $player.y, $player.z - The users position


    Chat Commands
    /discord - Opens the reward selector
    /discord <discord username> <discord id> - Request a validation token
    /discord <token> - Validate your user to access the reward selector


    Console Commands
    discord.admin purge - Clear all users with expired tokens from the data file
    discord.admin wipe - Revoke rewards from all players and invalidate their tokens
    discord.admin revoke <player ID> - Revoke all rewards from the target player and invalidate their token

    Reward Add/Edit/Delete Commands
    discord.rewards - Shows help menu

    --- List Rewards ---
    discord.rewards list <items | kits | commands> - Display a list of rewards for the specified category, which information on each item

    --- Add Rewards ---
    discord.rewards add item <shortname> <skinId> <amount> <cooldown> <opt:bp> - Add a new reward item to the store (add "bp" to add the item as a blueprint)
    discord.rewards add kit <name> <kitname> <cooldown> - Add a new reward kit to the store
    discord.rewards add command <name> <command> <cooldown> - Add a new reward command to the store

    --- Editing Rewards ---
    discord.rewards edit item <ID> <name | amount | cooldown> "edit value" - Edit the specified field of the item with ID number <ID>
    discord.rewards edit kit <ID> <name | description | icon | cooldown> "edit value" - Edit the specified field of the kit with ID number <ID>
    discord.rewards edit command <ID> <name | amount | description | icon | add | remove | cooldown> "edit value" - Edit the specified field of the kit with ID number <ID>
    Icon field : The icon field can either be a URL, or a image saved to disk under the folder "oxide/data/DiscordRewards/Images/"
    Command add/remove field: Here you add additional commands or remove existing commands. Be sure to type the command inside quotation marks

    --- Removing Rewards ---
    discord.rewards remove item <ID #> - Removes the item with the specified ID number
    discord.rewards remove kit <ID #> - Removes the kit with the specified ID number
    discord.rewards remove command <ID #> - Removes the command with the specified ID number

    --- Important Note ---
    Removing rewards may change each rewards ID number. Be sure to list your rewards before removing them


    Config Options
    Token Lifetime (seconds) - This is the amount of time from when the Discord bot has sent a user their validation token until it expires

    Revalidation Interval (seconds) - This is the amount of time from when a user has entered their validation token ingame until they will need to re-validate

    Bot Token & Bot Client ID - Described above in the steps to set up your Discord bot

    Use Global Cooldown - This will create a global cooldown on all items, so a user can only claim 1 reward at a time. If this is false then users can claim all rewards and will be limited by their individual cooldowns

    Global Cooldown Time (seconds) - The cooldown time for a global cooldown

    Enable Reward Menu - Enables the UI reward selector. Set this to false if you only want to grant permissions/groups

    Require Re-validation - Enable the re-validation process, forcing users to go through the validation process at the interval you specify

    Add user to user groups - A list of user groups to add the player to upon validation.
    Example usage: "Add user to user groups": [ "group1", "group2" ],

    Permissions to grant on successful validation
    - A list of permissions to grant the user upon validation
    Example usage: "Permissions to grant on successful validation": [ "rustnet.use", "grenadelauncher.spawn"],

    Commands to run on successful validation - A list of commands to run when a player is validated
    Example usage: "Commands to run on successful validation": [ "spawncar $player.x $player.y $player.z"],

    Discord roles to grant on successful validation -
    A list of Discord roles to grant when a player is validated
    Example usage: "Discord roles to grant on successful validation": [ "Test Role"],



    Config
    Code (C#):

    {
      "Settings": {
        "Bot Token": "",
        "Bot Client ID": "",
        "Enable DiscordExt Debug Mode": false
      },
      "Alternative Rewards": {
        "Add user to user groups": [],
        "Commands to run on successful validation": [],
        "Permissions to grant on successful validation": [],
        "Discord roles to grant on successful validation": []
      },
      "Validation Tokens": {
        "Token Lifetime (seconds)": 3600,
        "Require Re-validation": true,
        "Revalidation Interval (seconds)": 84600
      },
      "Global Cooldown": {
        "Use Global Cooldown": true,
        "Global Cooldown Time (seconds)": 84600
      },
      "UI Options": {
        "Enable Reward Menu": true,
        "UI Coloring": {
          "Button_Selected": {
            "Hex": "#d85540",
            "Alpha": 1.0
          },
          "Button_Deselected": {
            "Hex": "#393939",
            "Alpha": 1.0
          },
          "BG_Main": {
            "Hex": "#2b2b2b",
            "Alpha": 1.0
          }
        }
      },
      "Version": {
        "Major": 0,
        "Minor": 1,
        "Patch": 2
      }
    }
     

Recent Updates

  1. 0.1.4
  2. 0.1.3
  3. 0.1.2

Recent Reviews

  1. xXBLITZxKRIEGXx
    xXBLITZxKRIEGXx
    5/5,
    Version: 0.1.1
    I've been waiting for a plugin like this for a while now. So glad you finally made it. Working great! Thank You!
  2. michiel marcelis
    michiel marcelis
    5/5,
    Version: 0.1.1
    Thank you alot for releasing this.