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.