summaryrefslogtreecommitdiff
path: root/Admin.md
blob: a21c996335f7c3ce7f86414852555365e853a5e0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# 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)