Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on $*:text:/^!tfln$/iS:#:tfln $chan
- on *:input:#:if ($regex($1,/^!tfln$/iS)) tfln #
- alias -l tfln {
- if (!%f) { inc -u4 %f
- if ($sock(tf)) sockclose tf
- sockopen tf www.textsfromlastnight.com 80
- sockmark tf describe $1 :[Text From Lastnight]:
- }
- }
- on *:sockopen:tf: {
- sockwrite -n tf GET /Random-Texts-From-Last-Night.html?t= HTTP/1.1
- sockwrite -n tf Host: $+($sock(tf).addr,$str($crlf,2))
- }
- on *:sockread:tf: {
- var %tf | sockread %tf
- if ($regex(%tf,/<textarea.+>(.+?)<\/text.+>/)) {
- var %link $wildtok($regml(1),http://*,1,32)
- unshorten %link
- set %tfln $sock($sockname).mark $replace($remove($regml(1),%link),',',",",-,-)
- sockclose $sockname
- }
- }
- alias unshorten {
- if (!$1) { echo -ac info SYNTAX /unshorten LINK | halt }
- if ($sock(unshorten)) sockclose unshorten
- sockopen unshorten api.unshorten.it 80
- sockmark unshorten $1
- }
- on *:sockopen:unshorten: {
- var %x sockwrite -nt $sockname
- %x GET $+(/?shortURL=,$sock($sockname).mark,&apiKey=f1b4c050d55b97f6ee016915c5de50c2) HTTP/1.1
- %x Host: api.unshorten.it
- %x $crlf
- }
- on *:sockread:unshorten: {
- if ($sockerr) { echo -a SOCKET ERROR: $sockerr | halt }
- else {
- sockread &t
- %tfln >> $bvar(&t,$+($bfind(&t,1,http:),-)).text
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement