summaryrefslogblamecommitdiff
path: root/Admin.md
blob: 6380a4338a8164bc23a36b8190365d3c25ad4a14 (plain) (tree)









































                                                                                                                          
























                                                           
# ircbot admin bot

Everything is supposed to be ran inside a remote IEx console: `./bin/lsg 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)