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