@elara-services/tickets 4.0.5 → 4.0.6
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/index.d.ts +1 -1
- package/lib/base.js +4 -4
- package/lib/v13.js +25 -25
- package/lib/v14.js +25 -25
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -132,7 +132,7 @@ declare module "@elara-services/tickets" {
|
|
|
132
132
|
users: string[];
|
|
133
133
|
};
|
|
134
134
|
|
|
135
|
-
public str(name: keyof LangFile): string;
|
|
135
|
+
public str(name: keyof LangFile, lang?: Langs): string;
|
|
136
136
|
|
|
137
137
|
public button(options: { style: 1 | 2 | 3 | 4 | 5 | number, id?: string, label?: string, emoji?: { name?: string, id?: string } }): { type: number, custom_id: string, style: number, label?: string, emoji?: { name?: string, id?: string } }
|
|
138
138
|
public closeTicket(options: {
|
package/lib/base.js
CHANGED
|
@@ -11,7 +11,6 @@ module.exports = class Tickets {
|
|
|
11
11
|
* @param {import("@elara-services/tickets").TicketOptions} options
|
|
12
12
|
*/
|
|
13
13
|
constructor(options) {
|
|
14
|
-
this.options = options;
|
|
15
14
|
if (!is.object(options)) {
|
|
16
15
|
throw new Error(this.str("NO_CONSTRUCTOR_OPTIONS")());
|
|
17
16
|
}
|
|
@@ -20,6 +19,7 @@ module.exports = class Tickets {
|
|
|
20
19
|
throw new Error(this.str("NO_CONSTRUCTOR_OPTIONS")(`'${r}'`));
|
|
21
20
|
}
|
|
22
21
|
}
|
|
22
|
+
this.options = options;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
get prefix() {
|
|
@@ -54,8 +54,8 @@ module.exports = class Tickets {
|
|
|
54
54
|
/**
|
|
55
55
|
* @param {keyof typeof import("../languages/en-US")} name
|
|
56
56
|
*/
|
|
57
|
-
str(name) {
|
|
58
|
-
return getString(name, this
|
|
57
|
+
str(name, lang = "en-US") {
|
|
58
|
+
return getString(name, lang || this?.options?.lang || "en-US");
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/** @private */
|
|
@@ -120,7 +120,7 @@ module.exports = class Tickets {
|
|
|
120
120
|
files: [
|
|
121
121
|
{
|
|
122
122
|
name: `${this.str("TRANSCRIPT")}.txt`,
|
|
123
|
-
attachment: Buffer.from(displayMessages(channel, messages.reverse(), channel.name.split("-")[1], this.options.prefix, this.str)),
|
|
123
|
+
attachment: Buffer.from(displayMessages(channel, messages.reverse(), channel.name.split("-")[1], this.options.prefix, (name) => this.str(name, this?.options?.lang))),
|
|
124
124
|
},
|
|
125
125
|
],
|
|
126
126
|
})
|
package/lib/v13.js
CHANGED
|
@@ -64,14 +64,14 @@ module.exports = class Tickets extends base {
|
|
|
64
64
|
})
|
|
65
65
|
) {
|
|
66
66
|
return send({
|
|
67
|
-
embeds: [embed(this.str("TICKET_LIMIT_ONE_PER_USER")(this.options.prefix), { guild, str: this.str })],
|
|
67
|
+
embeds: [embed(this.str("TICKET_LIMIT_ONE_PER_USER")(this.options.prefix), { guild, str: (name) => this.str(name, this?.options?.lang) })],
|
|
68
68
|
ephemeral: true,
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
if (this.options.support?.ignore?.length) {
|
|
72
72
|
if (this.options.support.ignore.some((c) => member.roles.cache.has(c))) {
|
|
73
73
|
return send({
|
|
74
|
-
embeds: [embed(this.str("TICKET_BLOCKED"), { str: this.str })],
|
|
74
|
+
embeds: [embed(this.str("TICKET_BLOCKED"), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
75
75
|
ephemeral: true,
|
|
76
76
|
});
|
|
77
77
|
}
|
|
@@ -84,7 +84,7 @@ module.exports = class Tickets extends base {
|
|
|
84
84
|
title: this.options.modal?.title,
|
|
85
85
|
components: defs.getModalComponents(this.options.modal?.questions || []),
|
|
86
86
|
},
|
|
87
|
-
{ prefix: this.prefix, str: this.str },
|
|
87
|
+
{ prefix: this.prefix, str: (name) => this.str(name, this?.options?.lang) },
|
|
88
88
|
),
|
|
89
89
|
)
|
|
90
90
|
.catch(this._debug);
|
|
@@ -117,7 +117,7 @@ module.exports = class Tickets extends base {
|
|
|
117
117
|
embed(this.str("TICKET_CLOSE_CONFIRM"), {
|
|
118
118
|
color: 0xff000,
|
|
119
119
|
guild,
|
|
120
|
-
str: this.str,
|
|
120
|
+
str: (name) => this.str(name, this?.options?.lang),
|
|
121
121
|
}),
|
|
122
122
|
],
|
|
123
123
|
components: [
|
|
@@ -197,7 +197,7 @@ module.exports = class Tickets extends base {
|
|
|
197
197
|
}
|
|
198
198
|
if (customId.startsWith(`${this.prefix}:close:confirm`)) {
|
|
199
199
|
if (customId.includes(`:modal_submit`)) {
|
|
200
|
-
return int.showModal(defs.modals.reason(customId, this.str));
|
|
200
|
+
return int.showModal(defs.modals.reason(customId, (name) => this.str(name, this?.options?.lang)));
|
|
201
201
|
}
|
|
202
202
|
await send({ ephemeral: true }, true);
|
|
203
203
|
let reason = this.str("NO_REASON");
|
|
@@ -207,19 +207,19 @@ module.exports = class Tickets extends base {
|
|
|
207
207
|
const user = await discord.user(this.options.client, customId.split("close:confirm:")[1].replace(/:modal_complete/gi, ""), { fetch: true, mock: false });
|
|
208
208
|
if (!user) {
|
|
209
209
|
return send({
|
|
210
|
-
embeds: [embed(this.str("NO_USER_FOUND", { str: this.str }))],
|
|
210
|
+
embeds: [embed(this.str("NO_USER_FOUND", { str: (name) => this.str(name, this?.options?.lang) }))],
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
213
|
let messages = await fetchMessages(channel, 5000);
|
|
214
214
|
if (!messages?.length) {
|
|
215
215
|
return send({
|
|
216
|
-
embeds: [embed(this.str("NO_MESSAGES_FETCHED"), { str: this.str })],
|
|
216
|
+
embeds: [embed(this.str("NO_MESSAGES_FETCHED"), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
217
217
|
});
|
|
218
218
|
}
|
|
219
219
|
let closed = await channel.delete(`${member.user.tag} (${member.id}) ${this.str("CLOSED_TICKET")}`).catch(this._debug);
|
|
220
220
|
if (!closed) {
|
|
221
221
|
return send({
|
|
222
|
-
embeds: [embed(this.str("NO_CHANNEL_DELETE"), { str: this.str })],
|
|
222
|
+
embeds: [embed(this.str("NO_CHANNEL_DELETE"), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
225
|
return this.closeTicket({
|
|
@@ -235,31 +235,31 @@ module.exports = class Tickets extends base {
|
|
|
235
235
|
if (customId.startsWith(`${this.prefix}:unban:`)) {
|
|
236
236
|
if (!int.memberPermissions?.has?.([perms.members.ban])) {
|
|
237
237
|
return send({
|
|
238
|
-
embeds: [embed(this.str("NO_BAN_PERMS_USER"), { str: this.str })],
|
|
238
|
+
embeds: [embed(this.str("NO_BAN_PERMS_USER"), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
239
239
|
ephemeral: true,
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
242
|
let server = getAppealServer(this.options);
|
|
243
243
|
if (!server) {
|
|
244
244
|
return send({
|
|
245
|
-
embeds: [embed(this.str("NO_APPEAL_SERVER_FOUND"), { str: this.str })],
|
|
245
|
+
embeds: [embed(this.str("NO_APPEAL_SERVER_FOUND"), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
246
246
|
ephemeral: true,
|
|
247
247
|
});
|
|
248
248
|
}
|
|
249
249
|
const mod = await discord.member(server, member.id, true);
|
|
250
250
|
if (!mod) {
|
|
251
251
|
return send({
|
|
252
|
-
embeds: [embed(this.str("NOT_FOUND_IN_APPEAL_SERVER")(server), { str: this.str })],
|
|
252
|
+
embeds: [embed(this.str("NOT_FOUND_IN_APPEAL_SERVER")(server), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
253
253
|
ephemeral: true,
|
|
254
254
|
});
|
|
255
255
|
}
|
|
256
256
|
if (!mod.permissions?.has?.([perms.members.ban])) {
|
|
257
257
|
return send({
|
|
258
|
-
embeds: [embed(this.str("NO_BAN_PERMS_USER_IN_APPEAL_SERVER")(server), { str: this.str })],
|
|
258
|
+
embeds: [embed(this.str("NO_BAN_PERMS_USER_IN_APPEAL_SERVER")(server), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
259
259
|
ephemeral: true,
|
|
260
260
|
});
|
|
261
261
|
}
|
|
262
|
-
return int.showModal(defs.modals.unbanReason(customId, server, this.str, member, this.prefix)).catch(this._debug);
|
|
262
|
+
return int.showModal(defs.modals.unbanReason(customId, server, (name) => this.str(name, this?.options?.lang), member, this.prefix)).catch(this._debug);
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
if (customId.startsWith(`${this.prefix}:unban_modal:`)) {
|
|
@@ -267,30 +267,30 @@ module.exports = class Tickets extends base {
|
|
|
267
267
|
const [, , id] = customId.split(":");
|
|
268
268
|
if (!int.memberPermissions?.has?.([perms.members.ban])) {
|
|
269
269
|
return send({
|
|
270
|
-
embeds: [embed(this.str("NO_BAN_PERMS_USER"), { str: this.str })],
|
|
270
|
+
embeds: [embed(this.str("NO_BAN_PERMS_USER"), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
271
271
|
});
|
|
272
272
|
}
|
|
273
273
|
let server = getAppealServer(this.options);
|
|
274
274
|
if (!server) {
|
|
275
275
|
return send({
|
|
276
|
-
embeds: [embed(this.str("NO_APPEAL_SERVER_FOUND"), { str: this.str })],
|
|
276
|
+
embeds: [embed(this.str("NO_APPEAL_SERVER_FOUND"), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
279
|
const mod = await discord.member(server, member.id, true);
|
|
280
280
|
if (!mod) {
|
|
281
281
|
return send({
|
|
282
|
-
embeds: [embed(this.str("NOT_FOUND_IN_APPEAL_SERVER")(server), { str: this.str })],
|
|
282
|
+
embeds: [embed(this.str("NOT_FOUND_IN_APPEAL_SERVER")(server), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
283
283
|
});
|
|
284
284
|
}
|
|
285
285
|
if (!mod.permissions?.has?.([perms.members.ban])) {
|
|
286
286
|
return send({
|
|
287
|
-
embeds: [embed(this.str("NO_BAN_PERMS_USER_IN_APPEAL_SERVER")(server), { str: this.str })],
|
|
287
|
+
embeds: [embed(this.str("NO_BAN_PERMS_USER_IN_APPEAL_SERVER")(server), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
288
288
|
});
|
|
289
289
|
}
|
|
290
290
|
let isBanned = await server.bans.fetch({ user: id, force: true }).catch(this._debug);
|
|
291
291
|
if (!isBanned) {
|
|
292
292
|
return send({
|
|
293
|
-
embeds: [embed(this.str("USER_NOT_BANNED")(id), { str: this.str })],
|
|
293
|
+
embeds: [embed(this.str("USER_NOT_BANNED")(id), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
294
294
|
});
|
|
295
295
|
}
|
|
296
296
|
return server.bans
|
|
@@ -315,7 +315,7 @@ module.exports = class Tickets extends base {
|
|
|
315
315
|
})
|
|
316
316
|
.catch(this._debug);
|
|
317
317
|
send({
|
|
318
|
-
embeds: [embed(this.str("UNBAN_SUCCESS")(id, server.name), { str: this.str })],
|
|
318
|
+
embeds: [embed(this.str("UNBAN_SUCCESS")(id, server.name), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
319
319
|
});
|
|
320
320
|
})
|
|
321
321
|
.catch((e) =>
|
|
@@ -381,7 +381,7 @@ module.exports = class Tickets extends base {
|
|
|
381
381
|
embed(this.str("NOT_BANNED_MAIN_SERVER"), {
|
|
382
382
|
guild,
|
|
383
383
|
color: 0xff0000,
|
|
384
|
-
str: this.str,
|
|
384
|
+
str: (name) => this.str(name, this?.options?.lang),
|
|
385
385
|
}),
|
|
386
386
|
],
|
|
387
387
|
},
|
|
@@ -392,7 +392,7 @@ module.exports = class Tickets extends base {
|
|
|
392
392
|
embed(ban?.reason ?? this.str("NO_REASON"), {
|
|
393
393
|
title: this.str("BAN_REASON"),
|
|
394
394
|
guild: server,
|
|
395
|
-
str: this.str,
|
|
395
|
+
str: (name) => this.str(name, this?.options?.lang),
|
|
396
396
|
}),
|
|
397
397
|
],
|
|
398
398
|
components: [
|
|
@@ -435,7 +435,7 @@ module.exports = class Tickets extends base {
|
|
|
435
435
|
})
|
|
436
436
|
.catch(this._debug);
|
|
437
437
|
if (!channel) {
|
|
438
|
-
return send({ embeds: [embed(this.str("NO_CHANNEL_CREATE"), { str: this.str })] });
|
|
438
|
+
return send({ embeds: [embed(this.str("NO_CHANNEL_CREATE"), { str: (name) => this.str(name, this?.options?.lang) })] });
|
|
439
439
|
}
|
|
440
440
|
let embs = await Promise.all(
|
|
441
441
|
(
|
|
@@ -445,7 +445,7 @@ module.exports = class Tickets extends base {
|
|
|
445
445
|
color: 0xf50de3,
|
|
446
446
|
guild,
|
|
447
447
|
footer: { text: this.str("OPEN_TICKET_MESSAGE_FOOTER") },
|
|
448
|
-
str: this.str,
|
|
448
|
+
str: (name) => this.str(name, this?.options?.lang),
|
|
449
449
|
}),
|
|
450
450
|
]
|
|
451
451
|
).map((c) => parser(c, { guild, member, user: member.user })),
|
|
@@ -491,7 +491,7 @@ module.exports = class Tickets extends base {
|
|
|
491
491
|
text: `${this.str("TICKET_ID")} ${channel.name.split("-")[1]}`,
|
|
492
492
|
},
|
|
493
493
|
guild,
|
|
494
|
-
str: this.str,
|
|
494
|
+
str: (name) => this.str(name, this?.options?.lang),
|
|
495
495
|
}),
|
|
496
496
|
)
|
|
497
497
|
.send()
|
|
@@ -505,7 +505,7 @@ module.exports = class Tickets extends base {
|
|
|
505
505
|
name: this.str("OPEN_TICKET_CREATE"),
|
|
506
506
|
icon_url: `https://cdn.discordapp.com/emojis/476629550797684736.gif`,
|
|
507
507
|
},
|
|
508
|
-
str: this.str,
|
|
508
|
+
str: (name) => this.str(name, this?.options?.lang),
|
|
509
509
|
}),
|
|
510
510
|
],
|
|
511
511
|
components: [
|
package/lib/v14.js
CHANGED
|
@@ -60,14 +60,14 @@ module.exports = class Tickets extends base {
|
|
|
60
60
|
})
|
|
61
61
|
) {
|
|
62
62
|
return send({
|
|
63
|
-
embeds: [embed(this.str("TICKET_LIMIT_ONE_PER_USER")(this.options.prefix), { guild, str: this.str })],
|
|
63
|
+
embeds: [embed(this.str("TICKET_LIMIT_ONE_PER_USER")(this.options.prefix), { guild, str: (name) => this.str(name, this?.options?.lang) })],
|
|
64
64
|
ephemeral: true,
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
if (this.options.support?.ignore?.length) {
|
|
68
68
|
if (this.options.support.ignore.some((c) => member.roles?.cache?.has?.(c))) {
|
|
69
69
|
return send({
|
|
70
|
-
embeds: [embed(this.str("TICKET_BLOCKED"), { str: this.str })],
|
|
70
|
+
embeds: [embed(this.str("TICKET_BLOCKED"), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
71
71
|
ephemeral: true,
|
|
72
72
|
});
|
|
73
73
|
}
|
|
@@ -80,7 +80,7 @@ module.exports = class Tickets extends base {
|
|
|
80
80
|
title: this.options.modal?.title,
|
|
81
81
|
components: defs.getModalComponents(this.options.modal.questions || []),
|
|
82
82
|
},
|
|
83
|
-
{ prefix: this.prefix, str: this.str },
|
|
83
|
+
{ prefix: this.prefix, str: (name) => this.str(name, this?.options?.lang) },
|
|
84
84
|
),
|
|
85
85
|
)
|
|
86
86
|
.catch(this._debug);
|
|
@@ -113,7 +113,7 @@ module.exports = class Tickets extends base {
|
|
|
113
113
|
embed(this.str("TICKET_CLOSE_CONFIRM"), {
|
|
114
114
|
color: 0xff000,
|
|
115
115
|
guild,
|
|
116
|
-
str: this.str,
|
|
116
|
+
str: (name) => this.str(name, this?.options?.lang),
|
|
117
117
|
}),
|
|
118
118
|
],
|
|
119
119
|
components: [
|
|
@@ -193,7 +193,7 @@ module.exports = class Tickets extends base {
|
|
|
193
193
|
}
|
|
194
194
|
if (customId.startsWith(`${this.prefix}:close:confirm`)) {
|
|
195
195
|
if (customId.includes(`:modal_submit`)) {
|
|
196
|
-
return int.showModal(defs.modals.reason(customId, this.str)).catch(this._debug);
|
|
196
|
+
return int.showModal(defs.modals.reason(customId, (name) => this.str(name, this?.options?.lang))).catch(this._debug);
|
|
197
197
|
}
|
|
198
198
|
await send({ ephemeral: true }, true);
|
|
199
199
|
let reason = this.str("NO_REASON");
|
|
@@ -203,19 +203,19 @@ module.exports = class Tickets extends base {
|
|
|
203
203
|
const user = await discord.user(this.options.client, customId.split("close:confirm:")[1].replace(/:modal_complete/gi, ""), { fetch: true, mock: false });
|
|
204
204
|
if (!user) {
|
|
205
205
|
return send({
|
|
206
|
-
embeds: [embed(this.str("NO_USER_FOUND"), { str: this.str })],
|
|
206
|
+
embeds: [embed(this.str("NO_USER_FOUND"), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
209
|
let messages = await fetchMessages(channel, 5000);
|
|
210
210
|
if (!messages?.length) {
|
|
211
211
|
return send({
|
|
212
|
-
embeds: [embed(this.str("NO_MESSAGES_FETCHED"), { str: this.str })],
|
|
212
|
+
embeds: [embed(this.str("NO_MESSAGES_FETCHED"), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
213
213
|
});
|
|
214
214
|
}
|
|
215
215
|
let closed = await channel.delete(`${member.user.tag} (${member.id}) closed the ticket.`).catch(this._debug);
|
|
216
216
|
if (!closed) {
|
|
217
217
|
return send({
|
|
218
|
-
embeds: [embed(this.str("NO_CHANNEL_DELETE"), { str: this.str })],
|
|
218
|
+
embeds: [embed(this.str("NO_CHANNEL_DELETE"), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
219
219
|
});
|
|
220
220
|
}
|
|
221
221
|
return this.closeTicket({
|
|
@@ -231,31 +231,31 @@ module.exports = class Tickets extends base {
|
|
|
231
231
|
if (customId.startsWith(`${this.prefix}:unban:`)) {
|
|
232
232
|
if (!int.memberPermissions?.has?.(perms.members.ban)) {
|
|
233
233
|
return send({
|
|
234
|
-
embeds: [embed(this.str("NO_BAN_PERMS_USER"), { str: this.str })],
|
|
234
|
+
embeds: [embed(this.str("NO_BAN_PERMS_USER"), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
235
235
|
ephemeral: true,
|
|
236
236
|
});
|
|
237
237
|
}
|
|
238
238
|
let server = getAppealServer(this.options);
|
|
239
239
|
if (!server) {
|
|
240
240
|
return send({
|
|
241
|
-
embeds: [embed(this.str("NO_APPEAL_SERVER_FOUND"), { str: this.str })],
|
|
241
|
+
embeds: [embed(this.str("NO_APPEAL_SERVER_FOUND"), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
242
242
|
ephemeral: true,
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
245
|
const mod = await discord.member(server, member.id, true);
|
|
246
246
|
if (!mod) {
|
|
247
247
|
return send({
|
|
248
|
-
embeds: [embed(this.str("NOT_FOUND_IN_APPEAL_SERVER")(server), { str: this.str })],
|
|
248
|
+
embeds: [embed(this.str("NOT_FOUND_IN_APPEAL_SERVER")(server), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
249
249
|
ephemeral: true,
|
|
250
250
|
});
|
|
251
251
|
}
|
|
252
252
|
if (!mod.permissions?.has?.(perms.members.ban)) {
|
|
253
253
|
return send({
|
|
254
|
-
embeds: [embed(this.str("NO_BAN_PERMS_USER_IN_APPEAL_SERVER")(server), { str: this.str })],
|
|
254
|
+
embeds: [embed(this.str("NO_BAN_PERMS_USER_IN_APPEAL_SERVER")(server), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
255
255
|
ephemeral: true,
|
|
256
256
|
});
|
|
257
257
|
}
|
|
258
|
-
return int.showModal(defs.modals.unbanReason(customId, server, this.str, member, this.prefix)).catch(this._debug);
|
|
258
|
+
return int.showModal(defs.modals.unbanReason(customId, server, (name) => this.str(name, this?.options?.lang), member, this.prefix)).catch(this._debug);
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
if (customId.startsWith(`${this.prefix}:unban_modal:`)) {
|
|
@@ -263,30 +263,30 @@ module.exports = class Tickets extends base {
|
|
|
263
263
|
const [, , id] = customId.split(":");
|
|
264
264
|
if (!int.memberPermissions?.has?.(perms.members.ban)) {
|
|
265
265
|
return send({
|
|
266
|
-
embeds: [embed(this.str("NO_BAN_PERMS_USER"), { str: this.str })],
|
|
266
|
+
embeds: [embed(this.str("NO_BAN_PERMS_USER"), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
267
267
|
});
|
|
268
268
|
}
|
|
269
269
|
let server = getAppealServer(this.options);
|
|
270
270
|
if (!server) {
|
|
271
271
|
return send({
|
|
272
|
-
embeds: [embed(this.str("NO_APPEAL_SERVER_FOUND"), { str: this.str })],
|
|
272
|
+
embeds: [embed(this.str("NO_APPEAL_SERVER_FOUND"), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
273
273
|
});
|
|
274
274
|
}
|
|
275
275
|
const mod = await discord.member(server, member.id, true);
|
|
276
276
|
if (!mod) {
|
|
277
277
|
return send({
|
|
278
|
-
embeds: [embed(this.str("NOT_FOUND_IN_APPEAL_SERVER")(server), { str: this.str })],
|
|
278
|
+
embeds: [embed(this.str("NOT_FOUND_IN_APPEAL_SERVER")(server), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
281
|
if (!mod.permissions?.has?.(perms.members.ban)) {
|
|
282
282
|
return send({
|
|
283
|
-
embeds: [embed(this.str("NO_BAN_PERMS_USER_IN_APPEAL_SERVER")(server), { str: this.str })],
|
|
283
|
+
embeds: [embed(this.str("NO_BAN_PERMS_USER_IN_APPEAL_SERVER")(server), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
284
284
|
});
|
|
285
285
|
}
|
|
286
286
|
let isBanned = await server.bans.fetch({ user: id, force: true }).catch(this._debug);
|
|
287
287
|
if (!isBanned) {
|
|
288
288
|
return send({
|
|
289
|
-
embeds: [embed(this.str("USER_NOT_BANNED")(id), { str: this.str })],
|
|
289
|
+
embeds: [embed(this.str("USER_NOT_BANNED")(id), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
290
290
|
});
|
|
291
291
|
}
|
|
292
292
|
return server.bans
|
|
@@ -311,7 +311,7 @@ module.exports = class Tickets extends base {
|
|
|
311
311
|
})
|
|
312
312
|
.catch(this._debug);
|
|
313
313
|
send({
|
|
314
|
-
embeds: [embed(this.str("UNBAN_SUCCESS")(id, server.name), { str: this.str })],
|
|
314
|
+
embeds: [embed(this.str("UNBAN_SUCCESS")(id, server.name), { str: (name) => this.str(name, this?.options?.lang) })],
|
|
315
315
|
});
|
|
316
316
|
})
|
|
317
317
|
.catch((e) =>
|
|
@@ -377,7 +377,7 @@ module.exports = class Tickets extends base {
|
|
|
377
377
|
embed(this.str("NOT_BANNED_MAIN_SERVER"), {
|
|
378
378
|
guild,
|
|
379
379
|
color: 0xff0000,
|
|
380
|
-
str: this.str,
|
|
380
|
+
str: (name) => this.str(name, this?.options?.lang),
|
|
381
381
|
}),
|
|
382
382
|
],
|
|
383
383
|
},
|
|
@@ -388,7 +388,7 @@ module.exports = class Tickets extends base {
|
|
|
388
388
|
embed(ban?.reason ?? this.str("NO_REASON"), {
|
|
389
389
|
title: this.str("BAN_REASON"),
|
|
390
390
|
guild: server,
|
|
391
|
-
str: this.str,
|
|
391
|
+
str: (name) => this.str(name, this?.options?.lang),
|
|
392
392
|
}),
|
|
393
393
|
],
|
|
394
394
|
components: [
|
|
@@ -432,7 +432,7 @@ module.exports = class Tickets extends base {
|
|
|
432
432
|
})
|
|
433
433
|
.catch(this._debug);
|
|
434
434
|
if (!channel) {
|
|
435
|
-
return send({ embeds: [embed(this.str("NO_CHANNEL_CREATE"), { str: this.str })] });
|
|
435
|
+
return send({ embeds: [embed(this.str("NO_CHANNEL_CREATE"), { str: (name) => this.str(name, this?.options?.lang) })] });
|
|
436
436
|
}
|
|
437
437
|
let embs = await Promise.all(
|
|
438
438
|
(
|
|
@@ -442,7 +442,7 @@ module.exports = class Tickets extends base {
|
|
|
442
442
|
color: 0xf50de3,
|
|
443
443
|
guild,
|
|
444
444
|
footer: { text: this.str("OPEN_TICKET_MESSAGE_FOOTER") },
|
|
445
|
-
str: this.str,
|
|
445
|
+
str: (name) => this.str(name, this?.options?.lang),
|
|
446
446
|
}),
|
|
447
447
|
]
|
|
448
448
|
).map((c) => parser(c, { guild, member, user: member.user })),
|
|
@@ -488,7 +488,7 @@ module.exports = class Tickets extends base {
|
|
|
488
488
|
text: `${this.str("TICKET_ID")} ${channel.name.split("-")[1]}`,
|
|
489
489
|
},
|
|
490
490
|
guild,
|
|
491
|
-
str: this.str,
|
|
491
|
+
str: (name) => this.str(name, this?.options?.lang),
|
|
492
492
|
}),
|
|
493
493
|
)
|
|
494
494
|
.send()
|
|
@@ -502,7 +502,7 @@ module.exports = class Tickets extends base {
|
|
|
502
502
|
name: this.str("OPEN_TICKET_CREATE"),
|
|
503
503
|
icon_url: `https://cdn.discordapp.com/emojis/476629550797684736.gif`,
|
|
504
504
|
},
|
|
505
|
-
str: this.str,
|
|
505
|
+
str: (name) => this.str(name, this?.options?.lang),
|
|
506
506
|
}),
|
|
507
507
|
],
|
|
508
508
|
components: [
|