Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F51281
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
19 KB
Subscribers
None
View Options
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 @@
<div>
<div class="bg-gray-800 pb-32">
<nav class="bg-gray-800">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="border-b border-gray-700">
<div class="flex items-center justify-between h-16 px-4 sm:px-0">
<div class="flex items-center">
<div class="flex-shrink-0">
<img class="h-8 w-8" src="https://tailwindui.com/img/logos/workflow-mark-on-dark.svg" alt="Workflow logo">
</div>
<div class="hidden md:block">
<div class="ml-10 flex items-baseline">
- <a href="/" class="px-3 py-2 rounded-md text-sm font-medium text-white bg-gray-900 focus:outline-none focus:text-white focus:bg-gray-700">bot.goulag.org</a>
+ <a href="/" class="px-3 py-2 rounded-md text-sm font-medium text-white bg-gray-900 focus:outline-none focus:text-white focus:bg-gray-700"><%= Nola.name() %></a>
<!--<a href="#" class="ml-4 px-3 py-2 rounded-md text-sm font-medium text-gray-300 hover:text-white hover:bg-gray-700 focus:outline-none focus:text-white focus:bg-gray-700">Team</a>
<a href="#" class="ml-4 px-3 py-2 rounded-md text-sm font-medium text-gray-300 hover:text-white hover:bg-gray-700 focus:outline-none focus:text-white focus:bg-gray-700">Projects</a>
<a href="#" class="ml-4 px-3 py-2 rounded-md text-sm font-medium text-gray-300 hover:text-white hover:bg-gray-700 focus:outline-none focus:text-white focus:bg-gray-700">Calendar</a>
<a href="#" class="ml-4 px-3 py-2 rounded-md text-sm font-medium text-gray-300 hover:text-white hover:bg-gray-700 focus:outline-none focus:text-white focus:bg-gray-700">Reports</a>-->
</div>
</div>
</div>
<div class="hidden md:block">
<div class="ml-4 flex items-center md:ml-6">
<!--<button class="p-1 border-2 border-transparent text-gray-400 rounded-full hover:text-white focus:outline-none focus:text-white focus:bg-gray-700" aria-label="Notifications">
<svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9" />
</svg>
</button>-->
<!-- Profile dropdown -->
<div class="ml-3 relative">
<div>
<button class="max-w-xs flex items-center text-sm rounded-full text-white focus:outline-none focus:shadow-solid" id="user-menu" aria-label="User menu" aria-haspopup="true">
<!--<img class="h-8 w-8 rounded-full" src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80" alt="">-->
~<%= if @conn.assigns[:account], do: @conn.assigns.account.name %>
</button>
</div>
<!--
Profile dropdown panel, show/hide based on dropdown state.
Entering: "transition ease-out duration-100"
From: "transform opacity-0 scale-95"
To: "transform opacity-100 scale-100"
Leaving: "transition ease-in duration-75"
From: "transform opacity-100 scale-100"
To: "transform opacity-0 scale-95"
-->
<!--<div class="origin-top-right absolute right-0 mt-2 w-48 rounded-md shadow-lg">
<div class="py-1 rounded-md bg-white shadow-xs">
<a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">Your Profile</a>
<a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">Settings</a>
<a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">Sign out</a>
</div>
</div>-->
</div>
</div>
</div>
<div class="-mr-2 flex md:hidden">
<!-- Mobile menu button -->
<button class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-white hover:bg-gray-700 focus:outline-none focus:bg-gray-700 focus:text-white">
<!-- Menu open: "hidden", Menu closed: "block" -->
<svg class="block h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
</svg>
<!-- Menu open: "block", Menu closed: "hidden" -->
<svg class="hidden h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
</div>
</div>
</div>
<!--
Mobile menu, toggle classes based on menu state.
Open: "block", closed: "hidden"
-->
<div class="hidden border-b border-gray-700 md:hidden">
<div class="px-2 py-3 sm:px-3">
<a href="#" class="block px-3 py-2 rounded-md text-base font-medium text-white bg-gray-900 focus:outline-none focus:text-white focus:bg-gray-700">Dashboard</a>
<a href="#" class="mt-1 block px-3 py-2 rounded-md text-base font-medium text-gray-300 hover:text-white hover:bg-gray-700 focus:outline-none focus:text-white focus:bg-gray-700">Team</a>
<a href="#" class="mt-1 block px-3 py-2 rounded-md text-base font-medium text-gray-300 hover:text-white hover:bg-gray-700 focus:outline-none focus:text-white focus:bg-gray-700">Projects</a>
<a href="#" class="mt-1 block px-3 py-2 rounded-md text-base font-medium text-gray-300 hover:text-white hover:bg-gray-700 focus:outline-none focus:text-white focus:bg-gray-700">Calendar</a>
<a href="#" class="mt-1 block px-3 py-2 rounded-md text-base font-medium text-gray-300 hover:text-white hover:bg-gray-700 focus:outline-none focus:text-white focus:bg-gray-700">Reports</a>
</div>
<div class="pt-4 pb-3 border-t border-gray-700">
<div class="flex items-center px-5">
<div class="flex-shrink-0">
<img class="h-10 w-10 rounded-full" src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80" alt="">
</div>
<div class="ml-3">
<div class="text-base font-medium leading-none text-white">Tom Cook</div>
<div class="mt-1 text-sm font-medium leading-none text-gray-400">tom@example.com</div>
</div>
</div>
<div class="mt-3 px-2" role="menu" aria-orientation="vertical" aria-labelledby="user-menu">
<a href="#" class="block px-3 py-2 rounded-md text-base font-medium text-gray-400 hover:text-white hover:bg-gray-700 focus:outline-none focus:text-white focus:bg-gray-700" role="menuitem">Your Profile</a>
<a href="#" class="mt-1 block px-3 py-2 rounded-md text-base font-medium text-gray-400 hover:text-white hover:bg-gray-700 focus:outline-none focus:text-white focus:bg-gray-700" role="menuitem">Settings</a>
<a href="#" class="mt-1 block px-3 py-2 rounded-md text-base font-medium text-gray-400 hover:text-white hover:bg-gray-700 focus:outline-none focus:text-white focus:bg-gray-700" role="menuitem">Sign out</a>
</div>
</div>
</div>
</nav>
<header class="py-10">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<h1 class="text-3xl leading-9 font-bold text-white">
<%= if n = @conn.assigns[:network] do %><a href="/<%= n %>"><%= n %></a> › <% end %>
<%= if c = @conn.assigns[:chan] do %><a href="/<%= @conn.assigns.network %>/<%= NolaWeb.format_chan(c) %>"><%= c %></a> › <% end %>
<%= for({name, href} <- Enum.uniq(@conn.assigns[:breadcrumbs]||[]), do: [link(name, to: href), raw(" › ")]) %>
<%= @conn.assigns[:title] %>
</h1>
</div>
</header>
</div>
<main class="-mt-32 h-full">
<div class="max-w-7xl h-full mx-auto pb-12 px-4 sm:px-6 lg:px-8">
<!-- Replace with your content -->
<div class="bg-white h-full rounded-lg shadow px-5 py-6 sm:px-6">
<%= @inner_content %>
</div>
<!-- /End replace -->
</div>
</main>
</div>
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: <oof> 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
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Fri, Mar 14, 5:03 PM (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33626
Default Alt Text
(19 KB)
Attached To
rNOLA Nola
Event Timeline
Log In to Comment