smfbot 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +9 -7
  2. data/lib/smfbot.rb +6 -10
  3. metadata +1 -1
data/README.md CHANGED
@@ -16,18 +16,20 @@ IRC bot engine build for `#smf.sh` and related channels, quite similar to [cinch
16
16
  `config.yaml`:
17
17
 
18
18
  ---
19
- server: irc.freenode.net
20
- port: 6667
21
- nick: user
22
- channels:
23
- - "#my-test-channel"
19
+ connection:
20
+ :server: irc.freenode.net
21
+ :port: 6667
22
+ :nick: user
23
+ :delay_joins: :identified
24
+ :channels:
25
+ - "#my-test-channel"
24
26
  plugins:
25
27
  "Cinch::Plugins::Identify":
26
28
  type: :nickserv
27
29
  username: "user"
28
30
  password: "password"
29
- "Cinch::Plugins::YamlMemo": nil
30
- "Cinch::Plugins::UrlScraper": nil
31
+ "Cinch::Plugins::YamlMemo":
32
+ "Cinch::Plugins::UrlScraper":
31
33
 
32
34
  and run:
33
35
 
data/lib/smfbot.rb CHANGED
@@ -9,13 +9,8 @@ class SmfBot
9
9
  raise "\n\n Missing configuration file 'config.yaml'.\n\n"
10
10
  end
11
11
  @bot = Cinch::Bot.new do
12
- debug "settings <<-EOF\n#{settings.to_yaml}EOF"
13
12
  configure do |c|
14
- c.server = settings['server']
15
- c.port = settings['port']
16
- c.channels = settings['channels']
17
- c.nick = settings['nick']
18
- c.username = settings['nick']
13
+ c.load settings['connection']
19
14
  c.plugins.plugins = []
20
15
  end
21
16
  end
@@ -23,15 +18,16 @@ class SmfBot
23
18
  end
24
19
 
25
20
  def add_plugin(plugin, options = nil)
26
- @bot.info "loading plugin: #{plugin}."
21
+ @bot.info "loading plugin: #{plugin} with options: #{options}."
22
+ require plugin.downcase.gsub('::','/')
27
23
  @bot.configure do |c|
28
- require plugin.downcase.gsub('::','/')
29
24
  plugin = eval plugin
30
25
  c.plugins.plugins << plugin
31
26
  c.plugins.options[plugin] = options if options
32
27
  end
33
- rescue
34
- @bot.warn "failed loading plugin: #{plugin} ->\n#{}"
28
+ rescue Exception => e
29
+ @bot.warn "failed loading plugin: #{plugin} ->\n"
30
+ raise e
35
31
  end
36
32
 
37
33
  def start
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smfbot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: