Skip to content

Instantly share code, notes, and snippets.

@Syfaro
Created May 30, 2014 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Syfaro/dcf348ab13127f056b3a to your computer and use it in GitHub Desktop.
Save Syfaro/dcf348ab13127f056b3a to your computer and use it in GitHub Desktop.
Joins the FurCast IRC channel, spams ":3"s, then leaves and randomly joins again sometime in the next day
irc = require 'irc'
client = new irc.Client 'irc.ircfox.net', 'FoxBot'
String.prototype.repeat = (num) ->
return new Array(num + 1).join this
randomNumber = (min, max) ->
return Math.floor Math.random() * (max - min) + min
assault = (channel) ->
console.log "Assaulting #{channel}"
client.join channel
times = randomNumber 0, 15
count = 0
console.log "Speaking #{times} times"
speak = ->
if count > times
client.part channel
waitTime = randomNumber 1000, 1000 * 60 * 60 * 24
console.log "Waiting #{waitTime}ms before next assault"
setTimeout ->
assault channel
, waitTime
return
repeat = randomNumber 1, 10
console.log "Repeating #{repeat} times"
client.say channel, ':3 '.repeat repeat
count++
messageDelay = randomNumber 1000, 5000
console.log "Waiting #{messageDelay}ms before next message"
setTimeout speak, messageDelay
speak()
client.on 'error', (err) ->
console.error err
client.on 'registered', ->
assault '#furcast'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment