SteemJs - программно проверяйте, правильно ли я подписался на пользователя и сохранил его сообщение.
Вот как я сейчас реализовал эту функцию:
const steem = require('steem');
const { Client } = require('dsteem');
const client = new Client('https://api.steemit.com');
const myBotName = whoami();
// @returns whether my bot has already resteemed the target post
const resteemedPost = ({ history = 100, permlink = '' }) => new Promise((resolve) => {
const query = {
tag: myBotName, // This tag is used to filter the results by a specific post tag
// TODO: figure out how to deal with more posts as the MAX here is 100 !
limit: history, // This limit allows us to limit the overall results returned to N
};
// Gotta use the following because steem.api.getRebloggedBy stopped working
// and resteemed_by in client.database.getDiscussions is always [].
client.database
.getDiscussions('blog', query)
.then((result) => {
const isInMyHistory = result.filter(post => post.permlink === permlink)[0];
resolve(!!isInMyHistory);
});
});
// @returns whether my bot is already following the target user
const followedUser = targetUser => new Promise((resolve) => {
const options = [
targetUser,
'',
'blog',
// TODO: figure out how to deal with more followers as the MAX here is 1000 !
1000,
];
client.call('follow_api', 'get_followers', options)
.then((result) => {
const hasMeAsFollower = result.filter(({ follower }) => follower === myBotName);
resolve(!!hasMeAsFollower);
});
});
Проблема в том, что обе функции имеют ограничения.
Тот, который используется для проверки того, правильно ли был почитаем пост, может проверять только последние 100 постов в моем блоге.
Тот, который используется для проверки правильности отслеживания учетной записи, может получить только 1000 пользователей, которые в настоящее время подписаны на целевого пользователя.
Как я могу это решить?