The reputation number from hive.api.getAccounts has been broken for a while. I still see many places where it shows everyone's rep as 25 which is the default initial value.
I found another way to get an account's reputation using this javascript.
function getAuthorReputation(author) {
// get Reputation Number!
fetch('https://api.hive.blog', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
jsonrpc: '2.0',
method: 'bridge.get_profile',
params: {
account: author,
observer: author,
},
id: 1,
}),
})
.then(response => response.json())
.then(data => {
// Handle the response data here
console.log('bridge.get_profile Reputation: ' + data.result.reputation);
})
.catch(error => {
// Handle any errors
});
}
So now I am testing my new @tokenfaucet bot with this reputation check code.
I want to only give a reward to accounts with a reputation of 30 or more, and I use the above to check the reply author's rep.
This post is just for my own testing purposes but if anyone has any questions, ask here or find me (@kenny-crane) on discord or X.
Congratulations @ktest! You received a personal badge!
You can view your badges on your board and compare yourself to others in the Ranking
OK, here we go...
!TF
Gift of 600.000 PEPE.
So ktest should not get anything, but I should.
!TF
Gift of 0.400 LOH. RARE X2 Multiplier Applied!!
Gift of 600.000 PEPE.
My code had an error, so I fixed it and restarted the bot.
The second time, ktest did NOT get anything but again kenny-crane did.
This account's rep is 25 so it should not get a reward!
!TF
OK, things look good now.
I'm stopping the bot from processing on this post.
Expect a new post at @tokenfaucet in a few minutes.
WITH HIGHER REWARDS! 😃👍
Gud job Kenny and bots! :D