Image Source
Hoje brincando com uns códigos, decidi criar minha própria versão do aplicativo de votação automático usando ruby, os códigos são bem simples, mas é funcional. Atualmente, não utilizo nenhum software de automação no steemit, mas é muito util para quem não tem muito tempo, vou deixar o código pois alguém pode se interessar em usar ou aplimorar o codigo.
Primeiro devemos instalar a API, para isso siga as instruções abaixo:
Pré Requisitos
$ sudo apt-get install ruby-full git openssl libssl1.0.0 libssl-dev
$ gem install bundler
$ sudo gem install time_difference
API Radiator
$ sudo gem install radiator
Agora você precisará criar um arquivo chamado main.rb
, e colar o codigo abaixo:
require 'radiator'
require 'yaml'
require 'time_difference'
@config = YAML.load_file('config.yml')
@options = @config[:chain_options]
@keys = @config[:account]
@voter = @config[:voter]
api = Radiator::DatabaseApi.new(@options.dup)
while TRUE
@voter.each do |x|
author, voter_power, minutos = x.split(' ')
getblog = api.get_state("@#{author}/blog")
getblog = getblog.result.accounts[author].blog.first
acc, link = getblog.split("/")
if getblog.include? author
r = api.get_content(acc, link)
check_voter = r.result.active_votes.map(&:voter)
@keys.each do |key|
account, posting_wif = key.split(' ')
if check_voter.include? account
puts "ja votou para #{author}"
else
post_date = r.result.created
time_now = Time.now.utc
diferenca = TimeDifference.between(post_date, time_now).in_minutes
if diferenca > eval(minutos)
power = eval(voter_power)*100
transacao = Radiator::Transaction.new(wif: posting_wif)
voto = {
type: :vote,
voter: account,
author: author,
permlink: link,
weight: power
}
transacao.operations << voto
puts transacao.process(true)
else
puts "O post foi criado a #{diferenca} e precisa de #{minutos} minutos para votar"
end
end
end
else
#puts "Erro "
end
end
end
Salve e crie outro arquivo com o nome de config.yml
e coloque o codigo abaixo com suas modificações
:account:
# ColoqueSuaContaAbaixo e SuaSenhadePostagem
- suaconta P5445nbEg45mn45045521cgr9h514gbr549TestFac55k
:chain_options:
:chain: steem
:url: https://steemd.steemit.com
:voter:
# Author PoderDeVoto EsperarParaVotarEmMinutos
- ned 20 30
- dan 25 30
- eliel 100 30
Agora salve e abra o terminal na pasta onde esta salvo o codigo e coloque para rodar com o comando:
$ ruby main.rb
bacana, hein...temos alguns projetos em andamentos e talvez estes seus coneitos possas ser uteis.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Espero que esses códigos seja útil para seu projeto. :)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
img credz: pixabay.com
Nice, you got a $4.44 @minnowbooster upgoat, thanks to @eliel
Want a boost? Minnowbooster's got your back!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
The @OriginalWorks bot has determined this post by @eliel to be original material and upvoted it!
To call @OriginalWorks, simply reply to any post with @originalworks or !originalworks in your message!
To enter this post into the daily RESTEEM contest, upvote this comment! The user with the most upvotes on their @OriginalWorks comment will win!
For more information, Click Here!
Special thanks to @reggaemuffin for being a supporter! Vote him as a witness to help make Steemit a better place!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
This post received a 1.6% upvote from @randowhale thanks to @eliel! To learn more, check out @randowhale 101 - Everything You Need to Know!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit