thelounge-plugin-ntfy 1.5.0 → 1.6.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thelounge-plugin-ntfy",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "A plugin for The Lounge that sends push notifications via ntfy when highlighted",
5
5
  "keywords": [
6
6
  "thelounge",
package/src/config.js CHANGED
@@ -122,7 +122,7 @@ const userConfigSchema = {
122
122
  properties: {
123
123
  notify_on_private_messages: {
124
124
  type: "object",
125
- additionalProperties: { type: ["boolean", "string"] },
125
+ additionalProperties: { type: "boolean" },
126
126
  default: {},
127
127
  },
128
128
  },
package/src/handler.js CHANGED
@@ -10,11 +10,21 @@ function createHandler(client, network) {
10
10
  return;
11
11
  }
12
12
 
13
+ const isPM = data.target === network.nick;
14
+
15
+ const channel = isPM
16
+ ? network.channels.find((chan) => chan.name === data.nick)
17
+ : network.channels.find((chan) => chan.name === data.target);
18
+
19
+ if (channel.muted) {
20
+ // Ignore messages in muted channels
21
+ return;
22
+ }
23
+
13
24
  const highlightRegex = new RegExp(network.highlightRegex, "i");
14
25
  const message = data.message || "";
15
26
 
16
27
  const mentioned = highlightRegex.test(message);
17
- const isPM = data.target === network.nick;
18
28
 
19
29
  let notify = false;
20
30
  let userConfig;