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

Fixes InAppNotifications not working due to missing raw message module #398

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Infinitay
Copy link

Changes

Hooks onto the s(e) function. I'm not that versed with the BD API, but I looked through the webpack and found that the following filters returned the appropriate function that fixed InAppNotifications for me. I haven't experienced any issues (yet), so I would appreciate it if someone else could also test this just to confirm things are in fact working for everyone.

New hook: Webpack.getModule(Webpack.Filters.byStrings("userId", "channelId", "mentionEveryone", "mentionUsers", "mentionRoles", "suppressEveryone", "suppressRoles"), { searchExports: true });

image

Additional Information

As I said, I'm not too familiar with hooking into functions so I wasn't sure how to make it such that I retrieve the parent function such that SomethingHereShrug changes from isMentioned.isRawMessageMentioned => isRawMessageMentioned, but I guess this PR works fine too albeit no proper #isRawMessageMentioned definition via the parent (if that makes sense).
Other potential hits: Webpack.getModules(Webpack.Filters.byStrings("userId", "channelId", "mentionEveryone", "mentionUsers", "mentionRoles", "suppressEveryone", "suppressRoles"), { searchExports: true });

The workaround in #397 works just fine, but I figured I would take a shot at looking into the webpack to see if I can find the hook again after reading the comments mentioning how isRawMessageMentioned may have been removed. I thought by calling it directly there would be some performance increase albeit negligible, but it seems like both the workaround and directly calling is essentially the same judging by the l function. Nonetheless, again, the performance is probably negligible.

@Infinitay Infinitay changed the title Fixes plugin not working due to missing raw message module Fixes InAppNotifications not working due to missing raw message module Jul 9, 2024
@Infinitay
Copy link
Author

Infinitay commented Jul 13, 2024

There seems to be an existing issue where if you refresh Discord the plugin won't send the notifications but they will accumulate still

Steps to reproduce and fix:

  1. Have AppNotifications enabled
  2. CTRL+R to refresh/restart Discord
  3. (Get a message sent that should trigger AppNotifications)
    • At this point, the message will be caught by AppNotifications, but you won't see the in-Discord pop-up despite AppNotifications still being enabled after the refresh (see later)
  4. Disable the plugin
    • You will get a pop-up saying the plugin could not be started despite toggling to disable it
  5. Renable the plugin and you will start receiving in-app notifications properly

Console Log (using my version):

[AppNotifications] version 1.1.5 has stopped.
[PluginManager] AppNotifications v1.1.5 could not be started. Error: Minified React error #40; visit https://reactjs.org/docs/error-decoder.html?invariant=40 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at t.unmountComponentAtNode
    at Object.shutdown (InAppNotifications.plugin.js:539:22) // shutdown() function within instantiating QWERTLib scope
    at Object.shutdown (InAppNotifications.plugin.js:557:23)
    at plugin.onStop (InAppNotifications.plugin.js:1079:20)
    at plugin.stop (0PluginLibrary.plugin.js:3670:53)
    at N.stopPlugin (renderer.js:5:29608)
    at N.stopAddon (renderer.js:5:28892)
    at N.disableAddon (renderer.js:5:7988)
    at N.toggleAddon (renderer.js:5:8313)
    at N.togglePlugin (renderer.js:5:26140)
    at renderer.js:5:92556
    at renderer.js:5:124717
    at Object.ek
    at eY
    at 
    at re 
    at rt 
    at
    at sL
    at eU 
    at rs
    at tk 
    at tx 

@Myth0ne
Copy link

Myth0ne commented Aug 1, 2024

There seems to be an existing issue where if you refresh Discord the plugin won't send the notifications but they will accumulate

Have you managed to get a workaround or a fix to this yet? Finding mine is producing the same error where the plugin is not sending the notification.

@Infinitay
Copy link
Author

There seems to be an existing issue where if you refresh Discord the plugin won't send the notifications but they will accumulate

Have you managed to get a workaround or a fix to this yet? Finding mine is producing the same error where the plugin is not sending the notification.

Unfortunately not. I haven't bothered looking into it because it's a little hard for me because I'm not too familiar with BD and plugins, but maybe I will take a look tomorrow. For now, you can do the following:

  1. Disable the AppsNotifications plugin
  2. Refresh Discord by doing CTRL+R
  3. Re-enable the plugin after the refresh

@Myth0ne
Copy link

Myth0ne commented Aug 7, 2024

Have you had any chance to see if there's any update on this to try and resolve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants