Skip to content

Instantly share code, notes, and snippets.

@czbaker
Created January 16, 2015 16:49
Show Gist options
  • Save czbaker/d57fe000de62b4cc92e3 to your computer and use it in GitHub Desktop.
Save czbaker/d57fe000de62b4cc92e3 to your computer and use it in GitHub Desktop.
class WASDbot
# Bot object constructor
constructor: (params) ->
@params = params
@doc = null
@client = new IRC params
# Connect to a network
connect: ->
@client.connect
# Say something to a channel
say: (msg, chan) ->
if typeof chan is "undefined" then chan = @params.channels[0]
@client.say chan, msg
return
W20150116-11:49:44.294(-5)? (STDERR) ReferenceError: WASDbot is not defined
W20150116-11:49:44.294(-5)? (STDERR) at theChannels.forEach.chan (server/server.coffee:10:38)
W20150116-11:49:44.294(-5)? (STDERR) at [object Object]._.extend.forEach (packages/mongo/mongo_driver.js:921:1)
W20150116-11:49:44.294(-5)? (STDERR) at [object Object].Cursor.(anonymous function) [as forEach] (packages/mongo/mongo_driver.js:768:1)
W20150116-11:49:44.294(-5)? (STDERR) at server/server.coffee:9:10
W20150116-11:49:44.295(-5)? (STDERR) at server/server.coffee:1:1
W20150116-11:49:44.295(-5)? (STDERR) at /home/misutowolf/projects/wasdtwitch/.meteor/local/build/programs/server/boot.js:175:10
W20150116-11:49:44.295(-5)? (STDERR) at Array.forEach (native)
W20150116-11:49:44.295(-5)? (STDERR) at Function._.each._.forEach (/home/misutowolf/.meteor/packages/meteor-tool/.1.0.38.ieqxkv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20150116-11:49:44.295(-5)? (STDERR) at /home/misutowolf/projects/wasdtwitch/.meteor/local/build/programs/server/boot.js:86:5
@CLIENTS = []
# Build channel list
chanList = []
userList = []
theChannels = IRCChannels.find()
theNames = Meteor.users.find({}, {fields: {profile: 1}})
theNames.forEach (doc) ->
@CLIENTS[doc.profile.name] = new WASDbot
server: ''
port: 6667
nick: "wasdboss"
realname: "wasdboss"
username: "wasdboss"
theChannels.forEach (doc) ->
chan = doc.channel
chanList.push chan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment