cinch-yaml-score 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +3 -1
- data/lib/cinch/plugins/yamlscore.rb +20 -18
- metadata +9 -13
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 21036b42cdccf874446d93a9b1a4d6a4503f10e6
|
4
|
+
data.tar.gz: 270d620e6dd0a50a4f089b94b9e3e48d6f2b6aa4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3518323e42cf8f38da00afa872df5217a36365d3edaad198ece086f1fb2acede1be5e6f2032119d649885d9bc09f7f1096f3169edd41674b611c9b512d770bcd
|
7
|
+
data.tar.gz: 3c606d5110b1b180aa88734f5673b5090588dc521397c4bb47a52409d476922bb377abe2f3041fdd21901a688a39c85307a5a8c9c8fc7eff516b196751033ab8
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Cinch YAML score plugin
|
2
2
|
|
3
|
+
[![Code Climate](https://codeclimate.com/github/mpapis/cinch-yaml-score.png)](https://codeclimate.com/github/mpapis/cinch-yaml-score)
|
4
|
+
|
3
5
|
A Cinch plugin to count +1, scores are saved in yaml file for persistence.
|
4
6
|
|
5
7
|
## Installation
|
@@ -33,5 +35,5 @@ bot.start
|
|
33
35
|
!scores
|
34
36
|
!score <user>
|
35
37
|
<user>[,:]? [+-]1
|
36
|
-
<user>[,:]? ?[+-]{2}
|
38
|
+
<user>[,:]? ?[+-]{2}$
|
37
39
|
```
|
@@ -29,32 +29,19 @@ module Cinch
|
|
29
29
|
end
|
30
30
|
|
31
31
|
match(/(\S+) ([-+]1)/, use_prefix: false, use_suffix: false, method: :change)
|
32
|
-
match(/(\S+) ?([-+]{2})
|
32
|
+
match(/(\S+) ?([-+]{2})$/, use_prefix: false, use_suffix: false, method: :change)
|
33
33
|
def change(m, nick, score)
|
34
|
-
if
|
35
|
-
m
|
36
|
-
elsif nick == bot.nick
|
37
|
-
m.reply "You can't score for me..."
|
38
|
-
elsif m.channel.has_user?(nick)
|
39
|
-
score.sub!(/([+-]){2}/,'\11')
|
40
|
-
@scores[nick] ||= 0
|
41
|
-
@scores[nick] += score.to_i
|
42
|
-
@scores.delete(nick) if @scores[nick] == 0
|
43
|
-
m.reply "#{m.user.nick}(#{@scores[m.user.nick]}) gave #{score} for #{nick}(#{@scores[nick]})."
|
44
|
-
update_store
|
34
|
+
if m.channel.has_user?(nick)
|
35
|
+
change_nick(m, nick, score)
|
45
36
|
elsif %w( , : ).include?(nick[-1]) && m.channel.has_user?(nick.slice(0..-2))
|
46
37
|
nick.slice!(-1)
|
47
|
-
score
|
48
|
-
@scores[nick] ||= 0
|
49
|
-
@scores[nick] += score.to_i
|
50
|
-
@scores.delete(nick) if @scores[nick] == 0
|
51
|
-
m.reply "#{m.user.nick}(#{@scores[m.user.nick]}) gave #{score} for #{nick}(#{@scores[nick]})."
|
52
|
-
update_store
|
38
|
+
change_nick(m, nick, score)
|
53
39
|
elsif config[:warn_no_user_message]
|
54
40
|
m.reply config[:warn_no_user_message] % nick
|
55
41
|
end
|
56
42
|
end
|
57
43
|
|
44
|
+
private
|
58
45
|
def update_store
|
59
46
|
synchronize(:update) do
|
60
47
|
File.open('scores.yaml', 'w') do |fh|
|
@@ -62,6 +49,21 @@ module Cinch
|
|
62
49
|
end
|
63
50
|
end
|
64
51
|
end
|
52
|
+
|
53
|
+
def change_nick(m, nick, score)
|
54
|
+
if nick == m.user.nick
|
55
|
+
m.reply "You can't score for yourself..."
|
56
|
+
elsif nick == bot.nick
|
57
|
+
m.reply "You can't score for me..."
|
58
|
+
else
|
59
|
+
score.sub!(/([+-]){2}/,'\11')
|
60
|
+
@scores[nick] ||= 0
|
61
|
+
@scores[nick] += score.to_i
|
62
|
+
@scores.delete(nick) if @scores[nick] == 0
|
63
|
+
m.reply "#{m.user.nick}(#{@scores[m.user.nick]}) gave #{score} for #{nick}(#{@scores[nick]})."
|
64
|
+
update_store
|
65
|
+
end
|
66
|
+
end
|
65
67
|
end
|
66
68
|
end
|
67
69
|
end
|
metadata
CHANGED
@@ -1,30 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cinch-yaml-score
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Michal Papis
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-08-30 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: cinch
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '2'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '2'
|
30
27
|
description: A Cinch plugin to count +1, scores are saved in yaml file for persistence.
|
@@ -39,26 +36,25 @@ files:
|
|
39
36
|
- lib/cinch/plugins/yamlscore.rb
|
40
37
|
homepage: https://github.com/mpapis/cinch-yaml-score
|
41
38
|
licenses: []
|
39
|
+
metadata: {}
|
42
40
|
post_install_message:
|
43
41
|
rdoc_options: []
|
44
42
|
require_paths:
|
45
43
|
- lib
|
46
44
|
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
-
none: false
|
48
45
|
requirements:
|
49
|
-
- -
|
46
|
+
- - ">="
|
50
47
|
- !ruby/object:Gem::Version
|
51
48
|
version: 1.9.1
|
52
49
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
-
none: false
|
54
50
|
requirements:
|
55
|
-
- -
|
51
|
+
- - ">="
|
56
52
|
- !ruby/object:Gem::Version
|
57
53
|
version: '0'
|
58
54
|
requirements: []
|
59
55
|
rubyforge_project:
|
60
|
-
rubygems_version:
|
56
|
+
rubygems_version: 2.2.2
|
61
57
|
signing_key:
|
62
|
-
specification_version:
|
58
|
+
specification_version: 4
|
63
59
|
summary: A Cinch plugin to count +1, scores are saved in yaml file for persistence.
|
64
60
|
test_files: []
|