Advertisement
westor

Pandora Bot for Kendy v1.0

Jun 27th, 2020
2,795
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 3.61 KB | None | 0 0
  1. ON *:PART:#: {
  2.   if ($nick == $me) { .timer[AI_ $+ $chan $+ _*] off | return }
  3.  
  4.   .timer[AI_ $+ $chan $+ _ $+ $nick $+ ] off
  5. }
  6.  
  7. ON @*:TEXT:*:#: {
  8.   tokenize 32 $strip($1-)
  9.  
  10.   var %p = $evalnext($+(%,pandora_,$chan))
  11.   var %s = $evalnext($+(%,pandora_,$chan,_,$nick,_say))
  12.   var %d = $evalnext($+(%,pandora_,$chan,_delay))
  13.  
  14.   if ($1 == !pandora) {
  15.     if ($nick !isop $chan) { msg $chan ( $+ $bold($nick) $+ ): Error, You are NOT an channel operator! | return }
  16.     if (!$2) { msg $chan ( $+ $bold($nick) $+ ): Error, Please specify an option! | return }
  17.  
  18.     if ($2 == ON) {
  19.       if (%p) { msg $chan ( $+ $bold($nick) $+ ): Error, The Pandora Bot is already enabled for this channel! | return }
  20.       set %pandora_ $+ $chan 1
  21.  
  22.       msg $chan ( $+ $bold($nick) $+ ): You have enabled the Pandora Bot for this channel.
  23.     }
  24.  
  25.     if ($2 == OFF) {
  26.       if (!%p) { msg $chan ( $+ $bold($nick) $+ ): Error, The Pandora Bot is already disabled for this channel! | return }
  27.       set %pandora_ $+ $chan 0
  28.  
  29.       msg $chan ( $+ $bold($nick) $+ ): You have disabled the Pandora Bot for this channel.
  30.     }
  31.  
  32.     return
  33.   }
  34.  
  35.   if ($1 == !pandoradelay) {
  36.     if ($nick !isop $chan) { msg $chan ( $+ $bold($nick) $+ ): Error, You are NOT an channel operator! | return }
  37.     if (!$2) { msg $chan ( $+ $bold($nick) $+ ): Error, Please specify an number! | return }
  38.     if ($2 !isnum) { msg $chan ( $+ $bold($nick) $+ ): Error, Please specify only numbers! | return }
  39.     if ($2 < 3) || ($2 > 300) { msg $chan ( $+ $bold($nick) $+ ): Error, Please a number from 3-300 ! | return }
  40.     if ($2 == %d) { msg $chan ( $+ $bold($nick) $+ ): Error, Please use an other number and NOT the same with now! | return }
  41.  
  42.     set %pandora_ $+ $chan $+ _delay $2
  43.  
  44.     msg $chan ( $+ $bold($nick) $+ ): The Pandora Bot delay has been changed from $bold($iif(%d,$v1,5)) to $bold($2) second(s).
  45.  
  46.     return
  47.   }
  48.  
  49.   if (!%p) || (%s == $1-) { return }
  50.  
  51.   set -eu6 %pandora_ $+ $chan $+ _ $+ $nick $+ _say $1-
  52.   var %t = $ticks $+ $ctime $+ $rand(1,100000000000)
  53.  
  54.   sockopen -e pandora_ $+ %t www.pandorabots.com 443
  55.   sockmark pandora_ $+ %t $nick $chan $1-
  56. }
  57.  
  58. ON *:SOCKOPEN:pandora_*: {
  59.   if ($sockerr) {
  60.     msg $gettok($sock($sockname).mark,2,32) ( $+ $bold($gettok($sock($sockname).mark,1,32)) $+ ): Error, The Pandora Bot had an connection problem!
  61.  
  62.     return
  63.   }
  64.  
  65.   var %t = $+(&botcust2=,$gettok($sock($sockname).mark,1,32),&input=,$urlencode($gettok($sock($sockname).mark,3-,32)))
  66.  
  67.   sockwrite -nt $sockname POST /pandora/talk?botid=a847934aae3456cb HTTP/2.0
  68.   sockwrite -nt $sockname Host: $sock($sockname).addr
  69.   sockwrite -nt $sockname Cache-Control: no-cache
  70.   sockwrite -nt $sockname Content-Type: application/x-www-form-urlencoded
  71.   sockwrite -nt $sockname Content-Length: $len(%t)
  72.   sockwrite -nt $sockname $crlf %t
  73. }
  74.  
  75. ON *:SOCKREAD:pandora_*: {
  76.   if ($sockerr) {
  77.     msg $gettok($sock($sockname).mark,2,32) ( $+ $bold($gettok($sock($sockname).mark,1,32)) $+ ): Error, The Pandora Bot had an connection reading problem!
  78.  
  79.     return
  80.   }
  81.  
  82.   var %r
  83.   sockread %r
  84.  
  85.   if (*<font size* iswm %r) && (*</font>* iswm %r) {
  86.     var %n = $gettok($sock($sockname).mark,1,32)
  87.     var %c = $gettok($sock($sockname).mark,2,32)
  88.     var %s = $iif(%pandora_ [ $+ [ %c ] $+ ] _delay,$v1,5)
  89.  
  90.     var %m = $nohtml(%r)
  91.  
  92.     .timer[AI_ $+ %c $+ _ $+ %n $+ ] 1 %s .msg %c $bold(%n) $+ : %m
  93.  
  94.     sockclose $sockname
  95.   }
  96.  
  97. }
  98.  
  99. alias -l bold { return $+($chr(2),$1-,$chr(2)) }
  100. alias -l nohtml { return $regsubex($1-, /<[^>]+(?:>|$)|^[^<>]+>/g,) }
  101. alias -l urlencode { return $regsubex($1-,/([^a-z0-9])/ig,% $+ $base($asc(\t),10,16,2)) }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement