Glubbrer / TW Daily Task notifier with Pranks

// ==UserScript==
// @name         TW Daily Task notifier with Pranks
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  reminds you to complete your daily tasks
// @author       You
// @include  http://*.the-west.*/game.php*
// @include  https://*.the-west.*/game.php*
// @grant        none
// @license      GPL-2.0-or-later
// @updateURL   https://openuserjs.org/meta/Glubbrer/TW_Daily_Task_notifier_with_Pranks.meta.js
// @downloadURL     https://openuserjs.org/install/Glubbrer/TW_Daily_Task_notifier_with_Pranks.user.js
// ==/UserScript==

async function createOrUpdateStatusField(newStatus) {
  if (document.getElementById('dailyStatus')) {
    document.getElementById('dailyStatus').setAttribute("innerHTML", newStatus)
    document.getElementById("dailyStatus").setAttribute("hidden", false);
  }
  else {
    var bagStatus = document.createElement('div');

    bagStatus.setAttribute('id', 'dailyStatus');
    bagStatus.innerHTML = newStatus;
    bagStatus.setAttribute('style', 'position:absolute;z-index:1;text-align:center;color:#fff;font-size:16px;padding: 2px 1px 1px 2px;left:10px;top:400px;background:#992222 no-repeat scroll 0px -7px');
    bagStatus.onclick = function () {

      document.getElementById('dailyStatus').innerHTML = "";
      document.getElementById('dailyStatus').hidden = true;
      DailyActivitiesWindow.open();
    }
    document.body.appendChild(bagStatus);
  }

}

async function dailyTaskReminder() {
    
  await new Promise(r => setTimeout(r, 1000 * 30));
  if (DailyActivitiesWindow.finished_activities.length >= 3) {
    try {
      document.getElementById('dailyStatus').hidden = true;
    }
    catch (err) {}

    return;
  }
  else {
    createOrUpdateStatusField("Do your Dailys");
    if (new Date().getHours() >= 22) {
      var a = new Notification("Do your dailys");
    }
    await new Promise(r => setTimeout(r, 1000 * 60 * 30));
  }
  dailyTaskReminder();
}
async function init(){
    dailyTaskReminder();
}

init();