thelounge-plugin-ntfy 1.6.2 → 1.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/handler.js +11 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thelounge-plugin-ntfy",
3
- "version": "1.6.2",
3
+ "version": "1.6.3",
4
4
  "description": "A plugin for The Lounge that sends push notifications via ntfy when highlighted",
5
5
  "keywords": [
6
6
  "thelounge",
package/src/handler.js CHANGED
@@ -19,13 +19,18 @@ function createHandler(client, network) {
19
19
 
20
20
  const isPM = data.target === network.nick;
21
21
 
22
- const channel = isPM
23
- ? network.channels.find((chan) => chan.name === data.nick)
24
- : network.channels.find((chan) => chan.name === data.target);
22
+ try {
23
+ const channel = isPM
24
+ ? network.channels.find((chan) => chan.name === data.nick)
25
+ : network.channels.find((chan) => chan.name === data.target);
25
26
 
26
- if (channel.muted) {
27
- // Ignore messages in muted channels
28
- return;
27
+ if (channel && channel.muted) {
28
+ // Ignore messages in muted channels
29
+ return;
30
+ }
31
+ } catch (e) {
32
+ PluginLogger.error("Failed to determine channel mute status", e);
33
+ PluginLogger.debug(`Data: ${JSON.stringify(data)}`);
29
34
  }
30
35
 
31
36
  const highlightRegex = new RegExp(network.highlightRegex, "i");