Created
September 30, 2015 14:48
-
-
Save anonymous/d3304096ca1c4660ecd0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bind pub - .x hex:it | |
proc hex:it {n u h c t} { | |
set hexit [join [lrange [split [string trim $t]] 0 end]]; set out "" | |
if {$hexit eq ""} { putserv "privmsg $c :\00303$::lastbind <WHAT!>\003"; return } | |
foreach _ [split $hexit {}] { | |
lappend out [format "\\\u%04x" [scan $_ %c]] | |
} | |
putserv "privmsg $c :\002[join $out ""]\002" | |
putserv "privmsg $c :[hexor $hexit]" | |
return 0 | |
} | |
proc hexor {str} { | |
set out "" | |
foreach _ [split $str {}] { | |
binary scan $_ H* hexor | |
lappend out $hexor | |
} | |
return "\002\\\x[join $out "\\\x"]\002" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment