Introducing: Cosgrove - A STEEM Centric Discord Bot Framework
Cosgrove
Cosgrove is a STEEM Centric Discord Bot Framework that allows you to write your own Discord bots that interact with the STEEM blockchain.
One example of a bot that uses this framework is @banjo on SteemSpeak.
Many (not all) features work on Golos as well.
Features
- Registration
$register <account> [chain]
- associateaccount
with your Discord user (chain
defaultsteem
)
- Verification
$verify <account> [chain]
- checkaccount
association with Discord users (chain
defaultsteem
)
- Up Voting
$upvote [url]
- upvote from cosgrove; empty or^
to upvote last steemit link
Installation
$ gem install cosgrove
... or in your Gemfile
gem 'steemdata-rb', require: 'steemdata', git: '[email protected]:steem-third-party/steemdata-rb.git'
gem 'cosgrove'
Setup
Add a config file to your ruby
project called config.yml
:
:cosgrove:
:token:
:client_id:
:secret: set this
:chain:
:steem_account:
:steem_posting_wif:
:golos_account:
:golos_posting_wif:
:steem_api_url: https://steemd.steemit.com
:golos_api_url: https://ws.golos.io
:discord:
:log_mode: info
You will need to request a token
and client_id
from Discord (see below).
Provide the accounts and wif
private postings keys if you want your bot to upvote posts.
You should change the secret
key using the output of:
SecureRandom.hex(32)
Bot Registration
- Request a new bot here: https://discordapp.com/developers/applications/me#top
- Register an
application
and create anapp bot user
. - 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 - Give that URL to the Discord server/guild owner and have them authorize the bot.
- Set the
token
andclient_id
in your bot constructor (see below).
Usage
Cosgrove is based on discordrb
, see: https://github.com/meew0/discordrb
All features offered by discordrb
are available in Cosgrove. In addition, Cosgrove comes with pre-defined commands. See them by typing: $help
You can add you features thusly:
require 'cosgrove'
bot = Cosgrove::Bot.new
bot.message(with_text: 'Ping!') do |event|
event.respond 'Pong!'
end
bot.run
Tests
- Clone the client repository into a directory of your choice:
git clone [email protected]:steem-third-party/cosgrove.git
- Navigate into the new folder
cd cosgrove
- Basic tests can be invoked as follows:
rake
- To run tests with parallelization and local code coverage:
HELL_ENABLED=true rake
See my previous Ruby How To posts in: #radiator #ruby
Get in touch!
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.
License
I don't believe in intellectual "property". If you do, consider Cosgrove as licensed under a Creative Commons License.
Inertia has built some of the most amazing bots for steem, check out the /created/radiator category, the library grows and grows!
Another great one! Upvoted as hard as I could!
Cool to see ur still around, so nice of you making this SteamSpeak! Hope well have a chat sometime soon :) <3
welcome anytime, http://steemspeak.com 24/7 all year action :)
I use this in @minnowsupport and am very grateful for it.
:D nice one .. its like you push a new cool tool every 2 weeks .. awesome 👍🤗
I have a hard time getting all this working
Will steem be totally automated one day? Is anyone real?
Brave new world.
great post, thank you for sharing this interesting information with the community, I hope you can go through my blog
Some bots are cool !
Honestly I'm just happy other people love that character as much as I do.
Great job!
Thanks for this... Ill be looking into it for sure!
You're fricken awesome @inertia :)