Giter VIP home page Giter VIP logo

fryatog's Introduction

Fryatog Build

fryatog's People

Contributors

dependabot[bot] avatar fryyyyy avatar lunakv avatar villawhatever avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fryatog's Issues

Reuse objects

Since now the bot backfills Card objects with metadata, we want to make sure that we give back the "canonical" object with stuff in it.
e.g If we fuzzily retrieve a card, check the cache for card.Name (or ncn(card.Name)? ) and return that one rather than the new one.

Highlighting [$RULE] Example: in !ex requests

// TODO:
// '[603.10a.] Example: Two' with highlighting of rule name and example

Highlighted text should be from '[603.10a.] Example:' to match the formatting we've all come to know and love.

Consider limiting the number of sets we show

Disenchant {1}{W} · Instant · Destroy target artifact or enchantment. ·
IMA-C,PRM-C,CN2-C,TPR-C,PRM-C,ME3-C,ME2-C,P07-R,TSB-R,CST-C,F03-R,7ED-C,BRB-C,MMQ-C,6ED-C,ATH-C,USG-C,WC98-C,WC98-C,TMP-C,WC97-C,WC97-C,WC97-C,5ED-C,MIR-C,PARL-R,PTC-C,PTC-C,PTC-C,PTC-C,PTC-C,PTC-C,ICE-C,FBB-C,4ED-C,SUM-C,3ED-C,CEI-C,CED-C,2ED-C,LEB-C,LEA-C,A25-C · Vin,Leg,Mod

Maybe this should [...] after a while

Caching or consuming the wrong thing ?

t=2019-04-20T09:39:21+1000 lvl=dbug msg=Processing: Command="!ruling the wretched 3"
t=2019-04-20T09:39:21+1000 lvl=dbug msg=Dispatching index=0
t=2019-04-20T09:39:21+1000 lvl=dbug msg=Receiving index=0
t=2019-04-20T09:39:21+1000 lvl=dbug msg="In handleCommand" Message="ruling the wretched 3"
t=2019-04-20T09:39:21+1000 lvl=dbug msg="Done tokenising" Tokens="[ruling the wretched 3]"
t=2019-04-20T09:39:21+1000 lvl=dbug msg="Metadata query"
t=2019-04-20T09:39:21+1000 lvl=dbug msg="In a Ruling Query - Valid command detected" Command=ruling Card Name="the wretched" Ruling No.=3
t=2019-04-20T09:39:21+1000 lvl=dbug msg="In ReduceCard -- Tokens were" Tokens="[the wretched]" Length=2
t=2019-04-20T09:39:21+1000 lvl=dbug msg="Reverse descent" i=2 msg="the wretched"
t=2019-04-20T09:39:21+1000 lvl=dbug msg="Reverse descent" i=1 msg=the
t=2019-04-20T09:39:21+1000 lvl=dbug msg="Checking Scryfall for card" Name=thewretched
t=2019-04-20T09:39:21+1000 lvl=dbug msg="Checking cache for card" Name=thewretched
t=2019-04-20T09:39:21+1000 lvl=dbug msg="Card was cached"

==> /var/log/supervisor/fryatog-stderr---supervisor-87zKRe.log <==
panic: interface conversion: interface {} is *main.Card, not main.Card

goroutine 1201 [running]:
main.checkCacheForCard(0xc420552680, 0xb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/mnt/e/Temp/Code/src/fryatog/card.go:483 +0x6d2
main.getScryfallCard(0xc4205524e0, 0xc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/mnt/e/Temp/Code/src/fryatog/card.go:509 +0x1a5
main.findCard(0xc420252480, 0x2, 0x2, 0x859d28, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/mnt/e/Temp/Code/src/fryatog/main.go:615 +0x128
main.handleCardMetadataQuery(0xc4203976a1, 0x6, 0xc4203976a1, 0x15, 0x859d28, 0xc420010420, 0xc4200103a0)
	/mnt/e/Temp/Code/src/fryatog/main.go:467 +0x655
main.handleCommand(0xc4203976a1, 0x15, 0xc420bc6300, 0x859d28, 0x859d20)
	/mnt/e/Temp/Code/src/fryatog/main.go:405 +0x753
created by main.tokeniseAndDispatchInput
	/mnt/e/Temp/Code/src/fryatog/main.go:371 +0x82c

Don't lookup too short or empty names

So what is the right talking to my opponent ( first thank you very much !) To avoid judge calling


t=2019-02-26T13:31:51+1100 lvl=dbug msg="in lookupUniqueNamePrefix" Input=") To" NCN=to Length of CN=18911


t=2019-02-26T13:31:52+1100 lvl=dbug msg="Checking Scryfall for card" Name=
t=2019-02-26T13:31:52+1100 lvl=dbug msg="Checking cache for card" Name=
t=2019-02-26T13:31:52+1100 lvl=dbug msg="Not in cache"
t=2019-02-26T13:31:52+1100 lvl=dbug msg="fetchScryfallCard: Attempting to fetch" URL="https://api.scryfall.com/cards/named?fuzzy="
t=2019-02-26T13:31:52+1100 lvl=dbug msg="Getting Metadata"
t=2019-02-26T13:31:52+1100 lvl=info msg="fetchScryfallCard: Scryfall returned a non-200" Status Code=400
t=2019-02-26T13:31:52+1100 lvl=dbug msg="in lookupUniqueNamePrefix" Input= NCN= Length of CN=18911
t=2019-02-26T13:31:52+1100 lvl=dbug msg="In lookupUniqueNamePrefix" Gottem="To Arms!"

finds every card

Detain

10:47 <Fry_> !define detain
10:47 <Fryatog> Detain: A keyword action that temporarily stops a permanent from attacking, blocking, or having its activated abilities activated. See rule 701.28, "Detain."
10:47 <Fryatog> 701.28. Detain

User menu if there are multiple possible cards found

<Volo> !ruin
t=2019-01-26T17:08:03-0600 lvl=dbug msg="In lookupUniqueNamePrefix" C="[Ruin Ghost Ruin Processor Ruin Raider Ruin Rat Ruin in Their Wake Ruination Ruination Guide Ruination Wurm Ruinous Gremlin Ruinous Minotaur Ruinous Path Ruins of Oran-Rief Ruins of Trokair]"

Currently a request like this just fizzles, because there's Too Much Stuff and none of them match the legendary-ish fuzziness.

Suggestion: add per-user menus if multiple things come back and we can't make a reasonable guess. Ex:

<Volo> teysa
-Datatog- 4 cards beginning with "teysa" found: (1) Teysa Karlov (2) Teysa, Envoy of Ghosts (3) Teysa, Orzhov Scion (4) Teysa, Orzhov Scion Avatar

Something weird with duplicate responses

05:34 <+Fryatog> Staunch: Duplicate response withheld. (Braid of Fire {1}{R} · Enchantment · Cumulative upkeep—Add {R}. (At the beginning of your upkeep, put an age counter on this permanent, then sacrifice it unless you pay its upkeep cost for each age counter on it.) · CSP-R · Vin,Leg,Mod ...)
05:34 <+Fryatog> Staunch: Caged Sun {6} · Artifact · As Caged Sun enters the battlefield, choose a color. \ Creatures you control of the chosen color get +1/+1. \ Whenever a land's ability causes you to add one or more mana of the chosen color, add one additional mana of that color. · CM2-R · Vin,Leg,Mod

Cards close together

Maybe check the exact first word to see if it's a match? I wonder how many cards have multiple word names where the first word is also a card?

10:34 < Garruk1> if !kinya of the old ways is in play enchanted with !lignify or imprisoned in the moon or song of the dryads and you cast !fractured identity .. your opponents will all get a normal nikya right?
10:34 <+Fryatog> Garruk1: Fractured Identity {3}{W}{U} · Sorcery · Exile target nonland permanent. Each player other than its controller creates a token that's a copy of it. · PZ2-R,C17-R · Vin,Leg
10:34 <+Fryatog> Garruk1: Imprisoned in the Moon {2}{U} · Enchantment — Aura · Enchant creature, land, or planeswalker \ Enchanted permanent is a colorless land with "{T}: Add {C}" and loses all other card types and abilities. · PEMN-R,EMN-R · Vin,Leg,Mod
10:34 <+Fryatog> Garruk1: Nikya of the Old Ways {3}{R}{G} · Legendary Creature — Centaur Druid · 5/5 · You can't cast noncreature spells. \ Whenever you tap a land for mana, add one mana of any type that land produced. · PRNA-R,RNA-R · Vin,Leg,Mod,Std

Apparently too generous with detecting !cardname

<Volo> Animate dead ETBing is a trigger. The *entire* trigger resolves like this: "Bring back Karmic guide. Fail to attach to Karmic Guide." State-based actions check and go "that's an aura not attached to anything!" and sends Animate Dead to the graveyard
<Fryatog> Volo: Animate Dead {1}{B}

Keep the cache

Can we save out the cache to disk when killed, and read it in on startup to preserve the data we've already gone and gotten

Mana costs

<+Fryatog> Repudiate {G/UG/U}

Do we want to actually not munge mana costs and put it back to {G/U}{G/U}

Have multiple caches

Currently we have a single duplicate response cache, since we're only in one channel.
Once we join another one, it's possible that someone in chan 1 requests a card, and someone in chan 2 soon after would get 'Duplicate response withheld'

Paginate excessively long responses

Something very large like !205.3m (the list of creature types) spits the whole thing into the channel, which is... a lot. Maybe trim to two full outputs and then offer !next to get the next page?

Printings

After we've brought up a card for the first time, launch a goroutine to fetch the rest of the printings using prints_search_uri and fill in the Card object for the next time it's requested

Cards starting with 'rule' aren't rules

23:31 < mjj29> !rule of law
23:31 < Fryatog> mjj29: Nonbasic Land: Any land that doesn't have the supertype "basic." See rule 205.4, "Supertypes."
23:31 < Fryatog> mjj29: 205.4. Supertypes
23:31 < mjj29> *sigh*
23:31 < mjj29> !card rule of law
23:31 < Fryatog> mjj29: Duplicate response withheld. (Nonbasic Land: Any la ...)
23:31 < mjj29> really fryatog
23:31 < mjj29> Yeti13: the oracle text of Rule of Law is "Each player can’t cast more than one spell each turn." (https://scryfall.com/card/10e/37/rule-of-law)

Flip card creatures not showing P/T

<Volo> !bushi tenderfoot
<Fryatog> Bushi Tenderfoot {W} | Creature — Human Soldier | When a creature dealt damage by Bushi Tenderfoot this turn dies, flip Bushi Tenderfoot. · CHK-U · Vin,Leg,Mod

WHO Race Condition

END OF WHO can be handled before the last actual WHO messages due to goroutines.
Should do a LIST first and match the number of nicks to the number of WHOs.

recover()

Panics are probably going to happen, should try and recover gracefully

Too much punctuation

what?!? Why does

DBUG[01-20|13:23:30] in lookupUniqueNamePrefix                Input="? Why do" NCN=whydo Length of CN=18911
DBUG[01-20|13:23:31] Attempting to fetch                      URL="https://api.scryfall.com/cards/named?fuzzy=%3F+Why"
DBUG[01-20|13:23:31] Card Func gave us                        CardID=8987644d-5a31-4a4e-9a8a-3d6260ed0fd6 Card="{Object:card ID:8987644d-5a31-4a4e-9a8a-3d6260ed0fd6 OracleID:adfe1b07-dd82-4c39-a7a6-ded0b1c39761 MultiverseIds:[74358] MtgoID:0 MtgoFoilID:0 TcgplayerID:37950 Name:Who // What // When // Where // Why

Rulings order

Check that our order is the same as Gatherer, so the index numbers align

!cards are a little generous?

<Phasing12> Hello! I was wondering if Selvala, Explorer Returned flip triggers work. If I use Selvala and two nonlands are revealed, is that two triggers of life & mana gain or are they summe into <Fryatog> Phasing12: Mana Tithe {W} · Instant · Counter target spell unless its controller pays {1}. · PLC-C · Vin,Leg,Mod

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.