Finish up markov with implementation of !markov status

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-07-17 20:51:01 -07:00
parent 04a4c740bd
commit e375f1604a
3 changed files with 21 additions and 1 deletions

View File

@@ -37,7 +37,10 @@ defmodule Omnibot.Contrib.Markov do
end
command "!markov", ["status"] do
Irc.send_to(irc, channel, "TODO")
total = chain_server(channel, :all) |> ChainServer.chain_sum()
value = chain_server(channel, nick) |> ChainServer.chain_sum()
ratio = (value * 100) / total
Irc.send_to(irc, channel, "#{nick}: You are worth #{ratio |> Float.round(4)}% of the channel")
end
def save_dir() do