mirror of https://github.com/nealey/irc-bot
Expanded notion of channels
This commit is contained in:
parent
6dd5c6fd54
commit
d7e7677547
4
bot.ml
4
bot.ml
|
@ -84,11 +84,11 @@ let handle_command iobuf cmd =
|
|||
| (_, "PING", _, text) ->
|
||||
write iobuf "PONG" [] text
|
||||
| (_, "001", _, _) ->
|
||||
write iobuf "JOIN" ["#bot"] None
|
||||
write iobuf "JOIN" ["+bot"] None
|
||||
| (Some sender, "JOIN", [], Some chan) ->
|
||||
write iobuf "PRIVMSG" [chan] (Some "hi asl")
|
||||
| (Some sender, "PRIVMSG", [target], Some text) ->
|
||||
if target.[0] = '#' then
|
||||
if Irc.is_channel target then
|
||||
handle_privmsg iobuf sender target text
|
||||
| _ ->
|
||||
()
|
||||
|
|
5
irc.ml
5
irc.ml
|
@ -8,6 +8,11 @@ let dbg msg a =
|
|||
prerr_endline ("[" ^ msg ^ "]");
|
||||
a
|
||||
|
||||
let is_channel str =
|
||||
match str with
|
||||
| '#' | '+' | '&' -> true
|
||||
| _ -> false
|
||||
|
||||
let string_map f s =
|
||||
let l = String.length s in
|
||||
if l = 0 then
|
||||
|
|
Loading…
Reference in New Issue