Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discord do not show badges for all new message, even with setting activated. #1370

Closed
2 tasks done
gauchya opened this issue Sep 21, 2023 · 11 comments
Closed
2 tasks done
Labels
bug 🪲 Something isn't working recipe 📑 This issue is about a ferdium recipe

Comments

@gauchya
Copy link

gauchya commented Sep 21, 2023

Preflight Checklist

  • I agree to follow the Code of Conduct that Ferdium Recipes adheres to.
  • I have searched the issue tracker for a bug report that matches the one I want to file, without success.

Ferdium Version

6.4.1-beta.2

Recipe Name

Discrod

Recipe Version

1.8.0

Last Known working version of the recipe

No response

Steps to reproduce

  1. Join a Discord server and keep all notification
  2. Activate Badges for all message in Discord recipe settings
  3. Receive a message in the server, with no @name @here @ALL ...
  4. No notification

Expected Behavior

A "New message badge" should appear when a message is received in any server with discord notification on when the settings is activated.

Actual Behavior

No Ferdium notification or new message badge.

Screenshots

image

New message, no badge.

Additional Information

No response

@gauchya gauchya added bug 🪲 Something isn't working recipe 📑 This issue is about a ferdium recipe labels Sep 21, 2023
@Arthur-Huan
Copy link
Contributor

Could you provide OS info? I cannot reproduce this on Fedora Linux and Windows 10.

@gauchya
Copy link
Author

gauchya commented Sep 25, 2023

I use Ubuntu 23.04.
A friend use mac OS and have the same problème.

Just note that if someone talk to me in a 1-1 discussion it works and if in the server the message is a reply to one of my message it works too or if it is a @Myname even in a server chat it works too.

Only "basic" messages in a server don't work.

@Mickhopes
Copy link

Mickhopes commented Sep 26, 2023

Hi,

This problem exists only if you receive a notification on a server that is not currently opened in Discord.

The recipe is looking at the modeUnread-* classes to check for indirect messages but this CSS class is attached to channels. As they are not part of the view on non-opened servers you are not notified.

This can be fixed using the document.title. Discord will change it's title with (<number>) Discord | ... when you have direct message(s) and • Discord | ... when you have indirect message(s) (prioritizing showing the first one). If the character is present on the title, you have unread indirect messages.

@gauchya
Copy link
Author

gauchya commented Sep 29, 2023

Using @Mickhopes method in a discord recipe fixed my and my friend issue.

@chaudron
Copy link

@gauchya having the same problem. New to Ferdium so how/what/where do I change the recipe?

@andyeff
Copy link

andyeff commented Oct 29, 2023

Using @Mickhopes method in a discord recipe fixed my and my friend issue.

I'm guessing this involves editing the webview.js for the Discord service, this part?

    const indirectCountPerServer = document.querySelectorAll(
      '[class*="modeUnread-"]',
    ).length;

Would you be able to show how you used document.title to fix this? I don't know enough javascript to figure this out currently :(

@chaudron I found the file to edit at this path (for windows): %appdata%\Ferdium\recipes\discord\webview.js

@Mickhopes
Copy link

Mickhopes commented Oct 30, 2023

To find the folder containing the recipes, you go to Settings > Advanced and then on the bottom Open Service Recipes folder.

In this folder you have to edit discord/webview.js and replace:

const indirectCountPerServer = document.querySelectorAll(
      '[class*="modeUnread-"]',
    ).length;

with

const indirectCountPerServer = document.title.search("•") != -1 ? 1 : 0;

@briankendall
Copy link

There's another issue where direct messages, either from a server or in DMs, are not causing Ferdium to add a badge to Discord's icon.

The solution is to change the following code in discord/webview.js:

    const directCountPerServer = document.querySelectorAll(
      '[class*="lowerBadge-"] [class*="numberBadge-"]',
    );

to:

    const directCountPerServer = document.querySelectorAll(
      '[class*="lowerBadge_"] [class*="numberBadge_"]',
    );

(Note that change from hyphens to underscores in the class names.)

Cknight70 added a commit to Cknight70/ferdium-recipes that referenced this issue Nov 4, 2023
Cknight70 added a commit to Cknight70/ferdium-recipes that referenced this issue Nov 4, 2023
@Cknight70
Copy link

Hi @briankendall and @Mickhopes Hope you don't mind I opened a pull request to get discord notifications fixed using your advice. Thanks

@Cknight70
Copy link

It is done

@mcmxcdev
Copy link
Member

Closing since the fix in ferdium/ferdium-recipes#461 was merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working recipe 📑 This issue is about a ferdium recipe
Projects
None yet
Development

No branches or pull requests

8 participants