Cosgrove: Database Update

in #radiator7 years ago

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.

New features

  • Added support for SteemApi as a fallback to SteemData.
  • Gem updates.

Features

  • Registration
    • $register <account> [chain] - associate account with your Discord user (chain default steem)
  • Verification
    • $verify <account> [chain] - check account association with Discord users (chain default steem)
  • Up Voting
    • $upvote [url] - upvote from cosgrove; empty or ^ to upvote last steemit link
    • The ability for each discord channel to have its own upvote weight, as well as have a default. Upvote voting weight can be:
      • dynamic - uses the bot's current voting recharge percent as the upvote percent.
      • upvote_rules - uses channel specific rules.
      • 100.00 % - can be any valid voting percentage.
      • disable_comment_voting - only posts can get votes.
    • CommentJob for creating automated replies.
    • Callback on_success_upvote_job which can be used to, for example, reply to the post after being upvoted.
    • Market data now uses Bittrex instead of Poloniex.
    • operators to keep track of steem accounts that can do things like block upvotes (by blockchain mute).

Installation

$ gem install cosgrove

... or in your Gemfile

source 'https://rubygems.org'

gem 'cosgrove'

Setup

Add a config file to your ruby project called config.yml:

:cosgrove:
  :token: 
  :client_id: 
  :secure: set this
  :operators: <account names seperated by space>
  :upvote_weight: upvote_rules
  :upvote_rules:
    :channels:
      :default:
        :upvote_weight: 50.00 %
      :general_text:
        :channel_id: <Your Favorite Channel ID>
        :upvote_weight: 100.00 %
        :disable_comment_voting: true
:chain:
  :steem_account: 
  :steem_posting_wif: 
  :golos_account: 
  :golos_posting_wif: 
  :steem_api_url: https://api.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.hex(32)

Bot Registration

  1. Request a new bot here: https://discordapp.com/developers/applications/me#top
  2. Register an application and create an app bot user.
  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
  4. Give that URL to the Discord server/guild owner and have them authorize the bot.
  5. Set the token and client_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:
  • 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

Also see:

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 CC0 License.

Sort:  

appreciate the efforts. Just wondering whether you have codeclimate based tests for the frame work and associated code. I am trying to look into this for @indiaunited and may be able to try the tests if you haven't already

I do have the tests. I haven't hooked it up to codeclimate just yet. Currently at about 63% coverage.

63% is quite enviable I must say :)

If I read well does it mean this bot will be doing some action? You mean like for example programmed to help you perform some specific discord actions?

Honestly it is a bit technical for me but please assure the policeman in the picture that it is just a database update. Thanks for the info. Blessings.

you are the best @inertia with every new feature or update you provide a full tuto for that so thnx

Can you please update me so I can learn more on discord. Thanks

You want me to teach you discord?

Yes. Thanks

Don't you have any ''Python/Discord/Ruby for dummies'' guide or something?

thank you for the great guide :)

I appreciate the efforts I see that you do a very good job friend successful


Keep it up

Upvoted this from $12.30 to $13 and I am gpoing to imagine that this is just an update for @mongo the steem database that is super behind and causing a problem for the $mvests and $accounts commands that @banjo usually responds to accurately, and yes I know Its not that simple

having low steem power, can I create my own steem @bot on discord? can I join you on discord?