pollmommy icon indicating copy to clipboard operation
pollmommy copied to clipboard

Can we get a start.js or other callable script?

Open wMarciano opened this issue 5 years ago • 1 comments

I'm currently trying to build the pollmommy functionality into an AppleScript for a simple macOS application for a group of people, though there is no 'start.js' or similar to call from the script. Is there any chance that could be added?

wMarciano avatar Nov 02 '19 22:11 wMarciano

const Pollmommy = require('pollmommy')
const pollmommy = new Pollmommy()

function autoVote( count = 1 ) {
	const poll = 111;
	const answer = 222;
	const url = 'https://www.your-domain.com';

	process.stdout.write(`Contacting ${ String( count ).padStart( 4, '0' ) } - `)
	pollmommy.vote( url, poll, answer )
		.then( () => {
			console.log('\u001B[32mvoted!\u001b[39m');

			autoVote( count + 1 );
		})
		.catch( error => {
			console.error(`\u001B[31m${ error.message }\u001b[39m`);

			setTimeout( () => autoVote( count ), 1000 );
		})
}

autoVote();

MrRedBeard avatar Oct 15 '21 17:10 MrRedBeard