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) ->
|
| (_, "PING", _, text) ->
|
||||||
write iobuf "PONG" [] text
|
write iobuf "PONG" [] text
|
||||||
| (_, "001", _, _) ->
|
| (_, "001", _, _) ->
|
||||||
write iobuf "JOIN" ["#bot"] None
|
write iobuf "JOIN" ["+bot"] None
|
||||||
| (Some sender, "JOIN", [], Some chan) ->
|
| (Some sender, "JOIN", [], Some chan) ->
|
||||||
write iobuf "PRIVMSG" [chan] (Some "hi asl")
|
write iobuf "PRIVMSG" [chan] (Some "hi asl")
|
||||||
| (Some sender, "PRIVMSG", [target], Some text) ->
|
| (Some sender, "PRIVMSG", [target], Some text) ->
|
||||||
if target.[0] = '#' then
|
if Irc.is_channel target then
|
||||||
handle_privmsg iobuf sender target text
|
handle_privmsg iobuf sender target text
|
||||||
| _ ->
|
| _ ->
|
||||||
()
|
()
|
||||||
|
|
5
irc.ml
5
irc.ml
|
@ -8,6 +8,11 @@ let dbg msg a =
|
||||||
prerr_endline ("[" ^ msg ^ "]");
|
prerr_endline ("[" ^ msg ^ "]");
|
||||||
a
|
a
|
||||||
|
|
||||||
|
let is_channel str =
|
||||||
|
match str with
|
||||||
|
| '#' | '+' | '&' -> true
|
||||||
|
| _ -> false
|
||||||
|
|
||||||
let string_map f s =
|
let string_map f s =
|
||||||
let l = String.length s in
|
let l = String.length s in
|
||||||
if l = 0 then
|
if l = 0 then
|
||||||
|
|
1
irc.mli
1
irc.mli
|
@ -5,6 +5,7 @@ val name : string ref
|
||||||
val version : string
|
val version : string
|
||||||
val start_time : float
|
val start_time : float
|
||||||
|
|
||||||
|
val is_channel : string -> bool
|
||||||
val uppercase : string -> string
|
val uppercase : string -> string
|
||||||
val lowercase : string -> string
|
val lowercase : string -> string
|
||||||
val truncate : string -> int -> string
|
val truncate : string -> int -> string
|
||||||
|
|
Loading…
Reference in New Issue