Previously, I posted a framework that can be used to bridge the STEEM blockchain with Discord. Basically, you can use it to write your own Discord bot. And that's what @banjo is.
But if you're not that familiar with writing a Discord bot in Ruby, this how-to might be helpful to you. So here's how you can go about it.
First, you'll need to prepare your workstation to do development on a stable version of ruby.
drphil to run on Windows (drphil.rb - Voting Bot - Windows Installation). Not sure if it's that helpful, but if you can follow those steps, you can do ruby development on Windows. The commands below are for bash prompts, but they are usually the same in the Microsoft command line. Alternative, you could use rvm for providing ruby tools. You can install it from (rvm.io)[https://rvm.io/]. Alternatively, if you're not that familiar with Linux, you can use rvm route, run:
rvm install ruby-2.2.5source ~/.rvm/scripts/rvmrvm use ruby-2.2.5rvm default use ruby-2.2.5We're just going to create an empty folder for this. I'm assuming you know how to do this, but just in case:
$ mkdir mybot
$ cd mybot
Also make sure you have bundler:
$ gem install bundler
As well, get imagemagick and git:
$ sudo apt-get install git imagemagick libmagickcore-dev libmagickwand-dev
$ sudo port install git imagemagick
GemfileThe Gemfile is for organizing all of the libraries used by the bot.
source 'https://rubygems.org'
gem 'cosgrove'
Once this file exists, you can install the libraries:
$ bundle install
Add a config file called config.yml:
:cosgrove:
:token:
:client_id:
:secure: set this
:upvote_weight: upvote_rules
:upvote_rules:
:channels:
:default:
:upvote_weight: 50.00 %
:general_text:
:channel_id: <Your Favorite Channel ID>
:upvote_weight: 100.00 %
: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 secure key using the output of SecureRandom. Use ruby to generate this key:
$ ruby -rrubygems -rbundler/setup -e "Bundler.require; puts ' :secure: ' + SecureRandom.hex(32)"
application and create an app bot user.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=153600token and client_id in your bot config.Now create a file called bot.rb:
require 'rubygems'
require 'bundler/setup'
Bundler.require
bot = Cosgrove::Bot.new(prefix: '$')
bot.message(with_text: 'Ping!') do |event|
event.respond 'Pong!'
end
bot.run
And finally, to run the bot, type:
$ ruby bot.rb
While the bot is running this way, you can use any of the commands available to Cosgrove from Discord. The default commands are:
$slap [target] - does a slap on the target
$verify <account> [chain] - check account association with Discord users (chain default steem)
$register <account> [chain] - associate account with your Discord user (chain default steem)
$upvote [url] - upvote from bot; empty or ^ to upvote last steemit link
Also see: Introducing: Cosgrove - A STEEM Centric Discord Bot Framework