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 +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/exe/rateless_bot +19 -0
- data/lib/rateless_bot.rb +5 -0
- data/lib/rateless_bot/bot.rb +8 -0
- data/lib/rateless_bot/plugins/coin_flipper.rb +15 -0
- data/lib/rateless_bot/plugins/dice_roller.rb +25 -0
- data/lib/rateless_bot/plugins/help.rb +17 -0
- data/lib/rateless_bot/plugins/magic_eight_ball.rb +36 -0
- data/lib/rateless_bot/plugins/video_title.rb +27 -0
- data/lib/rateless_bot/version.rb +3 -0
- data/rateless_bot.gemspec +27 -0
- metadata +118 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dcb565ed4cf49d1c3c13ea7e05238e0b3e8b4d98
|
4
|
+
data.tar.gz: e3d131c54adc1783ddb3e2a643c14cb8d0a3db38
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3321f44fbfd5631fc473c2be3d56181fcc56e203d1497cea81925dc316c4dc403aa6be5fb42d2fada57aa4f90146a8383473ff3cf93d181f85137c9511b7c13f
|
7
|
+
data.tar.gz: 79d03b89c7c410ca88c1ae8ae6528e2fb85ac92ccf746d980f66d16ce4a87b9d8df6d397214e6275838a51bab4064cb16fcd489c43b1e4d9acc1b169c8704654
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 TODO: Write your name
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# RatelessBot
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rateless_bot`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'rateless_bot'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install rateless_bot
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
1. Fork it ( https://github.com/[my-github-username]/rateless_bot/fork )
|
36
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
39
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
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/setup
ADDED
data/exe/rateless_bot
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rateless_bot'
|
4
|
+
|
5
|
+
bot = Cinch::Bot.new do
|
6
|
+
configure do |c|
|
7
|
+
c.nick = "Rateless-Bot"
|
8
|
+
c.server = "irc.rizon.net"
|
9
|
+
c.channels = ["#rateless"]
|
10
|
+
|
11
|
+
c.plugins.plugins = [CoinFlipper,
|
12
|
+
DiceRoller,
|
13
|
+
Help,
|
14
|
+
MagicEightBall,
|
15
|
+
VideoTitle]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
bot.start
|
data/lib/rateless_bot.rb
ADDED
@@ -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
|
@@ -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,27 @@
|
|
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 = RatelessBot::VERSION
|
9
|
+
spec.authors = ["Vincent Heuken"]
|
10
|
+
spec.email = ["me@vincentheuken.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{An IRC Bot}
|
13
|
+
# spec.description = %q{TODO: Write a longer description or delete this line.}
|
14
|
+
spec.homepage = "https://github.com/vheuken/Rateless-Bot"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables << 'rateless_bot'
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
|
25
|
+
spec.add_dependency "cinch"
|
26
|
+
spec.add_dependency "video_info"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
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-25 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.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
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
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: cinch
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: video_info
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- me@vincentheuken.com
|
72
|
+
executables:
|
73
|
+
- rateless_bot
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- bin/console
|
83
|
+
- bin/setup
|
84
|
+
- exe/rateless_bot
|
85
|
+
- lib/rateless_bot.rb
|
86
|
+
- lib/rateless_bot/bot.rb
|
87
|
+
- lib/rateless_bot/plugins/coin_flipper.rb
|
88
|
+
- lib/rateless_bot/plugins/dice_roller.rb
|
89
|
+
- lib/rateless_bot/plugins/help.rb
|
90
|
+
- lib/rateless_bot/plugins/magic_eight_ball.rb
|
91
|
+
- lib/rateless_bot/plugins/video_title.rb
|
92
|
+
- lib/rateless_bot/version.rb
|
93
|
+
- rateless_bot.gemspec
|
94
|
+
homepage: https://github.com/vheuken/Rateless-Bot
|
95
|
+
licenses:
|
96
|
+
- MIT
|
97
|
+
metadata: {}
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options: []
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
requirements: []
|
113
|
+
rubyforge_project:
|
114
|
+
rubygems_version: 2.4.6
|
115
|
+
signing_key:
|
116
|
+
specification_version: 4
|
117
|
+
summary: An IRC Bot
|
118
|
+
test_files: []
|