<repo_name>derdroste/tinder_bot<file_sep>/secrets/secret.js
const secret = {
    tinder: {
        mail: 'your email',
        password: '<PASSWORD>',
        message: {
            firstPart: 'Hi ',
            secondPart: ', my name is peter!'
        }
    }
};

module.exports = secret;<file_sep>/views/assets/index.js
document.addEventListener('DOMContentLoaded', () => {
    const tinderLike = document.querySelector('#tinderlike');
    let valueTinderLike = true;
    const tinderMessage = document.querySelector('#tindermessage');
    let valueTinderMessage = true;

    tinderLike.addEventListener('click', () => {
        sendRequest('http://www.localhost:3000/api/tinder/like',valueTinderLike);
        if (valueTinderLike === true) {
            tinderLike.classList.add('stop');
            tinderLike.innerHTML = 'Stop';
            valueTinderLike = false;
        } else {
            tinderLike.classList.remove('stop');
            tinderLike.innerHTML = 'Like';
            valueTinderLike = true;
        }
    });
    tinderMessage.addEventListener('click', () => {
        sendRequest('http://www.localhost:3000/api/tinder/like',valueTinderMessage);
        if (valueTinderMessage === true) {
            tinderMessage.classList.add('stop');
            tinderMessage.innerHTML = 'Stop';
            valueTinderMessage = false;
        } else {
            tinderMessage.classList.remove('stop');
            tinderMessage.innerHTML = 'Like';
            valueTinderMessage = true;
        }
    });
});

function sendRequest(url, val) {
    const xhr = new XMLHttpRequest();
    xhr.open("POST", url, true);
    xhr.setRequestHeader('Content-Type', 'application/json');
    xhr.send(JSON.stringify({
        value: val
    }));
}<file_sep>/routes/views.js
const express = require('express');
const router = express.Router();

router.get('/', (req, res) => {
    res.render('index', {
        title: 'Vidoodle',
        tinder: 'Tinder',
        like: 'Like',
        message: 'Message'
    });
});

module.exports = router;
<file_sep>/routes/tinder.js
const express = require('express');
const router = express.Router();
const loginTinder = require('../modules/tinder/loginTinder');
const likeTinder = require('../modules/tinder/likeTinder');
const messageTinder = require('../modules/tinder/messageTinder');
const chrome = require('selenium-webdriver/chrome');
const chromedriver = require('chromedriver');
const webdriver =  require('selenium-webdriver');
let driver = null;
let driverMessage = null;

router.post('/like',async (req, res) => {
    if(req.body.value === true) {
        try {
            driver = await new webdriver.Builder()
                .withCapabilities(webdriver.Capabilities.chrome())
                .build();
            await loginTinder(driver, webdriver, 'http://www.tinder.com/');
            await messageTinder(driver, webdriver);
        } catch (e) {
            console.log('Liking all the girls failed...', e);
            driver.quit();
        }
    } else {
        try {
            driver.quit();
            driver = null;
        } catch (e) {
            console.log('Liking all the girls failed...', e);
            driver.quit();
        }
    }
});

router.post('/message',async (req, res) => {
    if(req.body.value === true) {
        try {
            driverMessage = await new webdriver.Builder()
                .withCapabilities(webdriver.Capabilities.chrome())
                .build();
            await loginTinder(driverMessage, webdriver, 'http://www.tinder.com/');
            await likeTinder(driverMessage, webdriver);
        } catch (e) {
            console.log('Liking all the girls failed...', e);
            driverMessage.quit();
        }
    } else {
        try {
            driverMessage.quit();
            driverMessage = null;
        } catch (e) {
            console.log('Liking all the girls failed...', e);
            driverMessage.quit();
        }
    }
});

module.exports = router;
<file_sep>/README.md
# Tinder Bot
I have automated Tinder through Node &amp; Selenium!

# Install
Install Node if you didn't already.
```bash
$ npm i 
```

Add your E-Mail and Password in /secrets/secret.js.
Add two parts of the message, you want to send to all the girls.
The message will be displayed as 'firstMessage + name-of-the-girl + secondMessage'.
Example: 'Hi -sandra-, my name is peter'.

# Run
```bash
$ node app.js
```

# Use
A new Browser window should open, with the options to either like all the girls or to message all the girls.
You also have always the option to stop the execution.