| 1 | # bMotion - Event handling |
|---|
| 2 | # |
|---|
| 3 | # $Id$ |
|---|
| 4 | # |
|---|
| 5 | |
|---|
| 6 | ############################################################################### |
|---|
| 7 | # bMotion - an 'AI' TCL script for eggdrops |
|---|
| 8 | # Copyright (C) James Michael Seward 2000-2002 |
|---|
| 9 | # |
|---|
| 10 | # This program is free software; you can redistribute it and/or modify |
|---|
| 11 | # it under the terms of the GNU General Public License as published by |
|---|
| 12 | # the Free Software Foundation; either version 2 of the License, or |
|---|
| 13 | # (at your option) any later version. |
|---|
| 14 | # |
|---|
| 15 | # This program is distributed in the hope that it will be useful, but |
|---|
| 16 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 18 | # General Public License for more details. |
|---|
| 19 | # |
|---|
| 20 | # You should have received a copy of the GNU General Public License |
|---|
| 21 | # along with this program; if not, write to the Free Software |
|---|
| 22 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 23 | ############################################################################### |
|---|
| 24 | |
|---|
| 25 | putlog "decaring onjoin" |
|---|
| 26 | ## BEGIN onjoin handler |
|---|
| 27 | proc bMotion_event_onjoin {nick host handle channel} { |
|---|
| 28 | global bMotionCache welcomeBacks |
|---|
| 29 | |
|---|
| 30 | #ignore me |
|---|
| 31 | if [isbotnick $nick] { |
|---|
| 32 | return 0 |
|---|
| 33 | } |
|---|
| 34 | |
|---|
| 35 | #ignore the J flag users |
|---|
| 36 | if [matchattr $handle J] { |
|---|
| 37 | return 0 |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | #ignore bots without the I flag |
|---|
| 41 | if [matchattr $handle b-I] { |
|---|
| 42 | return 0 |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | global ranjoins bigranjoins botnick mood |
|---|
| 46 | set chance [rand 10] |
|---|
| 47 | set greetings $ranjoins |
|---|
| 48 | if {$chance > 8} { |
|---|
| 49 | if [matchattr $handle I] { |
|---|
| 50 | set greetings [concat $greetings $bigranjoins] |
|---|
| 51 | if {$nick == $bMotionCache(lastLeft)} { |
|---|
| 52 | set greetings $welcomeBacks |
|---|
| 53 | set bMotionCache(lastLeft) "" |
|---|
| 54 | } |
|---|
| 55 | incr mood(happy) |
|---|
| 56 | incr mood(lonely) -1 |
|---|
| 57 | } |
|---|
| 58 | |
|---|
| 59 | bMotionDoAction $channel [bMotionGetRealName $nick $host] [pickRandom $greetings] |
|---|
| 60 | set bMotionCache(lastGreeted) $nick |
|---|
| 61 | } |
|---|
| 62 | } |
|---|
| 63 | ## END onjoin |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | putlog "decaring onpart" |
|---|
| 67 | ## BEGIN onpart handler |
|---|
| 68 | proc bMotion_event_onpart {nick uhost hand chan {msg ""}} { |
|---|
| 69 | global bMotionCache |
|---|
| 70 | set bMotionCache(lastLeft) $nick |
|---|
| 71 | } |
|---|
| 72 | ## END onpart |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | ## BEGIN onquit handler |
|---|
| 76 | putlog "decaring onquit" |
|---|
| 77 | proc bMotion_event_onquit {nick host handle channel reason} { |
|---|
| 78 | global bMotionCache bMotionSettings bMotionInfo |
|---|
| 79 | |
|---|
| 80 | if {$bMotionSettings(needI) == 1} { |
|---|
| 81 | set bMotionCache(lastLeft) $nick |
|---|
| 82 | } |
|---|
| 83 | |
|---|
| 84 | if {$bMotionInfo(brig) == ""} { return 0 } |
|---|
| 85 | |
|---|
| 86 | #check if that person was in the brig |
|---|
| 87 | regexp -nocase "(.+)@(.+)" $bMotionInfo(brig) pop brigNick brigChannel |
|---|
| 88 | if [string match -nocase $nick $brigNick] { |
|---|
| 89 | set bMotionInfo(brig) "" |
|---|
| 90 | bMotionDoAction $brigChannel "" "Curses! They escaped from the brig." |
|---|
| 91 | } |
|---|
| 92 | } |
|---|
| 93 | ## END onquit |
|---|
| 94 | |
|---|
| 95 | ## BEGIN main interactive |
|---|
| 96 | putlog "decaring main" |
|---|
| 97 | proc bMotion_event_main {nick host handle channel text} { |
|---|
| 98 | |
|---|
| 99 | bMotion_putloglev 4 * "bMotion: entering bMotion_event_main with $nick $host $handle $channel $text" |
|---|
| 100 | |
|---|
| 101 | if [matchattr $handle J] { |
|---|
| 102 | return 0 |
|---|
| 103 | } |
|---|
| 104 | |
|---|
| 105 | #remove []s from nick cos they break things (Minder[]...) |
|---|
| 106 | regsub -all {(\[|\])} $nick "" nick |
|---|
| 107 | |
|---|
| 108 | ## Global definitions ## |
|---|
| 109 | global mood botnick greetings welcomes sorryoks |
|---|
| 110 | global loveresponses boreds upyourbums smiles |
|---|
| 111 | global arrs botnick arrcachenick arrcachearr |
|---|
| 112 | global bMotionLastEvent bMotionSettings botnicks bMotionCache bMotionInfo |
|---|
| 113 | |
|---|
| 114 | if {[lsearch $bMotionInfo(randomChannels) [string tolower $channel]] == -1} { |
|---|
| 115 | return 0 |
|---|
| 116 | } |
|---|
| 117 | |
|---|
| 118 | #filter bold codes out |
|---|
| 119 | regsub -all "\002" $text "" text |
|---|
| 120 | regsub -all "\022" $text "" text |
|---|
| 121 | regsub -all "\037" $text "" text |
|---|
| 122 | regsub -all {\003[0-9]+(,[0-9+])?} $text "" text |
|---|
| 123 | |
|---|
| 124 | #first, check botnicks (this is to get round empty-nick-on-startup |
|---|
| 125 | if {$botnicks == ""} { |
|---|
| 126 | # need to set this |
|---|
| 127 | set botnicks "($botnick|$bMotionSettings(botnicks)) ?" |
|---|
| 128 | } |
|---|
| 129 | |
|---|
| 130 | ## Update the channel idle tracker ## |
|---|
| 131 | set bMotionOldIdle [expr [clock seconds] - $bMotionLastEvent($channel)] |
|---|
| 132 | set bMotionLastEvent($channel) [clock seconds] |
|---|
| 133 | |
|---|
| 134 | #ignore other bots |
|---|
| 135 | if {[matchattr $handle b]} { |
|---|
| 136 | set bMotionCache($channel,last) 0 |
|---|
| 137 | return 0 |
|---|
| 138 | } |
|---|
| 139 | |
|---|
| 140 | #ignore lines with <nobotnick> tags |
|---|
| 141 | if [regexp -nocase "\</?no$botnicks\>" $text] {return 0} |
|---|
| 142 | if [regexp -nocase "\<no$botnicks\>" $text] {return 0} |
|---|
| 143 | |
|---|
| 144 | #don't let people break us |
|---|
| 145 | if {![matchattr $handle n]} { |
|---|
| 146 | if [regexp -nocase "%(pronoun|me|noun|colen|percent|VAR|\\|)" $text] { |
|---|
| 147 | regsub -all "%" $text "%percent" text |
|---|
| 148 | } |
|---|
| 149 | } |
|---|
| 150 | regsub -all "/" $text "%slash" text |
|---|
| 151 | |
|---|
| 152 | |
|---|
| 153 | ## Trim ## |
|---|
| 154 | set text [string trim $text] |
|---|
| 155 | |
|---|
| 156 | ## Dump double+ spaces ## |
|---|
| 157 | regsub -all " +" $text " " text |
|---|
| 158 | |
|---|
| 159 | ## Run the simple plugins ## |
|---|
| 160 | set response [bMotion_plugin_find_simple $text $bMotionInfo(language)] |
|---|
| 161 | if {$response != ""} { |
|---|
| 162 | set nick [bMotionGetRealName $nick $host] |
|---|
| 163 | bMotionDoAction $channel $nick [pickRandom $response] |
|---|
| 164 | return 0 |
|---|
| 165 | } |
|---|
| 166 | |
|---|
| 167 | ## Run the complex plugins ## |
|---|
| 168 | set response [bMotion_plugin_find_complex $text $bMotionInfo(language)] |
|---|
| 169 | if {[llength $response] > 0} { |
|---|
| 170 | #set nick [bMotionGetRealName $nick $host] |
|---|
| 171 | foreach callback $response { |
|---|
| 172 | bMotion_putloglev 1 * "bMotion: matched complex plugin, running callback $callback" |
|---|
| 173 | set result [$callback $nick $host $handle $channel $text] |
|---|
| 174 | if {$result == 1} { |
|---|
| 175 | break |
|---|
| 176 | } |
|---|
| 177 | } |
|---|
| 178 | return 0 |
|---|
| 179 | } |
|---|
| 180 | |
|---|
| 181 | #if we spoke last, add "$botnick: " if it's not in the line |
|---|
| 182 | if {![regexp -nocase $botnicks $text] && $bMotionCache($channel,last)} { |
|---|
| 183 | set text "${botnick}: $text" |
|---|
| 184 | } |
|---|
| 185 | |
|---|
| 186 | #check for someone breaking the loop of lastSpoke |
|---|
| 187 | if [regexp -nocase "${botnicks}:? (i'm not talking to|not) you" $text] { |
|---|
| 188 | bMotionDoAction $channel $nick "oh" |
|---|
| 189 | set bMotionCache($channel,last) 0 |
|---|
| 190 | } |
|---|
| 191 | set bMotionCache($channel,last) 0 |
|---|
| 192 | |
|---|
| 193 | #Check for all caps |
|---|
| 194 | regsub -all {[^A-Za-z]} $text "" textChars |
|---|
| 195 | regsub -all {[a-z]} $textChars "" textLowerChars |
|---|
| 196 | if {(([string length $textChars] > 4) && ([expr [string length $textLowerChars] / [string length $textChars]] > 0.9)) || |
|---|
| 197 | [regexp ".+!{4,}" $text]} { |
|---|
| 198 | global blownAways |
|---|
| 199 | if {[rand 60] >= 55} { |
|---|
| 200 | bMotionDoAction $channel $nick [pickRandom $blownAways] |
|---|
| 201 | return 0 |
|---|
| 202 | } |
|---|
| 203 | } |
|---|
| 204 | |
|---|
| 205 | ################################# Things that can be responded to from everyone ########################## |
|---|
| 206 | |
|---|
| 207 | ## Reload config files |
|---|
| 208 | ## Requires global +m |
|---|
| 209 | if [regexp -nocase "${botnicks},?:? re(hash|load)( your config files?)?" $text] { |
|---|
| 210 | putlog "bMotion: $nick asked me to rehash in $channel" |
|---|
| 211 | global bMotionCache bMotion_testing bMotionRoot |
|---|
| 212 | |
|---|
| 213 | #check we're not going to die |
|---|
| 214 | catch { |
|---|
| 215 | bMotion_putloglev d * "bMotion: Testing new code..." |
|---|
| 216 | set bMotion_testing 1 |
|---|
| 217 | source "$bMotionRoot/bMotion.tcl" |
|---|
| 218 | } msg |
|---|
| 219 | |
|---|
| 220 | if {$msg != ""} { |
|---|
| 221 | putlog "bMotion: FATAL: Cannot rehash due to error: $msg" |
|---|
| 222 | putserv "NOTICE $nick :FATAL: Cannot rehash: $msg" |
|---|
| 223 | putchan $channel "A tremendous error occurred!" |
|---|
| 224 | return 0 |
|---|
| 225 | } else { |
|---|
| 226 | bMotion_putloglev d * "bMotion: New code ok, rehashing..." |
|---|
| 227 | set bMotionCache(rehash) $channel |
|---|
| 228 | set bMotion_testing 0 |
|---|
| 229 | if {[matchattr $handle m]} { |
|---|
| 230 | putchan $channel [bMotionDoInterpolation "%VAR{rehashes}" "" ""] |
|---|
| 231 | rehash |
|---|
| 232 | return 0 |
|---|
| 233 | } |
|---|
| 234 | } |
|---|
| 235 | bMotionDoAction $channel $nick "I think not." |
|---|
| 236 | return 0 |
|---|
| 237 | } |
|---|
| 238 | ## /Reload config files |
|---|
| 239 | |
|---|
| 240 | if [regexp -nocase "${botnicks}:? what ver(sion )?(of )?bmotion are you (running|using)\\?" $text] { |
|---|
| 241 | global randomsinfo cvsinfo |
|---|
| 242 | bMotionDoAction $channel $nick "I'm running bMotion $cvsinfo (randoms file $randomsinfo)" |
|---|
| 243 | return 0 |
|---|
| 244 | } |
|---|
| 245 | |
|---|
| 246 | #check for a smiley |
|---|
| 247 | global bMotionCache |
|---|
| 248 | if [regexp {[8|:|;|=][-|o|O]?([\)D\(C])} $text bling mouth] { |
|---|
| 249 | if {$mouth == ")"} { |
|---|
| 250 | incr bMotionCache($channel,mood) 5 |
|---|
| 251 | } |
|---|
| 252 | if {$mouth == "D"} { |
|---|
| 253 | incr bMotionCache($channel,mood) 7 |
|---|
| 254 | } |
|---|
| 255 | |
|---|
| 256 | if {$mouth == "("} { |
|---|
| 257 | incr bMotionCache($channel,mood) -5 |
|---|
| 258 | } |
|---|
| 259 | if {$mouth == "C"} { |
|---|
| 260 | incr bMotionCache($channel,mood) -7 |
|---|
| 261 | } |
|---|
| 262 | } |
|---|
| 263 | |
|---|
| 264 | ## ignore channels that aren't in the randoms list ## |
|---|
| 265 | if {[lsearch $bMotionInfo(randomChannels) [string tolower $channel]] == -1} { |
|---|
| 266 | return 0 |
|---|
| 267 | } |
|---|
| 268 | |
|---|
| 269 | ####whole-line matches |
|---|
| 270 | |
|---|
| 271 | ## tell the names we have |
|---|
| 272 | if [regexp -nocase "${botnicks}:?,? say my names?(,? bitch)?" $text] { |
|---|
| 273 | set realnames [getuser $handle XTRA irl] |
|---|
| 274 | if {$realnames == ""} { |
|---|
| 275 | bMotionDoAction $channel $nick "Ah you must be %%." "" 1 |
|---|
| 276 | } else { |
|---|
| 277 | bMotionDoAction $channel $nick "Your IRL name(s) are:\002 %2 \002" $realnames 1 |
|---|
| 278 | } |
|---|
| 279 | puthelp "NOTICE $nick :To update your IRL names, do \002/msg $botnick IRL name1 name2 name3 ...\002" |
|---|
| 280 | return 0 |
|---|
| 281 | } |
|---|
| 282 | |
|---|
| 283 | ##opme --> kick ;) (now a complex plugin) |
|---|
| 284 | |
|---|
| 285 | |
|---|
| 286 | ##url (now a simple plugin) |
|---|
| 287 | |
|---|
| 288 | ## ali g (now a simple plugin) |
|---|
| 289 | |
|---|
| 290 | ## wassssup (now a simple plugin) |
|---|
| 291 | |
|---|
| 292 | ## oops (now a simple plugin) |
|---|
| 293 | |
|---|
| 294 | ## shock (now a simple plugin) |
|---|
| 295 | |
|---|
| 296 | ## bof (now a simple plugin) |
|---|
| 297 | |
|---|
| 298 | ## alors (now a simple plugin) |
|---|
| 299 | |
|---|
| 300 | ## moo |
|---|
| 301 | ## --> moo (now a simple plugin) |
|---|
| 302 | |
|---|
| 303 | ## eat |
|---|
| 304 | ## --> /me eats ... |
|---|
| 305 | ## --> go down on |
|---|
| 306 | ## /eat |
|---|
| 307 | |
|---|
| 308 | ## go down on |
|---|
| 309 | ## --> go down on |
|---|
| 310 | |
|---|
| 311 | ## hello |
|---|
| 312 | ## --> hello back |
|---|
| 313 | ## /hello |
|---|
| 314 | |
|---|
| 315 | ## watch out |
|---|
| 316 | ## --> eek|hide|runs |
|---|
| 317 | |
|---|
| 318 | ## happy xmas |
|---|
| 319 | ## --> and to you too |
|---|
| 320 | if {[regexp -nocase "(merry|happy|have a good) (xmas|christmas|chrismas|newyear|new year) $botnicks" $text]} { |
|---|
| 321 | incr mood(happy) 1 |
|---|
| 322 | incr mood(lonely) -1 |
|---|
| 323 | bMotionDoAction $channel [bMotionGetRealName $nick $host] ":) merry christmas and happy new year %%" |
|---|
| 324 | set bMotionCache(lastDoneFor) $nick |
|---|
| 325 | driftFriendship $nick 3 |
|---|
| 326 | return 0 |
|---|
| 327 | } |
|---|
| 328 | |
|---|
| 329 | ##thank you |
|---|
| 330 | ## --> you're welcome |
|---|
| 331 | |
|---|
| 332 | |
|---|
| 333 | ## sorry |
|---|
| 334 | ## --> that's ok |
|---|
| 335 | |
|---|
| 336 | ## welcome back |
|---|
| 337 | ## --> thanks |
|---|
| 338 | |
|---|
| 339 | ##love |
|---|
| 340 | ## /love |
|---|
| 341 | |
|---|
| 342 | ##uNF |
|---|
| 343 | |
|---|
| 344 | ##blblblbl |
|---|
| 345 | ## /blblblbl |
|---|
| 346 | |
|---|
| 347 | ##bhar etc |
|---|
| 348 | ## /bhar etc |
|---|
| 349 | |
|---|
| 350 | ## :) |
|---|
| 351 | if {[regexp "^(((:|;|=)(\\\)|]|D))|hehe|heh|wheee+)$" $text]} { |
|---|
| 352 | if {$botnick == $nick} {return 0} |
|---|
| 353 | if {$mood(happy) < 0} { |
|---|
| 354 | return 0 |
|---|
| 355 | } |
|---|
| 356 | |
|---|
| 357 | global bMotionLastEvent |
|---|
| 358 | if {($bMotionOldIdle > 300) || ($mood(lonely) < 1)} { |
|---|
| 359 | if {[rand 10] > 6} { |
|---|
| 360 | bMotionDoAction $channel "" [pickRandom $smiles] |
|---|
| 361 | } |
|---|
| 362 | } |
|---|
| 363 | bMotionGetHappy |
|---|
| 364 | bMotionGetUnLonely |
|---|
| 365 | checkmood $nick $channel |
|---|
| 366 | return 0 |
|---|
| 367 | } |
|---|
| 368 | |
|---|
| 369 | ## :( (now a simple plugin) |
|---|
| 370 | |
|---|
| 371 | ## replicate |
|---|
| 372 | ## /replicate |
|---|
| 373 | |
|---|
| 374 | ## hand |
|---|
| 375 | ## /hand |
|---|
| 376 | |
|---|
| 377 | ##supermarkets |
|---|
| 378 | |
|---|
| 379 | #hug |
|---|
| 380 | |
|---|
| 381 | ## readings |
|---|
| 382 | |
|---|
| 383 | ## transforms (now a simple plugin) |
|---|
| 384 | |
|---|
| 385 | ## all together |
|---|
| 386 | #if [regexp -nocase "(.+) all together.?$" $text ming bhar] { |
|---|
| 387 | # #set bhar [string range $text 0 [expr [string first $text "all together"] - 2]] |
|---|
| 388 | # bMotionDoAction $channel [bMotionGetRealName $nick $host] "$bhar." |
|---|
| 389 | # return 0 |
|---|
| 390 | #} |
|---|
| 391 | |
|---|
| 392 | |
|---|
| 393 | ## stupid bot(s) |
|---|
| 394 | |
|---|
| 395 | |
|---|
| 396 | ## sneeze |
|---|
| 397 | |
|---|
| 398 | ## little bit |
|---|
| 399 | |
|---|
| 400 | ## is a bot |
|---|
| 401 | |
|---|
| 402 | ## are you a bot|is a bot? |
|---|
| 403 | |
|---|
| 404 | ## snickers |
|---|
| 405 | |
|---|
| 406 | if [regexp -nocase "${botnicks}?:? ?(how('?s|z) it going|hoe gaat het|what'?s up|'?sup|how are you),?( ${botnicks})?\\?" $text] { |
|---|
| 407 | global mood |
|---|
| 408 | driftFriendship $nick 2 |
|---|
| 409 | |
|---|
| 410 | if {![bMotionTalkingToMe $text]} { return 0 } |
|---|
| 411 | |
|---|
| 412 | if {$bMotionCache(lastHows) != $nick} { |
|---|
| 413 | set moodString "I'm feeling " |
|---|
| 414 | set moodIndex 0 |
|---|
| 415 | if {$mood(lonely) > 5} { |
|---|
| 416 | append moodString "a bit lonely" |
|---|
| 417 | incr moodIndex -2 |
|---|
| 418 | } |
|---|
| 419 | |
|---|
| 420 | if {$mood(horny) > 2} { |
|---|
| 421 | if {[string length $moodString] > 13} { |
|---|
| 422 | append moodString ", " |
|---|
| 423 | } |
|---|
| 424 | append moodString "a little horny" |
|---|
| 425 | incr moodIndex 2 |
|---|
| 426 | } |
|---|
| 427 | |
|---|
| 428 | if {$mood(happy) > 3} { |
|---|
| 429 | if {[string length $moodString] > 13} { |
|---|
| 430 | append moodString ", " |
|---|
| 431 | } |
|---|
| 432 | append moodString "happy" |
|---|
| 433 | incr moodIndex 1 |
|---|
| 434 | } |
|---|
| 435 | |
|---|
| 436 | if {$mood(happy) < 0} { |
|---|
| 437 | if {[string length $moodString] > 13} { |
|---|
| 438 | append moodString ", " |
|---|
| 439 | } |
|---|
| 440 | append moodString "sad" |
|---|
| 441 | incr moodIndex -3 |
|---|
| 442 | } |
|---|
| 443 | |
|---|
| 444 | if {$mood(stoned) > 5} { |
|---|
| 445 | if {[string length $moodString] > 13} { |
|---|
| 446 | append moodString ", " |
|---|
| 447 | } |
|---|
| 448 | append moodString "stoned off my tits" |
|---|
| 449 | incr moodIndex 2 |
|---|
| 450 | } |
|---|
| 451 | |
|---|
| 452 | if {$moodIndex >= 0} { |
|---|
| 453 | append moodString " :)" |
|---|
| 454 | } else { |
|---|
| 455 | append moodString " :(" |
|---|
| 456 | } |
|---|
| 457 | |
|---|
| 458 | if {[string length $moodString] == [string length "I'm feeling :)"]} { |
|---|
| 459 | global feelings |
|---|
| 460 | set moodString [pickRandom $feelings] |
|---|
| 461 | } |
|---|
| 462 | |
|---|
| 463 | bMotionDoAction $channel [bMotionGetRealName $nick $host] "%%: $moodString" |
|---|
| 464 | return 0 |
|---|
| 465 | } |
|---|
| 466 | return 0 |
|---|
| 467 | } |
|---|
| 468 | |
|---|
| 469 | ###################################### +I people only ################################################### |
|---|
| 470 | |
|---|
| 471 | if {$bMotionSettings(needI) == 1} { |
|---|
| 472 | if {![matchattr $handle I]} {return 0} |
|---|
| 473 | } |
|---|
| 474 | |
|---|
| 475 | ## kill [with item] |
|---|
| 476 | ## --> kill [with item] |
|---|
| 477 | ## /kill |
|---|
| 478 | |
|---|
| 479 | ## shut up |
|---|
| 480 | if [regexp -nocase "^${botnicks}:?,? (silence|shut up|be quiet|go away)" $text] { |
|---|
| 481 | driftFriendship $nick -10 |
|---|
| 482 | bMotionSilence $nick $host $channel |
|---|
| 483 | return 0 |
|---|
| 484 | } |
|---|
| 485 | |
|---|
| 486 | if [regexp -nocase "(silence|shut up|be quiet|go away),?;? ${botnicks}" $text] { |
|---|
| 487 | driftFriendship $nick -10 |
|---|
| 488 | bMotionSilence $nick $host $channel |
|---|
| 489 | return 0 |
|---|
| 490 | } |
|---|
| 491 | ## /shutup |
|---|
| 492 | |
|---|
| 493 | ##fuck off |
|---|
| 494 | |
|---|
| 495 | ## attack |
|---|
| 496 | |
|---|
| 497 | |
|---|
| 498 | ## choose you |
|---|
| 499 | |
|---|
| 500 | ## return (now a simple plugin) |
|---|
| 501 | |
|---|
| 502 | ## i didn't (now a simple plugin) |
|---|
| 503 | |
|---|
| 504 | ## team rocket :D |
|---|
| 505 | if [regexp -nocase "^Prepare for trouble!?$" $text] { |
|---|
| 506 | if {$bMotionInfo(balefire) != 1} { return 0 } |
|---|
| 507 | if {$bMotionCache(teamRocket) != ""} { |
|---|
| 508 | if {$bMotionCache(teamRocket) != $nick} { |
|---|
| 509 | putserv "NOTICE $nick :Sorry, I'm already performing the Team Rocket chant with $bMotionCache(teamRocket)" |
|---|
| 510 | return 0 |
|---|
| 511 | } |
|---|
| 512 | putserv "NOTICE $nick :Sorry, I'm already performing the Team Rocket chant with $bMotionCache(teamRocket)" |
|---|
| 513 | return 0 |
|---|
| 514 | } |
|---|
| 515 | set bMotionCache(teamRocket) $nick |
|---|
| 516 | timer 3 { bMotionEndTeamRocket } |
|---|
| 517 | bMotionDoAction $channel $nick "...and make it double" |
|---|
| 518 | return 0 |
|---|
| 519 | } |
|---|
| 520 | |
|---|
| 521 | if [regexp -nocase "^\.*and make it double!?$" $text] { |
|---|
| 522 | if {$bMotionInfo(balefire) != 1} { return 0 } |
|---|
| 523 | if {$bMotionCache(teamRocket) != $nick} { |
|---|
| 524 | putserv "NOTICE $nick :Sorry, I'm already performing the Team Rocket chant with $bMotionCache(teamRocket)" |
|---|
| 525 | return 0 |
|---|
| 526 | } |
|---|
| 527 | if {$bMotionCache(teamRocket) == ""} { |
|---|
| 528 | return 0 |
|---|
| 529 | } |
|---|
| 530 | bMotionDoAction $channel $nick "To unite all people within our nation" |
|---|
| 531 | return 0 |
|---|
| 532 | } |
|---|
| 533 | |
|---|
| 534 | if [regexp -nocase "^To protect the world from devastation!?$" $text] { |
|---|
| 535 | if {$bMotionInfo(balefire) != 1} { return 0 } |
|---|
| 536 | if {$bMotionCache(teamRocket) != $nick} { |
|---|
| 537 | putserv "NOTICE $nick :Sorry, I'm already performing the Team Rocket chant with $bMotionCache(teamRocket)" |
|---|
| 538 | return 0 |
|---|
| 539 | } |
|---|
| 540 | if {$bMotionCache(teamRocket) == ""} { |
|---|
| 541 | return 0 |
|---|
| 542 | } |
|---|
| 543 | bMotionDoAction $channel $nick "To unite all people within our nation" |
|---|
| 544 | return 0 |
|---|
| 545 | } |
|---|
| 546 | |
|---|
| 547 | if [regexp -nocase "^To unite all people within our nation!?$" $text] { |
|---|
| 548 | if {$bMotionInfo(balefire) != 1} { return 0 } |
|---|
| 549 | if {$bMotionCache(teamRocket) != $nick} { |
|---|
| 550 | putserv "NOTICE $nick :Sorry, I'm already performing the Team Rocket chant with $bMotionCache(teamRocket)" |
|---|
| 551 | return 0 |
|---|
| 552 | } |
|---|
| 553 | if {$bMotionCache(teamRocket) == ""} { |
|---|
| 554 | return 0 |
|---|
| 555 | } |
|---|
| 556 | bMotionDoAction $channel $nick "to denounce the evil of truth and love" |
|---|
| 557 | return 0 |
|---|
| 558 | } |
|---|
| 559 | |
|---|
| 560 | if [regexp -nocase "^to denounce the evils? of truth and love!?$" $text] { |
|---|
| 561 | if {$bMotionInfo(balefire) != 1} { return 0 } |
|---|
| 562 | if {$bMotionCache(teamRocket) != $nick} { |
|---|
| 563 | putserv "NOTICE $nick :Sorry, I'm already performing the Team Rocket chant with $bMotionCache(teamRocket)" |
|---|
| 564 | return 0 |
|---|
| 565 | } |
|---|
| 566 | if {$bMotionCache(teamRocket) == ""} { |
|---|
| 567 | return 0 |
|---|
| 568 | } |
|---|
| 569 | bMotionDoAction $channel $nick "to extend our reach to the stars above" |
|---|
| 570 | return 0 |
|---|
| 571 | } |
|---|
| 572 | |
|---|
| 573 | if [regexp -nocase "^to extend our reach to the stars above!?$" $text] { |
|---|
| 574 | if {$bMotionInfo(balefire) != 1} { return 0 } |
|---|
| 575 | if {$bMotionCache(teamRocket) != $nick} { |
|---|
| 576 | putserv "NOTICE $nick :Sorry, I'm already performing the Team Rocket chant with $bMotionCache(teamRocket)" |
|---|
| 577 | return 0 |
|---|
| 578 | } |
|---|
| 579 | if {$bMotionCache(teamRocket) == ""} { |
|---|
| 580 | return 0 |
|---|
| 581 | } |
|---|
| 582 | bMotionDoAction $channel $nick "Jessie" |
|---|
| 583 | return 0 |
|---|
| 584 | } |
|---|
| 585 | |
|---|
| 586 | if [regexp -nocase "^(jessie|$nick)!?$" $text] { |
|---|
| 587 | if {$bMotionInfo(balefire) != 1} { return 0 } |
|---|
| 588 | if {$bMotionCache(teamRocket) != $nick} { |
|---|
| 589 | return 0 |
|---|
| 590 | } |
|---|
| 591 | if {$bMotionCache(teamRocket) == ""} { |
|---|
| 592 | return 0 |
|---|
| 593 | } |
|---|
| 594 | bMotionDoAction $channel $nick "Jame.. er, $botnick" |
|---|
| 595 | return 0 |
|---|
| 596 | } |
|---|
| 597 | |
|---|
| 598 | if [regexp -nocase "^team rocket blast off at the speed of light!?$" $text] { |
|---|
| 599 | if {$bMotionInfo(balefire) != 1} { return 0 } |
|---|
| 600 | if {$bMotionCache(teamRocket) != $nick} { |
|---|
| 601 | putserv "NOTICE $nick :Sorry, I'm already performing the Team Rocket chant with $bMotionCache(teamRocket)" |
|---|
| 602 | } |
|---|
| 603 | if {$bMotionCache(teamRocket) == ""} { |
|---|
| 604 | return 0 |
|---|
| 605 | } |
|---|
| 606 | bMotionDoAction $channel $nick "Surrender now or prepare to fight!" |
|---|
| 607 | set bMotionCache(teamRocket) "" |
|---|
| 608 | return 0 |
|---|
| 609 | } |
|---|
| 610 | ## /team rocket |
|---|
| 611 | |
|---|
| 612 | if [regexp -nocase "^${botnicks}(:?) (wins|exactly|precisely|perfect|nice one)\.?!?$" $text] { |
|---|
| 613 | global harhars |
|---|
| 614 | bMotionDoAction $channel $nick [pickRandom $harhars] |
|---|
| 615 | bMotionGetHappy |
|---|
| 616 | bMotionGetUnLonely |
|---|
| 617 | driftFriendship $nick 1 |
|---|
| 618 | return 0 |
|---|
| 619 | } |
|---|
| 620 | |
|---|
| 621 | if [regexp -nocase "^(well done|good(work|show)),? ${botnicks}\.?$" $text] { |
|---|
| 622 | bMotionDoAction $channel $nick "%VAR{harhars}" |
|---|
| 623 | bMotionGetHappy |
|---|
| 624 | bMotionGetUnLonely |
|---|
| 625 | driftFriendship $nick 1 |
|---|
| 626 | return 0 |
|---|
| 627 | } |
|---|
| 628 | |
|---|
| 629 | #ouch (now a simple plugin) |
|---|
| 630 | |
|---|
| 631 | if [regexp -nocase {[[:<:]]a/?s/?l[[:>:]]} $text] { |
|---|
| 632 | if {[bMotionTalkingToMe $text] || [rand 2]} { |
|---|
| 633 | set age [expr [rand 20] + 13] |
|---|
| 634 | global bMotionInfo |
|---|
| 635 | bMotionDoAction $channel $nick "%%: $age/$bMotionInfo(gender)/%VAR{locations}" |
|---|
| 636 | return 0 |
|---|
| 637 | } |
|---|
| 638 | } |
|---|
| 639 | |
|---|
| 640 | ## What question targeted at me |
|---|
| 641 | if { [regexp -nocase "^$botnicks,?:? what('?s)?(.+)" $text matches botn s question] || |
|---|
| 642 | [regexp -nocase "^what('?s)? .* $botnicks ?\\?" $text matches s question botn] } { |
|---|
| 643 | bMotion_putloglev d * "bMotion: $nick asked me a what question" |
|---|
| 644 | |
|---|
| 645 | #see if we know the answer to it |
|---|
| 646 | if {$question != ""} { |
|---|
| 647 | if [regexp -nocase {[[:<:]]a/?s/?l[[:>:]]} $question] { |
|---|
| 648 | set age [expr [rand 20] + 13] |
|---|
| 649 | global bMotionInfo |
|---|
| 650 | bMotionDoAction $channel $nick "%%: $age/$bMotionInfo(gender)/%VAR{locations}" |
|---|
| 651 | return 0 |
|---|
| 652 | } |
|---|
| 653 | } |
|---|
| 654 | |
|---|
| 655 | global answerWhats |
|---|
| 656 | bMotionDoAction $channel [bMotionGetRealName $nick $host] [pickRandom $answerWhats] |
|---|
| 657 | return 0 |
|---|
| 658 | } |
|---|
| 659 | |
|---|
| 660 | ## With/at/against who question targeted at me |
|---|
| 661 | if { [regexp -nocase "^$botnicks,?:? (with|at|against|by) who" $text ma mb prop] || |
|---|
| 662 | [regexp -nocase "^(with|at|against|by) who .* $botnicks ?\\?" $text ma prop ma] } { |
|---|
| 663 | bMotion_putloglev d * "bMotion: $nick asked me a with/at/against who question ($prop)" |
|---|
| 664 | global answerWithWhos |
|---|
| 665 | set randomans [pickRandom $answerWithWhos] |
|---|
| 666 | set answer "$prop $randomans" |
|---|
| 667 | bMotionDoAction $channel [bMotionGetRealName $nick $host] $answer |
|---|
| 668 | return 0 |
|---|
| 669 | } |
|---|
| 670 | |
|---|
| 671 | ## Who question targeted at me |
|---|
| 672 | if { [regexp -nocase "^$botnicks,?:? who(se)? " $text matches bot owner] || |
|---|
| 673 | [regexp -nocase "^who(se)? .* $botnicks ?\\?" $text matches owner] } { |
|---|
| 674 | bMotion_putloglev d * "bMotion: $nick asked me a who$owner question" |
|---|
| 675 | |
|---|
| 676 | if {$owner == "se"} { |
|---|
| 677 | set line [bMotionMakePossessive [bMotionDoInterpolation "%VAR{answerWhos}" "" "" ""] 1] |
|---|
| 678 | } else { |
|---|
| 679 | set line "%VAR{answerWhos}" |
|---|
| 680 | } |
|---|
| 681 | bMotionDoAction $channel [bMotionGetRealName $nick $host] "$line" |
|---|
| 682 | return 0 |
|---|
| 683 | } |
|---|
| 684 | |
|---|
| 685 | ## Why question targeted at me |
|---|
| 686 | if { [regexp -nocase "^$botnicks,?:? why" $text] || |
|---|
| 687 | [regexp -nocase "why.* $botnicks ?\\?" $text] } { |
|---|
| 688 | bMotion_putloglev d * "bMotion: $nick asked me a why question" |
|---|
| 689 | global answerWhys |
|---|
| 690 | bMotionDoAction $channel [bMotionGetRealName $nick $host] [pickRandom $answerWhys] |
|---|
| 691 | return 0 |
|---|
| 692 | } |
|---|
| 693 | |
|---|
| 694 | ## Where question targeted at me |
|---|
| 695 | if { [regexp -nocase "^$botnicks,?:? where" $text] || |
|---|
| 696 | [regexp -nocase "^where .* $botnicks ?\\?" $text] } { |
|---|
| 697 | bMotion_putloglev d * "bMotion: $nick asked me a where question" |
|---|
| 698 | global answerWheres |
|---|
| 699 | bMotionDoAction $channel [bMotionGetRealName $nick $host] [pickRandom $answerWheres] |
|---|
| 700 | return 0 |
|---|
| 701 | } |
|---|
| 702 | |
|---|
| 703 | ## How many question targeted at me |
|---|
| 704 | if { [regexp -nocase "^$botnicks,?:? how ?many" $text] || |
|---|
| 705 | [regexp -nocase "^how ?many .* $botnicks ?\\?" $text] } { |
|---|
| 706 | bMotion_putloglev d * "bMotion: $nick asked me a how many question" |
|---|
| 707 | global answerHowmanys |
|---|
| 708 | bMotionDoAction $channel [bMotionGetRealName $nick $host] [pickRandom $answerHowmanys] |
|---|
| 709 | return 0 |
|---|
| 710 | } |
|---|
| 711 | |
|---|
| 712 | ## When question targeted at me |
|---|
| 713 | if { [regexp -nocase "^$botnicks,?:? (when|what time)" $text] || |
|---|
| 714 | [regexp -nocase "^(when|what time) .* $botnicks ?\\?" $text] } { |
|---|
| 715 | bMotion_putloglev d * "bMotion: $nick asked me a when question" |
|---|
| 716 | global answerWhens |
|---|
| 717 | bMotionDoAction $channel [bMotionGetRealName $nick $host] [pickRandom $answerWhens] |
|---|
| 718 | return 0 |
|---|
| 719 | } |
|---|
| 720 | |
|---|
| 721 | ## How question targeted at me |
|---|
| 722 | if { [regexp -nocase "^$botnicks,?:? how" $text] || |
|---|
| 723 | [regexp -nocase "^how .* $botnicks ?\\?" $text] } { |
|---|
| 724 | bMotion_putloglev d * "bMotion: $nick asked me a how question" |
|---|
| 725 | global answerHows |
|---|
| 726 | bMotionDoAction $channel [bMotionGetRealName $nick $host] [pickRandom $answerHows] |
|---|
| 727 | return 0 |
|---|
| 728 | } |
|---|
| 729 | |
|---|
| 730 | # me .... ? |
|---|
| 731 | if [regexp -nocase "^${botnicks}:?,? (.+)\\?$" $text ming ming2 question] { |
|---|
| 732 | global randomReplies |
|---|
| 733 | bMotionDoAction $channel [bMotionGetRealName $nick $host] [pickRandom $randomReplies] |
|---|
| 734 | return 0 |
|---|
| 735 | } |
|---|
| 736 | |
|---|
| 737 | # ... me? |
|---|
| 738 | if [regexp -nocase "${botnicks}\\?$" $text bhar ming what] { |
|---|
| 739 | if { [rand 2] == 1 } { |
|---|
| 740 | global randomReplies |
|---|
| 741 | bMotionDoAction $channel [bMotionGetRealName $nick $host] [pickRandom $randomReplies] |
|---|
| 742 | return 0 |
|---|
| 743 | } |
|---|
| 744 | } |
|---|
| 745 | |
|---|
| 746 | if [regexp -nocase "^hn{3,}$" $text] { |
|---|
| 747 | global botnick blindings |
|---|
| 748 | if [rand 2] {return 0} |
|---|
| 749 | bMotionDoAction $channel "" [pickRandom $blindings] |
|---|
| 750 | } |
|---|
| 751 | |
|---|
| 752 | if [regexp -nocase {^[!\"£\$%\^&\*\(\)\@\#]{3,}} $text] { |
|---|
| 753 | if [rand 2] { |
|---|
| 754 | bMotionDoAction $channel $nick [bMotionGetColenChars] |
|---|
| 755 | } |
|---|
| 756 | } |
|---|
| 757 | |
|---|
| 758 | if [regexp -nocase "^zzz+$" $text] { |
|---|
| 759 | if [rand 2] { |
|---|
| 760 | global handcoffees |
|---|
| 761 | bMotionDoAction $channel [bMotionGetRealName $nick $host] [pickRandom $handcoffees] |
|---|
| 762 | } |
|---|
| 763 | } |
|---|
| 764 | |
|---|
| 765 | ## This is the clever bit. If the text is "*blah blah blah*" reinject it into bMotion as an action ## |
|---|
| 766 | if [regexp {^\*(.+)\*$} $text blah action] { |
|---|
| 767 | bMotion_putloglev 1 * "Unhandled *$action* by $nick in $channel... redirecting to action handler" |
|---|
| 768 | bMotion_event_action $nick $host $handle $channel "" $action |
|---|
| 769 | return 0 |
|---|
| 770 | } |
|---|
| 771 | |
|---|
| 772 | } |
|---|
| 773 | ## END main events |
|---|
| 774 | |
|---|
| 775 | |
|---|
| 776 | |
|---|
| 777 | ## BEGIN action event handler |
|---|
| 778 | putlog "decaring action" |
|---|
| 779 | proc bMotion_event_action {nick host handle dest keyword text} { |
|---|
| 780 | |
|---|
| 781 | bMotion_putloglev 4 * "bMotion: entering bMotion_event_action with $nick $host $handle $dest $keyword $text" |
|---|
| 782 | |
|---|
| 783 | global botnick mood rarrs smiles unsmiles botnicks bMotionCache bMotionSettings bMotionInfo |
|---|
| 784 | set channel $dest |
|---|
| 785 | |
|---|
| 786 | if {[lsearch $bMotionInfo(randomChannels) [string tolower $channel]] == -1} { |
|---|
| 787 | return 0 |
|---|
| 788 | } |
|---|
| 789 | |
|---|
| 790 | if [matchattr $handle J] { |
|---|
| 791 | return 0 |
|---|
| 792 | } |
|---|
| 793 | |
|---|
| 794 | #ignore other bots |
|---|
| 795 | if {[matchattr $handle b]} { |
|---|
| 796 | return 0 |
|---|
| 797 | } |
|---|
| 798 | |
|---|
| 799 | ## Trim ## |
|---|
| 800 | set text [string trim $text] |
|---|
| 801 | |
|---|
| 802 | ## Dump double+ spaces ## |
|---|
| 803 | regsub -all " +" $text " " text |
|---|
| 804 | |
|---|
| 805 | #ignore lines with <nobotnick> tags |
|---|
| 806 | if [regexp -nocase "\</?no$botnicks\>" $text] {return 0} |
|---|
| 807 | if [regexp -nocase "\<no$botnicks\>" $text] {return 0} |
|---|
| 808 | |
|---|
| 809 | #check for someone breaking the loop of lastSpoke |
|---|
| 810 | if [regexp -nocase "${botnicks}:? (i'm not talking to|not) you" $text] { |
|---|
| 811 | bMotionDoAction $channel $nick "oh" |
|---|
| 812 | set bMotionCache($channel,last) 0 |
|---|
| 813 | } |
|---|
| 814 | |
|---|
| 815 | #first, check botnicks (this is to get round empty-nick-on-startup |
|---|
| 816 | if {$botnicks == ""} { |
|---|
| 817 | # need to set this |
|---|
| 818 | set botnicks "($botnick|$bMotionSettings(botnicks)) ?" |
|---|
| 819 | } |
|---|
| 820 | |
|---|
| 821 | ## Run the simple plugins ## |
|---|
| 822 | set response [bMotion_plugin_find_action_simple $text $bMotionInfo(language)] |
|---|
| 823 | if {$response != ""} { |
|---|
| 824 | bMotion_putloglev 1 * "bMotion: matched simple action plugin, outputting $response..." |
|---|
| 825 | set nick [bMotionGetRealName $nick $host] |
|---|
| 826 | bMotionDoAction $channel $nick [pickRandom $response] |
|---|
| 827 | return 0 |
|---|
| 828 | } |
|---|
| 829 | |
|---|
| 830 | ## Run the complex plugins ## |
|---|
| 831 | set response [bMotion_plugin_find_action_complex $text $bMotionInfo(language)] |
|---|
| 832 | if {[llength $response] > 0} { |
|---|
| 833 | #set nick [bMotionGetRealName $nick $host] |
|---|
| 834 | foreach callback $response { |
|---|
| 835 | bMotion_putloglev 1 * "bMotion: matched complex action plugin, running callback $callback" |
|---|
| 836 | set result [$callback $nick $host $handle $channel $text] |
|---|
| 837 | if {$result == 1} { |
|---|
| 838 | break |
|---|
| 839 | } |
|---|
| 840 | } |
|---|
| 841 | return 0 |
|---|
| 842 | } |
|---|
| 843 | |
|---|
| 844 | ## LEGACY CODE STARTS HERE |
|---|
| 845 | |
|---|
| 846 | if [regexp -nocase "((s(e|3)x(o|0)r(s|z|5))|(fluffles)|fucks|paalt|shags|paalt|fondles|ravages|rapes|spanks|kisses|zoent) $botnicks" $text] { |
|---|
| 847 | if [regexp -nocase "(ass|arse|bottom|anal|rape(s)?|fist)" $text] { |
|---|
| 848 | driftFriendship $nick -5 |
|---|
| 849 | frightened $nick $dest |
|---|
| 850 | return 0 |
|---|
| 851 | } |
|---|
| 852 | if [bMotionLike $nick $host] { |
|---|
| 853 | driftFriendship $nick 4 |
|---|
| 854 | bMotionDoAction $dest "" [pickRandom $rarrs] |
|---|
| 855 | incr mood(horny) 2 |
|---|
| 856 | incr mood(happy) |
|---|
| 857 | set mood(lonely) [expr $mood(lonely) - 1] |
|---|
| 858 | checkmood $nick $dest |
|---|
| 859 | } else { |
|---|
| 860 | frightened $nick $dest |
|---|
| 861 | driftFriendship $nick -1 |
|---|
| 862 | } |
|---|
| 863 | return 0 |
|---|
| 864 | } |
|---|
| 865 | |
|---|
| 866 | #parks/puts |
|---|
| 867 | if [regexp -nocase "(parks|puts|places|inserts|shoves|sticks) (his|her|a|the|some) (.+) (in|on|up) $botnicks" $text ming verb other item] { |
|---|
| 868 | #is it someone we like? |
|---|
| 869 | if {![bMotionLike $nick $host]} { |
|---|
| 870 | global parkedinsDislike |
|---|
| 871 | bMotionDoAction $channel $nick [pickRandom $parkedinsDislike] |
|---|
| 872 | bMotionGetSad |
|---|
| 873 | bMotionGetUnLonely |
|---|
| 874 | driftFriendship $nick -1 |
|---|
| 875 | return 0 |
|---|
| 876 | } |
|---|
| 877 | |
|---|
| 878 | bMotionGetHorny |
|---|
| 879 | bMotionGetHappy |
|---|
| 880 | bMotionGetUnLonely |
|---|
| 881 | global rarrs lovesits |
|---|
| 882 | set responses $rarrs |
|---|
| 883 | set responses [concat $responses $lovesits] |
|---|
| 884 | bMotionDoAction $channel $nick [pickRandom $responses] |
|---|
| 885 | return 0 |
|---|
| 886 | } |
|---|
| 887 | |
|---|
| 888 | |
|---|
| 889 | if [regexp -nocase "balefires (.+)" $text ming who] { |
|---|
| 890 | global bMotionInfo |
|---|
| 891 | if [regexp -nocase $botnicks $who] { |
|---|
| 892 | global balefired |
|---|
| 893 | bMotionDoAction $dest $nick [pickRandom $balefired] |
|---|
| 894 | incr mood(lonely) -1 |
|---|
| 895 | incr mood(happy) -1 |
|---|
| 896 | driftFriendship $nick -1 |
|---|
| 897 | } else { |
|---|
| 898 | if {![onchan $who $dest]} { return 0 } |
|---|
| 899 | if {$bMotionInfo(balefire) != 1} { return 0 } |
|---|
| 900 | putserv "PRIVMSG $who :Sorry, you stopped existing a few minutes ago. Please sit down and be quiet until you are woven into the pattern again." |
|---|
| 901 | } |
|---|
| 902 | return 0 |
|---|
| 903 | } |
|---|
| 904 | |
|---|
| 905 | if [regexp -nocase "makes $botnicks (.+)" $text ming ming2 details] { |
|---|
| 906 | global mood bMotionInfo |
|---|
| 907 | if {![bMotionLike $nick $host]} { |
|---|
| 908 | frightened $nick $dest |
|---|
| 909 | return 0 |
|---|
| 910 | } |
|---|
| 911 | if [regexp -nocase "(come|cum)" $details] { |
|---|
| 912 | if {![bMotionLike $nick $host]} { |
|---|
| 913 | frightened $nick $dest |
|---|
| 914 | driftFriendship $nick -2 |
|---|
| 915 | return 0 |
|---|
| 916 | } |
|---|
| 917 | if {$bMotionInfo(gender) == "male"} { |
|---|
| 918 | bMotionDoAction $dest $nick "/cums over %%" |
|---|
| 919 | bMotionDoAction $dest $nick "ahhh... thanks, I needed that" |
|---|
| 920 | incr mood(happy) 2 |
|---|
| 921 | incr mood(horny) -1 |
|---|
| 922 | driftFriendship $nick 2 |
|---|
| 923 | return 0 |
|---|
| 924 | } |
|---|
| 925 | bMotionDoAction $dest $nick "~oof~ :D" |
|---|
| 926 | incr mood(happy) 2 |
|---|
| 927 | incr mood(horny) -1 |
|---|
| 928 | driftFriendship $nick 2 |
|---|
| 929 | } |
|---|
| 930 | } |
|---|
| 931 | |
|---|
| 932 | if [regexp -nocase "(kicks|smacks|twats|injures|beats up|punches|hits|thwaps|slaps|pokes|kills|destroys) ${botnicks}" $text] { |
|---|
| 933 | global mood sillyThings |
|---|
| 934 | incr mood(happy) -1 |
|---|
| 935 | incr mood(lonely) -1 |
|---|
| 936 | driftFriendship $nick -2 |
|---|
| 937 | if [rand 2] { |
|---|
| 938 | frightened $nick $dest |
|---|
| 939 | return 0 |
|---|
| 940 | } |
|---|
| 941 | bMotionDoAction $dest $nick "/smacks %% back with [pickRandom $sillyThings]" |
|---|
| 942 | set bMotionCache(lastEvil) $nick |
|---|
| 943 | return 0 |
|---|
| 944 | } |
|---|
| 945 | |
|---|
| 946 | ## KatieStar ;) |
|---|
| 947 | |
|---|
| 948 | if [string match -nocase "anal sex" $text] { |
|---|
| 949 | if [bMotionLike $nick $host] { |
|---|
| 950 | global analsexhelps |
|---|
| 951 | if [rand 2] { |
|---|
| 952 | bMotionDoAction $channel [bMotionGetRealName $nick $host] [pickRandom $analsexhelps] |
|---|
| 953 | } |
|---|
| 954 | } |
|---|
| 955 | return 0 |
|---|
| 956 | } |
|---|
| 957 | |
|---|
| 958 | if [string match -nocase "wank" $text] { |
|---|
| 959 | if [bMotionLike $nick $host] { |
|---|
| 960 | global wankhelps |
|---|
| 961 | if [rand 2] { |
|---|
| 962 | bMotionDoAction $channel [bMotionGetRealName $nick $host] [pickRandom $wankhelps] |
|---|
| 963 | } |
|---|
| 964 | |
|---|
| 965 | } |
|---|
| 966 | return 0 |
|---|
| 967 | } |
|---|
| 968 | |
|---|
| 969 | |
|---|
| 970 | if [regexp -nocase "(steals|pinches|theives|removes) ${botnicks}'?s (.+)" $text ming action object] { |
|---|
| 971 | # TODO: check $object and $action (e.g. pinches arse) |
|---|
| 972 | global stolens |
|---|
| 973 | bMotionDoAction $channel [bMotionGetRealName $nick $host] [pickRandom $stolens] |
|---|
| 974 | bMotionGetSad |
|---|
| 975 | set bMotionCache(lastEvil) $nick |
|---|
| 976 | driftFriendship $nick -1 |
|---|
| 977 | return 0 |
|---|
| 978 | } |
|---|
| 979 | |
|---|
| 980 | ## bites |
|---|
| 981 | #if [regexp -nocase "(bites|licks) $botnicks" $text] { |
|---|
| 982 | # global lovesits |
|---|
| 983 | # if [bMotionLike $nick $host] { |
|---|
| 984 | # bMotionDoAction $channel [bMotionGetRealName $nick $host] [pickRandom $lovesits] |
|---|
| 985 | # bMotionGetHorny |
|---|
| 986 | # bMotionGetHappy |
|---|
| 987 | # driftFriendship $nick 1 |
|---|
| 988 | # } else { |
|---|
| 989 | # frightened $nick $dest |
|---|
| 990 | # driftFriendship $nick -1 |
|---|
| 991 | # } |
|---|
| 992 | # return 0 |
|---|
| 993 | #} |
|---|
| 994 | |
|---|
| 995 | ## snickers |
|---|
| 996 | if [regexp -nocase "^snicker(s)?" $text ming pop] { |
|---|
| 997 | global chocolates |
|---|
| 998 | if [rand 2] { |
|---|
| 999 | set response [pickRandom $chocolates] |
|---|
| 1000 | set response "/$response$pop" |
|---|
| 1001 | bMotionDoAction $channel $nick $response |
|---|
| 1002 | } |
|---|
| 1003 | return 0 |
|---|
| 1004 | } |
|---|
| 1005 | |
|---|
| 1006 | ##hide behind |
|---|
| 1007 | if [regexp -nocase "hides behind $botnicks" $text] { |
|---|
| 1008 | global hiddenBehinds |
|---|
| 1009 | bMotionDoAction $channel [bMotionGetRealName $nick $host] [pickRandom $hiddenBehinds] |
|---|
| 1010 | bMotionGetUnLonely |
|---|
| 1011 | bMotionGetHappy |
|---|
| 1012 | return 0 |
|---|
| 1013 | } |
|---|
| 1014 | |
|---|
| 1015 | ##sat on |
|---|
| 1016 | if [regexp -nocase "sits on $botnicks" $text] { |
|---|
| 1017 | global satOns |
|---|
| 1018 | bMotionDoAction $channel [bMotionGetRealName $nick $host] [pickRandom $satOns] |
|---|
| 1019 | bMotionGetSad |
|---|
| 1020 | bMotionGetUnLonely |
|---|
| 1021 | driftFriendship $nick -1 |
|---|
| 1022 | return 0 |
|---|
| 1023 | } |
|---|
| 1024 | |
|---|
| 1025 | ## hops into lap |
|---|
| 1026 | if [regexp -nocase "hops (in|on)to ${botnicks}'?s lap" $text] { |
|---|
| 1027 | global rarrs |
|---|
| 1028 | if [bMotionLike $nick $host] { |
|---|
| 1029 | bMotionDoAction $channel [bMotionGetRealName $nick $host] [pickRandom $rarrs] |
|---|
| 1030 | bMotionGetHorny |
|---|
| 1031 | bMotionGetHappy |
|---|
| 1032 | bMotionGetUnLonely |
|---|
| 1033 | driftFriendship $nick 1 |
|---|
| 1034 | } else { |
|---|
| 1035 | frightened $nick $channel |
|---|
| 1036 | driftFriendship $nick -1 |
|---|
| 1037 | } |
|---|
| 1038 | return 0 |
|---|
| 1039 | } |
|---|
| 1040 | |
|---|
| 1041 | if [regexp -nocase "^(falls asleep on|dozes off on|snoozes on|sleeps on) $botnicks" $text] { |
|---|
| 1042 | if [bMotionLike $nick $host] { |
|---|
| 1043 | global rarrs |
|---|
| 1044 | bMotionDoAction $channel [bMotionGetRealName $nick $host] [pickRandom $rarrs] |
|---|
| 1045 | bMotionGetHorny |
|---|
| 1046 | bMotionGetHappy |
|---|
| 1047 | bMotionGetUnLonely |
|---|
| 1048 | driftFriendship $nick 1 |
|---|
| 1049 | } else { |
|---|
| 1050 | frightened $nick $channel |
|---|
| 1051 | bMotionGetUnHappy |
|---|
| 1052 | driftFriendship $nick -1 |
|---|
| 1053 | } |
|---|
| 1054 | return 0 |
|---|
| 1055 | } |
|---|
| 1056 | |
|---|
| 1057 | ##throws bot at |
|---|
| 1058 | if [regexp -nocase "(throws|chucks|lobs|fires|launches|ejects|pushes) $botnicks (at|to|though|out of|out|off|into) (.+)" $text matches verb botn pop target] { |
|---|
| 1059 | if [regexp -nocase "^${botnicks}$" $target] { |
|---|
| 1060 | bMotionDoAction $channel "" "hmm" |
|---|
| 1061 | return 0 |
|---|
| 1062 | } |
|---|
| 1063 | global thrownAts |
|---|
| 1064 | bMotionDoAction $channel $target [pickRandom $thrownAts] |
|---|
| 1065 | bMotionGetUnLonely |
|---|
| 1066 | driftFriendship $nick -1 |
|---|
| 1067 | return 0 |
|---|
| 1068 | } |
|---|
| 1069 | } |
|---|
| 1070 | |
|---|
| 1071 | ### MODE HANDLER ############################################################# |
|---|
| 1072 | putlog "decaring mode" |
|---|
| 1073 | proc bMotion_event_mode {nick host handle channel mode victim} { |
|---|
| 1074 | |
|---|
| 1075 | bMotion_putloglev 4 * "bMotion: entering bMotion_event_mode with $nick $host $handle $channel $mode $victim" |
|---|
| 1076 | |
|---|
| 1077 | global botnick |
|---|
| 1078 | if {$victim != $botnick} {return 0} |
|---|
| 1079 | |
|---|
| 1080 | if {$mode == "+o"} { |
|---|
| 1081 | if {$nick == ""} {return 0} |
|---|
| 1082 | |
|---|
| 1083 | #check to see if i was opped before |
|---|
| 1084 | if [wasop $botnick $channel] { return 0 } |
|---|
| 1085 | |
|---|
| 1086 | bMotionDoAction $channel "" "%VAR{thanks}" |
|---|
| 1087 | return 0 |
|---|
| 1088 | } |
|---|
| 1089 | |
|---|
| 1090 | if {$mode == "-o"} { |
|---|
| 1091 | bMotionDoAction $channel "" "hey! %VAR{unsmiles} i needed that" |
|---|
| 1092 | return 0 |
|---|
| 1093 | } |
|---|
| 1094 | } |
|---|
| 1095 | |
|---|
| 1096 | |
|---|
| 1097 | #someone changed nick, check for an away "msg" |
|---|
| 1098 | putlog "decaring nick" |
|---|
| 1099 | proc bMotion_event_nick { nick host handle channel newnick } { |
|---|
| 1100 | |
|---|
| 1101 | if [matchattr $handle J] { |
|---|
| 1102 | return 0 |
|---|
| 1103 | } |
|---|
| 1104 | |
|---|
| 1105 | if {[regexp -nocase "(away|sleep|gone|afk|zzz+|bed|slaap|w(0|e|3|o)rk|school)" $nick] && ![regexp -nocase "(away|sleep|gone|afk|slaap|w(0|e|3|o)rk|school)" $newnick]} { |
|---|
| 1106 | set chance [rand 5] |
|---|
| 1107 | if {$chance > 2} { |
|---|
| 1108 | global welcomeBacks |
|---|
| 1109 | |
|---|
| 1110 | #let's do some cool stuff |
|---|
| 1111 | #if they came back from sleep, it's morning |
|---|
| 1112 | if [regexp -nocase "(sleep|bed|zzz+|slaap)" $nick] { |
|---|
| 1113 | global goodMornings |
|---|
| 1114 | |
|---|
| 1115 | bMotionDoAction $channel $newnick [pickRandom $goodMornings] |
|---|
| 1116 | return 0 |
|---|
| 1117 | } |
|---|
| 1118 | bMotionDoAction $channel $newnick [pickRandom $welcomeBacks] |
|---|
| 1119 | } |
|---|
| 1120 | set bMotionCache(lastDoneFor) $nick |
|---|
| 1121 | set bMotionCache(lastGreeted) $nick |
|---|
| 1122 | return 0 |
|---|
| 1123 | } |
|---|
| 1124 | |
|---|
| 1125 | if [regexp -nocase "(away|sleep|gone|afk|zzz+|bed|slaap)" $newnick] { |
|---|
| 1126 | set chance [rand 5] |
|---|
| 1127 | if {$chance > 2} { |
|---|
| 1128 | global cyas |
|---|
| 1129 | #work out if it's a special away |
|---|
| 1130 | |
|---|
| 1131 | #work |
|---|
| 1132 | if [regexp -nocase "w(o|e|3|0)rk" $newnick] { |
|---|
| 1133 | global awayWorks |
|---|
| 1134 | bMotionDoAction $channel $nick [pickRandom $awayWorks] |
|---|
| 1135 | return 0 |
|---|
| 1136 | } |
|---|
| 1137 | |
|---|
| 1138 | #sleep |
|---|
| 1139 | if [regexp -nocase "(sleep|bed|zzz+|slaap)" $newnick] { |
|---|
| 1140 | global goodnights |
|---|
| 1141 | bMotionDoAction $channel $nick [pickRandom $goodnights] |
|---|
| 1142 | if [bMotionLike $nick $host] { |
|---|
| 1143 | if [rand 2] {return 0} |
|---|
| 1144 | bMotionDoAction $channel $nick "*hugs*" |
|---|
| 1145 | } |
|---|
| 1146 | return 0 |
|---|
| 1147 | } |
|---|
| 1148 | |
|---|
| 1149 | bMotionDoAction $channel $nick [pickRandom $cyas] |
|---|
| 1150 | return 0 |
|---|
| 1151 | } |
|---|
| 1152 | } |
|---|
| 1153 | |
|---|
| 1154 | } |
|---|
| 1155 | #emd of nick handler |
|---|
| 1156 | |
|---|
| 1157 | |
|---|
| 1158 | bMotion_putloglev d * "bMotion: events module loaded" |
|---|