Tutorial: Invoice Verification Discord Bot

Today I’m going to walk you through how to configure a Linux server to run your Unity Publisher Invoice Verification Discord Bot! This tutorial assumes you already have a Virtual Private Server up and running with Ubuntu 18.04 or later installed.

Step 1: Installing .NET 3.1 SDK

We will begin by installing the Microsoft .NET 3.1 SDK from their repositories, but first, we need to tell the package manager where those repositories are. Let’s do that now. *For newer versions of Ubuntu, make sure you are running a supported distribution by checking the list of supported distributions for .NET 3.1.

wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb

Next we will ensure everything is up to date, refresh the package information from the repositories, and install the .NET 3.1 SDK.

sudo apt-get update; \
  sudo apt-get install -y apt-transport-https && \
  sudo apt-get update && \
  sudo apt-get install -y dotnet-sdk-3.1

Step 1.1: Additional Utilities

Additionally, we will want to install the Screen utility so the bot can run in the background, and ensure the unzip utility is installed so that we can extract the bot from its’ archive.

sudo apt-get install -y screen unzip

Step 2: Extracting and configuring the bot.

Upload the bot to your server using the method of your choice, navigate to the folder in which it is located, and type the following:

unzip ShadowedBot.zip -d ShadowedBot && cd ShadowedBot/

After that, we will need to configure the bot! You will need the following information:

  • An Application Token from Discord
  • Your Unity Publisher API Key

Step 2.1: Discord Application Token

  1. Go to the Applications page on the Discord Developer portal.
  2. Press the New Application button.
  3. On the New Application page, enter your bot’s application name in the name field.
  4. Press the Create button.
  5. On the General Information page, under the Settings pane, select Bot.
  6. On the Bot page, add a username and display icon for your bot.
  7. Under Bot Permissions, select Manage Roles underneath General Settings, and Send Messages underneath Text Permissions.
  8. Underneath Username, you will find Token. Click Copy to copy your bot’s token – this is the application token necessary for the bot configuration. Do not lose this!

Step 2.2: Unity Publisher API Key

  1. Go to the Invoices page of the Unity Publisher Portal.
  2. Copy your API key. This is the apiKey necessary for the bot configuration. Do not lose this either!

Step 2.3: Adjusting the config.json file

Open the config.json file in your favorite text editor (Ours is JOE!) and change your configuration file to include your token, API key, server name, asset name(s), and role(s) to be assigned upon verification. Here’s a sample:

{
  "token": "DISCORDAPPLICATIONTOKENFORVERIFICATIONBOT",          // Your bot application token from Discord.
  "prefix": "!",        // The prefix to use for this bot (default: !verify) 
  "apiKey": "UNITYPUBLISHERAPIKEYFORINVOICEVERIFICATION",         // Your Unity Publisher API key!
  "serverName": "Shadowed Souls Studios",     // The name of your Discord server (example: Official Unity Discord)
  "assetRoles": {       // A dictionary containing the full name of your asset and the Discord role to assign.	
    "UMA Add-On for RPG Builder":"UMA Verified",
    "TOP_SECRET":"COMING_SOON"
  }
}

Step 3: Run the bot!

We will use the Linux Screen utility to help keep the bot running in the background. This will require you to send keyboard commands through your terminal if remotely connected, and will be denoted with an asterisk (*) when necessary.

Type the following commands into your terminal!

screen -S shadowedbot
dotnet ShadowedBot.dll
*CTRL+A+D (this releases the window into the background!)

And that’s it! If you followed these steps, you should be up and running! To verify an invoice, simply message the bot with the following command:

!verify ############

Replacing ############ with an invoice number.

That’s all for now! Thanks for reading!

Update: Store, Discord Bot

Hi there! Long time no chat – we’ve been hard at work filling custom orders for our clients and have had little time to even remember a blog exists! Fret no longer, however – we come with an update or two sure to be worthy of the absence.

Shadowed Store

We have opened our own storefront! Here you will be able to purchase various things that may be Unity related, but not necessarily fit for the Asset Store (like the Discord bot below, for example!), as well as all of our assets, and even some from our partners!

Unity Publisher Invoice Verification Bot for Discord

This week, we released a Discord bot for Unity Asset Store publishers that automagically verifies invoices for Asset Store purchases. The bot features the capability to assign each asset its’ own role – don’t wait, buy it today! Unity Publisher Invoice Verification Bot can be found here. Cost: $25 USD.

This is just the beginning, folks. Stay tuned for more updates and even more cool things headed your way in the next year!