@elara-services/tickets 4.0.8 → 4.0.9

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/lib/v13.js CHANGED
@@ -495,18 +495,20 @@ module.exports = class Tickets extends base {
495
495
  }
496
496
  }
497
497
  if (this.options.ticket?.supportCommentThread === true) {
498
- await channel.threads
498
+ const thread = await channel.threads
499
499
  .create({
500
500
  name: this.str("SUPPORT_TALK"),
501
501
  invitable: false,
502
502
  type: 12,
503
- startMessage: !this.getSupportIds.empty
504
- ? {
505
- content: `${this.getSupportIds.roles.length ? this.getSupportIds.roles.map((c) => `<@&${c}>`).join(" ") : ""}${this.getSupportIds.users.length ? `${this.getSupportIds.roles.length ? ` | ` : ""}${this.getSupportIds.users.map((c) => `<@${c}>`).join(" ")}` : ""}`,
506
- }
507
- : undefined,
508
503
  })
509
504
  .catch((e) => this._debug(e));
505
+ if (thread && !this.getSupportIds.empty) {
506
+ await thread
507
+ .send({
508
+ content: `${this.getSupportIds.roles.length ? this.getSupportIds.roles.map((c) => `<@&${c}>`).join(" ") : ""}${this.getSupportIds.users.length ? `${this.getSupportIds.roles.length ? ` | ` : ""}${this.getSupportIds.users.map((c) => `<@${c}>`).join(" ")}` : ""}`,
509
+ })
510
+ .catch((e) => this._debug(e));
511
+ }
510
512
  }
511
513
  if (this.webhookOptions.id && this.webhookOptions.token) {
512
514
  webhook(this.webhookOptions)
package/lib/v14.js CHANGED
@@ -491,18 +491,20 @@ module.exports = class Tickets extends base {
491
491
  }
492
492
  }
493
493
  if (this.options.ticket?.supportCommentThread === true) {
494
- await channel.threads
494
+ const thread = await channel.threads
495
495
  .create({
496
496
  name: this.str("SUPPORT_TALK"),
497
497
  invitable: false,
498
498
  type: 12,
499
- startMessage: !this.getSupportIds.empty
500
- ? {
501
- content: `${this.getSupportIds.roles.length ? this.getSupportIds.roles.map((c) => `<@&${c}>`).join(" ") : ""}${this.getSupportIds.users.length ? `${this.getSupportIds.roles.length ? ` | ` : ""}${this.getSupportIds.users.map((c) => `<@${c}>`).join(" ")}` : ""}`,
502
- }
503
- : undefined,
504
499
  })
505
500
  .catch((e) => this._debug(e));
501
+ if (thread && !this.getSupportIds.empty) {
502
+ await thread
503
+ .send({
504
+ content: `${this.getSupportIds.roles.length ? this.getSupportIds.roles.map((c) => `<@&${c}>`).join(" ") : ""}${this.getSupportIds.users.length ? `${this.getSupportIds.roles.length ? ` | ` : ""}${this.getSupportIds.users.map((c) => `<@${c}>`).join(" ")}` : ""}`,
505
+ })
506
+ .catch((e) => this._debug(e));
507
+ }
506
508
  }
507
509
  if (this.webhookOptions.id && this.webhookOptions.token) {
508
510
  webhook(this.webhookOptions)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elara-services/tickets",
3
- "version": "4.0.8",
3
+ "version": "4.0.9",
4
4
  "description": "Helper for tickets",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",