Fryyyyy / Fryatog

GoLang based IRC bot for looking up MTG Rules/Oracle
4 stars 3 forks source link

Uppercase commands dont work #171

Closed Villawhatever closed 3 years ago

Villawhatever commented 3 years ago

This works fine:

<Volo> !ruling 1 tree of perdition
<Fryatest> Volo: 2016-07-13: If Tree of Perdition isn’t on the battlefield when the ability resolves, the exchange can’t happen and the ability will have no effect. Notably, activating the ability and giving Tree of Perdition -13/-13 in response won’t cause your opponent to lose the game.

But this does not:

<Volo> !Ruling 1 tree of perdition
<Fryatest> Volo: 2016-07-13: If Tree of Perdition isn’t on the battlefield when the ability resolves, the exchange can’t happen and the ability will have no effect. Notably, activating the ability and giving Tree of Perdition -13/-13 in response won’t cause your opponent to lose the game.
<Fryatest> Volo: 2016-07-13: When the ability resolves, Tree of Perdition’s toughness becomes the targeted opponent’s former life total and that player gains or loses an amount of life necessary so that their life total equals Tree of Perdition’s former toughness. Other effects that interact with life gain or life loss will interact with this effect accordingly.
<Fryatest> Volo: 2016-07-13: Any toughness-modifying effects, counters, Auras, or Equipment will apply after its toughness is set to the player’s former life total. For example, say Tree of Perdition is equipped with Cultist’s Staff (which makes it 2/15) and the player’s life total is 7. After the exchange, Tree of Perdition would be a 2/9 creature (its toughness became 7, which was then [...]
<Fryatest> modified by Cultist’s Staff) and the player’s life total would be 15.

And this was processed as a ruling query:

<Volo> !Flavour tree of perdition
<Fryatest> Volo: 2016-07-13: If Tree of Perdition isn’t on the battlefield when the ability resolves, the exchange can’t happen and the ability will have no effect. Notably, activating the ability and giving Tree of Perdition -13/-13 in response won’t cause your opponent to lose the game.
<Fryatest> Volo: 2016-07-13: When the ability resolves, Tree of Perdition’s toughness becomes the targeted opponent’s former life total and that player gains or loses an amount of life necessary so that their life total equals Tree of Perdition’s former toughness. Other effects that interact with life gain or life loss will interact with this effect accordingly.
<Fryatest> Volo: 2016-07-13: Any toughness-modifying effects, counters, Auras, or Equipment will apply after its toughness is set to the player’s former life total. For example, say Tree of Perdition is equipped with Cultist’s Staff (which makes it 2/15) and the player’s life total is 7. After the exchange, Tree of Perdition would be a 2/9 creature (its toughness became 7, which was then [...]
<Fryatest> modified by Cultist’s Staff) and the player’s life total would be 15.

Far as I can tell, we can just change https://github.com/Fryyyyy/Fryatog/blob/44f3eb812d88dfbda9c7d444a9709922775136b8/main.go#L328 to message := strings.ToLower(params.message). The only thing that seems to be incorrect with that is !wc [username] gives the name in lowercase, which is so far into WhoCaresVille.

Villawhatever commented 3 years ago

Even with strings.ToLower, !Ruling is still processing incorrectly:

Uppercase still failing:

DBUG[06-03|07:30:26] Dispatching message                      From=Volo To=#frybottest Content="!Ruling 1 abbot of keral keep"
DBUG[06-03|07:30:26] Processing:                              Command="!Ruling 1 abbot of keral keep"
DBUG[06-03|07:30:26] Dispatching                              index=0
DBUG[06-03|07:30:26] Receiving                                index=0
DBUG[06-03|07:30:26] In handleCommand                         Message="ruling 1 abbot of keral keep"
DBUG[06-03|07:30:26] Done tokenising                          Tokens="[ruling 1 abbot of keral keep]"
DBUG[06-03|07:30:26] Metadata query
DBUG[06-03|07:30:26] In a Ruling Query - Valid command detected Command=ruling Card Name="abbot of keral keep" Ruling No.=0

Lowercase is fine:

DBUG[06-03|07:30:37] Incoming                                 id=9605d78269bfb434 host=irc.libera.chat:6667 nick=Fryatest raw=":Volo!~Volo@c-73-59-128-136.hsd1.la.comcast.net PRIVMSG #frybottest :!ruling 1 abbot of keral keep" msg.To=#frybottest msg.From=Volo msg.Params="[#frybottest !ruling 1 abbot of keral keep]" msg.Trailing="!ruling 1 abbot of keral keep"
DBUG[06-03|07:30:37] Dispatching message                      From=Volo To=#frybottest Content="!ruling 1 abbot of keral keep"
DBUG[06-03|07:30:37] Processing:                              Command="!ruling 1 abbot of keral keep"
DBUG[06-03|07:30:37] Dispatching                              index=0
DBUG[06-03|07:30:37] Receiving                                index=0
DBUG[06-03|07:30:37] In handleCommand                         Message="ruling 1 abbot of keral keep"
DBUG[06-03|07:30:37] Done tokenising                          Tokens="[ruling 1 abbot of keral keep]"
DBUG[06-03|07:30:37] Metadata query
DBUG[06-03|07:30:37] In a Ruling Query - Valid command detected Command=ruling Card Name="abbot of keral keep" Ruling No.=1

For some reason it's failing to parse the ruling number.

Fryyyyy commented 3 years ago

Technically this shouldn't work - these are commands and commands are more often than not case sensititive. But its a relatively easy fix so why not