Random Insult Bot

By DarkCoder on Jan 30, 2010

My random insult bot, its very simple to use. Load it in your remote (Alt R). And then make another person type @Insult To message the channel or ./!Insult to notice the person. It comes with flood control allowing one insult per every 9 seconds and every insult it updates its internal insult list.

«(09:37:34)» {- +Blanker -} @insult
«(09:37:35)» {- +Co0kiebot -} ¤Insult¤ 2 You're so stupid, when you saw an NC-17 (under 17 not admitted) sign at the movie theatre, you went home and found 16 friends.
«(09:37:43)» {- +Blanker -} LOL.
«(09:38:59)» {- +Blanker -} @insult 3
«(09:39:00)» {- +DissBot -} ¤Insult¤ 3 You must be an experiment in Artificial Stupidity.
«(09:39:19)» {- +Blanker -} @insult 999
«(09:39:20)» -Dissbot- The insult you have requested does not exist! There are currently 4 insults!

on *:load:insult
on $*:TEXT:/^[.!@](Insult|Diss)/Si:#: {
  if (!$timer(insult $+ $nick)) {
    if ($2) && (!$read(insult.txt, $2)) { notice $nick The insult you have requested does not exist! There are currently $lines(insult.txt) insults! | halt }
    .timerinsult $+ $nick 1 9 noop
    insult
    var %x $iif($2,$v1,$rand(1,$lines(insult.txt)))
    $iif(@* iswm $1,Msg $chan,notice $nick) 7¤4Insult7¤15 $+(12«15,%x,12»,14) $read(insult.txt, %x)
  }
}
alias insult {
  if ($sock(Insult)) sockclose insult
  sockopen Insult www.randominsults.net 80
}
on *:sockopen:Insult: {
  sockwrite -nt $sockname GET / HTTP/1.1
  sockwrite -nt $sockname Host: www.randominsults.net
  sockwrite -nt $sockname $crlf
}
on *:sockread:insult: {
  if (!$sockerr) {
    sockread %insult
    if (<i> isin %insult) {
      write insult.txt $remove(%insult,<i>,</i>)
      echo -a %insult
      sockclose $sockname
    }
  }
  else echo -a Socket error: $sockerr
}

Comments

Sign in to comment.
flazzid   -  Feb 01, 2014

i am making one of these right now for twitch and heres my idea of it

 on *:TEXT:!insult*:#: {

  ;check for != not equal, if anyone else but you they get flood.
  if ($nick != botownernamehere) {
    if ((%flood!insult) || ($($+(%,flood!insult.,$nick),2))) { return }
    set -u5 %flood!insult On
    set -u15 %flood!insult. $+ $nick On
  }

  if ($0 < 2) {
    msg $chan The proper way to use this bot is !insult <#> <user>
  }
  else {
    if ($2 <= $lines(insults.txt))  {

      ; this is checking to see if request is not less than 0
      if ($2 > 0 ) {

        set %user $3
        set %messsageline $2
        set %message $read(insults.txt, n, %messsageline)
        set %spot $calc($pos(%message, *) - 1 )

        if (%spot = -1) {
          ;no * found so full message is ok. and no need to check vs white list.
          set %message $read(insults.txt, n, %messsageline)
        }
        else {
          set %leftmessage $left(%message, %spot)
          set %rightmessage $right(%message, $calc($len(%message) - $calc(%spot + 1)))

          if ($3 = $ulist(%user,whitelist,1)) { 
            ;user on white list fix message to $nick not what they wanted.
            set %message %leftmessage $nick %rightmessage
          }
          else {
            ;name not on white list ok to display as requested.
            set %message %leftmessage $3 %rightmessage
          }
        }
        ; send message to chat.
        msg $chan %message

      }
      else {
        msg $chan You cannot input negative numbers
      }
    }
    ; this is if they pick a request larger than the total number of insults.
    else {
      msg $chan You exceeded the total number of insults of $lines(insults.txt) $+ .
    }
  }
}  
 Respond  
Linuxuser   -  Jan 31, 2010

it's ok.

 Respond  
napa182   -  Jan 30, 2010

lmao

 Respond  
Jethro   -  Jan 30, 2010

Yeah using txt is an insult to the socket. lol

 Respond  
napa182   -  Jan 30, 2010

if you are using a socket why use a txt file?

 Respond  
Ghost-writer   -  Jan 30, 2010

You could remove the echo -a, but other than that its fast and pretty good :.

 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.