@open-wa/wa-automate 4.23.0 → 4.23.4

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/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ### Copyright (c) 2020 Mohammed Shah
2
2
 
3
- # Hippocratic + Do Not Harm (H-DNH) Version 1.0
3
+ # Hippocratic + Do Not Harm (H-DNH) Version 1.1
4
4
 
5
5
  ## Preamble
6
6
 
@@ -34,6 +34,11 @@ Licensor hereby grants permission by this license ("License"), free of charge,
34
34
  * warfare
35
35
  * weapons manufacturing
36
36
  * war crimes
37
+ * settler colonialism
38
+ * apartheid
39
+ * vaccine misinformation
40
+ * climate misinformation
41
+ * child endangerment
37
42
  * violence (except when required to protect public safety)
38
43
  * burning of forests
39
44
  * deforestation
@@ -59,4 +64,4 @@ Licensor hereby grants permission by this license ("License"), free of charge,
59
64
 
60
65
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
61
66
 
62
- This license is an extension of the Hippocratic License - an Ethical Source license (https://ethicalsource.dev) and the Do Not Harm License - (https://github.com/raisely/NoHarm)
67
+ This license is an extension of the Hippocratic License - an Ethical Source license (https://ethicalsource.dev) and the Do Not Harm License - (https://github.com/raisely/NoHarm)
@@ -266,7 +266,10 @@ class Client {
266
266
  const ident = typeof ((_f = this._createConfig) === null || _f === void 0 ? void 0 : _f.autoEmoji) === "string" ? (_g = this._createConfig) === null || _g === void 0 ? void 0 : _g.autoEmoji : ":";
267
267
  this.onMessage((message) => __awaiter(this, void 0, void 0, function* () {
268
268
  if (message.body && message.body.startsWith(ident) && message.body.endsWith(ident)) {
269
- return yield this.sendEmoji(message.from, message.body.replace(new RegExp(ident, 'g'), ""), message.id);
269
+ const emojiId = message.body.replace(new RegExp(ident, 'g'), "");
270
+ if (!emojiId)
271
+ return;
272
+ return yield this.sendEmoji(message.from, emojiId, message.id);
270
273
  }
271
274
  }));
272
275
  }
@@ -1087,6 +1090,8 @@ class Client {
1087
1090
  return __awaiter(this, void 0, void 0, function* () {
1088
1091
  if (!content)
1089
1092
  content = '';
1093
+ if (typeof content !== 'string')
1094
+ content = String(content);
1090
1095
  const err = [
1091
1096
  'Not able to send message to broadcast',
1092
1097
  'Not a contact',
@@ -2793,7 +2798,7 @@ class Client {
2793
2798
  a.stickerMetadata = { discord: this._createConfig.discord };
2794
2799
  }
2795
2800
  try {
2796
- const { data } = yield axios_1.default.post(`${((fallback ? pkg.stickerUrl : 'https://open-wa-sticker-api.herokuapp.com') || this._createConfig.stickerServerEndpoint).replace(/\/$/, '')}/${func}`, Object.assign(Object.assign({}, a), { sessionInfo, config: this.getConfig() }), {
2801
+ const { data } = yield axios_1.default.post(`${((fallback ? pkg.stickerUrl : 'https://sticker-api.openwa.dev') || this._createConfig.stickerServerEndpoint).replace(/\/$/, '')}/${func}`, Object.assign(Object.assign({}, a), { sessionInfo, config: this.getConfig() }), {
2797
2802
  maxBodyLength: 20000000,
2798
2803
  maxContentLength: 1500000 // 1.5mb response body limit
2799
2804
  });
@@ -545,7 +545,7 @@ export interface ConfigObject {
545
545
  *
546
546
  * Redundant until self-hostable sticker server is available.
547
547
  *
548
- * @default `https://open-wa-sticker-api.herokuapp.com`
548
+ * @default `https://sticker-api.openwa.dev`
549
549
  */
550
550
  stickerServerEndpoint?: string | boolean;
551
551
  /**
package/dist/cli/index.js CHANGED
@@ -20,7 +20,7 @@ const axios_1 = __importDefault(require("axios"));
20
20
  const setup_1 = require("./setup");
21
21
  const collections_1 = require("./collections");
22
22
  const server_1 = require("./server");
23
- let checkUrl = is_url_superb_1.default;
23
+ let checkUrl = (s) => (typeof s === "string") && is_url_superb_1.default(s);
24
24
  const ready = (config) => __awaiter(void 0, void 0, void 0, function* () {
25
25
  if (process.send) {
26
26
  process.send('ready');
@@ -245,6 +245,7 @@ const setupBotPressHandler = (cliConfig, client) => {
245
245
  const { responses } = data;
246
246
  return yield Promise.all(responses.filter(({ type }) => type != "typing").map((response) => {
247
247
  if (response.type == "text") {
248
+ response.text = response.variations ? (response.variations.concat(response.text))[Math.floor(Math.random() * (response.variations.length + 1))] : response.text;
248
249
  return client.sendText(chatId, response.text);
249
250
  }
250
251
  if (response.type == "file") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-wa/wa-automate",
3
- "version": "4.23.0",
3
+ "version": "4.23.4",
4
4
  "licenseCheckUrl": "https://openwa.dev/license-check",
5
5
  "brokenMethodReportUrl": "https://openwa.dev/report-bm",
6
6
  "patches": "https://cdn.openwa.dev/patches.json",