Compare commits
No commits in common. "fix" and "master" have entirely different histories.
3 changed files with 8 additions and 36 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +0,0 @@
|
||||||
factoids.txt
|
|
||||||
std
|
|
|
@ -3,7 +3,6 @@
|
||||||
HOST = "127.0.0.1".
|
HOST = "127.0.0.1".
|
||||||
PORT = 6667.
|
PORT = 6667.
|
||||||
NICK = "lambot".
|
NICK = "lambot".
|
||||||
PASS = "YOUR_PASS_HERE".
|
|
||||||
|
|
||||||
LASTFM_API_KEY = "YOUR_LASTFM_API_KEY_HERE".
|
LASTFM_API_KEY = "YOUR_LASTFM_API_KEY_HERE".
|
||||||
|
|
||||||
|
@ -11,4 +10,4 @@ LASTFM_API_KEY = "YOUR_LASTFM_API_KEY_HERE".
|
||||||
ADMINS = ["darkf"].
|
ADMINS = ["darkf"].
|
||||||
|
|
||||||
-- channels to join
|
-- channels to join
|
||||||
CHANS = ["#lounge"].
|
CHANS = ["#lobby"].
|
39
irc.lamb
39
irc.lamb
|
@ -1,4 +1,3 @@
|
||||||
import("std/base64").
|
|
||||||
import("std/list").
|
import("std/list").
|
||||||
import("std/str").
|
import("std/str").
|
||||||
import("std/http").
|
import("std/http").
|
||||||
|
@ -263,28 +262,6 @@ handleCommand(s, _, "251", _) -> s. -- There are X users and Y services on Z ser
|
||||||
handleCommand(s, _, "331", _) -> s. -- No topic is set
|
handleCommand(s, _, "331", _) -> s. -- No topic is set
|
||||||
handleCommand(s, _, "366", _) -> s. -- End of NAMES list
|
handleCommand(s, _, "366", _) -> s. -- End of NAMES list
|
||||||
|
|
||||||
handleCommand(s, _, "CAP", ["*", "ACK", "sasl "]) -> do
|
|
||||||
putstrln("Starting SASL handshake.");
|
|
||||||
fputstr(sock, "AUTHENTICATE PLAIN\r\n");
|
|
||||||
s
|
|
||||||
end.
|
|
||||||
|
|
||||||
handleCommand(s, _, "AUTHENTICATE", ["+"]) -> do
|
|
||||||
auth = base64\base64_encode(config\NICK + "\0" + config\NICK + "\0" + config\PASS);
|
|
||||||
fputstr(sock, "AUTHENTICATE " + auth + "\r\n");
|
|
||||||
s
|
|
||||||
end.
|
|
||||||
|
|
||||||
handleCommand(s, _, "903", _) -> do
|
|
||||||
putstrln("SASL authentication successful.");
|
|
||||||
fputstr(sock, "CAP END\r\n");
|
|
||||||
fputstr(sock, "NICK " + config\NICK + "\r\n");
|
|
||||||
fputstr(sock, "USER " + config\NICK + " 0 * :Lamb Da. Bot\r\n");
|
|
||||||
joinChans() -> list\map(\chan -> fputstr(sock, "JOIN " + chan + "\r\n"), config\CHANS);
|
|
||||||
joinChans();
|
|
||||||
s
|
|
||||||
end.
|
|
||||||
|
|
||||||
handleCommand(s, src, cmd, args) -> do
|
handleCommand(s, src, cmd, args) -> do
|
||||||
putstrln("Unhandled command: " + cmd + ", with args: " + repr(args) + " from " + src);
|
putstrln("Unhandled command: " + cmd + ", with args: " + repr(args) + " from " + src);
|
||||||
s
|
s
|
||||||
|
@ -309,15 +286,13 @@ end.
|
||||||
sock = sockopen(config\HOST, config\PORT).
|
sock = sockopen(config\HOST, config\PORT).
|
||||||
|
|
||||||
-- send introduction
|
-- send introduction
|
||||||
if config\PASS == "" then do
|
fputstr(sock, "PASS " + config\NICK + "\r\n").
|
||||||
fputstr(sock, "NICK " + config\NICK + "\r\n");
|
fputstr(sock, "NICK " + config\NICK + "\r\n").
|
||||||
fputstr(sock, "USER " + config\NICK + " 0 * :Lamb Da. Bot\r\n");
|
fputstr(sock, "USER " + config\NICK + " 0 * :Lamb Da. Bot\r\n").
|
||||||
joinChans() -> list\map(\chan -> fputstr(sock, "JOIN " + chan + "\r\n"), config\CHANS);
|
|
||||||
joinChans()
|
-- note: workaround for issue #19 (passing lambdas to modules in the global scope is incorrect)
|
||||||
end
|
joinChans() -> list\map(\chan -> fputstr(sock, "JOIN " + chan + "\r\n"), config\CHANS).
|
||||||
else do
|
joinChans().
|
||||||
fputstr(sock, "CAP REQ :sasl\r\n")
|
|
||||||
end.
|
|
||||||
|
|
||||||
-- loop receiving lines
|
-- loop receiving lines
|
||||||
mainloop(state) ->
|
mainloop(state) ->
|
||||||
|
|
Loading…
Reference in a new issue