Giter Club home page Giter Club logo

judgebot's Introduction

MTG Discord Bot

image

Discord Bot for Magic / Judge related content

Add the bot to your server

Supported commands

You can list the judgebot commands by typing / in discord and clicking on the Judgebot icon.

Development Setup

Clone the Git repository and run the following commands:

npm install
export DISCORD_TOKEN="<your Discord bot token>"
export GOOGLE_TOKEN="<your Google (Maps) API key>"
export CR_ADDRESS="https://media.wizards.com/2020/downloads/MagicCompRules%2020200417.txt"
export IPG_ADDRESS="https://raw.githubusercontent.com/hgarus/mtgdocs/master/docs/ipg.json"
export MTR_ADDRESS="https://sites.google.com/site/mtgfamiliar/rules/MagicTournamentRules-light.html"
npm run build
node updateInteractions.js
node server.js

Badges

Code Climate

Acknowledgements

  • Card images are all copyright Wizards of the Coast.
  • Card database is provided by Scryfall.org.
  • This bot is not affiliated with Wizards of the Coast in any way.
  • The server is kindly provided by SKnetworX

judgebot's People

Contributors

bra1n avatar dantolini avatar dependabot[bot] avatar exmem avatar hanmac avatar hcschild avatar hgarus avatar lunakv avatar multimeric avatar noxxflame avatar villawhatever 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

judgebot's Issues

Prevent the bot from finding incorrect results

The command "!card Nix" finds a random Phoenix instead of the card Nix.

Ideas to solve this:

  • If the bot finds multiple results, interpose a text comparison before the result is posted and if one card matches the query exactly, post that one.
  • Prioritize results that start with the search query if no card matches it exactly.
  • Prioritize results that contain the search query as a solitary word instead of a part of a word (Nix in Phoenix).

[Feature Request] Variable Prefix for Commands

Would it be at all possible to create a feature in which you could change the prefix of the commands from ! to another symbol?

I run a small community that uses a fair number of bots and I would like to be able to tweak the prefixes of them so that they don't overlap.

documents

!docs (or documents)
will display the important docs ipg, mtr AND also like PPTQ requierments or GPT requierments for even a storeowner so any judge can easy find it.
(i just had to search it so this idea came to me :P )

Judges

!Judge location
Shows you judge in a certain location and if the judge is in the chat highlights him?

!judge level
If you search for a certain level.

Make !cr results more useful when querying for a "Headline Paragraph"

Some Paragraphs in the CR are basically just headlines (ie 702.15 Lifelink) currently the bot just responds 702.15 Lifelink to a query for 702.15.

A result like:

702.15 Lifelink
702.15a Lifelink is a static ability.
Further subsections are 702.15b - 702.15f

would be much more useful.

Help

!help
shows what the bot can do. all the possible commands and stuff :D

!price scrubland -is:online throws an error

Sep 28 08:32:09 judgebot app/bot.1: [ERROR] [card] - RangeError: RichEmbed field values may not be empty. 
Sep 28 08:32:09 judgebot app/bot.1:     at RichEmbed.addField (/app/node_modules/discord.js/src/structures/RichEmbed.js:158:34) 
Sep 28 08:32:09 judgebot app/bot.1:     at resolve (/app/modules/card.js:248:23) 
Sep 28 08:32:09 judgebot app/bot.1:     at Promise (<anonymous>) 
Sep 28 08:32:09 judgebot app/bot.1:     at MtgCardLoader.generateEmbed (/app/modules/card.js:202:16) 
Sep 28 08:32:09 judgebot app/bot.1:     at Promise.all.then (/app/modules/card.js:327:22) 
Sep 28 08:32:09 judgebot app/bot.1:     at <anonymous> 
Sep 28 08:32:09 judgebot app/bot.1:     at process._tickCallback (internal/process/next_tick.js:188:7) 

!cr 510.1c doesn't work

2017-04-12T09:53:27.205351+00:00 app[bot.1]: [2017-04-12 09:53:27.192] [ERROR] bot - An error occured while handling !cr 510.1c :
2017-04-12T09:53:27.205355+00:00 app[bot.1]:  { Error: Bad Request
2017-04-12T09:53:27.205356+00:00 app[bot.1]:     at Request.callback (/app/node_modules/superagent/lib/node/index.js:626:17)
2017-04-12T09:53:27.205357+00:00 app[bot.1]:     at /app/node_modules/superagent/lib/node/index.js:795:18
2017-04-12T09:53:27.205357+00:00 app[bot.1]:     at IncomingMessage.<anonymous> (/app/node_modules/superagent/lib/node/parsers/json.js:16:7)
2017-04-12T09:53:27.205358+00:00 app[bot.1]:     at emitNone (events.js:91:20)
2017-04-12T09:53:27.205359+00:00 app[bot.1]:     at IncomingMessage.emit (events.js:185:7)
2017-04-12T09:53:27.205359+00:00 app[bot.1]:     at endReadableNT (_stream_readable.js:974:12)
2017-04-12T09:53:27.205360+00:00 app[bot.1]:     at _combinedTickCallback (internal/process/next_tick.js:74:11)
2017-04-12T09:53:27.205361+00:00 app[bot.1]:     at process._tickCallback (internal/process/next_tick.js:98:9)
2017-04-12T09:53:27.205361+00:00 app[bot.1]:   original: null,
2017-04-12T09:53:27.205362+00:00 app[bot.1]:   response:
2017-04-12T09:53:27.205363+00:00 app[bot.1]:    Response {
2017-04-12T09:53:27.205363+00:00 app[bot.1]:      domain: null,
2017-04-12T09:53:27.205364+00:00 app[bot.1]:      _events: {},
2017-04-12T09:53:27.205364+00:00 app[bot.1]:      _eventsCount: 0,
2017-04-12T09:53:27.205365+00:00 app[bot.1]:      _maxListeners: undefined,
2017-04-12T09:53:27.205366+00:00 app[bot.1]:      res:
2017-04-12T09:53:27.205366+00:00 app[bot.1]:       IncomingMessage {
2017-04-12T09:53:27.205367+00:00 app[bot.1]:         _readableState: [Object],
2017-04-12T09:53:27.205367+00:00 app[bot.1]:         readable: false,
2017-04-12T09:53:27.205368+00:00 app[bot.1]:         domain: null,
2017-04-12T09:53:27.205368+00:00 app[bot.1]:         _events: [Object],
2017-04-12T09:53:27.205369+00:00 app[bot.1]:         _eventsCount: 4,
2017-04-12T09:53:27.205369+00:00 app[bot.1]:         _maxListeners: undefined,
2017-04-12T09:53:27.205370+00:00 app[bot.1]:         socket: [Object],
2017-04-12T09:53:27.205370+00:00 app[bot.1]:         connection: [Object],
2017-04-12T09:53:27.205371+00:00 app[bot.1]:         httpVersionMajor: 1,
2017-04-12T09:53:27.205371+00:00 app[bot.1]:         httpVersionMinor: 1,
2017-04-12T09:53:27.205372+00:00 app[bot.1]:         httpVersion: '1.1',
2017-04-12T09:53:27.205372+00:00 app[bot.1]:         complete: true,
2017-04-12T09:53:27.205373+00:00 app[bot.1]:         headers: [Object],
2017-04-12T09:53:27.205373+00:00 app[bot.1]:         rawHeaders: [Object],
2017-04-12T09:53:27.205374+00:00 app[bot.1]:         trailers: {},
2017-04-12T09:53:27.205374+00:00 app[bot.1]:         rawTrailers: [],
2017-04-12T09:53:27.205375+00:00 app[bot.1]:         upgrade: false,
2017-04-12T09:53:27.205376+00:00 app[bot.1]:         url: '',
2017-04-12T09:53:27.205376+00:00 app[bot.1]:         method: null,
2017-04-12T09:53:27.205377+00:00 app[bot.1]:         statusCode: 400,
2017-04-12T09:53:27.205377+00:00 app[bot.1]:         statusMessage: 'BAD REQUEST',
2017-04-12T09:53:27.205378+00:00 app[bot.1]:         client: [Object],
2017-04-12T09:53:27.205379+00:00 app[bot.1]:         _consuming: true,
2017-04-12T09:53:27.205379+00:00 app[bot.1]:         _dumped: false,
2017-04-12T09:53:27.205380+00:00 app[bot.1]:         req: [Object],
2017-04-12T09:53:27.205381+00:00 app[bot.1]:         text: '{"content": ["Must be 2000 or fewer characters long."]}',

Vorschlag: Examples aus den Rules rausfiltern und separat anbieten (z.B. mit !example 510.1c)

!card function is imprecise

When querying judgebot using !card we frequently get an undesired result - near as I can figure it seems to be indexing all possible matches for the search term and then returning the first match in the index, even if there's a more exacting comparison.

For example, !card fling (or !card Fling) returns Akki Boneflinger, rather than Fling. If I was making a deliberate imprecise search, I'd expect to be including wildcards - the implicit wildcard search makes it impossible to get simple-worded cards from the bot.

Bug with !hangman

We use judgebot on our Discord server, and hangman always gives us

Error
You can only start one hangman game every 3 minutes.

It has worked before, but seems broken now

Events

!event Location city land
event wherever

!event location 20km
Events around the location

!event location date
events around the date and location

!event type
what type of event. FNM. Game Day. GP.

Full image of card

Hi, it will be great to show only full card and if possible in langage of our choice.

Allow switching results (ie. for !card) with Discord reactions

Discord support "reactions" to messages and the idea here would be to allow changing the displayed result for a card query to the next / previous one when somebody reacts with a ➡️ or ⬅️ emoji (or similar) to a card result message. The idea would be that the bot reacts itself to its own message with ◀️ and ▶️ and people can simply click on them (to add a reaction) and have the bot edit the message then.
It's probably pretty tricky to implement, but would make an awesome feature. 😁

Decklists

Decklists form netstats or tappedout or i dont know where...

maybe with linked cards to magiccardsinfo.

Welcome Message

title says it all? ^^

can be rules, announcements, whatever is going on..

Cache responses for !ipg, !mtr, !card

The bot shouldn't make requests for resources it has recently accessed, in order to speed up the query. In theory, the whole MTR and IPG could be served from cache.

  • IPG
  • MTR
  • Card

!card fails on too long results

If !card produces a result which is longer than discord's character limit of 2000, the command fails.

An example would be !card ice.

translation for DescriptionText

Hello here. Maybe We can imagine to use printed_text instead of oracle_test in function generateDescriptionText. I'm using this bot mainly with lang:french and the displayed text is the english text.
Could we fix that ? @bra1n

Append a card image as a message attachment

...instead of putting the URL to the image into the message.
This way, the message itself will be cleaner (no Gatherer image URL anymore!), plus the content is clearly separated and maybe can be filtered in Discord.

Banlist

!banlist format
would show the banned card in the format chosen.

!cr should support pulls of subrules

While the bot is great, a large number of rules in mtg are split into several smaller subrules

Either allowing an option to simply return all subrules of the requested rule, or allowing multiple arguments to !cr would be useful when explaining a full rule to someone, instead of the rule being returned with breaks as you request each subrule in a seperate !cr

Image doesn't show in !hangman

Hi.
The cardimage currently doesn't show up after completing a game of hangman. The issue seems to be that scryfall have changed their api.

Changing card.image_uri on row 78 in hangman.js to one of the following should fix it as far as I can tell:

card.image_uris.small
card.image_uris.normal
card.image_uris.large
card.image_uris.png

some cards also seems to have
card.image_uris.art_crop
and
card.image_uris.bordercrop
but not all of them.

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.