Coder Social home page Coder Social logo

lonestarbeer / humblebundlebot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cswendrowski/humblebundlebot

0.0 1.0 0.0 89 KB

Scrapes HumbleBundle.com for new Bundles and posts new bundles to different Discord channels whenever a new Bundle shows up.

C# 100.00%

humblebundlebot's Introduction

HumbleBundleBot

Scrapes HumbleBundle.com for new Bundles and posts new bundles to different webhooks whenever a new Bundle shows up. Each Bundle can be sent to a different webhook, allowing easy organization of messages - in Discord, each channel can have webhooks associated with them for integrations like this.

Scraping is done once and results are sent to all relevant webhooks using Serverless Functions and Azure Queue, making the system extremely cheap to run (currently free) and highly scalable.

Changelog

5/23/2018 - We now support the ability to register any webhook instead of just Discord webhooks. If you register a Discord webhook the experience is still the same and you will receive Discord formatted messages. If you have already registered a webhook before this date, your webhook registration has been defaulted to Discord.

If you register a webhook of type RawJson (1), you will receive a BundleQueue payload that looks similiar to the following:

{
  "Bundle": {
    "Name": "Humble Indie Bundle 19",
    "URL": "https://www.humblebundle.com/games/humble-indie-bundle-19",
    "Description": "SUPERHOT, JYDGE, SOMA, and more โ€“ cross-platform, DRM-free, and on Steam!",
    "ImageUrl": "https://humblebundle.imgix.net/misc/files/hashed/632a3bceaaede04cf3d0dee88cfaa7f473cc3fb8.png?auto=compress&h=630&w=1200&s=98e4c242fff7139eceb2bee5740b605b",
    "Type": 0,
    "Sections": [
      {
        "Title": "Pay what you want!",
        "Items": [
          {
            "Name": "Halcyon 6: Lightspeed Edition"
          }
        ]
      },
      {
        "Title": "Beat the Average!",
        "Items": [
          {
            "Name": "Keep Talking and Nobody Explodes"
          }
        ]
      },
      {
        "Title": "Pay $14 or more to also unlock!",
        "Items": [
          {
            "Name": "SUPERHOT"
          },
          {
            "Name": "$2 Humble Wallet credit for Monthly subscribers"
          }
        ]
      }
    ],
    "Items": [
      {
        "Name": "Halcyon 6: Lightspeed Edition"
      }
      {
        "Name": "Keep Talking and Nobody Explodes"
      },
      {
        "Name": "SUPERHOT"
      },
      {
        "Name": "$2 Humble Wallet credit for Monthly subscribers"
      }
    ]
  },
  "IsUpdate": false
}

How To Register a Webhook

All requests to the endpoints require a header of Content-Type: application/json

Make a HTTP POST request to https://humblebundlenotifications.azurewebsites.net/api/RegisterWebhook with a Body of the following format:

{
    "type": <Valid Bundle Type Code>,
    "webhook": "<YOUR DISCORD WEBHOOK URL>",
    "sendUpdates": <true|false>,
    "webhookType": <Valid Webhook Type Code>
}

The following Bundle types are valid:

Type Type Code
Games 0
Books 1
Mobile 2
Software 3
Mixed 4

The following Webhook types are valid:

Type Type Code
Discord 0
RawJson 1

Example of subscribing to the Games Bundle with a Discord webhook:

{
    "type": 0,
    "webhook": "https://discordapp.com/api/webhooks/abcd123...",
    "sendUpdates": true,
    "webhookType": 0
}

Webhook URLs are encrypted before they are stored.

How to remove a registered Webhook

All requests to the endpoints require a header of Content-Type: application/json

Make a HTTP DELETE request to https://humblebundlenotifications.azurewebsites.net/api/DeleteWebhook with a Body of the following format:

{
    "type": <Valid Bundle Type Code>,
    "webhook": "<YOUR SUBSCRIBED WEBHOOK URL>",
    "webhookType": 0
}

Roadmap

  • Discord Embed Formatting
  • Discord Webhook for message creation
  • Azure Table Storage for persistent storage
  • Swap from IronWebScraping to ScrapySharp as scraping library
  • General Games scraping
  • Books Scraping
  • Mobile Scraping
  • API for registering new webhooks to different bundles rather than current static implementation
  • Ability to "unsubscribe" by deleting Webhook registration from system
  • Rework entire system as Serverless App
  • Polish Embed Formatting
  • Software Scraping
  • Add data-at-rest encryption to Webhook URL's
  • Ability to send out messages about updates to bundles
  • Extralife "Special" scraping
  • Raw JSON registering
  • Micro-site to make Webhook registration / deregistration easier

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.