Class: Teamspeak::Channel

Inherits:
Base
  • Object
show all
Defined in:
lib/teamspeak.rb

Instance Attribute Summary

Attributes inherited from Base

#api, #attributes, #parent, #server

Instance Method Summary collapse

Methods inherited from Base

create, #initialize, #save, #update_attributes

Constructor Details

This class inherits a constructor from Teamspeak::Base

Instance Method Details

#all_clientsObject


119
120
121
# File 'lib/teamspeak.rb', line 119

def all_clients
	clients | channels.collect(&:all_clients).flatten
end

#channelsObject


127
128
129
# File 'lib/teamspeak.rb', line 127

def channels
	@channels ||= Teamspeak::Association.new(server.channels.reject{|channel| channel.pid != cid}, :class => Teamspeak::Channel, :parent => parent)
end

#clientsObject


115
116
117
# File 'lib/teamspeak.rb', line 115

def clients
	@clients ||= Teamspeak::Association.new(server.clients.reject{|client| client.cid != cid}, :class => Teamspeak::Client, :parent => parent)
end

#cmd(command, *args) ⇒ Object


135
136
137
# File 'lib/teamspeak.rb', line 135

def cmd(command, *args)
	server.cmd(command, args[0])
end

#empty?Boolean

Returns:

  • (Boolean)

123
124
125
# File 'lib/teamspeak.rb', line 123

def empty?
	all_clients.empty?
end

#msg(message = '') ⇒ Object


131
132
133
# File 'lib/teamspeak.rb', line 131

def msg(message = '')
	cmd(:sendtextmessage, :targetmode => TEXTMESSAGETARGET_CHANNEL, :target => cid, :msg => message)
end