Class: Isaac::EventContext
- Inherits:
-
Object
- Object
- Isaac::EventContext
- Defined in:
- lib/isaac.rb
Instance Attribute Summary collapse
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#commands ⇒ Object
Returns the value of attribute commands.
-
#match ⇒ Object
Returns the value of attribute match.
-
#message ⇒ Object
Returns the value of attribute message.
-
#nick ⇒ Object
Returns the value of attribute nick.
-
#userhost ⇒ Object
Returns the value of attribute userhost.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ EventContext
constructor
A new instance of EventContext.
-
#invite(channel, *nicks) ⇒ Object
Invite nicks to channel invite “#awesome_channel”, “arnie” invite “#awesome_channel”, “arnie”, “brigitte”.
-
#join(*channels) ⇒ Object
Join channel(s): join “#awesome_channel” join “#rollercoaster”, “#j-lo”.
-
#kick(channel, nick, comment = nil) ⇒ Object
Kick nick from channel, with optional comment.
-
#msg(recipient, text) ⇒ Object
Send a message to nick/channel.
-
#newnick(nickname) ⇒ Object
Change nickname.
-
#notice(recipient, text) ⇒ Object
Send a notice to nick/channel.
-
#part(*channels) ⇒ Object
Part channel(s): part “#awesome_channel” part “#rollercoaster”, “#j-lo”.
-
#raw(command) ⇒ Object
Send a raw IRC message.
-
#topic(channel, topic) ⇒ Object
Change topic of channel.
Constructor Details
#initialize(args = {}) ⇒ EventContext
Returns a new instance of EventContext.
267 268 269 270 |
# File 'lib/isaac.rb', line 267 def initialize(args = {}) args.each {|k,v| instance_variable_set("@#{k}",v)} @commands = [] end |
Instance Attribute Details
#channel ⇒ Object
Returns the value of attribute channel.
266 267 268 |
# File 'lib/isaac.rb', line 266 def channel @channel end |
#commands ⇒ Object
Returns the value of attribute commands.
266 267 268 |
# File 'lib/isaac.rb', line 266 def commands @commands end |
#match ⇒ Object
Returns the value of attribute match.
266 267 268 |
# File 'lib/isaac.rb', line 266 def match @match end |
#message ⇒ Object
Returns the value of attribute message.
266 267 268 |
# File 'lib/isaac.rb', line 266 def end |
#nick ⇒ Object
Returns the value of attribute nick.
266 267 268 |
# File 'lib/isaac.rb', line 266 def nick @nick end |
#userhost ⇒ Object
Returns the value of attribute userhost.
266 267 268 |
# File 'lib/isaac.rb', line 266 def userhost @userhost end |
Instance Method Details
#invite(channel, *nicks) ⇒ Object
Invite nicks to channel
invite "#awesome_channel", "arnie"
invite "#awesome_channel", "arnie", "brigitte"
315 316 317 |
# File 'lib/isaac.rb', line 315 def invite(channel, *nicks) nicks.each {|nick| raw("INVITE #{nick} #{channel}")} end |
#join(*channels) ⇒ Object
Join channel(s):
join "#awesome_channel"
join "#rollercoaster", "#j-lo"
290 291 292 |
# File 'lib/isaac.rb', line 290 def join(*channels) channels.each {|channel| raw("JOIN #{channel}")} end |
#kick(channel, nick, comment = nil) ⇒ Object
Kick nick from channel, with optional comment.
302 303 304 305 |
# File 'lib/isaac.rb', line 302 def kick(channel, nick, comment=nil) comment = " :#{comment}" if comment raw("KICK #{channel} #{nick}#{comment}") end |
#msg(recipient, text) ⇒ Object
Send a message to nick/channel.
278 279 280 |
# File 'lib/isaac.rb', line 278 def msg(recipient, text) raw("PRIVMSG #{recipient} :#{text}") end |
#newnick(nickname) ⇒ Object
Change nickname
320 321 322 |
# File 'lib/isaac.rb', line 320 def newnick(nickname) raw("NICK #{nickname}") end |
#notice(recipient, text) ⇒ Object
Send a notice to nick/channel
283 284 285 |
# File 'lib/isaac.rb', line 283 def notice(recipient, text) raw("PRIVMSG #{recipient} :#{text}") end |
#part(*channels) ⇒ Object
Part channel(s):
part "#awesome_channel"
part "#rollercoaster", "#j-lo"
297 298 299 |
# File 'lib/isaac.rb', line 297 def part(*channels) channels.each {|channel| raw("PART #{channel}")} end |
#raw(command) ⇒ Object
Send a raw IRC message.
273 274 275 |
# File 'lib/isaac.rb', line 273 def raw(command) @commands << command end |
#topic(channel, topic) ⇒ Object
Change topic of channel.
308 309 310 |
# File 'lib/isaac.rb', line 308 def topic(channel, topic) raw("TOPIC #{channel} :#{topic}") end |