summaryrefslogtreecommitdiff
path: root/lib/nola_plugins/alcolog_plugin.ex
diff options
context:
space:
mode:
authorJordan Bracco <href@random.sh>2022-12-20 02:13:47 +0000
committerJordan Bracco <href@random.sh>2022-12-20 19:29:41 +0100
commit70b9bba56f5319361ce5a7df5c489b9c0d6905ce (patch)
treef9b4438965f4c5e3e1f3a6129904cbb9a37047f2 /lib/nola_plugins/alcolog_plugin.ex
parentUpdate repo URL, refs T77. (diff)
Rename to Nola
Summary: Nola rename cont. pt. 2. Refs T77. `find lib -name "*.ex" -type f | xargs sed -i '' 's/LSG/Nola/g'` Nola rename, cont. pt. 3. Refs T77. `s/:lsg/:nola/g` Nola rename, cont. pt. 4. Refs T77. Nola rename, cont. pt. 5. Refs T77. Configs. find config -type f | xargs sed -i '' 's/LSG/Nola/g' find config -type f | xargs sed -i '' 's/lsg/nola/g' BREAKING CHANGE: Config keys switch from `:lsg` to `:nola` Nola rename, the end. pt 6. Refs T77. Nola rename: The Big Move, Refs T77 Update repo URL, refs T77. Nola rename: Nola.Plugins, refs T77 Maniphest Tasks: T77 Differential Revision: https://phab.random.sh/D3
Diffstat (limited to '')
-rw-r--r--lib/nola_plugins/alcoolog.ex (renamed from lib/nola_plugins/alcolog_plugin.ex)24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/nola_plugins/alcolog_plugin.ex b/lib/nola_plugins/alcoolog.ex
index 145e4fc..7f44ca2 100644
--- a/lib/nola_plugins/alcolog_plugin.ex
+++ b/lib/nola_plugins/alcoolog.ex
@@ -1,4 +1,4 @@
-defmodule Nola.IRC.AlcoologPlugin do
+defmodule Nola.Plugins.Alcoolog do
require Logger
@moduledoc """
@@ -102,7 +102,7 @@ defmodule Nola.IRC.AlcoologPlugin do
@eau ["santo", "santeau"]
def handle_info({:irc, :trigger, santeau, m = %IRC.Message{trigger: %IRC.Trigger{args: _, type: :bang}}}, state) when santeau in @eau do
- Nola.IRC.TxtPlugin.reply_random(m, "alcoolog.santo")
+ Nola.Plugins.Txt.reply_random(m, "alcoolog.santo")
{:noreply, state}
end
@@ -330,9 +330,9 @@ defmodule Nola.IRC.AlcoologPlugin do
cond do
cl == nil -> m.replyfun.(cl_extra)
deg == nil -> m.replyfun.(comment)
- cl >= 500 || deg >= 100 -> Nola.IRC.TxtPlugin.reply_random(m, "alcoolog.drink_toohuge")
- cl == 0 || deg == 0 -> Nola.IRC.TxtPlugin.reply_random(m, "alcoolog.drink_zero")
- cl < 0 || deg < 0 -> Nola.IRC.TxtPlugin.reply_random(m, "alcoolog.drink_negative")
+ cl >= 500 || deg >= 100 -> Nola.Plugins.Txt.reply_random(m, "alcoolog.drink_toohuge")
+ cl == 0 || deg == 0 -> Nola.Plugins.Txt.reply_random(m, "alcoolog.drink_zero")
+ cl < 0 || deg < 0 -> Nola.Plugins.Txt.reply_random(m, "alcoolog.drink_negative")
true ->
points = Alcool.units(cl, deg)
now = m.at || DateTime.utc_now()
@@ -347,7 +347,7 @@ defmodule Nola.IRC.AlcoologPlugin do
:ok = :dets.insert(state.dets, {m.account.id, now, points, if(old_stats, do: old_stats.active, else: 0), cl, deg, name, comment, meta})
true = :ets.insert(state.ets, {{m.account.id, now}, points, if(old_stats, do: old_stats.active, else: 0),cl, deg, name, comment, meta})
#sante = @santai |> Enum.map(fn(s) -> String.trim(String.upcase(s)) end) |> Enum.shuffle() |> Enum.random()
- sante = Nola.IRC.TxtPlugin.random("alcoolog.santai")
+ sante = Nola.Plugins.Txt.random("alcoolog.santai")
k = if user_meta.sex, do: 0.7, else: 0.6
weight = user_meta.weight
peak = Float.round((10*points||0.0)/(k*weight), 4)
@@ -449,7 +449,7 @@ defmodule Nola.IRC.AlcoologPlugin do
end
if miss do
- miss = Nola.IRC.TxtPlugin.random("alcoolog.#{to_string(miss)}")
+ miss = Nola.Plugins.Txt.random("alcoolog.#{to_string(miss)}")
if miss do
for {net, chan} <- IRC.Membership.notify_channels(m.account) do
user = IRC.UserTrack.find_by_account(net, m.account)
@@ -532,7 +532,7 @@ defmodule Nola.IRC.AlcoologPlugin do
rising_file_key = if rising, do: "_rising", else: ""
txt_file = "alcoolog." <> "user_" <> to_string(user_state) <> rising_file_key
- user_status = Nola.IRC.TxtPlugin.random(txt_file)
+ user_status = Nola.Plugins.Txt.random(txt_file)
meta = get_user_meta(state, nick)
minutes_til_sober = h1/((meta.loss_factor/100)/60)
@@ -831,11 +831,11 @@ defmodule Nola.IRC.AlcoologPlugin do
put_user_meta(state, m.account.id, meta)
cond do
old_meta.weight < meta.weight ->
- Nola.IRC.TxtPlugin.reply_random(m, "alcoolog.fatter")
+ Nola.Plugins.Txt.reply_random(m, "alcoolog.fatter")
old_meta.weight == meta.weight ->
m.replyfun.("aucun changement!")
true ->
- Nola.IRC.TxtPlugin.reply_random(m, "alcoolog.thinner")
+ Nola.Plugins.Txt.reply_random(m, "alcoolog.thinner")
end
end
@@ -848,7 +848,7 @@ defmodule Nola.IRC.AlcoologPlugin do
:dets.delete_object(state.dets, obj)
:ets.delete(state.ets, {m.account.id, date})
m.replyfun.("supprimé: #{m.sender.nick} #{points} #{type} #{descr}")
- Nola.IRC.TxtPlugin.reply_random(m, "alcoolog.delete")
+ Nola.Plugins.Txt.reply_random(m, "alcoolog.delete")
notify = IRC.Membership.notify_channels(m.account) -- [{m.network,m.channel}]
for {net, chan} <- notify do
user = IRC.UserTrack.find_by_account(net, m.account)
@@ -995,7 +995,7 @@ defmodule Nola.IRC.AlcoologPlugin do
end
def handle_info(t, state) do
- Logger.debug("AlcoologPlugin: unhandled info #{inspect t}")
+ Logger.debug("#{__MODULE__}: unhandled info #{inspect t}")
{:noreply, state}
end