Community-edition: Discord number message

Created on 15 Oct 2017  Â·  15Comments  Â·  Source: ramboxapp/community-edition

<!-- Please describe here your issue and steps to reproduce it. -->

Discord not show number of unreaded messages

<!-- DON'T REMOVE THE FOLLOWING LINES -->
-
> Rambox 0.5.13
> Electron 1.7.8
> win32 x64 10.0.15063

Most helpful comment

Wokraround for now (unless new rambox version)

  1. Add Discord as custom service
  2. Click advanced
  3. Past code below into Custom Code box
function getAlertCount(badges) {
    var alerts = 0;
    for (var i = 0; i < badges.length; i++) {
        var badge = badges[i];
        if (badge && badge.childNodes && badge.childNodes.length > 0) {
            var count = parseInt(badge.childNodes[0].nodeValue, 10);
            alerts += count.isNaN
                ? 1
                : count;
        } else {
            alerts++;
        }
    }
    return alerts;
}

function checkUnread() {
    var direct = 0,
        indirect = document.querySelectorAll('.guilds-wrapper .unread').length,
        guildDirect = document.querySelectorAll('.guilds-wrapper .badge'),
        channelDirect = document.querySelectorAll('[class^="nameUnreadText-"]+div>div>div');

    direct += getAlertCount(guildDirect);
    direct += getAlertCount(channelDirect);
    indirect += document.querySelectorAll('[class^="nameUnreadText-"]').length;

    updateBadge(indirect, direct);
}

function updateBadge(ind, dir) {
    var n = dir > 0
        ? "(" + dir + ") "
        : ind > 0
            ? "(•) "
            : "";
    document.title = n + originalTitle;
}

var originalTitle = document.title;
setInterval(checkUnread, 3e3);

All 15 comments

Same for me. The Discord tab does not show any status or count of unread messages.

  • Rambox 0.5.13
  • Electron 1.7.8
  • linux x64 4.13.10-200.fc26.x86_64

Oh, and the Rambox system tray icon does not indicate unread messages at all when Discord is the only chat service waiting to be read.

I have the same issue. Unread count and tray icon turning red works for other services I have set up, but not for Discord. System notifications still work, so I get the native Windows 10 notification for new messages, but I am really missing some persistent visual clue for unread messages.

Same here with Rambox 0.5.13, observed both on Windows 7 and Mac OS X. No unread counter for unread messages.

Same issue here, using:
Version: 0.5.13
Platform: linux (x64)
Electron: 1.7.8

Same here.

  • Rambox 0.5.13
  • Electron 1.7.8
  • win32 x64 10.0.16299

Same here. Im not sure how to get the Rambox version from the program itself, but its still happening in the newest https://github.com/saenzramiro/rambox/releases/tag/0.5.14 release

Same here.

Version: 0.5.14
Platform: win32 (x64)
Electron: 1.7.8
Chromium: 58.0.3029.110
Node: 7.9.0

Also same! Please consider fixing it. Thank you!

Version: 0.5.14
Platform: win32 x64 6.1.7601
Electron: 1.7.8
Chromium: 58.0.3029.110
Node: 7.9.0

Still having the issue with the recent update.

  • Rambox 0.5.14
  • Electron 1.7.8
  • win32 x64 10.0.16299

Same:
Version: 0.5.16
Platform: linux (x64)
Electron: 1.8.3
Chromium: 59.0.3071.115
Node: 8.2.1

Same:
Version: 0.5.16
Platform: darwin (x64)
Electron: 1.8.3
Chromium: 59.0.3071.115
Node: 8.2.1

Would be great to fix this :)

Wokraround for now (unless new rambox version)

  1. Add Discord as custom service
  2. Click advanced
  3. Past code below into Custom Code box
function getAlertCount(badges) {
    var alerts = 0;
    for (var i = 0; i < badges.length; i++) {
        var badge = badges[i];
        if (badge && badge.childNodes && badge.childNodes.length > 0) {
            var count = parseInt(badge.childNodes[0].nodeValue, 10);
            alerts += count.isNaN
                ? 1
                : count;
        } else {
            alerts++;
        }
    }
    return alerts;
}

function checkUnread() {
    var direct = 0,
        indirect = document.querySelectorAll('.guilds-wrapper .unread').length,
        guildDirect = document.querySelectorAll('.guilds-wrapper .badge'),
        channelDirect = document.querySelectorAll('[class^="nameUnreadText-"]+div>div>div');

    direct += getAlertCount(guildDirect);
    direct += getAlertCount(channelDirect);
    indirect += document.querySelectorAll('[class^="nameUnreadText-"]').length;

    updateBadge(indirect, direct);
}

function updateBadge(ind, dir) {
    var n = dir > 0
        ? "(" + dir + ") "
        : ind > 0
            ? "(•) "
            : "";
    document.title = n + originalTitle;
}

var originalTitle = document.title;
setInterval(checkUnread, 3e3);

Thats awesome, thank you so much!

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Izin picture Izin  Â·  3Comments

Tseberechts picture Tseberechts  Â·  4Comments

biggestchops picture biggestchops  Â·  3Comments

juanmlambre picture juanmlambre  Â·  3Comments

jvdmeij picture jvdmeij  Â·  4Comments