Obedient Bot

By Geckat on Jan 05, 2013

Load this into your bot, and she will do as you command, either through notices (using the ! prefix) or through messages on a channel that she is on (using, of course, the phrase "would you kindly?").

Kick someone: !kick [chan] [user] [reason] || [botnick], would you kindly kick [user] for [reason]?
*User must have the appropriate authority in the channel, or feel the wrath of the bot.

Say something: !say [chan] [thing] || [botnick], would you kindly say [thing]?

Change the topic: !topic [chan] [topic] || [botnick], would you kindly change the topic to [topic]
*Anyone can change the topic, and their name is appended to the end of the topic so if you don't like it you can wring their scrawny neck later.

Notice someone: !tell [user] [thing] || [botnick], would you kindly tell/ask [user] that/to/if [thing]?
*The notice for the msg command changes depending on the command, which is great for freaking out bot-phobic users.

Leave the channel: !die [chan] || [botnick], would you kindly get stepped on by a Big Daddy?
*User must have the appropriate authority in the channel, or feel the wrath of the bot. And yes, this whole script is one giant BioShock reference.

Override auto-rejoin: !kb [chan] [user] [reason] || [botnick], would you kindly get rid of [user] for [reason]?
*User must have the appropriate authority in the channel, or feel the wrath of the bot.

Join a channel: !join [chan] || [botnick], would you kindly join [chan]?

Change nick: !nick [nick] || [botnick], would you kindly change your name/nick to [nick]?

Toggle flood control: !flood [chan] on/off || [botnick], would you kindly turn flood control on/off?
*Anyone can turn flood on, but only ops can turn it off. The default is [5t]:10. Change it in the script, whatever.

Mute someone: !mute [chan] [user] ([time]) || [botnick], would you kindly mute [user] (for [time] seconds?)
*User must have the appropriate authority in the channel, or feel the wrath of the bot. The timer is optional, and is measured in seconds. Users with +o or +h will also have that removed (and given back once the timer is up), so you can still mess with those who thought they were safe simply because you've deigned to share with them a meagre sample of your awesome power.

Voice someone: !voice [chan] [user] || [botnick], would you kindly give voice to [user]?
*Must have appropriate authority in the channel.

Do stuff: !do [chan] [thing] || [botnick], would you kindly [thing]?
*I'm very proud of the msg command's return on this one. It and "would you kindly tell" return perfect English nearly all the time. I knew my syntax classes would come in handy someday.

Note that in all of these, the question mark is optional, and really doesn't affect anything. Also, in the msg command, people can refer to your bot as either its present nick, or "MB", which is my channel's nickname for its bot. Feel free to remove it, change it, or to start calling your bot "MB". Enjoy.

on *:NOTICE:!*:*: {
  if ($1 == !kick) {
    if $nick isop $2 || ($nick ishop $2) {
      .kick $2 $3 $4-
    }    
    else {
      .kick $2 $nick Nice try.
    }
  }
  elseif ($1 == !say) {
    msg $2 $3-
  }
  elseif ($1 == !topic) {
    topic $2 $3- ( $+ $nick $+ )
  }
  elseif ($1 == !tell) {
    notice $2 $3-
  }
  elseif ($1 == !die) {
    if ($nick isop $2) {
      mode $2 -m
      leave $2 *squish*
    }
    else {
      kick $2 $nick I'm not THAT stupid.
    }
  }
  elseif ($1 == !kban) {
    if $nick isop $2 {  
      mode $2 +b $3
      .kick $2 $3 $4-
      .timer 1 3 mode $2 -b $3
    }
    else {
      kick $2 $nick lolno
    }
  }
  elseif ($1 == !join) {
    join $2
  }
  elseif ($1 == !nick) {
    nick $2
  }
  elseif ($1 == !flood on) {
    .mode $2 +f [5t]:10
  }
  elseif ($1 == !flood off) {
    if $nick isop $2 {
      .mode $2 -f
    }
    else {
      .kick $2 $nick How about no.
    }
  }
  elseif ($1 == !mute) {
    mode $2 +m
    if ($nick isop $2) || ($nick ishop $2) {
      mode $2 -v $3
      if ($3 isop $2) {
        mode $2 -o $3
        var %op 1
      }
      if ($3 ishop $2) {
        mode $2 -h $3
        var %hop 1
      }
    }
    else {
      mode $2 -v $nick.
    }
    if ($4) {
      var %mutetimer $4
      .timer 1 %mutetimer .mode $2 +vv $3 $nick
      if (%op == 1) {
        .timer 1 %mutetimer .mode $2 +o $3
      }
      if (%hop == 1) {
        .timer 1 %mutetimer .mode $2 +h $3
      }
    }
  }
  elseif ($1 == !voice) {
    if ($nick isop $2) || ($nick ishop $2) {
      mode $2 +v $3
    }
  }
  elseif ($1 == !do) {
    describe $2 $3-
  }
}

******************

on *:TEXT:*:*: {
  if ($1-4 == $me would you kindly) || ($1-4 == MB would you kindly) { msg $chan I'm not doing anything until you lern2english and insert a comma into that vocative. }
  if ($1-4 == $me $+ , would you kindly) || ($1-4 == MB, would you kindly) {

    var %bioshock $5- $+ .
    var %bioshock $replace(%bioshock,?,.,yourself,herself,your,her,you're,I'm,#,#,I'm,you're,$chr(32) $+ my $+ $chr(32),$chr(32) $+ $nick $+ 's $+ $chr(32),$chr(32) $+ me $+ $chr(32),$chr(32) $+ $nick $+ $chr(32),$chr(32) $+ me.,$chr(32) $+ $nick $+ .,$chr(32) $+ I $+ $chr(32),$chr(32) $+ $nick $+ $chr(32),$chr(32) $+ you $+ $chr(32),$chr(32) $+ I $+ $chr(32),I aren't,I'm not,I are,I am,$nick am,$nick is)
    var %bioshock $left(%bioshock,-1)

    if ($5 == kick) {
      if ($nick !isop $chan) && ($nick !ishop $chan) {
        kick $chan $nick You're not the boss of me!
      }
      else {
        kick $chan $gettok($6,1,63) $replace($upper($left($8,1)) $+ $right($8-,-1),?,.)
      }
    }

    elseif ($5 == say) {
      msg $chan $replace($upper($left($6,1)) $+ $right($6-,-1),?,.)
    }

    elseif ($5-8 == change the topic to) {
      topic $chan $9-
    }

    elseif ($5 == tell) || ($5 == ask) {
      var %bioshock $replace(%bioshock,his,your,her,your,he,you,she,you,him,you,her,you)
      if ($7 == that) { notice $6 $nick would like you to know that $replace($gettok(%bioshock,4-,32),?,.) }
      elseif ($7 == to) { notice $6 $nick would like you to $replace($gettok(%bioshock,4-,32),?,.) }
      elseif ($7 == if) { notice $6 $nick would like to know if $replace($gettok(%bioshock,4-,32),?,.) }
      else { notice $6 $replace($gettok(%bioshock,3-,32),?,.) }
    }

    elseif ($5- == get stepped on by a Big Daddy*) {
      if ($nick !isop $chan) { kick $chan $nick I'm not that stupid. }
      else { leave $chan *squish* }
    }

    elseif ($5-7 == get rid of) {
      if $nick isop $chan {  
        mode $chan +b $gettok($8,1,63)
        kick $chan $gettok($8,1,63) $replace($upper($left($10,1)) $+ $right($10-,-1),?,.)
        .timer 1 3 mode $chan -b $gettok($8,1,63)
      }
      else {
        kick $chan $nick lolno
      }
    }

    elseif ($5 == join) { join $gettok($6,1,63) }

    elseif ($5-8 == change your name to) || ($5-8 == change your nick to) { nick $gettok($9,1,63) }

    elseif ($5 == mute) {
      if ($nick isop $chan) || ($nick ishop $chan) {
        mode $chan -v $gettok($6,1,63)
        if ($6 isop $chan) {
          mode $chan -o $gettok($6,1,63)
          var %op 1
        }
        if ($6 ishop $chan) {
          mode $chan -h $gettok($6,1,63)
          var %hop 1
        }
      }
      else {
        mode $chan -v $nick.
      }
      if ($7 == for) {
        var %mutetimer $8
        .timer 1 %mutetimer .mode $chan +vv $gettok($6,1,63) $nick
        if (%op == 1) {
          .timer 1 %mutetimer .mode $chan +o $gettok($6,1,63)
        }
        if (%hop == 1) {
          .timer 1 %mutetimer .mode $chan +h $gettok($6,1,63)
        }
      }
    }

    elseif ($5-7 == give voice to) {
      if ($nick isop $chan) || ($nick ishop $chan) {
        mode $chan +v $8
      }
      else {
        msg $chan Nah.
      }
    }

    elseif ($5- == turn flood control on*) {
      .mode $chan +f [5t]:10
    }

    elseif ($5- == turn flood control off*) {
      if $nick isop $chan {
        .mode $chan -f
      }
      else {
        .kick $chan $nick How about no.
      }
    }

    else {

      var %bioshock $chr(32) $+ %bioshock
      var %bioshock $right($replace(%bioshock,$chr(32) $+ go $+ $chr(32),$chr(32) $+ goe $+ $chr(32),$chr(32) $+ do $+ $chr(32),$chr(32) $+ doe $+ $chr(32)),-1)
      if ($right($5-,1) != .) && ($right($5-,1) != ?) && ($right($5-,1) != !) {
        if (!$6) { var %bioshock $5 $+ s. }
        else {
        var %bioshock $gettok(%bioshock,1,32) $+ s $deltok(%bioshock,1,32) $+ . }
      }
      else {
        if (!$6) { var %bioshock $replace($5,?,s.) }
        else {
        var %bioshock $gettok(%bioshock,1,32) $+ s $deltok(%bioshock,1,32) }
      }

      describe $chan %bioshock
    }
  }
}

Comments

Sign in to comment.
NickLeStrange   -  Jan 10, 2013

Oooh. I do like the way that you implemented the natural way of speaking to the bot. Nice idea of combining the two. GJ.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.