Rateless-Bot 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.travis.yml +3 -0
- data/Gemfile +7 -0
- data/LICENSE +17 -0
- data/README.md +2 -0
- data/Rakefile +2 -0
- data/Rateless-Bot.gemspec +24 -0
- data/bin/console +14 -0
- data/bin/rateless_bot +5 -0
- data/bin/setup +7 -0
- data/exe/rateless_bot +4 -0
- data/lib/Rateless/Bot.rb +7 -0
- data/lib/Rateless/Bot/version.rb +5 -0
- data/lib/bot.rb +23 -0
- data/lib/plugins/coin_flipper.rb +15 -0
- data/lib/plugins/dice_roller.rb +25 -0
- data/lib/plugins/help.rb +17 -0
- data/lib/plugins/magic_eight_ball.rb +36 -0
- data/lib/plugins/video_title.rb +27 -0
- data/lib/rateless_bot_controller.rb +3 -0
- data/rateless_bot.gemspec.bk +13 -0
- metadata +96 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c3dc24cd0216bcab6de6050bb5c1993eeaa61a78
|
4
|
+
data.tar.gz: b500f83d8a76e11600fad0857d77d9e7209c8e7c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2b7a66d59914e526db7ee55f7550abf59763dcd31eb7dd1f06e372e60fc83bc83cf9a89b4b92fc145f81ec424bfd2e054f940eb7ef90dd33497e9c6125261e22
|
7
|
+
data.tar.gz: ef62b5bf99d6ab29972f4a01aab86b13283b7f9bab413fe9f1cf2e1850dcedf0bff07cb7c3edac054f3fe0d9d6ff9f58ef93b603c65c82ae0de35d100319f0d7
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
Copyright (c) 2014 Vincent Heuken
|
2
|
+
|
3
|
+
This software is provided 'as-is', without any express or implied
|
4
|
+
warranty. In no event will the authors be held liable for any damages
|
5
|
+
arising from the use of this software.
|
6
|
+
|
7
|
+
Permission is granted to anyone to use this software for any purpose,
|
8
|
+
including commercial applications, and to alter it and redistribute it
|
9
|
+
freely, subject to the following restrictions:
|
10
|
+
|
11
|
+
1. The origin of this software must not be misrepresented; you must not
|
12
|
+
claim that you wrote the original software. If you use this software
|
13
|
+
in a product, an acknowledgment in the product documentation would be
|
14
|
+
appreciated but is not required.
|
15
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
16
|
+
misrepresented as being the original software.
|
17
|
+
3. This notice may not be removed or altered from any source distribution.
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'Rateless/Bot/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "Rateless-Bot"
|
8
|
+
spec.version = Rateless::Bot::VERSION
|
9
|
+
spec.authors = ["Vincent Heuken"]
|
10
|
+
spec.email = ["me@vincentheuken.com"]
|
11
|
+
|
12
|
+
spec.summary = "IRC Bot"
|
13
|
+
spec.description = "IRC Bot"
|
14
|
+
spec.homepage = "http://www.foobar.com"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
#spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.executables = ["rateless_bot"]
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.8"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "Rateless/Bot"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/rateless_bot
ADDED
data/bin/setup
ADDED
data/exe/rateless_bot
ADDED
data/lib/Rateless/Bot.rb
ADDED
data/lib/bot.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'cinch'
|
2
|
+
require 'yaml'
|
3
|
+
require_relative 'plugins/coin_flipper'
|
4
|
+
require_relative 'plugins/dice_roller'
|
5
|
+
require_relative 'plugins/help'
|
6
|
+
require_relative 'plugins/magic_eight_ball'
|
7
|
+
require_relative 'plugins/video_title'
|
8
|
+
|
9
|
+
bot = Cinch::Bot.new do
|
10
|
+
configure do |c|
|
11
|
+
c.nick = "Rateless-Bot"
|
12
|
+
c.server = "irc.rizon.net"
|
13
|
+
c.channels = ["#rateless"]
|
14
|
+
|
15
|
+
c.plugins.plugins = [CoinFlipper,
|
16
|
+
DiceRoller,
|
17
|
+
Help,
|
18
|
+
MagicEightBall,
|
19
|
+
VideoTitle]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
bot.start
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'cinch'
|
2
|
+
|
3
|
+
class DiceRoller
|
4
|
+
def help
|
5
|
+
'!roll XdY - rolls dice (replace X with number of dice and Y with number of sides)'
|
6
|
+
end
|
7
|
+
|
8
|
+
include Cinch::Plugin
|
9
|
+
|
10
|
+
match /roll \d+d\d+/
|
11
|
+
|
12
|
+
def execute(m)
|
13
|
+
command = /\d+d\d+/.match(m.message).to_s
|
14
|
+
|
15
|
+
num_of_dice = command.split('d')[0].to_i
|
16
|
+
num_of_sides = command.split('d')[1].to_i
|
17
|
+
|
18
|
+
reply = ''
|
19
|
+
|
20
|
+
num_of_dice.times { reply << rand(1..num_of_sides).to_s + ' ' }
|
21
|
+
|
22
|
+
m.reply reply
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
data/lib/plugins/help.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'cinch'
|
2
|
+
|
3
|
+
class MagicEightBall
|
4
|
+
def help
|
5
|
+
'!8ball - Magic Eight Ball'
|
6
|
+
end
|
7
|
+
@@answers = ['It is certain',
|
8
|
+
'It is decidedly so',
|
9
|
+
'Without a doubt',
|
10
|
+
'Yes, definately',
|
11
|
+
'You may rely on it',
|
12
|
+
'As I see it, yes',
|
13
|
+
'Most likely',
|
14
|
+
'Outlook: good',
|
15
|
+
'Yes',
|
16
|
+
'Signs point to yes',
|
17
|
+
'Reply hazy; try again',
|
18
|
+
'Ask again later',
|
19
|
+
'Better not tell you now',
|
20
|
+
'Cannot predict now',
|
21
|
+
'Concentrate and ask again',
|
22
|
+
'Don\'t count on it',
|
23
|
+
'My reply is: no',
|
24
|
+
'My sources say: no',
|
25
|
+
'Outlook: not so good',
|
26
|
+
'Very doubtful']
|
27
|
+
|
28
|
+
include Cinch::Plugin
|
29
|
+
|
30
|
+
match "8ball"
|
31
|
+
|
32
|
+
def execute(m)
|
33
|
+
puts('h')
|
34
|
+
m.reply @@answers[rand(0..@@answers.length-1)]
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'cinch'
|
3
|
+
require 'video_info'
|
4
|
+
|
5
|
+
class VideoTitle
|
6
|
+
include Cinch::Plugin
|
7
|
+
|
8
|
+
listen_to :message
|
9
|
+
|
10
|
+
def listen(m)
|
11
|
+
if m.message.match(/youtube.com\/watch\?/)
|
12
|
+
video_url = get_url(m.message)
|
13
|
+
|
14
|
+
m.reply get_video_title(video_url)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_url(message)
|
19
|
+
index = message.index("youtube.com\/watch\?")
|
20
|
+
message[index..message.length].split(' ')[0]
|
21
|
+
end
|
22
|
+
|
23
|
+
def get_video_title(video_url)
|
24
|
+
video = VideoInfo.new(video_url)
|
25
|
+
video.title
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "Rateless-Bot"
|
3
|
+
s.version = '0.0.2'
|
4
|
+
s.date = '2014-10-30'
|
5
|
+
s.summary = "Hola!"
|
6
|
+
s.description = "A simple hello world gem"
|
7
|
+
s.authors = ["Vincent Heuken"]
|
8
|
+
s.email = 'me@vincentheuken.com'
|
9
|
+
s.files = ["lib/rateless_bot_controller.rb"]
|
10
|
+
s.executables = ["rateless_bot"]
|
11
|
+
s.homepage = 'https://github.com/vheuken/Rateless-Bot'
|
12
|
+
s.license = 'zlib'
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: Rateless-Bot
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Vincent Heuken
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.8'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: IRC Bot
|
42
|
+
email:
|
43
|
+
- me@vincentheuken.com
|
44
|
+
executables:
|
45
|
+
- rateless_bot
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- ".travis.yml"
|
51
|
+
- Gemfile
|
52
|
+
- Gemfile.lock
|
53
|
+
- LICENSE
|
54
|
+
- README.md
|
55
|
+
- Rakefile
|
56
|
+
- Rateless-Bot.gemspec
|
57
|
+
- bin/console
|
58
|
+
- bin/rateless_bot
|
59
|
+
- bin/setup
|
60
|
+
- exe/rateless_bot
|
61
|
+
- lib/.bot.rb.swp
|
62
|
+
- lib/Rateless/Bot.rb
|
63
|
+
- lib/Rateless/Bot/version.rb
|
64
|
+
- lib/bot.rb
|
65
|
+
- lib/plugins/.lastfm.rb.swp
|
66
|
+
- lib/plugins/coin_flipper.rb
|
67
|
+
- lib/plugins/dice_roller.rb
|
68
|
+
- lib/plugins/help.rb
|
69
|
+
- lib/plugins/magic_eight_ball.rb
|
70
|
+
- lib/plugins/video_title.rb
|
71
|
+
- lib/rateless_bot_controller.rb
|
72
|
+
- rateless_bot.gemspec.bk
|
73
|
+
homepage: http://www.foobar.com
|
74
|
+
licenses: []
|
75
|
+
metadata: {}
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirements: []
|
91
|
+
rubyforge_project:
|
92
|
+
rubygems_version: 2.4.6
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
95
|
+
summary: IRC Bot
|
96
|
+
test_files: []
|