This guide is a follow-up and a supplemement to a previous guide I made on how to building a pay4vote bot of your own. This bot is again based on the code from and will include additional features allowing you to refund payments that are not of the correct amount and/or missing or incorrect URLs.
I found this code on 's Github HERE and adapted it to create a bot similar to randowhale. Below are directions on how to setup and execute the bot in Windows.
Because it took me a few weeks to figure out and a lot of trial and error, I wanted to provide a step-by-step guide on what to do for newbies such as myself who are also interested in setting up something similar.
Let's get started:
You will first need to download and install the SteemBot library which is based on the Steem-js library and code. As I have mentioned in my previous posts, I am using Visual Studio Code to work on all my projects.
You can download the latest Visual Studio Code HERE.
You will also need to download and install the latest Node.js runtime files which you can get HERE.
Setup of the above two items should be fairly easy and involve clicking Next all the way until Finish.
Once you have installed all the above items, go back to downloading and installing the Steembot Library of files you will need by using the following command at the terminal window of Visual Studio Code:
- Create a folder named after your Bot and open the folder using Visual Studio Code - In my case I created a folder on my desktop named Pay4Vote
- Next download and install the SteemBot library by typing the following command
npm install steem-bot --save
Installation of the library should start like in the above screenshot.
Once Installation is complete, you may see a few notices. You can ignore those.
Next you will need to install the supporting files for your bot by typing:
npm init
you will be asked a series of questions which you can simply just press ENTER all the way through
Once complete, type the following command to install the remaining dependencies:
npm install
You should now have the following folders in your Pay4Vote Folder:
Next you will need to create a new Javascript file (which is where your bot code will go) by clicking on the New File Icon under your Bot folder Directory as seen in the screenshot below
I named my bot javascript file bot.js
Next you can copy and paste the following code onto your Bot.js file:
const SteemBot = require('steem-bot').default
const username = 'Your Steem Username';
const activeKey = 'Your Private Active Key';
function isValidSteemitLink(link) {
return link.indexOf('steemit.com') > -1;
}
const bot = new SteemBot({username, activeKey});
bot.onDeposit(username, handleDeposit);
function handleDeposit(data, responder) {
if (parseFloat(data.amount) >= 0.01 && isValidSteemitLink(data.memo)) {
const randomVote = (Math.random() * 4).toFixed(2) + 1;
responder.upvoteOnMemo(randomVote)
.then(() => {
responder.commentOnMemo(
`This post received a ${randomVote}% upvote from @Your_Bot_Name thanks to @${data.from}! For more information, click here!`
);
});
} else {
if (data.amount.indexOf('STEEM') > -1) {
responder.sendSteem(
data.amount,
'Sending back the money, should be at least 2 STEEM or SBD with a valid steemit link in memo'
);
} else {
responder.sendSbd(
data.amount,
'Sending back the money, should be at least 2 STEEM or SBD with a valid steemit link in memo'
);
}
}
}
bot.start();
Replace the items in **Bold** with your Bots personal Steemit details. What you should end up with is something that looks like the following screenshot
Please keep in mind that you will need to use your Bots Steemit Account Name and Private Active Key in order for this to work. You will also need to make sure your bot is funded with enough Steem Power in order to start voting.
Once all of the information is updated with your personal information, type the following command to execute the bot:
node bot.js
If done correctly, you should see the following comment and corresponding upvote on posts when someone sends the correct amount of SBD and the URL in the memo:
If the incorrect amount of SBD is sent or the URL is incorrect, your Bot should refund the SBD sent and provide a memo in the users wallet like the following
This Guide will hopefully help you get started with setting up your own Pay4Vote bot in a Windows environment. Thanks to for providing the initial libraries and code which served as the foundation for me to create my own bot and this guide.
If there are any updates, feedback, input, or suggestions - please let me know in the comments below. If you found this helpful, please consider visiting my Steemit profile and upvoting, resteeming, and voting for my witness cloh76.witness. I appreciate the support!
Posted on Utopian.io - Rewarding Open Source Contributors