cosgrove 0.0.1rc1
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 +7 -0
- data/.gitignore +50 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +229 -0
- data/LICENSE +41 -0
- data/README.md +131 -0
- data/Rakefile +43 -0
- data/cosgrove.gemspec +49 -0
- data/lib/cosgrove.rb +28 -0
- data/lib/cosgrove/account.rb +103 -0
- data/lib/cosgrove/agent.rb +25 -0
- data/lib/cosgrove/bot.rb +149 -0
- data/lib/cosgrove/comment_job.rb +140 -0
- data/lib/cosgrove/config.rb +100 -0
- data/lib/cosgrove/market.rb +411 -0
- data/lib/cosgrove/phantomjs.rb +18 -0
- data/lib/cosgrove/snark_commands.rb +52 -0
- data/lib/cosgrove/support.rb +213 -0
- data/lib/cosgrove/upvote_job.rb +147 -0
- data/lib/cosgrove/utils.rb +116 -0
- data/lib/cosgrove/version.rb +4 -0
- data/mongoid.yml +9 -0
- data/support/js/screencap.js +57 -0
- metadata +444 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 95702814dc6660cd0cc27bcb877ba99aca124e67
|
4
|
+
data.tar.gz: 602bfbac6a5ceb141b70ca3ebc25a324a97dd76f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 612ae734c309582c7efe232a0f656ab366336da8e61075418a668ec22ca3c529147f7547f32ca5ab5638346830d2cd7a1645097c7bbc005664cad271380069f4
|
7
|
+
data.tar.gz: ea77bb291cf19f601eb7bafad96a04aa60b4b06b260d363173a06203ba1fc9ce50c86ef6e23ecc0f2d9f4f97de42afec62fc0c0ec3a8ae8263e3daffca1e057b
|
data/.gitignore
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
# Gemfile.lock
|
46
|
+
# .ruby-version
|
47
|
+
# .ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,229 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git@github.com:Reaver01/cleverbot_rb.git
|
3
|
+
revision: b051f5df41ccc44e527229f7b5f59d58a4298ef2
|
4
|
+
branch: master
|
5
|
+
specs:
|
6
|
+
cleverbot_rb (1.0.0)
|
7
|
+
json
|
8
|
+
rest-client
|
9
|
+
|
10
|
+
GIT
|
11
|
+
remote: git@github.com:steem-third-party/steemdata-rb.git
|
12
|
+
revision: b98b24bf6ec62cf125a46a60c0d23fbc10152103
|
13
|
+
specs:
|
14
|
+
steemdata-rb (0.0.1f)
|
15
|
+
mongoid (~> 6.1, >= 6.1.0)
|
16
|
+
|
17
|
+
PATH
|
18
|
+
remote: .
|
19
|
+
specs:
|
20
|
+
cosgrove (0.0.1rc1)
|
21
|
+
activeview
|
22
|
+
ai4r
|
23
|
+
discordrb
|
24
|
+
mechanize
|
25
|
+
mongoid
|
26
|
+
phantomjs
|
27
|
+
radiator
|
28
|
+
rdiscount
|
29
|
+
rmagick
|
30
|
+
ruby-cleverbot-api
|
31
|
+
steem-slap
|
32
|
+
steemdata-rb
|
33
|
+
wolfram-alpha
|
34
|
+
|
35
|
+
GEM
|
36
|
+
remote: https://rubygems.org/
|
37
|
+
specs:
|
38
|
+
actionpack (5.1.1)
|
39
|
+
actionview (= 5.1.1)
|
40
|
+
activesupport (= 5.1.1)
|
41
|
+
rack (~> 2.0)
|
42
|
+
rack-test (~> 0.6.3)
|
43
|
+
rails-dom-testing (~> 2.0)
|
44
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
45
|
+
actionview (5.1.1)
|
46
|
+
activesupport (= 5.1.1)
|
47
|
+
builder (~> 3.1)
|
48
|
+
erubi (~> 1.4)
|
49
|
+
rails-dom-testing (~> 2.0)
|
50
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
51
|
+
activemodel (5.1.1)
|
52
|
+
activesupport (= 5.1.1)
|
53
|
+
activesupport (5.1.1)
|
54
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
55
|
+
i18n (~> 0.7)
|
56
|
+
minitest (~> 5.1)
|
57
|
+
tzinfo (~> 1.1)
|
58
|
+
activeview (0)
|
59
|
+
activesupport (~> 5.0)
|
60
|
+
railties (~> 5.0)
|
61
|
+
addressable (2.5.1)
|
62
|
+
public_suffix (~> 2.0, >= 2.0.2)
|
63
|
+
ai4r (1.13)
|
64
|
+
awesome_print (1.7.0)
|
65
|
+
bitcoin-ruby (0.0.10)
|
66
|
+
bson (4.2.1)
|
67
|
+
builder (3.2.3)
|
68
|
+
byebug (9.0.6)
|
69
|
+
coderay (1.1.1)
|
70
|
+
concurrent-ruby (1.0.5)
|
71
|
+
crack (0.4.3)
|
72
|
+
safe_yaml (~> 1.0.0)
|
73
|
+
discordrb (3.2.1)
|
74
|
+
discordrb-webhooks (~> 3.2.0.1)
|
75
|
+
opus-ruby
|
76
|
+
rbnacl (~> 3.4.0)
|
77
|
+
rest-client
|
78
|
+
websocket-client-simple (>= 0.3.0)
|
79
|
+
discordrb-webhooks (3.2.0.1)
|
80
|
+
rest-client
|
81
|
+
docile (1.1.5)
|
82
|
+
domain_name (0.5.20170404)
|
83
|
+
unf (>= 0.0.5, < 1.0.0)
|
84
|
+
erubi (1.6.0)
|
85
|
+
ethon (0.10.1)
|
86
|
+
ffi (>= 1.3.0)
|
87
|
+
event_emitter (0.2.5)
|
88
|
+
faraday (0.12.1)
|
89
|
+
multipart-post (>= 1.2, < 3)
|
90
|
+
ffi (1.9.18)
|
91
|
+
hashdiff (0.3.4)
|
92
|
+
hashie (3.5.5)
|
93
|
+
http-cookie (1.0.3)
|
94
|
+
domain_name (~> 0.5)
|
95
|
+
i18n (0.8.4)
|
96
|
+
json (1.8.6)
|
97
|
+
little-plugger (1.1.4)
|
98
|
+
logging (2.2.2)
|
99
|
+
little-plugger (~> 1.1)
|
100
|
+
multi_json (~> 1.10)
|
101
|
+
loofah (2.0.3)
|
102
|
+
nokogiri (>= 1.5.9)
|
103
|
+
mechanize (2.7.5)
|
104
|
+
domain_name (~> 0.5, >= 0.5.1)
|
105
|
+
http-cookie (~> 1.0)
|
106
|
+
mime-types (>= 1.17.2)
|
107
|
+
net-http-digest_auth (~> 1.1, >= 1.1.1)
|
108
|
+
net-http-persistent (~> 2.5, >= 2.5.2)
|
109
|
+
nokogiri (~> 1.6)
|
110
|
+
ntlm-http (~> 0.1, >= 0.1.1)
|
111
|
+
webrobots (>= 0.0.9, < 0.2)
|
112
|
+
method_source (0.8.2)
|
113
|
+
mime-types (3.1)
|
114
|
+
mime-types-data (~> 3.2015)
|
115
|
+
mime-types-data (3.2016.0521)
|
116
|
+
mini_portile2 (2.2.0)
|
117
|
+
minitest (5.10.2)
|
118
|
+
minitest-line (0.6.3)
|
119
|
+
minitest (~> 5.0)
|
120
|
+
minitest-proveit (1.0.0)
|
121
|
+
minitest (> 5, < 7)
|
122
|
+
mongo (2.4.2)
|
123
|
+
bson (>= 4.2.1, < 5.0.0)
|
124
|
+
mongoid (6.2.0)
|
125
|
+
activemodel (~> 5.1)
|
126
|
+
mongo (>= 2.4.1, < 3.0.0)
|
127
|
+
multi_json (1.12.1)
|
128
|
+
multipart-post (2.0.0)
|
129
|
+
net-http-digest_auth (1.4.1)
|
130
|
+
net-http-persistent (2.9.4)
|
131
|
+
netrc (0.11.0)
|
132
|
+
nokogiri (1.8.0)
|
133
|
+
mini_portile2 (~> 2.2.0)
|
134
|
+
ntlm-http (0.1.1)
|
135
|
+
opus-ruby (1.0.1)
|
136
|
+
ffi
|
137
|
+
phantomjs (2.1.1.0)
|
138
|
+
pry (0.10.4)
|
139
|
+
coderay (~> 1.1.0)
|
140
|
+
method_source (~> 0.8.1)
|
141
|
+
slop (~> 3.4)
|
142
|
+
public_suffix (2.0.5)
|
143
|
+
rack (2.0.3)
|
144
|
+
rack-test (0.6.3)
|
145
|
+
rack (>= 1.0)
|
146
|
+
radiator (0.2.2)
|
147
|
+
bitcoin-ruby (= 0.0.10)
|
148
|
+
ffi (= 1.9.18)
|
149
|
+
hashie (~> 3.5, >= 3.5.5)
|
150
|
+
json (~> 1.8, >= 1.8.6)
|
151
|
+
logging (~> 2.2, >= 2.2.0)
|
152
|
+
net-http-persistent (~> 2.9, >= 2.9.4)
|
153
|
+
rails-dom-testing (2.0.3)
|
154
|
+
activesupport (>= 4.2.0)
|
155
|
+
nokogiri (>= 1.6)
|
156
|
+
rails-html-sanitizer (1.0.3)
|
157
|
+
loofah (~> 2.0)
|
158
|
+
railties (5.1.1)
|
159
|
+
actionpack (= 5.1.1)
|
160
|
+
activesupport (= 5.1.1)
|
161
|
+
method_source
|
162
|
+
rake (>= 0.8.7)
|
163
|
+
thor (>= 0.18.1, < 2.0)
|
164
|
+
rake (11.2.2)
|
165
|
+
rbnacl (3.4.0)
|
166
|
+
ffi
|
167
|
+
rdiscount (2.2.0.1)
|
168
|
+
rest-client (2.0.2)
|
169
|
+
http-cookie (>= 1.0.2, < 2.0)
|
170
|
+
mime-types (>= 1.16, < 4.0)
|
171
|
+
netrc (~> 0.8)
|
172
|
+
rmagick (2.16.0)
|
173
|
+
ruby-cleverbot-api (1.0.6)
|
174
|
+
safe_yaml (1.0.4)
|
175
|
+
simplecov (0.14.1)
|
176
|
+
docile (~> 1.1.0)
|
177
|
+
json (>= 1.8, < 3)
|
178
|
+
simplecov-html (~> 0.10.0)
|
179
|
+
simplecov-html (0.10.1)
|
180
|
+
slop (3.6.0)
|
181
|
+
steem-slap (0.0.2)
|
182
|
+
thor (0.19.4)
|
183
|
+
thread_safe (0.3.6)
|
184
|
+
typhoeus (1.1.2)
|
185
|
+
ethon (>= 0.9.0)
|
186
|
+
tzinfo (1.2.3)
|
187
|
+
thread_safe (~> 0.1)
|
188
|
+
unf (0.1.4)
|
189
|
+
unf_ext
|
190
|
+
unf_ext (0.0.7.4)
|
191
|
+
vcr (3.0.3)
|
192
|
+
webmock (3.0.1)
|
193
|
+
addressable (>= 2.3.6)
|
194
|
+
crack (>= 0.3.2)
|
195
|
+
hashdiff
|
196
|
+
webrobots (0.1.2)
|
197
|
+
websocket (1.2.4)
|
198
|
+
websocket-client-simple (0.3.0)
|
199
|
+
event_emitter
|
200
|
+
websocket
|
201
|
+
wolfram-alpha (0.3.1)
|
202
|
+
nokogiri
|
203
|
+
yard (0.9.9)
|
204
|
+
|
205
|
+
PLATFORMS
|
206
|
+
ruby
|
207
|
+
|
208
|
+
DEPENDENCIES
|
209
|
+
awesome_print
|
210
|
+
bundler (~> 1.11)
|
211
|
+
byebug
|
212
|
+
cleverbot_rb!
|
213
|
+
cosgrove!
|
214
|
+
faraday
|
215
|
+
minitest
|
216
|
+
minitest-line
|
217
|
+
minitest-proveit
|
218
|
+
pry
|
219
|
+
radiator
|
220
|
+
rake (~> 11.2.2)
|
221
|
+
simplecov
|
222
|
+
steemdata-rb!
|
223
|
+
typhoeus
|
224
|
+
vcr
|
225
|
+
webmock
|
226
|
+
yard
|
227
|
+
|
228
|
+
BUNDLED WITH
|
229
|
+
1.14.6
|
data/LICENSE
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
CC0 1.0 Universal (CC0 1.0)
|
2
|
+
Public Domain Dedication
|
3
|
+
https://creativecommons.org/publicdomain/zero/1.0/
|
4
|
+
|
5
|
+
This is a human-readable summary of the Legal Code:
|
6
|
+
https://creativecommons.org/publicdomain/zero/1.0/legalcode
|
7
|
+
|
8
|
+
Disclaimer
|
9
|
+
|
10
|
+
The Commons Deed is not a legal instrument. It is simply a handy reference for
|
11
|
+
understanding the CC0 Legal Code, a human-readable expression of some of its key
|
12
|
+
terms. Think of it as the user-friendly interface to the CC0 Legal Code beneath.
|
13
|
+
This Deed itself has no legal value, and its contents do not appear in CC0.
|
14
|
+
Creative Commons is not a law firm and does not provide legal services.
|
15
|
+
Distributing, displaying, or linking to this Commons Deed does not create an
|
16
|
+
attorney-client relationship.
|
17
|
+
|
18
|
+
Creative Commons has not verified the copyright status of any work to which CC0
|
19
|
+
has been applied. CC makes no warranties about any work or its copyright status
|
20
|
+
in any jurisdiction, and disclaims all liability for all uses of any work.
|
21
|
+
|
22
|
+
No Copyright
|
23
|
+
|
24
|
+
The person who associated a work with this deed has dedicated the work to the
|
25
|
+
public domain by waiving all of his or her rights to the work worldwide under
|
26
|
+
copyright law, including all related and neighboring rights, to the extent
|
27
|
+
allowed by law.
|
28
|
+
|
29
|
+
You can copy, modify, distribute and perform the work, even for commercial
|
30
|
+
purposes, all without asking permission. See Other Information below.
|
31
|
+
|
32
|
+
Other Information
|
33
|
+
|
34
|
+
* In no way are the patent or trademark rights of any person affected by CC0,
|
35
|
+
nor are the rights that other persons may have in the work or in how the work
|
36
|
+
is used, such as publicity or privacy rights.
|
37
|
+
* Unless expressly stated otherwise, the person who associated a work with this
|
38
|
+
deed makes no warranties about the work, and disclaims liability for all uses
|
39
|
+
of the work, to the fullest extent permitted by applicable law.
|
40
|
+
* When using or citing the work, you should not imply endorsement by the author
|
41
|
+
or the affirmer.
|
data/README.md
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
# [Cosgrove](https://github.com/steem-third-party/cosgrove)
|
2
|
+
|
3
|
+
Cosgrove is a STEEM Centric Discord Bot Framework that allows you to write your own Discord bots that interact with the STEEM blockchain.
|
4
|
+
|
5
|
+
One example of a bot that uses this framework is [@banjo](https://steemit.com/steemdata/@inertia/introducing-banjo) on SteemSpeak.
|
6
|
+
|
7
|
+
Many (not all) features work on Golos as well.
|
8
|
+
|
9
|
+
## New features
|
10
|
+
|
11
|
+
* Added the ability for each discord channel to have its own upvote weight, as well as have a default. Upvote voting weight can be:
|
12
|
+
* `dynamic` - uses the bot's current voting recharge percent as the upvote percent.
|
13
|
+
* `upvote_rules` - uses channel specific rules.
|
14
|
+
* `100.00 %` - can be any valid voting percentage.
|
15
|
+
* Added `CommentJob` for creating automated replies.
|
16
|
+
* Added callback `on_success_upvote_job` which can be used to, for example, reply to the post after being upvoted.
|
17
|
+
|
18
|
+
## Features
|
19
|
+
|
20
|
+
* **Registration**
|
21
|
+
* `$register <account> [chain]` - associate `account` with your Discord user (`chain` default `steem`)
|
22
|
+
* **Verification**
|
23
|
+
* `$verify <account> [chain]` - check `account` association with Discord users (`chain` default `steem`)
|
24
|
+
* **Up Voting**
|
25
|
+
* `$upvote [url]` - upvote from cosgrove; empty or `^` to upvote last steemit link
|
26
|
+
|
27
|
+
## Installation
|
28
|
+
|
29
|
+
```bash
|
30
|
+
$ gem install cosgrove
|
31
|
+
```
|
32
|
+
|
33
|
+
... or in your `Gemfile`
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
gem 'steemdata-rb', require: 'steemdata', git: 'git@github.com:steem-third-party/steemdata-rb.git'
|
37
|
+
gem 'cosgrove'
|
38
|
+
```
|
39
|
+
|
40
|
+
## Setup
|
41
|
+
|
42
|
+
Add a config file to your `ruby` project called `config.yml`:
|
43
|
+
|
44
|
+
```yaml
|
45
|
+
:cosgrove:
|
46
|
+
:token:
|
47
|
+
:client_id:
|
48
|
+
:secret: set this
|
49
|
+
:upvote_weight: upvote_rules
|
50
|
+
:upvote_rules:
|
51
|
+
:channels:
|
52
|
+
:default:
|
53
|
+
:upvote_weight: 50.00 %
|
54
|
+
:general_text:
|
55
|
+
:channel_id: <Your Favorite Channel ID>
|
56
|
+
:upvote_weight: 100.00 %
|
57
|
+
:chain:
|
58
|
+
:steem_account:
|
59
|
+
:steem_posting_wif:
|
60
|
+
:golos_account:
|
61
|
+
:golos_posting_wif:
|
62
|
+
:steem_api_url: https://steemd.steemit.com
|
63
|
+
:golos_api_url: https://ws.golos.io
|
64
|
+
:discord:
|
65
|
+
:log_mode: info
|
66
|
+
```
|
67
|
+
|
68
|
+
You will need to request a `token` and `client_id` from Discord (see below).
|
69
|
+
|
70
|
+
Provide the accounts and `wif` private postings keys if you want your bot to upvote posts.
|
71
|
+
|
72
|
+
You should change the `secret` key using the output of:
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
SecureRandom.hex(32)
|
76
|
+
```
|
77
|
+
|
78
|
+
## Bot Registration
|
79
|
+
|
80
|
+
1. Request a new bot here: https://discordapp.com/developers/applications/me#top
|
81
|
+
2. Register an `application` and create an `app bot user`.
|
82
|
+
3. Replace `APP_CLIENT_ID` with the App's Client ID in this URL: https://discordapp.com/oauth2/authorize?&client_id=APP_CLIENT_ID&scope=bot&permissions=153600
|
83
|
+
4. Give that URL to the Discord server/guild owner and have them authorize the bot.
|
84
|
+
5. Set the `token` and `client_id` in your bot constructor (see below).
|
85
|
+
|
86
|
+
## Usage
|
87
|
+
|
88
|
+
Cosgrove is based on `discordrb`, see: https://github.com/meew0/discordrb
|
89
|
+
|
90
|
+
All features offered by `discordrb` are available in Cosgrove. In addition, Cosgrove comes with pre-defined commands. See them by typing: `$help`
|
91
|
+
|
92
|
+
You can add you features thusly:
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
require 'cosgrove'
|
96
|
+
|
97
|
+
bot = Cosgrove::Bot.new
|
98
|
+
|
99
|
+
bot.message(with_text: 'Ping!') do |event|
|
100
|
+
event.respond 'Pong!'
|
101
|
+
end
|
102
|
+
|
103
|
+
bot.run
|
104
|
+
```
|
105
|
+
|
106
|
+
## Tests
|
107
|
+
|
108
|
+
* Clone the client repository into a directory of your choice:
|
109
|
+
* `git clone git@github.com:steem-third-party/cosgrove.git`
|
110
|
+
* Navigate into the new folder
|
111
|
+
* `cd cosgrove`
|
112
|
+
* Basic tests can be invoked as follows:
|
113
|
+
* `rake`
|
114
|
+
* To run tests with parallelization and local code coverage:
|
115
|
+
* `HELL_ENABLED=true rake`
|
116
|
+
|
117
|
+
---
|
118
|
+
|
119
|
+
<center>
|
120
|
+
<img src="http://i.imgur.com/7V09fNf.jpg" />
|
121
|
+
</center>
|
122
|
+
|
123
|
+
See my previous Ruby How To posts in: [#radiator](https://steemit.com/created/radiator) [#ruby](https://steemit.com/created/ruby)
|
124
|
+
|
125
|
+
## Get in touch!
|
126
|
+
|
127
|
+
If you're using Cosgrove, I'd love to hear from you. Drop me a line and tell me what you think! I'm @inertia on STEEM and Discord.
|
128
|
+
|
129
|
+
## License
|
130
|
+
|
131
|
+
I don't believe in intellectual "property". If you do, consider Cosgrove as licensed under a Creative Commons [](http://creativecommons.org/publicdomain/zero/1.0/) License.
|