Skip to content

Send a report of your hourly earning in a channel via a Discord webhook

License

Notifications You must be signed in to change notification settings

GABRYCA/earnapp-earnings-watcher

 
 

Repository files navigation

EarnApp earnings watcher

axios earnapp-earnings-watcher simple-discord-webhooks

GitHub stars

Send a report of your hourly earnings to a channel via a Discord webhook.

Bugs can occur, this is an unofficial use of the EarnApp API.

Installation

  • Install NodeJS.
  • Download or clone the project.
  • Run install.bat OR run npm install.
  • In the config.js, you need to edit the WEBHOOK URL and the COOKIE:
module.exports = {
    discordWebhookURL: "WEBHOOK URL", //Discord WebHook URL

    authMethod: "google", //don't touch this one

    oauthRefreshToken: "COOKIE", //see https://github.com/LockBlock-dev/earnapp.js#how-to-login-with-cookies

    modes: ["total", "referrals", "transactions"], //you can put one mode or all of them
    //available modes are: ["total", "perDevice", "groupDevices", "referrals", "transactions"]
    //using perDevice and groupDevices with many devices is not possible as it may exceed the size limit of an Embed

    delay: 40, //delay before updating earnings
};
  • Run start.bat OR node index.js OR npm start.

Database Setup

You should edit the mysql-db.json file with your database address, username and password, so this bot will be able to query data to it. Also, there is a known issue with automatically creating tables, so you may need to make them manually, this is the command to make it:

CREATE TABLE IF NOT EXISTS earnings (time datetime, traffic double, earnings double)

Docker

Compose

version: "3.3"
services:
    app:
        image: fazalfarhan01/earnapp-earning-monitor:lockblock-latest
        restart: always
        environment:
            AUTH: afbdsafdbaedgtfn
            WEBHOOK_URL: https://example.com/somthing_to_do_with_you
            MODE: all # Defaults to all when nothing specified
            # takes total / perDevice / referrals / transactions / all as option
            DELAY: 40

Non-Compose

docker run -it --rm --restart always \
-e AUTH=YOUR_AUTH_COOKIE \
-e WEBHOOK_URL=YOUR_WEBHOOK_URL_HERE \
-e MODE=YOUR_MODE_HERE \
-e DELAY=YOUR_DELAY_HERE \
fazalfarhan01/earnapp-earning-monitor:lockblock-latest

How do I find my cookies ?!

Please check this link.

What is what

  • discordWebhookURL: the Discord Webhook URL you created
  • authMethod: the authentication method used to log into earnapp
  • oauthRefreshToken: the token used to log into earnapp
  • modes:
    • total:
    • perDevice:
    • referrals:
    • transactions:
  • delay: the delay before updating the earnings

How does it work

The script checks every minute if it is an exact hour (17:00, 8:00, ...). Then it waits 40 seconds to allow all earnings to update. After that it gets your earnings and transactions with the provided cookie. Finally, it calculates the difference between your previous balance and the new one, calculates the difference between old and new transactions and sends the results to the Discord WebHook.

This means the webhook message will be sent at XX:00:40. Don't panic if you don't see any messages in the first few seconds.

In per-device mode, devices that have earned 0$ since the last payment are not included in the report.

Credits

EarnApp

Copyright

See the license

About

Send a report of your hourly earning in a channel via a Discord webhook

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.6%
  • Other 0.4%