@elara-services/tickets 3.0.0 → 3.0.1

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/lib/v13.js +16 -16
  2. package/package.json +1 -1
package/lib/v13.js CHANGED
@@ -31,7 +31,7 @@ module.exports = class Tickets extends base {
31
31
  case this.prefix: {
32
32
  if (this.options?.ticket?.limitOnePerUser && hasTicket({ userId: member.id, guild, token: this.options.encryptToken, prefix: this.options.prefix })) return send({ embeds: [ embed(`❌ You can only create one (${this.options.prefix}) ticket at a time.`, { guild }) ], ephemeral: true })
33
33
  if (this.options.support?.ignore?.length) {
34
- if (this.options.support.ignore.some(c => member.roles.cache.has(c))) return send({ content: `❌ You can no longer create tickets, if you believe this is a mistake contact one of the staff members.`, ephemeral: true });
34
+ if (this.options.support.ignore.some(c => member.roles.cache.has(c))) return send({ embeds: [embed(`❌ You can no longer create tickets, if you believe this is a mistake contact one of the staff members.`)], ephemeral: true });
35
35
  }
36
36
  if (this.options.modal?.enabled) return int.showModal(this.modal({ title: this.options.modal.title, components: this.options.modal.questions?.length >= 1 ? this.options.modal.questions.slice(0, 5).map(c => ({ type: 1, components: [{ min_length: c.min_length || 10, max_length: c.max_length || 4000, type: 4, style: c.style || 2, label: c.label, value: c.value, placeholder: c.placeholder, required: c.required, custom_id: c.label || `random_${Math.floor(Math.random() * 10000)}` }] })) : [] })).catch(e => this._debug(e));
37
37
  return this.handleCreate({ guild, member, category, send })
@@ -90,21 +90,21 @@ module.exports = class Tickets extends base {
90
90
  let reason = "No Reason Provided";
91
91
  if (int.isModalSubmit()) reason = int.fields.getTextInputValue("reason")
92
92
  let user = await this.options.client.users.fetch(customId.split("close:confirm:")[1].replace(/:modal_complete/gi, "")).catch(e => this._debug(e));
93
- if (!user) return send({ content: `❌ I was unable to fetch the user that opened the ticket.` })
93
+ if (!user) return send({ embeds: [ embed(`❌ I was unable to fetch the user that opened the ticket.`) ] });
94
94
  let messages = await fetchMessages(channel, 5000);
95
- if (!messages?.length) return send({ content: `❌ I was unable to close the ticket, I couldn't fetch the messages in this channel.` })
95
+ if (!messages?.length) return send({ embeds: [ embed(`❌ I was unable to close the ticket, I couldn't fetch the messages in this channel.`) ] });
96
96
  let closed = await channel.delete(`${member.user.tag} (${member.id}) closed the ticket.`).catch(e => this._debug(e));
97
- if (!closed) return send({ content: `❌ I was unable to delete the channel & close the ticket.` })
97
+ if (!closed) return send({ embeds: [ embed(`❌ I was unable to delete the channel and close the ticket.`) ] });
98
98
  return this.closeTicket({ channel, guild, user, member, messages, reason });
99
99
  };
100
100
 
101
101
  if (customId.startsWith("unban:")) {
102
- if (!int.memberPermissions?.has?.([ "BAN_MEMBERS" ])) return send({ content: `❌ You need (Ban Members) in this server to complete this action!`, ephemeral: true });
102
+ if (!int.memberPermissions?.has?.([ "BAN_MEMBERS" ])) return send({ embeds: [ embed(`❌ You need (Ban Members) in this server to complete this action!`) ], ephemeral: true });
103
103
  let server = getAppealServer(this.options);
104
- if (!server) return send({ content: `❌ I was unable to find the appeal server!`, ephemeral: true });
104
+ if (!server) return send({ embeds: [embed(`❌ I was unable to find the appeal server!`)], ephemeral: true });
105
105
  let mod = server.members.resolve(member.id) || await server.members.fetch(member.id).catch(e => this._debug(e));
106
- if (!mod) return send({ content: `❌ I was unable to find you in ${server.name}!`, ephemeral: true });
107
- if (!mod.permissions?.has?.([ "BAN_MEMBERS" ])) return send({ content: `❌ You need (Ban Members) in ${server.name} to complete this action!`, ephemeral: true });
106
+ if (!mod) return send({ embeds: [embed(`❌ I was unable to find you in ${server.name}!`)], ephemeral: true });
107
+ if (!mod.permissions?.has?.([ "BAN_MEMBERS" ])) return send({ embeds: [embed(`❌ You need (Ban Members) in ${server.name} to complete this action!`)], ephemeral: true });
108
108
  return int.showModal(modal({
109
109
  id: `unban_modal:${customId.split(":")[1]}`,
110
110
  title: `Unban From ${server.name}`,
@@ -115,20 +115,20 @@ module.exports = class Tickets extends base {
115
115
  if (customId.startsWith("unban_modal:")) {
116
116
  await send({ ephemeral: true }, true);
117
117
  const [ , id ] = customId.split(":");
118
- if (!int.memberPermissions?.has?.([ "BAN_MEMBERS" ])) return send({ content: `❌ You need (Ban Members) in this server to complete this action!` });
118
+ if (!int.memberPermissions?.has?.([ "BAN_MEMBERS" ])) return send({ embeds: [ embed(`❌ You need (Ban Members) in this server to complete this action!`)] });
119
119
  let server = getAppealServer(this.options);
120
- if (!server) return send({ content: `❌ I was unable to find the appeal server!` });
120
+ if (!server) return send({ embeds: [embed(`❌ I was unable to find the appeal server!`)] });
121
121
  let mod = server.members.resolve(member.id) || await server.members.fetch(member.id).catch(e => this._debug(e));
122
- if (!mod) return send({ content: `❌ I was unable to find you in ${server.name}!` });
123
- if (!mod.permissions?.has?.([ "BAN_MEMBERS" ])) return send({ content: `❌ You need (Ban Members) in ${server.name} to complete this action!` });
122
+ if (!mod) return send({ embeds: [embed(`❌ I was unable to find you in ${server.name}!`)] });
123
+ if (!mod.permissions?.has?.([ "BAN_MEMBERS" ])) return send({ embeds: [embed(`❌ You need (Ban Members) in ${server.name} to complete this action!`)] });
124
124
  let isBanned = await server.bans.fetch({ user: id, force: true }).catch(e => this._debug(e));
125
- if (!isBanned) return send({ content: `❌ User (<@${id}>) isn't banned in the main server!` });
125
+ if (!isBanned) return send({ embeds: [embed(`❌ User (<@${id}>) isn't banned in the main server!`)] });
126
126
  return server.bans.remove(id, int.fields.getTextInputValue("reason") ?? `No Reason Provided | By: ${member.user.tag} (${member.id})`)
127
127
  .then(() => {
128
128
  int.message.edit({ components: [ { type: 1, components: [ button({ title: "Unbanned!", style: 3, id: "_ _", disabled: true, emoji: { id: `476629550797684736` } }) ] } ] }).catch(e => this._debug(e));
129
- send({ content: `✅ Successfully unbanned <@${id}> from ${server.name}!` })
129
+ send({ embeds: [embed(`✅ Successfully unbanned <@${id}> from ${server.name}!`)] })
130
130
  })
131
- .catch(e => send({ content: `❌ Unable to unban <@${id} from ${server.name}!`, embeds: [ { title: "ERROR", description: `\`\`\`js\n${e.message ?? e.stack}\`\`\``, color: 0xFF0000 } ] }))
131
+ .catch(e => send({ embeds: [ { title: "ERROR", fields: [ { name: "\u200b", value: `❌ Unable to unban <@${id} from ${server.name}!` } ], description: `\`\`\`js\n${e.message ?? e.stack}\`\`\``, color: 0xFF0000 } ] }))
132
132
  }
133
133
  };
134
134
  };
@@ -185,7 +185,7 @@ module.exports = class Tickets extends base {
185
185
  ...permissions
186
186
  ]
187
187
  }).catch(e => this._debug(e));
188
- if (!channel) return send({ content: `❌ I was unable to create the ticket channel, if this keeps happening contact one of the staff members via their DMs!` });
188
+ if (!channel) return send({ embeds: [embed(`❌ I was unable to create the ticket channel, if this keeps happening contact one of the staff members via their DMs!`)] });
189
189
  let msg = await channel.send({
190
190
  content: (this.options.ticket?.open || this.options.ticketOpen)?.content?.replace?.(/%user%/gi, member.user.toString())?.replace?.(/%server%/gi, guild.name) || `${member.user.toString()} 👋 Hello, please explain what you need help with.`,
191
191
  embeds: (this.options.ticket?.open || this.options.ticketOpen)?.embeds || [ embed(undefined, { title: `Support will be with you shortly.`, color: 0xF50DE3, guild, footer: { text: `To close the ticket, press the button below` } }) ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elara-services/tickets",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Helper for tickets",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",