Requested for: Wikked
Contact: http://westor.ucoz.com/contact
Credits to: Wikked
Description:
In order to work you must enable the module (!pandora on) but you must be an channel operator/moderator (@) into the channel,
this module will allow the bot to response on every message that someone say into the channel, also you can set and delay response via (!pandoradelay SECS). it is multi channel support.
Commands (On the channel):
!Pandora ON/OFF = This will enable/disable the module into the channel.
!PandoraDelay SECONDS = This will change the delay bot response per message.
ON *:TEXT:*:#: { ; by westor
tokenize 32 $strip($1-)
if ($1 == !pandora) {
if ($nick !isop $chan) { .msg $chan ( $+ $nick $+ ): Error, You are not an channel moderator! | return }
if (!$2) { .msg $chan ( $+ $nick $+ ): Error, Please specify an option! | return }
if ($2 == ON) {
if (%pandora_ [ $+ [ $chan ] ]) { .msg $chan ( $+ $nick $+ ): Error, The Pandora Bot is already enabled for this channel! | return }
else {
set %pandora_ [ $+ [ $chan ] ] 1
.msg $chan ( $+ $nick $+ ): You have enabled the Pandora Bot for this channel.
}
}
if ($2 == OFF) {
if (!%pandora_ [ $+ [ $chan ] ]) { .msg $chan ( $+ $nick $+ ): Error, The Pandora Bot is already disabled for this channel! | return }
else {
unset %pandora_ [ $+ [ $chan ] ]
.msg $chan ( $+ $nick $+ ): You have disabled the Pandora Bot for this channel.
}
}
}
if ($1 == !pandoradelay) {
if (!$2) { .msg $chan ( $+ $nick $+ ): Error, Please specify an number! | return }
if ($2 !isnum) { .msg $chan ( $+ $nick $+ ): Error, Please specify only numbers! | return }
if ($2 == %pandora_ [ $+ [ $chan ] $+ ] _delay) { .msg $chan ( $+ $nick $+ ): Error, Please use an other number and NOT the same with now! | return }
set %pandora_ [ $+ [ $chan ] $+ ] _delay $2
.msg $chan ( $+ $nick $+ ): The Pandora Bot delay has been changed to $2 second(s).
}
else {
if (!%pandora_ [ $+ [ $chan ] ]) { return }
if (%pandora_ [ $+ [ $chan ] $+ ] _ [ $+ [ $nick ] $+ ] _say == $1-) { return }
set -eu6 %pandora_ [ $+ [ $chan ] $+ ] _ [ $+ [ $nick ] $+ ] _say $1-
var %t = $ticks $+ $ctime $+ $rand(1,100000000000)
sockopen -e alice. $+ %t www.pandorabots.com 443
sockmark alice. $+ %t $mid($md5($address($chan,2)),16) $chan $nick $regsubex($1-,/([^\w])/Sg,$+(%,$base($asc(\1),10,16,2)))
}
}
on *:sockopen:alice.*: {
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 }
tokenize 32 $sock($sockname).mark
var %u = $+(&botcust2=,$2&input=,$4)
sockwrite -n $sockname POST /pandora/talk?botid=f5d922d97e345aa1&skin=custom_input HTTP/1.1
sockwrite -n $sockname Host: $sock($sockname).addr
sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded
sockwrite -n $sockname Content-Length: $len(%u .)
sockwrite -n $sockname $crlf %u
}
on *:sockread:alice.*: {
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 }
var %s
sockread %s
if ($regex(%s,^.*<em>(.*?)<\/em><\/b>$)) {
var %ch = $gettok($sock($sockname).mark,2,32)
var %nick = $gettok($sock($sockname).mark,3,32)
var %sec = $iif(%pandora_ [ $+ [ %ch ] $+ ] _delay,$v1,5)
var %msg = $regml(1)
var %md5 = $md5(%msg)
.timer.AI. $+ %ch $+ . $+ %md5 1 %sec .msg %ch $+ %nick $+ : %msg
sockclose $sockname
}
}
ON *:PART:#: {
if ($nick == $me) { .timer.AI. $+ $chan $+ .* off }
}
I use it and it's a nice script. It would have been better if there was a facility which would make the bot stop talking without the "!pandora off" like "Shut up". Also the bot replies too much and to every sentence. It would have been better if it spoke out once in a while i.e. sometimes and prevented channel spamming.
Just wanted to say this works great. Thanks.
I'm trying to adapt it a bit for my needs, though. I'm trying to get it to send a message to the channel whenever there's a ping from the server.
Instead of using what the person last said as the message sent to pandorabots.com, I'd use a %botmessage var, which I'd set up to just be the last message said in the channel. That part is all well and fine, but I can't figure out how to change this script to utilize that var in the on:ping scenario.
Any help would be appreciated!
pandorabots website has closed their free service.
RIP