smfbot 1.0.0
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/README.md +38 -0
- data/bin/smfbot +5 -0
- data/lib/smfbot.rb +40 -0
- metadata +65 -0
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# SMF Bot
|
2
|
+
|
3
|
+
IRC bot engine build for `#smf.sh` and related channels, quite similar to [cinchize](https://github.com/netfeed/cinchize).
|
4
|
+
|
5
|
+
# Example
|
6
|
+
|
7
|
+
`Gemfile`:
|
8
|
+
|
9
|
+
source "https://rubygems.org"
|
10
|
+
#ruby=1.9.3
|
11
|
+
#ruby-gemset=cinch
|
12
|
+
gem "cinch-identify"
|
13
|
+
gem "cinch-yaml-memo"
|
14
|
+
gem "cinch-url-scraper"
|
15
|
+
|
16
|
+
`config.yaml`:
|
17
|
+
|
18
|
+
---
|
19
|
+
server: irc.freenode.net
|
20
|
+
port: 6667
|
21
|
+
nick: user
|
22
|
+
channels:
|
23
|
+
- "#my-test-channel"
|
24
|
+
plugins:
|
25
|
+
"Cinch::Plugins::Identify":
|
26
|
+
type: :nickserv
|
27
|
+
username: "user"
|
28
|
+
password: "password"
|
29
|
+
"Cinch::Plugins::YamlMemo": nil
|
30
|
+
"Cinch::Plugins::UrlScraper": nil
|
31
|
+
|
32
|
+
and run:
|
33
|
+
|
34
|
+
smfbot
|
35
|
+
|
36
|
+
# Backup
|
37
|
+
|
38
|
+
Do not forget to backup directory in which bot is running.
|
data/bin/smfbot
ADDED
data/lib/smfbot.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require "cinch"
|
2
|
+
require "yaml"
|
3
|
+
|
4
|
+
class SmfBot
|
5
|
+
def initialize(params)
|
6
|
+
if File.exist?('config.yaml')
|
7
|
+
settings = YAML.load_file('config.yaml')||{}
|
8
|
+
else
|
9
|
+
raise "\n\n Missing configuration file 'config.yaml'.\n\n"
|
10
|
+
end
|
11
|
+
@bot = Cinch::Bot.new do
|
12
|
+
debug "settings <<-EOF\n#{settings.to_yaml}EOF"
|
13
|
+
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']
|
19
|
+
c.plugins.plugins = []
|
20
|
+
end
|
21
|
+
end
|
22
|
+
(settings['plugins'] || []).each{ |plugin, options| add_plugin(plugin, options) }
|
23
|
+
end
|
24
|
+
|
25
|
+
def add_plugin(plugin, options = nil)
|
26
|
+
@bot.info "loading plugin: #{plugin}."
|
27
|
+
@bot.configure do |c|
|
28
|
+
require plugin.downcase.gsub('::','/')
|
29
|
+
plugin = eval plugin
|
30
|
+
c.plugins.plugins << plugin
|
31
|
+
c.plugins.options[plugin] = options if options
|
32
|
+
end
|
33
|
+
rescue
|
34
|
+
@bot.warn "failed loading plugin: #{plugin} ->\n#{}"
|
35
|
+
end
|
36
|
+
|
37
|
+
def start
|
38
|
+
@bot.start
|
39
|
+
end
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: smfbot
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Michal Papis
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-06-27 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: cinch
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2'
|
30
|
+
description: ! 'IRC bot engine build for #smf.sh and related channels.'
|
31
|
+
email:
|
32
|
+
- mpapis@gmail.com
|
33
|
+
executables:
|
34
|
+
- smfbot
|
35
|
+
extensions: []
|
36
|
+
extra_rdoc_files: []
|
37
|
+
files:
|
38
|
+
- README.md
|
39
|
+
- lib/smfbot.rb
|
40
|
+
- bin/smfbot
|
41
|
+
homepage: https://github.com/mpapis/smfbot
|
42
|
+
licenses: []
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options: []
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
none: false
|
49
|
+
requirements:
|
50
|
+
- - ! '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.9.1
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ! '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
requirements: []
|
60
|
+
rubyforge_project:
|
61
|
+
rubygems_version: 1.8.24
|
62
|
+
signing_key:
|
63
|
+
specification_version: 3
|
64
|
+
summary: ! 'IRC bot engine build for #smf.sh and related channels.'
|
65
|
+
test_files: []
|