Giter Site home page Giter Site logo

cswendrowski / humblebundlebot Goto Github PK

View Code? Open in Web Editor NEW
52.0 7.0 20.0 359 KB

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

C# 82.03% HTML 14.74% CSS 3.24%
discord c-sharp humble-bundle functions-as-a-service azure-functions webhook

humblebundlebot's Introduction

HumbleBundleBot

Build status

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 and highly scalable.

How to generate a webhook

https://support.discordapp.com/hc/en-us/articles/228383668-Intro-to-Webhooks

Get started fast with our registration site

https://humblebundlenotificationssite.azurewebsites.net

Changelog

7/15/2020 - You can now register for subtypes of BOOKS, such as RPG and COMIC

3/13/2019 - Thanks to BallBrian, we now have a nice blazor powered registration site! Check it out here: https://humblebundlenotificationssite.azurewebsites.net

1/8/2019 - In response to popular demand, you can now optionally register a Humble Bundle Partner referral that will be attached to all messages for your webhook only. This means that if you're a streamer who runs your own Discord and want your audience to be able to throw some of their purchase money at you, you can signup with Humble Bundle and register your partner name here to make it happen!

Not a Partner and want to support me for developing this service? Use cswendrowski for the Partner value when signing up, as the example will show. Thank you!

11/8/2018 - You can now opt-in to Developer Messages - we will only send these out in case of major outages to indicate when the Bot is down for maintenance and when it is back up. This message type is currently only valid for Discord webhooks.

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
}

API Docs

How To Register a Webhook with a Partner link

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>,
    "partner": "<YOUR PARTNER NAME OF CHOICE>"
}

The following Bundle types are valid:

Type Type Code
Games 0
Books 1
Mobile 2
Software 3
Mixed (Mixed Content Bundles) 4
Developer Messages (Valid for Discord only) 5
All Bundles 6

Books is a fairly large bundle type, so the following subtypes are additionally available if you don't want the entire type (register like other Bundle types):

Type Type Code
RPG 7
Comics 8
Book Other (Not RPG / Comics) 9

The following Webhook types are valid:

Type Type Code
Discord 0
RawJson 1

Example of subscribing to the Games Bundle with a Discord webhook with a Partner link of me (Thanks if you do this!):

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

Webhook URLs are encrypted before they are stored.

A Partner link will add a header to the page indicating who referred the user to the bundle:

It will also add a slider bar to the "Choose where your money goes section" where users can adjust how much the Partner receives (even down to nothing!)

How to find your Partner name

Are you signed up as a Partner and confused about what value to use when registering?

You can find your Partner name at on the Partner Dashboard, under the "Active partner" section:

How To Register a Webhook without a Partner link

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>
}

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 Test a Registered Webhook

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

This endpoint will lookup your registered webhook and, if it exists, send a recent Bundle of that type to your webhook. You can also specify which bundle you want if you just registered and want a current bundle.

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

{
    "type": <Valid Bundle Type Code>,
    "webhook": "<YOUR DISCORD WEBHOOK URL>",
    "webhookType": <Valid Webhook Type Code>,
    "bundleName": "<OPTIONAL: If included, will look for a particular bundle to send. Case insensitive>"
}

Example of testing a registered webhook for the Games Bundle with a Discord webhook:

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

Specific bundle:

{
    "type": 0,
    "webhook": "https://discordapp.com/api/webhooks/abcd123...",
    "webhookType": 0,
    "bundleName": "Super Cool Bundle"
}

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
}

humblebundlebot's People

Contributors

ballbrian avatar cswendrowski avatar toon324 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

humblebundlebot's Issues

[BUG] Register Webhook fails

Good evening,

Describe the bug
I've tried to register a webhook for my Discord Server throug the Web-GUI. This fails with the message "error".
I've looked in the firefox developer tools and the answer from the server is an error 400 with the body "Please pass in a valid Discord Webhook URL in the request body".

My Webhook URL is "https://discord.com/api/webhooks/78[...]46/_bBS[...]8tEKy4" (Shortend due to privacy reasons)
Notice the URL "discord.com". All examples in the readme i've found is "discordapp.com". Maybe thats the reason the bot dont recognize the webhook as a valid Webhook?

I am having issues with the following Bundles:
N/A

I have the following types of Webhooks registered

    1. WebhookType: 0
    1. Discord: Games
    1. JSON: Developer Messages

Expected behavior
Add the Webhook URL to the bot :)

Screenshots
N/A

Additional context
Some info about the domain change: discord/discord-api-docs#1585

[BUG] Missing bundles

The last 3 Humble Bundles have not been posted on my discord, seems the bot is not working?

[BUG]

Describe the bug
Appears that game bundles are no longer posting again.

I am having issues with the following Bundles:
Codemasters racing game bundle hasn't auto posted to my discord channel, despite a couple of other bu memes posting successfully earlier in the month (Quebec gaming bundle and Winter Indie Mix

I have the following types of Webhooks registered

    1. Discord: Games

Expected behavior
Would expect that the bundle would have auto posted via the bot, but similar to bundles in the last couple of months, it seems to occasionally fail to do so.

Additional context
No rush on a fix - I appreciate it's the holiday season - just wanted to let you know before I disappear for Christmas and potentially forget about it!

[FEATURE] CurrentBundles Endpoint

Is your feature request related to a problem? Please describe.
Users would like a way to view current bundles

Describe the solution you'd like
New Function GetCurrentBundles that returns all current bundles

Describe alternatives you've considered
Users could just view the HB website, but this isn't consumable in programs

Additional context
Bundles currently don't have the concept of "Current", we presently just store all Bundles and check the scraped ones against the DB to see if any are new / updated.
A new "IsCurrent" bool will need to be added that defaults to true and swaps to false when the bundle is no longer coming in on the scrape

[CRITICAL ISSUE] http://blog.humblebundle.com/rss no longer exists causing bot to fail

http://blog.humblebundle.com/rss (which used to be posted from http://blog.humblebundle.com) no longer seems to exist (nor does the core blog). This RSS feed was powering the bot's discovery of bundles. It is unknown if the blog is going to come back up, but for now we should assume it won't.

The bot does not currently function due to this missing feed, and the old method of URL discovery broke with the last major HumbleBundle.com rewrite. We currently do not have a workaround for this issue but will be researching options.

Nothing being posted

Hi there,

Ive had this bot linked for a couple of days now and it doesn’t seem to post anything into my discord and I can’t seem to find any way to test the webhook unless I’m missing something. Is this still in active development?

[BUG] Bundles not posting

Describe the bug
It appears that the bot isn't posting updates once, similar to the previously reported issue back in October. Last games bundle that was successfully posted was on 17/11/20.

I am having issues with the following Bundles:

  • Explore and Expand bundle hasn't posted.

I have the following types of Webhooks registered

    1. Discord: Games

Expected behavior
I would expect that the December games bundle would be posted to our deals channel as per the previous months but it doesn't appear to have.

Additional context
Appears that it may be the same problem as was experienced a couple of months ago.

[BUG]

Describe the bug
No game message pushes since October 20th
I am having issues with the following Bundles:

  • Fall VR Games bundle didn't push through to my server.

I have the following types of Webhooks registered

    1. Discord: Games

Expected behavior
A post for the November VR Games bundle

Screenshots
If applicable, add screenshots to help explain your problem.
This was what the most recent post looked like. No changes have been made to the webhook, nor permissions to the channel or server.
image

image

Additional context
Just wanting to confirm that the bot should still be pushing updates for the 'game' category, and that it doesn't need to be re-added each month or similar?

Webhook test successful but nothing posts to Discord through webhook

Describe the bug
500 Internal Server Error when testing Discord webhook with http post request

I have the following types of Webhooks registered
Discord webhook with game subtype

Expected behavior
A test post

Additional context
Response for reference:

{
"id": "3183150c-91f1-45e7-84ff-085cf3c02ba4",
"requestId": "8104c28f-b9db-4479-a14b-300c7b1f118a",
"statusCode": 500,
"errorCode": 0,
"message": "An error has occurred. For more information, please check the logs for error ID 3183150c-91f1-45e7-84ff-085cf3c02ba4"
}

EDIT: I fixed this by using Insomnia instead for the POST. Webhook still not sending anything in Discord though even after successful POST.

[FEATURE] Add way to test a webhook

Is your feature request related to a problem? Please describe.
Users would like a way to immediately verify that their webhook is working (both Discord and JSON). Currently they have to wait for a scrape.

Describe the solution you'd like
A new Function, TestWebhook(string webhook, int webhookType, string currentBundleName) should be created. This would load the current bundle of given name (see #9 for info on adding "Current"), then sends to a given webhook with the correct format

Describe alternatives you've considered
Rather than passing in a currentBundleName, we could just send the most recent bundle we've scraped

Additional context
Do we need to consider anti-spam functionality? We currently assume that a webhook is owned by the User. If someone got access to a Webhook they could spam it through our service, but they could do that themselves as well.

[FEATURE] As a User, I want to be able to register for all bundles at once

Is your feature request related to a problem? Please describe.
Users often get confused about the "Mixed" bundle type and misinterpret it as an "All" category.

Describe the solution you'd like
Explicitly adding a category would both clarify that "Mixed" is different and save Users some setup time

Describe alternatives you've considered
Could make this a UI-only feature, but API parity is preferred

Possibilty to add a hook outside of discord

Hello Cody,

I would love to use your app , but i don't want to apply for a discord hook.
Instead i would love to have a hook on my own webapp to use the data.

Do you plan on implement this sometime?

Thanks

[FEATURE] Omit bundle updates

Is your feature request related to a problem? Please describe.
I don't think it's possible to set update status to False with the bot service?

Describe the solution you'd like
The bot currently sends when update each time a bundle is update. It'd be nice to have the option to stop this.

Describe alternatives you've considered
I don't run the hosted system thus cannot :)

Additional context
Nope. Thanks!

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.