create account

Setting Up Inertia's Cosgrove Bot by eonwarped

View this thread on: hive.blogpeakd.comecency.com
· @eonwarped · (edited)
$8.82
Setting Up Inertia's Cosgrove Bot
A couple weeks back I was in need of a discord bot with steem integration, and saw that @inertia had one running off of Ruby. Since I previously had only toyed a bit with Ruby, I had a bit of initial trouble getting it off the ground, and just for my reference I'm just going to document my steps here. I'm working with a server running Ubuntu (16.xx).

The repository is here: https://github.com/steem-third-party/cosgrove

# Local Changes and Bundling 

The initial instructions show how to use it as is, but I also wanted to make some changes to it, so I dug into how to set up the package with [bundler](https://bundler.io/):

`sudo apt-get install ruby`

`gem install bundler`

`bundle install`

And this is where I ran into a quite a few problems. As of the time I did this, I had the following errors and resolutions:

`nokogiri: mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h`

A search revealed that I need ruby dev libraries:

```
sudo apt-get install ruby`ruby -e 'puts RUBY_VERSION[/\d+\.\d+/]'`-dev
```

After that was resolved, there was a complaint about not having 'freetds'... some googling and I found I needed to install it.

```
mkdir freetds
cd freetds
wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-1.00.27.tar.gz
tar -xzf freetds-1.00.27.tar.gz
cd freetds-1.00.27
 ./configure --prefix=/usr/local --with-tdsver=7.3
sudo make install
```

After that, a complaint about not having imagemagick....

`sudo apt-get install libmagickwand-dev imagemagick`

Then for an error about conflicting 'reset' scope...

`vi /var/lib/gems/2.3.0/gems/steem_api-1.1.2/lib/steem_api/models/tx/custom/follow.rb`

In this file, I looked for where the 'reset' scope was, and commented it out. Will probably need confirmation if that breaks something... so far it has been working. Probably for my purposes, better to remove the activerecord sql dep since I don't hook into SQL.

# Using the local bundle

After bundle install worked, I set up another directory to point to this package, with Gemfile:

```
# Gemfile
source "https://rubygems.org"

gem "cosgrove", path: "{PATH_TO_LOCAL_COSGROVE_GEM}"
```

Here I also set up the `config.yml`, as documented in the repository.

And now my main file:
```
# main.rb
require 'cosgrove'

# For some reason, no default prefix, so needs specification
bot = Cosgrove::Bot.new prefix: '$'
bot.run
```


Now to run it:

`bundle exec ruby main.rb`

That got it to start and respect various commands.

I did run into trouble because I did not have Steem SQL set up. In this case, I commented out a bunch of lines to get it to revert to non-SQL behavior. Will be looking into patching with an option that can turn SQL off. At some point...

But anyway, now that I've done that, I've had some fun toying with various modifications to it. Now for example, we have manual curation within our @helpie community via the @helpiecake  account. Curators call on the bot to upvote, resteem, and leave a cupcake comment. And more fun things to come...

So far I've found it very easy to extend with what I need, and there's still plenty to explore in terms of what is baked into Cosgrove. Looks to have all sorts of fun dependencies.
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 935 others
πŸ‘Ž  
properties (23)
authoreonwarped
permlinksetting-up-inertia-s-cosgrove-bot
categorydiscordbot
json_metadata{"tags":["discordbot","steem","helpie","cosgrove"],"users":["inertia","helpie","helpiecake"],"links":["https://github.com/steem-third-party/cosgrove","https://bundler.io/"],"app":"steemit/0.1","format":"markdown"}
created2019-03-19 05:13:18
last_update2019-04-06 03:39:00
depth0
children12
last_payout2019-03-26 05:13:18
cashout_time1969-12-31 23:59:59
total_payout_value6.800 HBD
curator_payout_value2.024 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,192
author_reputation88,102,208,706,615
root_title"Setting Up Inertia's Cosgrove Bot"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,553,143
net_rshares13,177,711,533,216
author_curate_reward""
vote details (1000)
@blewitt ·
$0.03
This all looks like Mandarin to me. Lol

I wish I knew how to decipher this stuff. #useless

Posted using [Partiko iOS](https://partiko.app/referral/blewitt)
πŸ‘  
properties (23)
authorblewitt
permlinkblewitt-re-eonwarped-setting-up-inertia-s-cosgrove-bot-20190319t052953834z
categorydiscordbot
json_metadata{"app":"partiko","client":"ios"}
created2019-03-19 05:29:54
last_update2019-03-19 05:29:54
depth1
children3
last_payout2019-03-26 05:29:54
cashout_time1969-12-31 23:59:59
total_payout_value0.026 HBD
curator_payout_value0.006 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length157
author_reputation504,983,721,208,239
root_title"Setting Up Inertia's Cosgrove Bot"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,553,585
net_rshares54,666,752,491
author_curate_reward""
vote details (1)
@eonwarped ·
One day, my friend. We will all be forced to speak bot.
properties (22)
authoreonwarped
permlinkre-blewitt-blewitt-re-eonwarped-setting-up-inertia-s-cosgrove-bot-20190319t054016285z
categorydiscordbot
json_metadata{"tags":["discordbot"],"app":"steemit/0.1"}
created2019-03-19 05:40:18
last_update2019-03-19 05:40:18
depth2
children1
last_payout2019-03-26 05:40:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length55
author_reputation88,102,208,706,615
root_title"Setting Up Inertia's Cosgrove Bot"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,553,832
net_rshares0
@igster ·
$0.03
The bot will speak english when that day comes :)
πŸ‘  
properties (23)
authorigster
permlinkre-eonwarped-re-blewitt-blewitt-re-eonwarped-setting-up-inertia-s-cosgrove-bot-20190319t102235592z
categorydiscordbot
json_metadata{"tags":["discordbot"],"app":"steemit/0.1"}
created2019-03-19 10:22:33
last_update2019-03-19 10:22:33
depth3
children0
last_payout2019-03-26 10:22:33
cashout_time1969-12-31 23:59:59
total_payout_value0.024 HBD
curator_payout_value0.007 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length49
author_reputation17,415,198,441,969
root_title"Setting Up Inertia's Cosgrove Bot"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,564,584
net_rshares48,194,863,529
author_curate_reward""
vote details (1)
@teutonium ·
$0.03
I think it's Aramaic, everyone always forgets Aramaic xD 

Now for real, am I crazy for wanting to learn Latin? At least the basics? Even though it's a dead language it's one of the most important languages in the world, it's one of the few that gave birth to all the current languages!
πŸ‘  
properties (23)
authorteutonium
permlinkre-blewitt-blewitt-re-eonwarped-setting-up-inertia-s-cosgrove-bot-20190319t200421508z
categorydiscordbot
json_metadata{"community":"busy","app":"busy/2.5.6","format":"markdown","tags":["discordbot"],"users":[],"links":[],"image":[]}
created2019-03-19 20:04:24
last_update2019-03-19 20:04:24
depth2
children0
last_payout2019-03-26 20:04:24
cashout_time1969-12-31 23:59:59
total_payout_value0.024 HBD
curator_payout_value0.007 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length286
author_reputation26,461,519,991,043
root_title"Setting Up Inertia's Cosgrove Bot"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,587,335
net_rshares47,756,725,707
author_curate_reward""
vote details (1)
@inertia ·
$0.07
Oh man, I really need to clean up cosgrove.
πŸ‘  
properties (23)
authorinertia
permlinkre-eonwarped-setting-up-inertia-s-cosgrove-bot-20190319t075413248z
categorydiscordbot
json_metadata{"tags":["discordbot"],"app":"steemit/0.1"}
created2019-03-19 07:54:12
last_update2019-03-19 07:54:12
depth1
children1
last_payout2019-03-26 07:54:12
cashout_time1969-12-31 23:59:59
total_payout_value0.049 HBD
curator_payout_value0.016 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length43
author_reputation346,568,901,399,561
root_title"Setting Up Inertia's Cosgrove Bot"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,557,995
net_rshares96,277,548,301
author_curate_reward""
vote details (1)
@eonwarped ·
Hehe no worries. I've been meaning to help a bit too but for now I'm just using what works. Thanks for publishing what you have either way!

Posted using [Partiko Android](https://partiko.app/referral/eonwarped)
properties (22)
authoreonwarped
permlinkeonwarped-re-inertia-re-eonwarped-setting-up-inertia-s-cosgrove-bot-20190319t164407878z
categorydiscordbot
json_metadata{"app":"partiko","client":"android"}
created2019-03-19 16:44:09
last_update2019-03-19 16:44:09
depth2
children0
last_payout2019-03-26 16:44:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length211
author_reputation88,102,208,706,615
root_title"Setting Up Inertia's Cosgrove Bot"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,580,264
net_rshares0
@ksikka ·
Why is the hardest part always getting the thing to run
properties (22)
authorksikka
permlinkre-eonwarped-setting-up-inertia-s-cosgrove-bot-20190320t132352861z
categorydiscordbot
json_metadata{"tags":["discordbot"],"app":"steemit/0.1"}
created2019-03-20 13:23:54
last_update2019-03-20 13:23:54
depth1
children0
last_payout2019-03-27 13:23:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length55
author_reputation189,512,007,122
root_title"Setting Up Inertia's Cosgrove Bot"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,622,355
net_rshares0
@partiko ·
Thank you so much for participating in the Partiko Delegation Plan Round 1! We really appreciate your support! As part of the delegation benefits, we just gave you a 3.00% upvote! Together, let’s change the world!
properties (22)
authorpartiko
permlinkre-setting-up-inertia-s-cosgrove-bot-20190319t073106
categorydiscordbot
json_metadata"{"app": "partiko"}"
created2019-03-19 07:31:09
last_update2019-03-19 07:31:09
depth1
children0
last_payout2019-03-26 07:31:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length213
author_reputation39,207,160,334,751
root_title"Setting Up Inertia's Cosgrove Bot"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,557,039
net_rshares0
@steem-bet ·
Dear eonwarped:

We are SteemBet, the next generation STEEM based gaming platform. We are honored to invite you to join our first fantastic dice game, which is just the beginning of SteemBet game series. Our dividend system has now launched. The prize pool has already accumulated 2,000 STEEM and more than 60 players have participated in staking mining token SBT. A huge reward of 40,000 STEEM is awaiting! Join us NOW with other 500 STEEM users to loot HUGE dividend reward!!

SteemBet Team

Official Website
https://steem-bet.com

Discord Server
https://discord.gg/95cBN3W

Telegram Group
https://t.me/steembet
properties (22)
authorsteem-bet
permlinksteem-bet-re-eonwarped-setting-up-inertia-s-cosgrove-bot-20190323t050030434z
categorydiscordbot
json_metadata{"app":"partiko"}
created2019-03-23 05:00:30
last_update2019-03-23 05:00:30
depth1
children0
last_payout2019-03-30 05:00:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length613
author_reputation18,461,529,615,904
root_title"Setting Up Inertia's Cosgrove Bot"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,777,159
net_rshares0
@steem-ua ·
#### Hi @eonwarped!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your **UA** account score is currently 4.996 which ranks you at **#1145** across all Steem accounts.
Your rank has improved 3 places in the last three days (old rank 1148).

In our last Algorithmic Curation Round, consisting of 201 contributions, your post is ranked at **#9**.
##### Evaluation of your UA score:

* Some people are already following you, keep going!
* The readers appreciate your great work!
* Great user engagement! You rock!


**Feel free to join our [@steem-ua Discord server](https://discord.gg/KpBNYGz)**
properties (22)
authorsteem-ua
permlinkre-setting-up-inertia-s-cosgrove-bot-20190319t153139z
categorydiscordbot
json_metadata"{"app": "beem/0.20.18"}"
created2019-03-19 15:31:39
last_update2019-03-19 15:31:39
depth1
children0
last_payout2019-03-26 15:31:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length650
author_reputation23,214,230,978,060
root_title"Setting Up Inertia's Cosgrove Bot"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,577,172
net_rshares0
@teutonium ·
What can you do with Ruby? Never used it, have no idea what it does, but if it is useful I might dip my pinky toe in it and see if I can do something nice with it
properties (22)
authorteutonium
permlinkre-eonwarped-setting-up-inertia-s-cosgrove-bot-20190319t200525793z
categorydiscordbot
json_metadata{"community":"busy","app":"busy/2.5.6","format":"markdown","tags":["discordbot"],"users":[],"links":[],"image":[]}
created2019-03-19 20:05:30
last_update2019-03-19 20:05:30
depth1
children0
last_payout2019-03-26 20:05:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length162
author_reputation26,461,519,991,043
root_title"Setting Up Inertia's Cosgrove Bot"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,587,372
net_rshares0
@tts ·
To listen to the audio version of this article click on the play image.
[![](https://s18.postimg.org/51o0kpijd/play200x46.png)](http://ec2-52-72-169-104.compute-1.amazonaws.com/eonwarped__setting-up-inertia-s-cosgrove-bot.mp3)
Brought to you by [@tts](https://steemit.com/tts/@tts/introduction). If you find it useful please consider upvoting this reply.
properties (22)
authortts
permlinkre-setting-up-inertia-s-cosgrove-bot-20190319t054119
categorydiscordbot
json_metadata""
created2019-03-19 05:41:21
last_update2019-03-19 05:41:21
depth1
children0
last_payout2019-03-26 05:41:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length354
author_reputation-4,535,154,553,995
root_title"Setting Up Inertia's Cosgrove Bot"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id81,553,866
net_rshares0