summaryrefslogtreecommitdiffstats
path: root/wat/game.go
diff options
context:
space:
mode:
authoralex2019-07-10 16:29:44 +0100
committeralex2019-07-10 16:29:44 +0100
commit304fcff75c561115d2816f8bb9c1074b70a204ee (patch)
treef8c055ec2d236f48fd5f6512e70bf17b476ce3a8 /wat/game.go
parente1eddb1b1125acf12afaa2ea7630d12f6bc4bc0d (diff)
downloadwatbot-304fcff75c561115d2816f8bb9c1074b70a204ee.tar.gz
watbot-304fcff75c561115d2816f8bb9c1074b70a204ee.tar.bz2
watbot-304fcff75c561115d2816f8bb9c1074b70a204ee.zip
fixes #5
Diffstat (limited to 'wat/game.go')
-rw-r--r--wat/game.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/wat/game.go b/wat/game.go
index 452534f..6f19dc3 100644
--- a/wat/game.go
+++ b/wat/game.go
@@ -60,6 +60,7 @@ func NewWatGame(bot *WatBot, db *WatDb) *WatGame {
"healthiest",
"losers",
"richest",
+ "bankruptest",
}
return &g
}
@@ -86,6 +87,8 @@ func (g *WatGame) Msg(m *irc.Message, player *Player, fields []string) {
reply = fmt.Sprintf("%s losers: %s", currency, g.TopLost())
case "richest":
reply = fmt.Sprintf("%s holders: %s", currency, g.TopTen())
+ case "bankruptest":
+ reply = fmt.Sprintf("most indebited: %s", g.Bankrupest())
case "source":
reply = "https://git.circuitco.de/self/watbot"
}
@@ -588,6 +591,15 @@ func (g *WatGame) TopLost() string {
return ret
}
+func (g *WatGame) Bankrupest() string {
+ players := g.db.Bankruptest()
+ ret := ""
+ for _, p := range players {
+ ret += fmt.Sprintf("%s (%d) ", CleanNick(p.Nick), p.Bankrupcy)
+ }
+ return ret
+}
+
func (g *WatGame) TopTen() string {
players := g.db.TopTen()
ret := ""