Module: IrcMachine::Commands

Included in:
Session
Defined in:
lib/irc_machine/commands.rb

Instance Method Summary collapse

Instance Method Details

#join(channel, key = nil) ⇒ Object



21
22
23
# File 'lib/irc_machine/commands.rb', line 21

def join(channel, key = nil)
  raw "JOIN #{channel}".tap { |c| c << " #{key}" if key }
end

#msg(to, text) ⇒ Object



33
34
35
# File 'lib/irc_machine/commands.rb', line 33

def msg(to, text)
  raw "PRIVMSG #{to} :#{text}"
end

#nick(nick) ⇒ Object



17
18
19
# File 'lib/irc_machine/commands.rb', line 17

def nick(nick)
  raw "NICK #{nick}"
end

#part(channel) ⇒ Object



25
26
27
# File 'lib/irc_machine/commands.rb', line 25

def part(channel)
  raw "PART #{channel}"
end

#password(password) ⇒ Object



13
14
15
# File 'lib/irc_machine/commands.rb', line 13

def password(password)
  raw "PASS #{password}"
end

#quit(reason) ⇒ Object



29
30
31
# File 'lib/irc_machine/commands.rb', line 29

def quit(reason)
  raw "QUIT :#{reason}"
end

#raw(raw) ⇒ Object



4
5
6
7
# File 'lib/irc_machine/commands.rb', line 4

def raw(raw)
  puts ">> #{raw}"
  irc_connection.send_data "#{raw}\r\n"
end

#user(user, name) ⇒ Object



9
10
11
# File 'lib/irc_machine/commands.rb', line 9

def user(user, name)
  raw "USER #{user} 8 * :#{name}"
end