butler 1.8.1 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.txt +212 -0
- data/{README → README.txt} +0 -0
- data/Rakefile +16 -11
- data/bin/botcontrol +35 -14
- data/data/butler/dialogs/create.rb +29 -40
- data/data/butler/dialogs/create_config.rb +1 -1
- data/data/butler/dialogs/dir.rb +13 -0
- data/data/butler/dialogs/en/create.yaml +24 -10
- data/data/butler/dialogs/en/dir.yaml +5 -0
- data/data/butler/dialogs/en/help.yaml +28 -11
- data/data/butler/dialogs/en/quickcreate.yaml +14 -0
- data/data/butler/dialogs/help.rb +16 -4
- data/data/butler/dialogs/quickcreate.rb +49 -0
- data/data/butler/plugins/core/access.rb +211 -0
- data/data/butler/plugins/core/logout.rb +11 -11
- data/data/butler/plugins/core/plugins.rb +23 -41
- data/data/butler/plugins/dev/bleakhouse.rb +46 -0
- data/data/butler/plugins/games/roll.rb +1 -1
- data/data/butler/plugins/operator/deop.rb +15 -20
- data/data/butler/plugins/operator/devoice.rb +14 -20
- data/data/butler/plugins/operator/limit.rb +56 -21
- data/data/butler/plugins/operator/op.rb +15 -20
- data/data/butler/plugins/operator/voice.rb +15 -20
- data/data/butler/plugins/service/define.rb +3 -3
- data/data/butler/plugins/service/more.rb +40 -0
- data/data/butler/plugins/util/cycle.rb +1 -1
- data/data/butler/plugins/util/load.rb +5 -5
- data/data/butler/plugins/util/pong.rb +3 -2
- data/lib/access/privilege.rb +17 -0
- data/lib/access/role.rb +33 -2
- data/lib/access/savable.rb +6 -0
- data/lib/access/yamlbase.rb +1 -2
- data/lib/butler/bot.rb +40 -7
- data/lib/butler/debuglog.rb +17 -0
- data/lib/butler/dialog.rb +1 -1
- data/lib/butler/irc/{channels.rb → channellist.rb} +2 -2
- data/lib/butler/irc/client.rb +60 -79
- data/lib/butler/irc/client/filter.rb +12 -0
- data/lib/butler/irc/client/listener.rb +55 -0
- data/lib/butler/irc/client/listenerlist.rb +69 -0
- data/lib/butler/irc/hostmask.rb +31 -16
- data/lib/butler/irc/message.rb +3 -3
- data/lib/butler/irc/parser.rb +2 -2
- data/lib/butler/irc/parser/rfc2812.rb +2 -6
- data/lib/butler/irc/socket.rb +12 -6
- data/lib/butler/irc/string.rb +4 -0
- data/lib/butler/irc/user.rb +0 -6
- data/lib/butler/irc/{users.rb → userlist.rb} +2 -2
- data/lib/butler/irc/whois.rb +6 -0
- data/lib/butler/plugin.rb +48 -14
- data/lib/butler/plugin/configproxy.rb +20 -0
- data/lib/butler/plugin/mapper.rb +308 -24
- data/lib/butler/plugin/matcher.rb +3 -1
- data/lib/butler/plugin/more.rb +65 -0
- data/lib/butler/plugin/onhandlers.rb +4 -4
- data/lib/butler/plugin/trigger.rb +4 -2
- data/lib/butler/plugins.rb +1 -1
- data/lib/butler/session.rb +11 -0
- data/lib/butler/version.rb +1 -1
- data/lib/cloptions.rb +1 -1
- data/lib/diagnostics.rb +20 -0
- data/lib/dialogline.rb +1 -1
- data/lib/durations.rb +19 -6
- data/lib/event.rb +8 -5
- data/lib/installer.rb +10 -3
- data/lib/ostructfixed.rb +11 -0
- data/lib/ruby/kernel/daemonize.rb +1 -2
- data/test/butler/plugin/mapper.rb +46 -0
- metadata +28 -11
- data/CHANGELOG +0 -44
- data/data/butler/plugins/core/privilege.rb +0 -103
data/CHANGELOG.txt
ADDED
@@ -0,0 +1,212 @@
|
|
1
|
+
= Butler2
|
2
|
+
|
3
|
+
=== 28th Nov, 2007
|
4
|
+
* Butler 1.8.2 (rev #436)
|
5
|
+
* bin/botcontrol:
|
6
|
+
* Added quickcreate
|
7
|
+
* Added 'dir' command
|
8
|
+
* Added -v/--verbose flag for start
|
9
|
+
* Added -d/--debug flag for start, sets $DEBUG
|
10
|
+
* Added fixes for bleakhouse support and problems with outdated ruby versions (fastthread)
|
11
|
+
* Fixed a message
|
12
|
+
* Fixed calling botcontrol without arguments
|
13
|
+
* Fixed wrong CLOptions declaration
|
14
|
+
* Removed -/--help flags in favor of the help command
|
15
|
+
* data/butler/dialogs:
|
16
|
+
* Added quickcreate
|
17
|
+
* Quickcreate now creates default_role
|
18
|
+
* Create is now thorough
|
19
|
+
* Added dialogs for 'dir' command
|
20
|
+
* Updated help
|
21
|
+
* data/butler/plugins:
|
22
|
+
* core/access.rb:
|
23
|
+
* Added, management of your users and privileges
|
24
|
+
* core/logout.rb:
|
25
|
+
* Refactored
|
26
|
+
* core/plugins.rb:
|
27
|
+
* Improved
|
28
|
+
* dev/bleakhouse.rb:
|
29
|
+
* Added
|
30
|
+
* games/roll.rb:
|
31
|
+
* Fixed rolling dice (dice had 0-(n-1) eyes instead of 1-n)
|
32
|
+
* operator/limit.rb:
|
33
|
+
* Now functional
|
34
|
+
* operator/*:
|
35
|
+
* Overhauled, using maps now
|
36
|
+
* service/define.rb:
|
37
|
+
* Uses 'more' now
|
38
|
+
* Small fix
|
39
|
+
* Adapted to new html of googles result page
|
40
|
+
* service/more.rb:
|
41
|
+
* Added, to provide access to "more" data in user sessions
|
42
|
+
* util/cycle.rb:
|
43
|
+
* Fixed a bug introduced by a newly added parameter to the on_part OnHandler
|
44
|
+
* util/load.rb:
|
45
|
+
* Uses metadata instead of trigger method
|
46
|
+
* Fixed a bug with OS X (used , instead of . for %CPU float)
|
47
|
+
* Changed output
|
48
|
+
* util/pong.rb:
|
49
|
+
* Uses metadata instead of trigger method
|
50
|
+
* lib:
|
51
|
+
* access/privilege.rb:
|
52
|
+
* Added #inspect to Privilege and Privileges
|
53
|
+
* access/roles.rb:
|
54
|
+
* Added #inspect to Role and Roles
|
55
|
+
* Added #description=, #description, #privileges and #roles to Role
|
56
|
+
* access/savable.rb:
|
57
|
+
* Added Savable#delete
|
58
|
+
* access/yamlbase.rb:
|
59
|
+
* Small fixes
|
60
|
+
* butler/bot.rb:
|
61
|
+
* Added debug/raw-logging of socket ops (read/write)
|
62
|
+
* Added #session to Butler::IRC::User
|
63
|
+
* Added a timeout for the on_quit event messages to plugins
|
64
|
+
* Added load path <bot>/lib
|
65
|
+
* Sends now on_login, on_disconnect and on_quit events
|
66
|
+
* Refactored for change from Users/Channels to UserList/ChannelList
|
67
|
+
* butler/debuglog.rb:
|
68
|
+
* Added
|
69
|
+
* butler/irc/client.rb:
|
70
|
+
* Improved documentation
|
71
|
+
* Fixed on_disconnect
|
72
|
+
* Fixed initialize (no longer ignores on_disconnect block)
|
73
|
+
* butler/irc/socket.rb:
|
74
|
+
* Better diagnostics when trying to write to an unconnected socket
|
75
|
+
* butler/irc/hostmask.rb:
|
76
|
+
* Fixed dummy state (is now functional)
|
77
|
+
* Improved documentation
|
78
|
+
* butler/irc/hostmask.rb:
|
79
|
+
* Added comment
|
80
|
+
* butler/irc/client.rb:
|
81
|
+
* Added license info
|
82
|
+
* Refactored Listeners
|
83
|
+
* butler/irc/client*:
|
84
|
+
* Moved from client.rb to own files, added ListenerList
|
85
|
+
* butler/irc/message.rb:
|
86
|
+
* Fixed documentation
|
87
|
+
* butler/irc/parser/rfc2812.rb:
|
88
|
+
* Fixed FIXMEs
|
89
|
+
* butler/irc/parser.rb:
|
90
|
+
* Refactored for change from Users/Channels to UserList/ChannelList
|
91
|
+
* butler/irc/socket.rb:
|
92
|
+
* Added #mode
|
93
|
+
* Deleted obsolete FIXME comment
|
94
|
+
* butler/irc/string.rb:
|
95
|
+
* Added String#same_nick?
|
96
|
+
* butler/irc/whois:
|
97
|
+
* Moved from client.rb to own file
|
98
|
+
* butler/plugin.rb:
|
99
|
+
* Added exceptions for invalid triggers/maps
|
100
|
+
* Fixed comments to reflect change from Users/Channels to UserList/ChannelList
|
101
|
+
* Initialize @mapping_type (avoid warning)
|
102
|
+
* #answer now uses More
|
103
|
+
* #answer_with_lead added
|
104
|
+
* Now prefixes answers with nicknames
|
105
|
+
* butler/plugin.rb:
|
106
|
+
* Added methods to intercept on_login, on_disconnect and on_quit events
|
107
|
+
* butler/plugin/configproxy.rb:
|
108
|
+
* Added #synchronize
|
109
|
+
* Improved documentation
|
110
|
+
* butler/plugin/mapper.rb:
|
111
|
+
* Complete rewrite
|
112
|
+
* butler/plugin/mapper.rb:
|
113
|
+
* Forgot to remove a debug output
|
114
|
+
* butler/plugin/mapper.rb:
|
115
|
+
* Fixed several bugs in the implementation
|
116
|
+
* butler/plugin/mapper.rb:
|
117
|
+
* Refactored
|
118
|
+
* butler/plugin/onhandlers.rb:
|
119
|
+
* Improved on_part
|
120
|
+
* Improved on_kick
|
121
|
+
* Improved on_kill
|
122
|
+
* Improved on_kline
|
123
|
+
* butler/plugin/mapper.rb:
|
124
|
+
* Included Comparable
|
125
|
+
* Added a constant for the priority
|
126
|
+
* Refactored for new priority rule (higher priority first)
|
127
|
+
* Respects that @mapping_type is already initialized
|
128
|
+
* Another set of fixes, also removed some debug outputs
|
129
|
+
* Fixed #inspect
|
130
|
+
* Fixed #<=>
|
131
|
+
* Fixed a bug in the regex generation code
|
132
|
+
* Deleted obsolete FIXME comment
|
133
|
+
* butler/plugin/matcher.rb:
|
134
|
+
* Included Comparable
|
135
|
+
* Refactored for new priority rule (higher priority first)
|
136
|
+
* butler/plugin/more.rb:
|
137
|
+
* Added
|
138
|
+
* butler/plugin/trigger.rb:
|
139
|
+
* Added a constant for the priority
|
140
|
+
* Fixed #<=>
|
141
|
+
* butler/plugins.rb:
|
142
|
+
* Plugins#identify now tests for complete filename, so 'oad' won't identify load.rb
|
143
|
+
* butler/session.rb:
|
144
|
+
* Added
|
145
|
+
* cloptions.rb:
|
146
|
+
* Fixed exception message
|
147
|
+
* diagnostics.rb:
|
148
|
+
* Added
|
149
|
+
* dialogline.rb:
|
150
|
+
* Deleted obsolete FIXME comments
|
151
|
+
* durations.rb:
|
152
|
+
* Added Kernel#second, #minute, #hour, #day, #week
|
153
|
+
* Removed Numeric#second, #minute, #hour, #day, #week
|
154
|
+
* installer.rb:
|
155
|
+
* Can now determine home paths on win using win32/etc gem
|
156
|
+
* ostructfixed.rb:
|
157
|
+
* Added OpenStruct#__hash__
|
158
|
+
* ruby/kernel/daemonize.rb:
|
159
|
+
* Removed fixmes and changed umode to 0066
|
160
|
+
* CHANGELOG, NEWS, README and TODO now all have .txt suffix
|
161
|
+
* website updated
|
162
|
+
* Renamed Butler::IRC::Channels to Butler::IRC::ChannelList
|
163
|
+
* Renamed Butler::IRC::Users to Butler::IRC::UserList
|
164
|
+
* Deleted obsolete channels.rb and users.rb (now in channellist.rb and userlist.rb)
|
165
|
+
* Rakefile
|
166
|
+
* Adapted for the new .txt suffixes
|
167
|
+
* Moved some requires that have dependencies to the tasks
|
168
|
+
* Added tests for lib/butler/plugin/mapper.rb
|
169
|
+
* core/privileges.rb replaced by the superior core/access.rb plugin
|
170
|
+
|
171
|
+
=== 27th Oct, 2007
|
172
|
+
* Butler 1.8.1 (rev #328)
|
173
|
+
* botcontrol
|
174
|
+
* New flag -l (lowercased L) overrides config and connects locally.
|
175
|
+
* Setup now allows to set botcontrol up for another user
|
176
|
+
* Fixed permissions of directories created for a user
|
177
|
+
* Log now uses logger instead of log_device, changes due to that in:
|
178
|
+
* lib/butler.rb
|
179
|
+
* lib/butler/bot.rb
|
180
|
+
* lib/butler/irc/socket.rb
|
181
|
+
* lib/butler/plugin.rb
|
182
|
+
* lib/irc/client.rb
|
183
|
+
* lib/log/comfort.rb
|
184
|
+
* lib/butler/irc/client.rb:
|
185
|
+
* Adapted to new Commands requiring specification of command-sets
|
186
|
+
* Added #load_command_set
|
187
|
+
* lib/butler/irc/parser/rfc2812.rb: Added, moved rfc2812 commands to it.
|
188
|
+
* lib/butler/irc/parser/generic.rb:
|
189
|
+
* moved rfc2812 commands to rfc2812.rb
|
190
|
+
* Added 396 RPL_HIDDENHOST
|
191
|
+
* lib/butler/irc/parser/commands.rb:
|
192
|
+
* Now loads only command-sets as specified
|
193
|
+
* Added #load, to post-load command-sets
|
194
|
+
* Added logging
|
195
|
+
* Added a warning if matching of a message fails
|
196
|
+
* lib/butler/irc/user.rb: Added #force_update.
|
197
|
+
* lib/butler/irc/parser.rb:
|
198
|
+
* Fixed logging of ParseErrors (forgot to initialize_details)
|
199
|
+
* Adapted to new Commands requiring specification of command-sets
|
200
|
+
* lib/configuration.rb: Changed separator from . to / to increase consistence.
|
201
|
+
* lib/log.rb: More documentation.
|
202
|
+
* lib/log/comfort.rb: Added #log_origin
|
203
|
+
* lib/log/entry.rb: Supports origin now.
|
204
|
+
* lib/butler.rb: Fixed a bug (::start wouldn't pass on the options param)
|
205
|
+
* lib/irc/client.rb: Now uses options[:server] if available
|
206
|
+
* lib/ruby/exception/detailed.rb: Hardened against misuse.
|
207
|
+
* lib/butler/irc/client.rb: Fixed a bug (forgot to include Log::Comfort)
|
208
|
+
* Rakefile: Added :website_docs task.
|
209
|
+
* README: updated.
|
210
|
+
|
211
|
+
=== 7th Oct, 2007
|
212
|
+
* Initial release of Butler2. Butler 1.8.x series is the alpha series of Butler2.
|
data/{README → README.txt}
RENAMED
File without changes
|
data/Rakefile
CHANGED
@@ -1,10 +1,13 @@
|
|
1
|
-
$LOAD_PATH.unshift("lib")
|
1
|
+
$LOAD_PATH.unshift(File.expand_path("lib"))
|
2
2
|
|
3
3
|
# This Rakefile makes use of some task taken from Hoe, a gem by Ryan Davis.
|
4
4
|
|
5
|
+
begin
|
6
|
+
require 'rubygems'
|
7
|
+
rescue LoadError
|
8
|
+
warn "No rubygems present"
|
9
|
+
end
|
5
10
|
require 'ostructfixed'
|
6
|
-
require 'rubyforge'
|
7
|
-
require 'rubygems'
|
8
11
|
require 'rbconfig'
|
9
12
|
require 'rake'
|
10
13
|
require 'rake/clean'
|
@@ -24,7 +27,7 @@ require File.join(File.dirname(__FILE__), 'lib', 'butler', 'version')
|
|
24
27
|
RDOC_OPTS = [
|
25
28
|
'--quiet',
|
26
29
|
'--title', 'Butler library API',
|
27
|
-
'--main', 'README',
|
30
|
+
'--main', 'README.txt',
|
28
31
|
'--charset', 'utf-8',
|
29
32
|
'--inline-source',
|
30
33
|
'--tab-width', '2',
|
@@ -44,7 +47,7 @@ CLEAN.include [
|
|
44
47
|
'**/.DS_Store', '**/._*',
|
45
48
|
]
|
46
49
|
PKG_FILES =
|
47
|
-
%w[CHANGELOG LICENSE.txt GPL.txt README Rakefile] +
|
50
|
+
%w[CHANGELOG.txt LICENSE.txt GPL.txt README.txt Rakefile] +
|
48
51
|
%w[bin/botcontrol] +
|
49
52
|
Dir.glob("{data,conf,lib,test}/**/*")
|
50
53
|
LOCAL_PATHS = {}
|
@@ -58,8 +61,8 @@ LOCAL_PATHS['strings'] = "#{LOCAL_PATHS['data']}/strings"
|
|
58
61
|
LOCAL_PATHS['plugins'] = "#{LOCAL_PATHS['data']}/plugins"
|
59
62
|
#LOCAL_PATHS['config'] = "#{Config::CONFIG['sysconfdir']}/butler"
|
60
63
|
LOCAL_PATHS['pids'] = "#{Config::CONFIG['localstatedir']}/run/butler"
|
61
|
-
CHANGES = "See CHANGELOG"
|
62
|
-
DESC = "
|
64
|
+
CHANGES = "See CHANGELOG.txt"
|
65
|
+
DESC = "Butler 1.8.2, 3rd alpha release of butler2."
|
63
66
|
|
64
67
|
GemSpec = Gem::Specification.new do |s|
|
65
68
|
s.homepage = HOMEPATH
|
@@ -72,7 +75,7 @@ GemSpec = Gem::Specification.new do |s|
|
|
72
75
|
s.platform = Gem::Platform::RUBY
|
73
76
|
s.required_ruby_version = '>= 1.8.0'
|
74
77
|
s.has_rdoc = true
|
75
|
-
s.extra_rdoc_files = %w[README CHANGELOG GPL.txt LICENSE.txt]
|
78
|
+
s.extra_rdoc_files = %w[README.txt CHANGELOG.txt GPL.txt LICENSE.txt]
|
76
79
|
s.summary = "Butler - the IRC bot with class"
|
77
80
|
s.description = s.summary
|
78
81
|
s.files = PKG_FILES
|
@@ -87,10 +90,10 @@ end
|
|
87
90
|
RDOC = Rake::RDocTask.new do |rdoc|
|
88
91
|
rdoc.rdoc_dir = 'doc/rdoc'
|
89
92
|
rdoc.options += RDOC_OPTS
|
90
|
-
rdoc.main = "README"
|
93
|
+
rdoc.main = "README.txt"
|
91
94
|
rdoc.rdoc_files.add [
|
92
|
-
'README',
|
93
|
-
'CHANGELOG',
|
95
|
+
'README.txt',
|
96
|
+
'CHANGELOG.txt',
|
94
97
|
'GPL.txt',
|
95
98
|
'LICENSE.txt',
|
96
99
|
'lib/**/*.rb'
|
@@ -242,6 +245,8 @@ task :website => [:website_generate, :website_upload] # , :publish_docs
|
|
242
245
|
|
243
246
|
desc 'Package and upload the release to rubyforge.'
|
244
247
|
task :release => [:clean, :package] do |t|
|
248
|
+
require 'rubyforge'
|
249
|
+
|
245
250
|
pkg = "pkg/#{GEM_NAME}-#{VERS}"
|
246
251
|
|
247
252
|
#if $DEBUG then
|
data/bin/botcontrol
CHANGED
@@ -9,7 +9,10 @@
|
|
9
9
|
|
10
10
|
|
11
11
|
begin
|
12
|
-
require 'rubygems'
|
12
|
+
require 'rubygems' # if rubygems is installed, you most likely want it be used
|
13
|
+
rescue LoadError => e; end
|
14
|
+
begin
|
15
|
+
require 'fastthread' # fixes potential bugs
|
13
16
|
rescue LoadError => e; end
|
14
17
|
begin
|
15
18
|
require 'butler'
|
@@ -26,10 +29,12 @@ begin
|
|
26
29
|
require 'time'
|
27
30
|
require 'yaml'
|
28
31
|
|
32
|
+
require 'bleak_house' if $BLEAK_HOUSE
|
33
|
+
|
29
34
|
require 'pp' # FIXME
|
30
35
|
rescue LoadError => e
|
31
|
-
puts "\e[31m\e[43mWarning, can't run botcontrol\e[0m\nYour installation is incomplete. Your
|
32
|
-
"installation is missing the file #{e.message.sub(/.*? -- /, '')}."
|
36
|
+
puts "\e[31m\e[43mWarning, can't run botcontrol\e[0m\nYour installation is incomplete. Your" \
|
37
|
+
"ruby-installation is missing the file #{e.message.sub(/.*? -- /, '')}."
|
33
38
|
puts "Backtrace:", *e.backtrace
|
34
39
|
exit
|
35
40
|
end
|
@@ -45,6 +50,7 @@ options = {}
|
|
45
50
|
options["backup"] = CLOptions.new("[botname] [backupname] [directory]")
|
46
51
|
options["config"] = CLOptions.new("[botname]")
|
47
52
|
options["create"] = CLOptions.new("[botname]")
|
53
|
+
options["dir"] = CLOptions.new("dirname botname")
|
48
54
|
options["delete"] = CLOptions.new("[botname]")
|
49
55
|
options["help"] = CLOptions.new("[command]")
|
50
56
|
options["info"] = CLOptions.new("[user]")
|
@@ -54,26 +60,27 @@ options["log"] = CLOptions.new("[botname]") {
|
|
54
60
|
o '-F', '--no-find', 'TEXT', :no_find, "List only entries that don't contain TEXT"
|
55
61
|
o '-g', '--grep', 'PATTERN', :grep, "List only entries that match PATTERN"
|
56
62
|
o '-G', '--no-grep', 'PATTERN', :no_grep, "List only entries that don't match PATTERN"
|
57
|
-
o '-
|
58
|
-
o '-h', '--help', nil, :help, "Display this help"
|
63
|
+
o '-h', '--head', 'COUNT', :head, "List the first COUNT entries"
|
59
64
|
o '-l', '--level', 'LEVEL, ...', :level, "List only entries of LEVEL"
|
60
65
|
o '-L', '--not-level', 'LEVEL, ...', :no_level, "List only entries not of LEVEL"
|
61
66
|
# o '-o', '--out', 'FORMAT', :format, "Print entries using FORMAT"
|
62
67
|
# o '-p', '--page', 'NUMBER', :page, "Show NUMBER entries per page"
|
63
68
|
o '-s', '--start-date', 'START_DATE', :start_date, "List only entries after START_DATE"
|
64
|
-
o '-
|
69
|
+
o '-t', '--tail', 'COUNT', :tail, "List the last COUNT entries"
|
65
70
|
}
|
66
71
|
options["list"] = CLOptions.new("[user]")
|
72
|
+
options["quickcreate"] = CLOptions.new("[botname]")
|
67
73
|
options["rename"] = CLOptions.new("[botname] [newname]")
|
68
74
|
options["start"] = CLOptions.new("[botname]") {
|
69
75
|
o '-c', '--channels', 'CHANNEL, ...', :channels, "Join CHANNELS instead of configured"
|
70
|
-
o '-
|
76
|
+
o '-d', '--debug', nil, :debug, "Activate raw logging and log debug messages."
|
71
77
|
o '-i', '--interactive', "Don't deamonize, lets the bot run interactively in shell."
|
72
78
|
o '-n', '--nick', 'NICK', :nick, "Use NICK instead of configured"
|
73
79
|
o '-p', '--port', 'PORT', :port, "Connect at PORT instead of configured"
|
74
80
|
o '-r', '--remote', 'PORT', :remote_port, "Start remote control server and bind to PORT"
|
75
81
|
o '-l', '--local', nil, :local, "Don't connect to configured server:port but to 127.0.0.1:6667"
|
76
82
|
o '-s', '--server', 'SERVER', :server, "Connect to SERVER instead of the configured."
|
83
|
+
o '-v', '--verbose', nil, :verbose, "Sets $VERBOSE."
|
77
84
|
o '-w', '--warnings', "Will enable warnings on stderr."
|
78
85
|
}
|
79
86
|
options["setup"] = CLOptions.new("[user]")
|
@@ -81,14 +88,10 @@ options["stop"] = CLOptions.new("[botname]")
|
|
81
88
|
options["sync_plugins"] = CLOptions.new("[botname] [user]")
|
82
89
|
options.each { |name, opt| opt.application_name "#{File.basename($0)} #{name}" }
|
83
90
|
|
84
|
-
command = ARGV.shift.downcase
|
91
|
+
command = (ARGV.shift || "interactive").downcase
|
85
92
|
opt = options[command].parse if options[command]
|
86
93
|
|
87
94
|
case command
|
88
|
-
when nil
|
89
|
-
botcontrol.discuss("create_config", false, :user => nil)
|
90
|
-
botcontrol.discuss("interactive")
|
91
|
-
|
92
95
|
when "backup"
|
93
96
|
botcontrol.discuss("create_config", false, :user => nil)
|
94
97
|
botcontrol.discuss("backup", false,
|
@@ -109,6 +112,10 @@ case command
|
|
109
112
|
botcontrol.discuss("create_config", false, :user => nil)
|
110
113
|
botcontrol.discuss("create", false, :name => opt.argv.botname)
|
111
114
|
|
115
|
+
when "dir"
|
116
|
+
botcontrol.discuss("create_config", false, :user => nil)
|
117
|
+
botcontrol.discuss("dir", false, :dirname => opt.argv.dirname, :botname => opt.argv.botname)
|
118
|
+
|
112
119
|
when "delete"
|
113
120
|
botcontrol.discuss("create_config", false, :user => nil)
|
114
121
|
botcontrol.discuss("delete", false, :name => opt.argv.botname)
|
@@ -122,6 +129,10 @@ case command
|
|
122
129
|
when "info"
|
123
130
|
botcontrol.discuss("info", false, :user => opt.argv.user)
|
124
131
|
|
132
|
+
when "interactive"
|
133
|
+
botcontrol.discuss("create_config", false, :user => nil)
|
134
|
+
botcontrol.discuss("interactive")
|
135
|
+
|
125
136
|
when "log"
|
126
137
|
botcontrol.discuss("create_config", false, :user => nil)
|
127
138
|
if opt[:help] then
|
@@ -194,6 +205,10 @@ case command
|
|
194
205
|
when "list"
|
195
206
|
botcontrol.discuss("list", false, :user => opt.argv.user)
|
196
207
|
|
208
|
+
when "quickcreate"
|
209
|
+
botcontrol.discuss("create_config", false, :user => nil)
|
210
|
+
botcontrol.discuss("quickcreate", false, :name => opt.argv.botname)
|
211
|
+
|
197
212
|
when "rename"
|
198
213
|
botcontrol.discuss("create_config", false, :user => nil)
|
199
214
|
botcontrol.discuss("rename", false,
|
@@ -206,12 +221,18 @@ case command
|
|
206
221
|
|
207
222
|
when "start"
|
208
223
|
botcontrol.discuss("create_config", false, :user => nil)
|
209
|
-
botname
|
210
|
-
options
|
224
|
+
botname = botcontrol.discuss(:start, false, :botname => opt.argv.botname)[:botname]
|
225
|
+
options = {:daemonize => !opt["-i"]}
|
211
226
|
if opt[:local] then
|
212
227
|
options[:server] = "127.0.0.1"
|
213
228
|
options[:port] = 6667
|
214
229
|
end
|
230
|
+
if opt[:debug] then
|
231
|
+
$DEBUG = true
|
232
|
+
$VERBOSE = true
|
233
|
+
elsif opt[:verbose]
|
234
|
+
$VERBOSE = true
|
235
|
+
end
|
215
236
|
Butler.start(nil, botname, options)
|
216
237
|
|
217
238
|
when "stop"
|
@@ -10,44 +10,33 @@ end
|
|
10
10
|
Butler.create(nil, name)
|
11
11
|
bot = Butler.new(nil, name)
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
}
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
#else
|
42
|
-
# "irc.server", ask(:server, "irc.freenode.org", String, :min => 3))
|
43
|
-
# "irc.port", ask(:port, 6667, Integer, :between => [0, 65535]))
|
44
|
-
# "login.nick", ask(:nick, name, String, :matching => /\A#[A-Za-z0-9_-]{2,40}\z/))
|
45
|
-
# "login.user", ask(:user, name, String, :matching => /\A#[A-Za-z0-9_-]{2,40}\z/))
|
46
|
-
# "login.real", ask(:real, "#{name} (Butler IRC bot)", String, :matching => /\A#[A-Za-z0-9_-]{2,40}\z/))
|
47
|
-
# "language", ask(:language, "en", String, :matching => /\A#[A-Za-z0-9_-]{2,40}\z/))
|
48
|
-
# Butler.configure(name, "login.channels", ask(:channels, nil, Array, String, :matching => /\A#[^\0\s,]+\z/))
|
49
|
-
#end
|
50
|
-
puts
|
51
|
-
say(:how_to_start)
|
13
|
+
nick = name
|
14
|
+
bot.config["connections/main/server"] = ask(:server, "irc.freenode.org", String, :min => 3)
|
15
|
+
bot.config["connections/main/port"] = ask(:port, 6667, Integer, :between => [0, 65535])
|
16
|
+
bot.config["connections/main/host"] = nil
|
17
|
+
bot.config["connections/main/reconnect_delay"] = ask(:reconnect_delay, 60, Integer, :greater_or_equal => 0)
|
18
|
+
bot.config["connections/main/reconnect_tries"] = ask(:reconnect_tries, -1, Integer, :greater_or_equal => -1)
|
19
|
+
bot.config["connections/main/charset"] = server_encoding = ask(:server_encoding, 'utf-8', String)
|
20
|
+
bot.config["connections/main/language"] = lang = ask(:language, "en", String, :min => 2)
|
21
|
+
bot.config["connections/main/nick"] = nick = ask(:nick, name, String, :between => [1, 32])
|
22
|
+
bot.config["connections/main/alternative"] = ask(:nick2, '[1]'+nick, String, :between => [1, 32])
|
23
|
+
bot.config["connections/main/user"] = ask(:user, nick, String, :between => [1, 32])
|
24
|
+
bot.config["connections/main/real"] = ask(:real, name+" (Butler IRC bot)", String, :between => [1, 32])
|
25
|
+
bot.config["connections/main/password"] = ask(:nickpass, nil, String)
|
26
|
+
bot.config["connections/main/identify"] = :auto
|
27
|
+
bot.config["connections/main/channels"] = channels=ask(:channels, (server == "irc.freenode.org" ? ["#butler"] : nil), Array, String, :matching => /\A#[^\0\s,]+\z/)
|
28
|
+
channels.each { |channel|
|
29
|
+
say(:config_channel, :name => channel)
|
30
|
+
prefix = "channels/#{server.config_key}/#{channel.config_key}"
|
31
|
+
bot.config["#{prefix}/password"] = ask(:channel_password, nil, String)
|
32
|
+
bot.config["#{prefix}/language"] = ask(:channel_language, lang, String)
|
33
|
+
bot.config["#{prefix}/charset"] = ask(:channel_encoding, server_encoding, String)
|
34
|
+
}
|
35
|
+
user = ask(:admin_user, nil, String, :min => 3)
|
36
|
+
pass = ask(:admin_pass, nil, String, :min => 3)
|
37
|
+
bot.access.user.create(user, pass, nil, true, :active => true)
|
38
|
+
user = bot.access.user.create("default_user", nil, nil, false, :active => true)
|
39
|
+
user.privileges.add(%w[plugin/public])
|
52
40
|
|
53
|
-
|
41
|
+
puts
|
42
|
+
say(:how_to_start, :botname => nick, :user => user, :pass => pass)
|