HiveBot - Easy & real-time automation on top of Hive Blockchain

in HiveDevs4 years ago (edited)

hivebot_logo2.png

HiveBot

HiveBot is an open-source free library that provides real-time automation on top of Hive Blockchain with a very simple API. It is very useful for the new comers who want to develop applications on Hive, It can be easily used to perform automated tasks without having to go through node's mechanism and tricky API.

This is basically an abstraction on top of the official JavaScript library of Hive, which is somehow a low-level API and is not easy to be used for newcomers of the platform.

Similar library was published by @p0o about 3 Years ago for Steem Blockchain called steem-bot (GitHub Repo). Although it still works, it hasn't been updated in a very long time and its limited to Steem. This is a modified version of that library which is able to work on Hive's API and provide same and more functionalities.

Features

It has most of the common operations included. At this moment it is possible to monitor these actions:

  • Receiving Deposits (For selected or all accounts)
  • New Posts (For selected or all accounts)
  • New Comments (For selected or all accounts)

Every action above can be optionally used to trigger an automatic response which can:

  • Send HBD
  • Send Hive
  • Upvote
  • Downvote
  • Comment/Reply

Installation

NPM package is available. You should be fine to use it with any supported node-js version but feel free to report any issue here:

npm install hive-bot --save

Then include the package on top of your file:

const { HiveBot } = require('hive-bot');

How to use?

It has a very easy setup. For Instance, lets say you just want to monitor every deposit on the account poloniex, you will start by defining the constructor:

const bot = new HiveBot({});
// or with username and keys (no need in this case):
// const bot = new HiveBot({username, postingKey, activeKey});

After than we call a function for the bot API to trigger a response whenever our target account (poloniex) receive deposits:

// you can add more than one target users
const targetUsers = ['poloniex']

// first param will be target user and 2nd handler
bot.onDeposit(targetUsers, (data, responder) => {
  console.log(data);
  // no need to use responder since we are just monitoring
  // on each deposit it will show a message like this 
  // { from: 'ali-h', to: 'poloniex', amount: '358 HIVE', memo: 'GbH4HgV35Ygv'}
});

Now after all the functions are declared you only have to start the bot like this:

// this function will start the bot and keep it open
bot.start();

Just simple as this, this is only one example of many possibilities, you may visit HiveBot's GitHub Repo for complete explanation and more examples.

Further Development

This package is still under development and I have many more features planned to implement very soon, like support for Communities, Hive-Engine tokens and detecting commands or mentions in comments (like @tipu curate! or !trdo) which are very useful to create curation and more dynamic bots. This package is using Semantic versioning so you don't have to worry about changes in API breaking your bot. Feel free to use it and give your feedback.

Links

GitHub Repository
NPM Package
GitHub Profile
Hive Profile
Discord: Ali H#7057
[email protected]

Sort:  

SCAM ALERT - This guy was "hacked" while working on a project for my friend shane with creativecoin and a HUGE amount of tokens were stolen and dumped into the market.

This user NEVER paid back shane.

thank you. i should probably not try to work anymore?

@kyle / @ali-h / @blocktrades,
Sorry I have to jump this due to I knew what happened at that day (Hacked CCC drama). @Ali-h is a genius developer who backed my project top of STEEM - TRDO (TRENDO). Ali-h is the guy who developed that bot scripts & had my keys under him, but never tried to steal funds or whatever. So personally I don't believe he hacked, but I do believe something happened at that day & @ali-h listed as a scammer.
Anyway I wish everyone should allow this kind of genius to work on HIVE. I know how good he is at coding & I do believe he might not let the same mistake happen twice.

Thanks
TheGuruAsia

thank you so much bro. I really appreciate this, i have learnt from mistakes, i will always be very careful now.

Downvoting because a1 says this dude is a fucking scammer..

I've no reason to believe a1 would mislead the community in falsely accusing another user of being a thieving twat. Avoid this code at all costs lest your systems be compromised and your crypto stolen.

@klye It is an open source project, you can verify the code. though i know many can't understand. i'm not a scammer, but yes i was involved because it was my partner who misused, hacked my project files & stole about 91,000 CCC tokens. i did not just go dark, i took responsibility, i explained completely what happened. i am still active on discord & i don't refuse to talk. unfortunately i am unable to pay, i do not have funds... i don't want to bitch about it but i'm really sorry & probably i can not work anymore because i am labeled 'SCAMMER'.. this was a try to get back in development, a free open-source library which could be useful for new devs. thanks... Also i literally your follower from like 2 years i think (you do good work, hive-roller is awesome). if please i can ask what can i do to get this off me? i would appreciate the help please.. and advice maybe? i want to work.. or should i just fuck off? i have apologized i'd do it again. i do not say that i don't deserve to be blamed, it was indeed my mistake. i hope you reply. wouldn't mind if you don't wanna get into it.

Ah, I see. Thank you for the explanation. Unfortunately the guilt be association is thick on the internet.

If it wasn't you and instead was your old partner I'd honestly give him up to the community identification wise so he can be dealt with in a timely matter.

Not opposed to second chances and whatnot.. Hopefully what you say is true and you have good intentions. The power developers have is greater than the average user and they must have some level of trust. Hopefully all goes well for you. Will be watching from the sidelines.

Not sure how to redeem your development en-devours. If you are pure in intention it should show over time..

thank you very much, really! yes i too believe that developer must have trust, i did a terrible mistake and behaved unprofessionally. i hope i will be able to redeem.. i will try to work and be as transparent i can. tbh i am not very experienced and quite young but I've learned from mistakes hope i never do that again. thank you for replying.

Your reply seems reasonable to me. Upvoted.

@blocktrades hold my tea!!! i'm very thankful! i will try to be more transparent and community engaging & hopefully gain back trust, be a good member. really amazed to see you here, a top witness, thank you for being in our community and actually actively engage with all users. i did not expect that. good luck with the new HF! you are awesome <3

If you're serious about redeeming yourself it would be wise to take any payout from this post and put it towards repaying parties affected by the hack.. But that is up to you.

yup, i am totally up for it, i am going to be honest i did not intended to do this while posting, assuming that its a thing in the past and i should start working again, fyi i was unactive in my blog for quite a time because i was demotivated n' sh*t. but now looking at things how of topic this thread got, i should really do it. i know i am not able to pay full amount in one go but i think i can try to do it like this maybe? i understand that @a1-shroom-spores commented to give heads up and because he thinks i'm scammer, and this code could get someone else scammed. which won't happen again, also its open-source! i don't blame or hate him for it, i'm not the most trusted person. i wish it helps me, again thanks dude you are good :)

but i am getting downvoted, i think this would go in negative! @gtg also downvoted this post, probably he was made aware. i'm now also on some blacklist now. not so good :(

Is this Hive bot still working?

Not updated to the latest version. Will eventually do it 😅.