diff options
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | gitgud-chat.tcl | 78 |
2 files changed, 79 insertions, 0 deletions
@@ -47,5 +47,6 @@ source scripts/archivebot-chat.tcl source scripts/down-the-tube-chat.tcl source scripts/telegrab-chat.tcl source scripts/jseater-chat.tcl +source scripts/gitgud-chat.tcl source scripts/youtube.tcl ``` diff --git a/gitgud-chat.tcl b/gitgud-chat.tcl new file mode 100644 index 0000000..26439df --- /dev/null +++ b/gitgud-chat.tcl @@ -0,0 +1,78 @@ +bind pubm * "#gitgud *" gitgud-privmsg + +proc gitgud-privmsg {nick uhost hand chan text} { + if {([string index $text 0] == "!") && (([string index $text 1] != " ") && ([string length $text] != "1"))} { + return 0 + } + + if {([string match "*@hackint/user/h2ibot" $uhost])} { + return 0 + } + + if {([string match "*@hackint/user/nullbot" $uhost])} { + return 0 + } + + if {([string match "*@hackint/user/kh2i" $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 #gitgud-chat :<$nick> $text" +} + +bind ctcp * "ACTION" gitgud-action + +proc gitgud-action {nick uhost hand dest keyword text} { + if {$dest == "#gitgud"} { + if {[isop $nick $dest]} { + set nick "@$nick" + } elseif {[isvoice $nick $dest]} { + set nick "+$nick" + } + putserv "PRIVMSG #gitgud-chat :\001ACTION <$nick> $text\001" + } +} + +bind notc * "*" gitgud-notice + +proc gitgud-notice {nick uhost hand text {dest ""}} { + if {$dest == "#gitgud"} { + if {[isop $nick $dest]} { + set nick "@$nick" + } elseif {[isvoice $nick $dest]} { + set nick "+$nick" + } + putserv "NOTICE #gitgud-chat :<$nick> $text" + } +} + +bind out * "% sent" gitgud-out + +proc gitgud-out {queue text status} { + set botnick $::botnick + if {[botisop "#gitgud"]} { + set botnick "@$botnick" + } elseif {[botisvoice "#gitgud"]} { + set botnick "+$botnick" + } + if {[string match "PRIVMSG #gitgud *" $text]} { + if {[string match "*\\\[remind\\\]*" $text]} { + putserv "PRIVMSG #gitgud-chat :<$botnick> [join [lrange [split $text ":"] 1 end] ":"]" + } + } + if {[string match "NOTICE #gitgud *" $text]} { + if {[string match "*\\\[karma\\\]*" $text]} { + putserv "NOTICE #gitgud-chat :<$botnick> [join [lrange [split $text ":"] 1 end] ":"]" + } + } +} |
