aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/notion/webview.js
blob: cd8f566f0d9307e2faa1186d4a07c6f763f5e61f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
module.exports = (Ferdi) => {
  const getMessages = () => {
    let direct = 0;
    const badgeDiv = document.querySelector('.notion-sidebar-container > div > div > div > :nth-child(4) > :nth-child(2) > div > :nth-child(3) > div > div');
    if (badgeDiv) {
      direct = Ferdi.safeParseInt(badgeDiv.innerText);
    }

    Ferdi.setBadge(direct);
  }

  Ferdi.loop(getMessages);
};