Coder Social home page Coder Social logo

yourroyallinus / hs-card-display-bot Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 890 KB

A Discord bot to display Hearthstone card images and metadata

License: MIT License

Python 100.00%
bot discord hearthstone card-data discordpy hs card-display

hs-card-display-bot's Introduction

Hearthstone Card Display Bothearthstone emblem

A Discord bot to display Hearthstone card images and metadata

Underlying API

Link to the documentation for the underlying Hearthstone API.

If you wish to run this bot locally, you will need to register with RapidAPI to receive an X-RapidAPI-Key.

How to Use

Inside a discord message within a channel that contains the hs-card-display-bot, enclose the name, partial name, or dbfId of a Hearthstone card in either [] or {} brackets.

  • [CARD_NAME] will return an image of the card
  • {CARD_NAME} will return the metadata of the card in a discord embed

You can have a message that contains multiple brackets of different types

  • E.G - "[Mr. Smite] in pirate warrior is too strong! I can't win with my {RENO JACKSON} control deck!

Card names are NOT case-sensitive

  • {Arbor Up}, {aRbOr Up}, {arbor up}, {ARBOR UP} all fetch and return the same card.

The term card is used loosely, as both bosses from Adventures as well as heroes from Battlegrounds are considered cards in the API.

Ambiguous Request

If a request returns more than one possible card, the bot will return a list of card names and dbfIds. You can then enter the dbfId within brackets to fetch the correct card.

  • A request of [YSERA] will return 13 card names in the form name: dbfId separated by newlines. Five of these cards will be named Ysera, the remaining 8 will contain the name Ysera.
    • If the card you were trying to fetch was the original 9 mana 4/12 Ysera, you would then enter a new message with [1186] or {1186}.

Workaround

Given an ambiguously named card, such as five cards with the exact name Ysera, to get the dbfId corresponding to the card you're looking for, you can go to https://playhearthstone.com/en-us/cards and search for your card there. When brought to the page for the card, you can extract the dbfId from the url: .../cards/1186-ysera?...

Limitations

  • Partial name searches return multiple results and the names do not clearly indicate the actual card it corresponds to. Multiple card objects can share attributes and only the dbfId is considered unique in the underlying API. So, the only way to fetch an ambiguously or non-uniquely named card is to use the dbfId.
    • With this, there is likely a more user-friendly way to handle multiple cards, and that is one of the notable future improvements.
  • There is currently no support for user customization of the bot, but future commands will be added to allow users to configure the bot.
    • For example, an immediate use case would be to allow users to set whether they wish to filter non-collectible cards, such as Boss cards or Battleground Hero cards.
  • The Hearthstone API used by this bot has support for Cardback objects, and the hearthstone package also has support for Cardbacks, but there is no code implemented for the bot to handle Cardback requests.
  • Nested brackets are considered invalid, and the bot will not process them.
    • E.G - [I LOVE [CARD_NAME]]

Future Improvements

  • Implement bot commands for bot configuration and usage assistance
  • Implement code to fetch Cardback objects
  • Improve handling of ambiguous name requests
  • Create a standalone library from the hearthstone package

hs-card-display-bot's People

Contributors

yourroyallinus avatar

Watchers

 avatar  avatar

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.