diff --git a/Admin.md b/Admin.md index a21c996..3ac2011 100644 --- a/Admin.md +++ b/Admin.md @@ -1,66 +1,66 @@ -# ircbot admin bot +# nola bot admin -Everything is supposed to be ran inside a remote IEx console: `./bin/lsg remote`. +Everything is supposed to be ran inside a remote IEx console: `./bin/nola remote`. ## Connection management ### List Connections IRC.Connection.connections() ### Add Connection conn = %{nick: "nick", user: "user", name: "user", network: "netname", host: "irc.netname.org", tls: true, port: 6697} IRC.Connection.add_connection(conn) ### Start Connection IRC.Connection.start_connection(connection_id) ### Stop Connection IRC.Connection.stop_connection(connection_id) ### Delete Connection IRC.Connection.delete_connection(connection_id) ## Plugin management ### Enabled plugins IRC.Plugin.enabled() ### Enable or Disable a plugin IRC.Plugin.disable(plugin_module_or_name) IRC.Plugin.enable(plugin_module_or_name) IRC.Plugin.switch(plugin_module_or_name) ### Declare a plugin IRC.Plugin.declare(module) ## Account/Users ### Get an account by ID IRC.Account.get(id) ### Find account by network & nick IRC.Account.find_by_nick(network, nick) ## Alcoolog * History: `AlcoologPlugin.user_history(id)` ### Remove an entry id = "" # Some account id alc = LSG.IRC.AlcoologPlugin.data_state() # 249° elem = h |> Enum.find(fn(el) -> elem(el, 4) == 249 end) # 249cl elem = h |> Enum.find(fn(el) -> elem(el, 3) == 249 end) :dets.delete_object(alc.dets, elem) diff --git a/README.md b/README.md index ea43e79..5fe1361 100644 --- a/README.md +++ b/README.md @@ -1,51 +1,51 @@ -# ircbot +# nola Some stupid and badly coded IRC bot. Can be spotted as "bavaria" on irc.random.sh, but is multi-connections and also elsewhere (poor channels). ## Dependencies * Erlang and Elixir (OTP24+) to build a release. * (Optional) Python 3 for: * link plugin: pdftitle: `pip install pdftitle` * txt plugin: markov: `pip install markovify` ## Development To start your Phoenix server: * Install dependencies with `mix deps.get` * Start Phoenix endpoint with `mix phx.server` Now you can visit [`localhost:4000`](http://localhost:4000) from your browser. Ready to run in production? Please [check our deployment guides](http://www.phoenixframework.org/docs/deployment). ## Production Build a release using `MIX_ENV=prod mix release`. -# bot +# nola ## ideas * logger * rate limiting only allow x/messages per x/period ignore user for exponential values notice user "Enhance Your Calm!" * duck games * markov txt * markov par txt * markov global * log to dets * !seen * !grab * 420 counter * kick roulette * counts ("won" and "lost") * !kickrandom (+ counts) * ? * partyline en pv * partyline! pour join la PL * parler en query <=> broadcast a tout les personnes qui ont "partyline!" * reminder diff --git a/lib/lsg_web/templates/layout/app.html.eex b/lib/lsg_web/templates/layout/app.html.eex index 956793f..c774369 100644 --- a/lib/lsg_web/templates/layout/app.html.eex +++ b/lib/lsg_web/templates/layout/app.html.eex @@ -1,126 +1,126 @@

<%= if n = @conn.assigns[:network] do %><%= n %> › <% end %> <%= if c = @conn.assigns[:chan] do %><%= c %> › <% end %> <%= for({name, href} <- Enum.uniq(@conn.assigns[:breadcrumbs]||[]), do: [link(name, to: href), raw(" › ")]) %> <%= @conn.assigns[:title] %>

<%= @inner_content %>
diff --git a/rel/config.exs b/rel/config.exs index 7aaf6d7..7bfc6a2 100644 --- a/rel/config.exs +++ b/rel/config.exs @@ -1,53 +1,53 @@ # Import all plugins from `rel/plugins` # They can then be used by adding `plugin MyPlugin` to # either an environment, or release definition, where # `MyPlugin` is the name of the plugin module. Path.join(["rel", "plugins", "*.exs"]) |> Path.wildcard() |> Enum.map(&Code.eval_file(&1)) use Mix.Releases.Config, # This sets the default release built by `mix release` default_release: :default, # This sets the default environment used by `mix release` default_environment: :prod # For a full list of config options for both releases # and environments, visit https://hexdocs.pm/distillery/configuration.html # You may define one or more environments in this file, # an environment's settings will override those of a release # when building in that environment, this combination of release # and environment configuration is called a profile environment :dev do # If you are running Phoenix, you should make sure that # server: true is set and the code reloader is disabled, # even in dev mode. # It is recommended that you build with MIX_ENV=prod and pass # the --env flag to Distillery explicitly if you want to use # dev mode. set dev_mode: true set include_erts: false set cookie: :"U!`hW]O(`|`gh_v0*noHuN3!Cs:3INx^VKd^>?(r/*?[/y,1T/umsm`T&V=sQ=T{" end environment :prod do set include_erts: true set include_src: false set cookie: :"1;of{d;szq!}X}nF1BKO[!w7QuLA(YSz,Nx)m)6M2/&XA7(Zg305(MGz^%L/8}=w" end # You may define one or more releases in this file. # If you have not set a default release, or selected one # when running `mix release`, the first release in the file # will be used by default -release :lsg do - set version: current_version(:lsg) +release :nola do + set version: current_version(:nola) set applications: [ :runtime_tools ] end diff --git a/test/correction_plugin_test.exs b/test/correction_plugin_test.exs index 6999b9f..b5a7394 100644 --- a/test/correction_plugin_test.exs +++ b/test/correction_plugin_test.exs @@ -1,12 +1,12 @@ -defmodule LSG.IRC.CorrectionPluginTest do +defmodule Nola.IRC.CorrectionPluginTest do use ExUnit.Case test "works" do message = %{text: "s/pouet/prout", replyfun: fn(x) -> assert x == "correction: prout les salopes" end, network: "test", channel: "#test"} hist = %{text: "pouet les salopes", sender: %{nick: "oof"}} - LSG.IRC.CorrectionPlugin.correction(message, %{"test/#test" => [hist]}) + Nola.IRC.CorrectionPlugin.correction(message, %{"test/#test" => [hist]}) end end diff --git a/test/lsg_web/controllers/page_controller_test.exs b/test/lsg_web/controllers/page_controller_test.exs index b7a0299..7550a24 100644 --- a/test/lsg_web/controllers/page_controller_test.exs +++ b/test/lsg_web/controllers/page_controller_test.exs @@ -1,8 +1,8 @@ -defmodule LSGWeb.PageControllerTest do - use LSGWeb.ConnCase +defmodule NolaWeb.PageControllerTest do + use NolaWeb.ConnCase test "GET /", %{conn: conn} do conn = get conn, "/" assert html_response(conn, 200) =~ "Welcome to Phoenix!" end end diff --git a/test/lsg_web/views/error_view_test.exs b/test/lsg_web/views/error_view_test.exs index 2aae44d..b67e3df 100644 --- a/test/lsg_web/views/error_view_test.exs +++ b/test/lsg_web/views/error_view_test.exs @@ -1,21 +1,21 @@ -defmodule LSGWeb.ErrorViewTest do - use LSGWeb.ConnCase, async: true +defmodule NolaWeb.ErrorViewTest do + use NolaWeb.ConnCase, async: true # Bring render/3 and render_to_string/3 for testing custom views import Phoenix.View test "renders 404.html" do - assert render_to_string(LSGWeb.ErrorView, "404.html", []) == + assert render_to_string(NolaWeb.ErrorView, "404.html", []) == "Page not found" end test "render 500.html" do - assert render_to_string(LSGWeb.ErrorView, "500.html", []) == + assert render_to_string(NolaWeb.ErrorView, "500.html", []) == "Internal server error" end test "render any other" do - assert render_to_string(LSGWeb.ErrorView, "505.html", []) == + assert render_to_string(NolaWeb.ErrorView, "505.html", []) == "Internal server error" end end diff --git a/test/lsg_web/views/layout_view_test.exs b/test/lsg_web/views/layout_view_test.exs index 5a904f8..51289f7 100644 --- a/test/lsg_web/views/layout_view_test.exs +++ b/test/lsg_web/views/layout_view_test.exs @@ -1,3 +1,3 @@ -defmodule LSGWeb.LayoutViewTest do - use LSGWeb.ConnCase, async: true +defmodule NolaWeb.LayoutViewTest do + use NolaWeb.ConnCase, async: true end diff --git a/test/lsg_web/views/page_view_test.exs b/test/lsg_web/views/page_view_test.exs index 26fce45..c0674a3 100644 --- a/test/lsg_web/views/page_view_test.exs +++ b/test/lsg_web/views/page_view_test.exs @@ -1,3 +1,3 @@ -defmodule LSGWeb.PageViewTest do - use LSGWeb.ConnCase, async: true +defmodule NolaWeb.PageViewTest do + use NolaWeb.ConnCase, async: true end diff --git a/test/support/channel_case.ex b/test/support/channel_case.ex index dcaa658..4ab8de3 100644 --- a/test/support/channel_case.ex +++ b/test/support/channel_case.ex @@ -1,33 +1,33 @@ -defmodule LSGWeb.ChannelCase do +defmodule NolaWeb.ChannelCase do @moduledoc """ This module defines the test case to be used by channel tests. Such tests rely on `Phoenix.ChannelTest` and also import other functionality to make it easier to build common datastructures and query the data layer. Finally, if the test case interacts with the database, it cannot be async. For this reason, every test runs inside a transaction which is reset at the beginning of the test unless the test case is marked as async. """ use ExUnit.CaseTemplate using do quote do # Import conveniences for testing with channels use Phoenix.ChannelTest # The default endpoint for testing - @endpoint LSGWeb.Endpoint + @endpoint NolaWeb.Endpoint end end setup _tags do :ok end end diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex index 9ed8e53..78a4419 100644 --- a/test/support/conn_case.ex +++ b/test/support/conn_case.ex @@ -1,34 +1,34 @@ -defmodule LSGWeb.ConnCase do +defmodule NolaWeb.ConnCase do @moduledoc """ This module defines the test case to be used by tests that require setting up a connection. Such tests rely on `Phoenix.ConnTest` and also import other functionality to make it easier to build common datastructures and query the data layer. Finally, if the test case interacts with the database, it cannot be async. For this reason, every test runs inside a transaction which is reset at the beginning of the test unless the test case is marked as async. """ use ExUnit.CaseTemplate using do quote do # Import conveniences for testing with connections use Phoenix.ConnTest - import LSGWeb.Router.Helpers + import NolaWeb.Router.Helpers # The default endpoint for testing - @endpoint LSGWeb.Endpoint + @endpoint NolaWeb.Endpoint end end setup _tags do {:ok, conn: Phoenix.ConnTest.build_conn()} end end