Module: Bitbot::TipStats

Included in:
Plugin
Defined in:
lib/bitbot/plugin/tipstats.rb

Instance Method Summary collapse

Instance Method Details

#on_tipstats(m) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/bitbot/plugin/tipstats.rb', line 4

def on_tipstats(m)
  stats = db.get_tipping_stats

  str = "Stats: ".irc(:grey) +
    "tips today: " +
    satoshi_with_usd(0 - stats[:total_tipped]) + " " +
    "(#{stats[:total_tips]} tips) "

  if stats[:tippers].length > 0
    str += "biggest tipper: ".irc(:black) +
      stats[:tippers][0][0].irc(:bold) +
      " (#{satoshi_with_usd(0 - stats[:tippers][0][1])}) "
  end

  if stats[:tippees].length > 0
    str += "biggest recipient: ".irc(:black) +
      stats[:tippees][0][0].irc(:bold) +
      " (#{satoshi_with_usd(stats[:tippees][0][1])}) "
  end

  m.reply str
end