/Unturned-News

A service that can be configured to forward webhooks to Discord whenever Unturned is updated or a blogpost is released.

Primary LanguageTypeScriptMIT LicenseMIT

Unturned News Service

Unturned News Service is a small service that simply tracks the SDG blog, and in the future it will track the Steam news page, and posts a webhook to Discord everytime a new blog or news item is posted.

I would suggest reading this post to learn how to create webhooks for Discord: https://github.com/SomeCatIDK/Unturned-News

Example Image

Requirements:

  • Latest version of Node.JS installed.
  • Latest version of git installed.
  • Latest version of npm installed.
  • A MySQL v5.x server.

Installation:

  1. To begin clone this repository with the following command:
git clone https://github.com/SomeCatIDK/Unturned-News
  1. Navigate to the folder it cloned:
cd Unturned-News
  1. Install dependencies using npm:
npm i
  1. Open src/config.ts with whatever text editor you prefer and enter in the MySQL connenction info and webhook info.

The default file should like like this:

export default {
    MySQL: {
        address: "localhost",
        database: "unturned-news",
        password: "toor",
        port: 3306,
        table_prefix: "u_",
        user: "root"
    },
    Webhook: {
        blogpost_webhooks: [],
        checktime: 30
    }
};

To add a webhook to use for the blogposts, add a string into the blogpost_webhooks array using the " marks in the following style: "<WEBHOOK_ID>/<WEBHOOK_TOKEN>"

Note that your webhook ID and webhook token are the last two routing paths of the url, so that the following url: https://discordapp.com/api/webhooks/1234567890/abcdefghijklmnopqrstuvwxyz1234567890 would look like this: 1234567890/abcdefghijklmnopqrstuvwxyz1234567890 in the config.

Here's an example after adding a fake webhooks:

export default {
    MySQL: {
        address: "localhost",
        database: "unturned-news",
        password: "toor",
        port: 3306,
        table_prefix: "u_",
        user: "root"
    },
    Webhook: {
        blogpost_webhooks: [
            "1234567890/abcdefghijklmnopqrstuvwxyz1234567890"
        ],
        checktime: 30
    }
};
  1. Build the bot:
npm run build
  1. Start the bot:
npm start
  1. That's it! Hope everything goes well, and stay unturned! :D