Steem-Discord Witnesses upvote with Javascript

in #utopian-io8 years ago (edited)

Immagine.png

What is witnessinfo

This is the first version of a script called "witnessinfo.js".
The script facilitates query on steem Blockchain using Discord and steem api.
Exactly:

  • Use discord to capture text
  • Use steem to query a specified user for witnesses upvotes given to users
  • Don't need steem priv key
  • Need bot token and Discord channel ID

With this script we capture all witnesses upvotes given by a specific user, printing the output on a specific discord channel.

Warranty

This software is provided as is and I am not responsible for any problems caused by it.

Current Version

1.0

Scripting Language

Javascript

Repository

https://github.com/yanosh01/Steem-Discord-Witnesses-upvotes-with-Javascript.git

Bug

  • Report me any bug if you find it

Requirements

1- Node Js
2- NPM
3- Steem Api
4- discord Js libraries
5- a discord Bot account

How to install

1- sudo apt-get install nodejs
2- sudo apt-get install npm
3- npm install steem --save
4- npm install discord.js
5- npm install pm2
6- create a discord bot with this guide
7- edit the script called witnessinfo.js

How to use it

$witness steemusername

Example: $witness yanosh01

Full Script

var steem = require("steem");
var Discord = require('discord.js');
var client = new Discord.Client();


var regex = /(\$)+(witness)+( [^ ]+)*$/; 
var regex1 = /(\W|^)witness /; 


client.on('message', msg => {
if (msg.content.match (regex)) {
var channel = client.channels.get('DISCORD CHANNEL ID');

        var aut = msg.content.match(regex)[0];
        var author = aut.replace(regex1,'');



steem.api.getAccounts([author], function (err, result) {
    if (err) {
channel.send("Witness query failed");

 }
  else {
var output = result[0].witness_votes;
var output2 = output.toString();

channel.send({embed: {
  color: 2447002,
  title: "List of Witnesses upvote given by "+author,
  description: output2

}});
 }

})
  }
});


client.login('DISCORD BOT TOKEN');

GitHub Account

https://github.com/yanosh01

divisorio.jpg

If you like what i'm doing, please upvote me as your Witness here

witness.gif

Sort:  
Loading...

Appreciate the code release. Any project promoting witness voting is a good thing. ✌💛

Thanks, it's a pleasure to create somenthing useful

That would be very useful for me!

Your entry has been upvoted by the @Faircrew trail. For more information, I invite you to be part of our Discord server .

Ty very much..

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by yanosh01 from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP.
Be sure to leave at least 50SP undelegated on your account.

Coin Marketplace

STEEM 0.04
TRX 0.33
JST 0.094
BTC 63540.09
ETH 1790.10
USDT 1.00
SBD 0.39