Class: CeilingCat::Plugin::About
- Inherits:
-
Base
- Object
- Base
- CeilingCat::Plugin::About
show all
- Defined in:
- lib/ceiling_cat/plugins/about.rb
Instance Attribute Summary
Attributes inherited from Base
#event
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#body, #body_without_command, #body_without_nick, #body_without_nick_or_command, #commands, #handle, #initialize, #pluralize, #reply, #room, store, #store, #user, #words
Class Method Details
.commands ⇒ Object
4
5
6
7
8
9
|
# File 'lib/ceiling_cat/plugins/about.rb', line 4
def self.commands
[{:command => "plugins", :description => "List of installed plugins.", :method => "list_plugins"},
{:command => "commands", :description => "List of available commands.", :method => "list_commands", :public => true},
{:command => "users", :description => "List of registered in the room.", :method => "list_users", :public => true},
{:command => "guests", :description => "List of guests in the room.", :method => "list_guests", :public => true}]
end
|
.description ⇒ Object
11
12
13
|
# File 'lib/ceiling_cat/plugins/about.rb', line 11
def self.description
"About the currently running Ceiling Cat"
end
|
.name ⇒ Object
15
16
17
|
# File 'lib/ceiling_cat/plugins/about.rb', line 15
def self.name
"About"
end
|
.public? ⇒ Boolean
19
20
21
|
# File 'lib/ceiling_cat/plugins/about.rb', line 19
def self.public?
true
end
|
Instance Method Details
#list_commands ⇒ Object
27
28
29
30
31
|
# File 'lib/ceiling_cat/plugins/about.rb', line 27
def list_commands
messages = room.available_commands(user.is_registered?) messages << "Run commands with '![command]' or '#{room.me.name}: [command]'"
reply messages
end
|
#list_guests ⇒ Object
42
43
44
45
46
47
48
49
|
# File 'lib/ceiling_cat/plugins/about.rb', line 42
def list_guests
guests = room.users_in_room(:type => "guest")
if guests.size > 0
reply "#{room.list_of_users_in_room(:type => "guest")} #{pluralize(guests.size, "is a", "are")} #{pluralize(guests.size, "guest")}."
else
reply "There are no guests in the room at this time."
end
end
|
#list_plugins ⇒ Object
23
24
25
|
# File 'lib/ceiling_cat/plugins/about.rb', line 23
def list_plugins
reply room.plugin_descriptions(user.is_registered?)
end
|
#list_users ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'lib/ceiling_cat/plugins/about.rb', line 33
def list_users
members = room.users_in_room(:type => "member")
if members.size > 0
reply "#{room.list_of_users_in_room(:type => "member")} #{pluralize(members.size, "is a", "are")} #{pluralize(members.size, "registered user")}."
else
reply "There are no registered users in the room at this time."
end
end
|