Advertisement
westor

Pandora Bot for Wikked v1.2

May 15th, 2015
496
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 3.12 KB | None | 0 0
  1. ON *:TEXT:*:#: { ; by westor
  2.   tokenize 32 $strip($1-)
  3.   if ($1 == !pandora) {
  4.     if ($nick !isop $chan) { .msg $chan ( $+ $nick $+ ): Error, You are not an channel moderator! | return }
  5.     if (!$2) { .msg $chan ( $+ $nick $+ ): Error, Please specify an option! | return }
  6.     if ($2 == ON) {
  7.       if (%pandora_ [ $+ [ $chan ] ]) { .msg $chan ( $+ $nick $+ ): Error, The Pandora Bot is already enabled for this channel! | return }
  8.       else {
  9.         set %pandora_ [ $+ [ $chan ] ] 1
  10.         .msg $chan ( $+ $nick $+ ): You have enabled the Pandora Bot for this channel.
  11.       }
  12.     }
  13.     if ($2 == OFF) {
  14.       if (!%pandora_ [ $+ [ $chan ] ]) { .msg $chan ( $+ $nick $+ ): Error, The Pandora Bot is already disabled for this channel! | return }
  15.       else {
  16.         unset %pandora_ [ $+ [ $chan ] ]
  17.         .msg $chan ( $+ $nick $+ ): You have disabled the Pandora Bot for this channel.
  18.       }
  19.     }
  20.   }
  21.   if ($1 == !pandoradelay) {
  22.     if (!$2) { .msg $chan ( $+ $nick $+ ): Error, Please specify an number! | return }
  23.     if ($2 !isnum) { .msg $chan ( $+ $nick $+ ): Error, Please specify only numbers! | return }
  24.     if ($2 == %pandora_ [ $+ [ $chan ] $+ ] _delay) { .msg $chan ( $+ $nick $+ ): Error, Please use an other number and NOT the same with now! | return }
  25.     set %pandora_ [ $+ [ $chan ] $+ ] _delay $2
  26.     .msg $chan ( $+ $nick $+ ): The Pandora Bot delay has been changed to $2 second(s).
  27.   }
  28.   else {
  29.     if (!%pandora_ [ $+ [ $chan ] ]) { return }
  30.     if (%pandora_ [ $+ [ $chan ] $+ ] _ [ $+ [ $nick ] $+ ] _say == $1-) { return }
  31.     set -eu6 %pandora_ [ $+ [ $chan ] $+ ] _ [ $+ [ $nick ] $+ ] _say $1-
  32.     var %t = $ticks $+ $ctime $+ $rand(1,100000000000)
  33.     sockopen alice. $+ %t www.pandorabots.com 80
  34.     sockmark alice. $+ %t $mid($md5($address($chan,2)),16) $chan $nick $regsubex($1-,/([^\w])/Sg,$+(%,$base($asc(\1),10,16,2)))
  35.   }
  36. }
  37.  
  38. on *:sockopen:alice.*: {
  39.   if ($sockerr) { .msg $gettok($sock($sockname).mark,2,32) ( $+ $gettok($sock($sockname).mark,3,32) $+ ): Error, The Pandora Bot had an connection open problem! | return }
  40.   tokenize 32 $sock($sockname).mark
  41.   var %u $+(&botcust2=,$2&input=,$4)
  42.   sockwrite -n $sockname POST /pandora/talk?botid=f5d922d97e345aa1&skin=custom_input HTTP/1.1
  43.   sockwrite -n $sockname Host: www.pandorabots.com
  44.   sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded
  45.   sockwrite -n $sockname Content-Length: $len(%u .)
  46.   sockwrite -n $sockname $crlf %u
  47. }
  48.  
  49. on *:sockread:alice.*: {
  50.   if ($sockerr) { .msg $gettok($sock($sockname).mark,2,32) ( $+ $gettok($sock($sockname).mark,3,32) $+ ): Error, The Pandora Bot had an connection reading problem! | return }
  51.   var %s
  52.   sockread %s
  53.   if $regex(%s,^.*<em>(.*?)<\/em><\/b>$) {
  54.     var %ch = $gettok($sock($sockname).mark,2,32)
  55.     var %nick = $gettok($sock($sockname).mark,3,32)
  56.     var %sec = $iif(%pandora_ [ $+ [ %ch ] $+ ] _delay,$v1,5)
  57.     var %msg = $regml(1)
  58.     var %md5 = $md5(%msg)
  59.     .timer.AI. $+ %ch $+ . $+ %md5 1 %sec .msg %ch  $+ %nick $+ : %msg
  60.     sockclose $sockname
  61.   }
  62. }
  63.  
  64. ON *:PART:#: {
  65.   if ($nick == $me) { .timer.AI. $+ $chan $+ .* off }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement