Introducing: Cosgrove - A STEEM Centric Discord Bot Framework

in #radiator7 years ago

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] - 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

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

  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

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:  

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.

You're fricken awesome @inertia :)

Great job!
Thanks for this... Ill be looking into it for sure!

How will this benefit Steemit and Steem users?

On SteemSpeak, we use it to boost engagement.

very good stuff @inertia
i hve followed n upvoted u
pls do the same for me
as we can help each other at this concept of steeming

I like this bot, have you other one with JS . thanks @inertia.

I have no idea about any of this

You will lol. I have only been here for a few weeks ,,,
And I am starting to see how the game is being played. And wrapping my head around it ..
I have worked in the mental health field for over 20 years ...Human nature never changes to much lmao

I to work in the mental heath field.. small world

Been a busy week for me.
Lots of extra paper work in fack should go do it now

no time like the present

And with less typooos lol ok no more steem back to work lol

:) I might use this bot for my steem school discord thanks

Some really cool stuff

Interesting information, thanks for sharing @inertia upvote and follow you

Thank you for the info inertia.

very help full, as an community we planned to build bot like @banjo, based on your post, i have some thing to starting.. thx very much..

Oh, yeah.. I'm actually a spy.. But you have to promise you won't tell anyone.

Why do you think I'm a bot?

i am traying to clone your git but error,. how to fix that problem

"Cloning into 'cosgrove'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists."

You might have better luck with these steps instead: https://chainbb.com/ruby/@inertia/how-to-write-a-discord-bot-in-ruby

Damn, see things like this are what I like to see!

All I need is this, my team event/gaming organizing bot, and my levels bot and boom! Amazing to think that there are these niche tools that can work together to build what I want out of my community.

What's next? Commercialized access to space?

@inertia if people would delegate to this bot will it pay out curation rewards automaticly?

Hey what are you on discord as?

Flagged for comment spam collusion. Stop upvoting @aluma or I am going to organize a campaign against all three of you. Your activity has been reported.