Skip to content

Update #14

Description

@Moonl1qht

maybe this option is better?

AutoQuestComplete.plugin.js
const randomInterval = Math.floor(Math.random() * 4) + 6;

const timestamp = secondsDone + remain;

try {
const response = await api.post({ url: /quests/${quest.id}/video-progress, body: { timestamp: Math.min(secondsNeeded, timestamp) } });
isFinished = response.body.completed_at != null;
secondsDone = Math.min(secondsNeeded, timestamp);
Logger.info(this._config.info.name, Video progress: ${secondsDone}/${secondsNeeded} sec.);
} catch (err) {
Logger.error(this._config.info.name, "Error sending video progress, retrying in 5s...", err);
await new Promise(resolve => setTimeout(resolve, 5000));
continue;
}

if (timestamp >= secondsNeeded || isFinished) {
break;
}

catch (err)
variables inside onConfirm have been replaced with err.message and err.stack

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions