Cinch-Roulette 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1d1a3ae7859c546c49fcdbf516b305016e34cb87
4
+ data.tar.gz: e35e493c31f5e6cd5eb2a7aebeb89ff31d866aaf
5
+ SHA512:
6
+ metadata.gz: f8495b85dd7724de01f7f43f7f390cfdb5e85cd34cefacad5d49af2df4ee9960aa79e3b69c48edaedeefc6870ae3b5d62a65b223e199dc6a4dbadbda00dd49f6
7
+ data.tar.gz: 8e4317282d84c13766bf5c9bfe26385fba1aa5ce44e2cf459d3acebc6172b205f4f4206cacea9f3439fcc85a95eb58c309795f2d24c40bd372c12f96fa5dd040
@@ -0,0 +1,39 @@
1
+
2
+ # -*- encoding: utf-8 -*-
3
+ $LOAD_PATH.push('lib')
4
+ require 'cinch/plugins/roulette/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = 'Cinch-Roulette'
8
+ s.version = Cinch::Roulette::VERSION.dup
9
+ s.date = '2016-02-28'
10
+ s.summary = 'Cinch plugin that adds russian roulette game'
11
+ s.email = 'lilian.jonsdottir@gmail.com'
12
+ s.homepage = 'https://github.com/lilyseki/Cinch-Automode'
13
+ s.authors = ['Lily Jónsdóttir']
14
+ s.license = 'MIT'
15
+
16
+ s.description = <<-EOF
17
+ Adds russian roulette game to your IRC bot. Take your chances!
18
+ EOF
19
+
20
+ dependencies = []
21
+
22
+ s.files = Dir['**/*']
23
+ s.test_files = Dir['test/**/*'] + Dir['spec/**/*']
24
+ s.executables = Dir['bin/*'].map { |f| File.basename(f) }
25
+ s.require_paths = ['lib']
26
+
27
+ ## Make sure you can build the gem on older versions of RubyGems too:
28
+ s.rubygems_version = '2.5.1'
29
+ s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
30
+ s.specification_version = 3 if s.respond_to? :specification_version
31
+
32
+ dependencies.each do |type, name, version|
33
+ if s.respond_to?("add_#{type}_dependency")
34
+ s.send("add_#{type}_dependency", name, version)
35
+ else
36
+ s.add_dependency(name, version)
37
+ end
38
+ end
39
+ end
data/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+ =====================
3
+
4
+ Copyright (c) 2016 Lily Jónsdottír
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
7
+ this software and associated documentation files (the "Software"), to deal in
8
+ the Software without restriction, including without limitation the rights to
9
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10
+ the Software, and to permit persons to whom the Software is furnished to do so,
11
+ subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,45 @@
1
+ Russian Roulette Plugin for Cinch
2
+ ========================
3
+ Play a game of Russian Roulette
4
+
5
+ Usage
6
+ -----
7
+
8
+ Until I figure out how to make it into a gem, download the .rb file, and place
9
+ it in a subdirectory of your bot entitled
10
+ `plugins` then require it via `require_relative`.
11
+ Add it to your bot like so:
12
+
13
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ruby
14
+ require 'cinch'
15
+ require_relative 'plugins/roulette.rb'
16
+
17
+ bot = Cinch::Bot.new do
18
+ configure do |c|
19
+ c.server = 'your server'
20
+ c.nick = 'your nick'
21
+ c.realname = 'your realname'
22
+ c.user = 'your user'
23
+ c.channels = ['#yourchannel']
24
+ c.plugins.plugins = [Cinch::Plugins::Roulette]
25
+ end
26
+
27
+ bot.start
28
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29
+
30
+ Contained Commands
31
+ ------------------
32
+
33
+ [rr]
34
+
35
+ Take your chances with the six shooter.
36
+
37
+ [spin]
38
+
39
+ Spin the relvover, resetting the position of the bullet.
40
+
41
+ License
42
+ -------
43
+
44
+ Licensed under The MIT License (MIT)
45
+ Please see LICENSE
@@ -0,0 +1,5 @@
1
+ module Cinch
2
+ module Roulette
3
+ VERSION = '0.0.1'.freeze
4
+ end
5
+ end
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding=utf-8
3
+
4
+ # These are all very annoying.
5
+ # rubocop:disable Metrics/LineLength, Metrics/ClassLength, Metrics/CyclomaticComplexity
6
+ # rubocop:disable Metrics/MethodLength, Metrics/PerceivedComplexity, Metrics/AbcSize
7
+
8
+ module Cinch
9
+ module Plugins
10
+ # Roulette game
11
+ class Roulette
12
+ include Cinch::Plugin
13
+
14
+ private
15
+
16
+ def initialize(*args)
17
+ super
18
+ @shells = {}
19
+ @shot = {}
20
+ end
21
+
22
+ public
23
+
24
+ match(/spin$/, method: :spin)
25
+ def spin(m)
26
+ @shells[m.channel] = 6
27
+ @shot[m.channel] = rand(1..@shells[m.channel])
28
+ lines = '=' * 10
29
+ puts "#{lines}\nShells left: #{@shells[m.channel]}"
30
+ puts "Hot shot: #{@shot[m.channel]}\n#{lines}"
31
+ m.action_reply 'spins the chamber!'
32
+ end
33
+
34
+ match(/rr$/, method: :rr)
35
+ def rr(m)
36
+ # just starting?
37
+ @shells[m.channel] = 6 if @shells[m.channel].nil?
38
+ @shot[m.channel] = rand(1..@shells[m.channel]) if @shot[m.channel].nil?
39
+
40
+ shooter = m.user.nick
41
+ # Cheating in the console
42
+ lines = '=' * 10
43
+ puts "#{lines}\nShells left: #{@shells[m.channel]}"
44
+ puts "Hot shot: #{@shot[m.channel]}\n#{lines}"
45
+
46
+ if @shot[m.channel] == @shells[m.channel]
47
+ @shells[m.channel] = 6
48
+ @shot[m.channel] = rand(1..@shells[m.channel])
49
+ m.reply 'Bang!'
50
+ m.channel.kick(shooter, 'Bad luck, you\'re dead!')
51
+ sleep(2)
52
+ m.action_reply 'reloads the revolver and spins the chamber!'
53
+ else
54
+ m.reply 'Click!'
55
+ @shells[m.channel] -= 1
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+
62
+ # vim:tabstop=2 softtabstop=2 expandtab shiftwidth=2 smarttab foldmethod=syntax:
metadata ADDED
@@ -0,0 +1,50 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: Cinch-Roulette
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Lily Jónsdóttir
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-28 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: 'Adds russian roulette game to your IRC bot. Take your chances!
14
+
15
+ '
16
+ email: lilian.jonsdottir@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - Cinch-Roulette.gemspec
22
+ - LICENSE.md
23
+ - README.md
24
+ - lib/cinch/plugins/roulette.rb
25
+ - lib/cinch/plugins/roulette/version.rb
26
+ homepage: https://github.com/lilyseki/Cinch-Automode
27
+ licenses:
28
+ - MIT
29
+ metadata: {}
30
+ post_install_message:
31
+ rdoc_options: []
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ requirements: []
45
+ rubyforge_project:
46
+ rubygems_version: 2.5.1
47
+ signing_key:
48
+ specification_version: 3
49
+ summary: Cinch plugin that adds russian roulette game
50
+ test_files: []