Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wMarciano opened this issue Nov 2, 2019 · 1 comment
Open

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

wMarciano opened this issue Nov 2, 2019 · 1 comment

Comments

@wMarciano
Copy link

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?

@MrRedBeard
Copy link

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();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants