aboutsummaryrefslogtreecommitdiff
path: root/telegrab-chat.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'telegrab-chat.tcl')
-rw-r--r--telegrab-chat.tcl67
1 files changed, 67 insertions, 0 deletions
diff --git a/telegrab-chat.tcl b/telegrab-chat.tcl
new file mode 100644
index 0000000..b99dfcf
--- /dev/null
+++ b/telegrab-chat.tcl
@@ -0,0 +1,67 @@
+bind pubm * "#telegrab *" telegrab-privmsg
+
+proc telegrab-privmsg {nick uhost hand chan text} {
+ if {([string index $text 0] == "!") && ([string index $text 1] != " ")} {
+ return 0
+ }
+ if {([string match "*@archiveteam/Aramaki" $uhost]) || ([string match "*@hackint/user/h2ibot" $uhost])} {
+ return 0
+ }
+ if {[string index $text 0] == "\001"} {
+ return 0
+ }
+ if {[isop $nick $chan]} {
+ set nick "@$nick"
+ } elseif {[isvoice $nick $chan]} {
+ set nick "+$nick"
+ }
+
+ putserv "PRIVMSG #telegrab-chat :<$nick> $text"
+}
+
+bind ctcp * "ACTION" telegrab-action
+
+proc telegrab-action {nick uhost hand dest keyword text} {
+ if {$dest == "#telegrab"} {
+ if {[isop $nick $dest]} {
+ set nick "@$nick"
+ } elseif {[isvoice $nick $dest]} {
+ set nick "+$nick"
+ }
+ putserv "PRIVMSG #telegrab-chat :\001ACTION <$nick> $text\001"
+ }
+}
+
+bind notc * "*" telegrab-notice
+
+proc telegrab-notice {nick uhost hand text {dest ""}} {
+ if {$dest == "#telegrab"} {
+ if {[isop $nick $dest]} {
+ set nick "@$nick"
+ } elseif {[isvoice $nick $dest]} {
+ set nick "+$nick"
+ }
+ putserv "NOTICE #telegrab-chat :<$nick> $text"
+ }
+}
+
+bind out * "% sent" telegrab-out
+
+proc telegrab-out {queue text status} {
+ set botnick $::botnick
+ if {[botisop "#telegrab"]} {
+ set botnick "@$botnick"
+ } elseif {[botisvoice "#telegrab"]} {
+ set botnick "+$botnick"
+ }
+ if {[string match "PRIVMSG #telegrab *" $text]} {
+ if {[string match "*\\\[remind\\\]*" $text]} {
+ putserv "PRIVMSG #telegrab-chat :<$botnick> [join [lrange [split $text ":"] 1 end] ":"]"
+ }
+ }
+ if {[string match "NOTICE #telegrab *" $text]} {
+ if {[string match "*\\\[karma\\\]*" $text]} {
+ putserv "NOTICE #telegrab-chat :<$botnick> [join [lrange [split $text ":"] 1 end] ":"]"
+ }
+ }
+}