ruboty-rating 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/README.md +39 -5
- data/lib/ruboty/handlers/rating.rb +2 -2
- data/lib/ruboty/rating/actions/delete_player.rb +1 -1
- data/lib/ruboty/rating/actions/show_ratings.rb +1 -1
- data/lib/ruboty/rating/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b58e7744979bc6e08fc02b0bdc93ea27e9377864
|
4
|
+
data.tar.gz: '097b652fcb98ba3f4087c10963310eda36f65597'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35ef5956853504478aa2ce06c239c0e44eb57588697ca33154b215379cacc637fb808322db4909548463b40004e9e7d948ca8fae7b78786ca3afcd260bf2ed72
|
7
|
+
data.tar.gz: d16259b256d43583f34b875d988e0ed90050a38084c2a9f61619e86e044d330d96feb36692ca8cb09962e361f62076e6a4dadc388494fba5853cdcd0771a7333
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Ruboty::Rating
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Run [Elo rating](https://en.wikipedia.org/wiki/Elo_rating_system) system on Ruboty.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,7 +20,43 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
23
|
+
```
|
24
|
+
$ ruboty
|
25
|
+
Type `exit` or `quit` to end the session.
|
26
|
+
> @ruboty help
|
27
|
+
ruboty /(?<left_player>\w+)(?:\s+)(?<result>[<>])(?:\s+)(?<right_player>\w+)$/ - Remember a game result
|
28
|
+
ruboty /delete\s+player\s+(?<player>\w+)/ - Show rating of a player
|
29
|
+
ruboty /set\s+rating\s+(?<player>\w+)\s+(?<new_rating>\d+)/ - Set rating of a player manually
|
30
|
+
ruboty /show\s+rating\s+(?<player>\w+)/ - Show rating of a player
|
31
|
+
ruboty /show\s+ratings/ - Show ratings of all player
|
32
|
+
ruboty /help( me)?(?: (?<filter>.+))?\z/i - Show this help message
|
33
|
+
ruboty /ping\z/i - Return PONG to PING
|
34
|
+
ruboty /who am i\?/i - Answer who you are
|
35
|
+
> @ruboty player1 > player2
|
36
|
+
player1: 1500 -> 1512
|
37
|
+
player2: 1500 -> 1488
|
38
|
+
> @ruboty player3 > player2
|
39
|
+
player3: 1500 -> 1512
|
40
|
+
player2: 1488 -> 1476
|
41
|
+
> @ruboty player1 > player4
|
42
|
+
player1: 1512 -> 1524
|
43
|
+
player4: 1500 -> 1488
|
44
|
+
> @ruboty show ratings
|
45
|
+
player1: 1524
|
46
|
+
player3: 1512
|
47
|
+
player4: 1488
|
48
|
+
player2: 1476
|
49
|
+
> @ruboty set rating player1 530000
|
50
|
+
Updated the rating of player1: 530000
|
51
|
+
> @ruboty show rating player1
|
52
|
+
player1: 530000
|
53
|
+
> @ruboty delete player player2
|
54
|
+
Deleted player2
|
55
|
+
> @ruboty show ratings
|
56
|
+
player1: 530000
|
57
|
+
player3: 1512
|
58
|
+
player4: 1488
|
59
|
+
```
|
26
60
|
|
27
61
|
## Development
|
28
62
|
|
@@ -32,5 +66,5 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
66
|
|
33
67
|
## Contributing
|
34
68
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
69
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/tomoasleep/ruboty-rating. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
70
|
|
@@ -49,8 +49,8 @@ module Ruboty
|
|
49
49
|
Ruboty::Rating::Actions::SetRating.new(message).call
|
50
50
|
end
|
51
51
|
|
52
|
-
def
|
53
|
-
Ruboty::Rating::Actions::
|
52
|
+
def delete_player(message)
|
53
|
+
Ruboty::Rating::Actions::DeletePlayer.new(message).call
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -3,7 +3,7 @@ module Ruboty
|
|
3
3
|
module Actions
|
4
4
|
class ShowRatings < Base
|
5
5
|
def call
|
6
|
-
rating_ranking = ratings.
|
6
|
+
rating_ranking = ratings.sort_by { |(_player, rating)| -rating }
|
7
7
|
message.reply(rating_ranking.map { |(player, rating)| "#{player}: #{rating}" }.join("\n"))
|
8
8
|
end
|
9
9
|
end
|