Skip to content

Commit 1a0d9ba

Browse files
committed
Apply change requested
1 parent 8e6111a commit 1a0d9ba

File tree

2 files changed

+88
-20
lines changed

2 files changed

+88
-20
lines changed

src/commands/slash/add.js

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
const { SlashCommand } = require('@eartharoid/dbf');
2-
const { ApplicationCommandOptionType } = require('discord.js');
2+
const {
3+
ApplicationCommandOptionType,
4+
MessageFlags,
5+
} = require('discord.js');
36
const ExtendedEmbedBuilder = require('../../lib/embed');
47
const { isStaff } = require('../../lib/users');
58
const { logTicketEvent } = require('../../lib/logging');
@@ -47,7 +50,7 @@ module.exports = class AddSlashCommand extends SlashCommand {
4750
/** @type {import('client')} */
4851
const client = this.client;
4952

50-
await interaction.deferReply({ ephemeral: true });
53+
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
5154

5255
const ticket = await client.prisma.ticket.findUnique({
5356
include: { guild: true },
@@ -175,24 +178,41 @@ module.exports = class AddSlashCommand extends SlashCommand {
175178
.setColor(ticket.guild.successColour)
176179
.setTitle(getMessage('commands.slash.add.success.title'))
177180
.setDescription(getMessage('commands.slash.add.success.description', {
178-
args: (member ? member.toString() : '') + (role ? ` and ${role.toString()}` : ''),
181+
args: [member?.toString(), role?.toString()].filter(Boolean).join(' & '),
179182
ticket: ticketChannel.toString(),
180183
})),
181184
],
182185
});
183186

184-
logTicketEvent(this.client, {
185-
action: 'update',
186-
diff: {
187-
original: {},
188-
updated: { [getMessage('log.ticket.added')]: member.user.tag },
189-
},
190-
target: {
191-
id: ticket.id,
192-
name: `<#${ticket.id}>`,
193-
},
194-
userId: interaction.user.id,
195-
});
187+
if (member) {
188+
logTicketEvent(this.client, {
189+
action: 'update',
190+
diff: {
191+
original: {},
192+
updated: { [getMessage('log.ticket.addedMember')]: member.user.tag },
193+
},
194+
target: {
195+
id: ticket.id,
196+
name: `<#${ticket.id}>`,
197+
},
198+
userId: interaction.user.id,
199+
});
200+
}
201+
202+
if (role) {
203+
logTicketEvent(this.client, {
204+
action: 'update',
205+
diff: {
206+
original: {},
207+
updated: { [getMessage('log.ticket.addedRole')]: role.name },
208+
},
209+
target: {
210+
id: ticket.id,
211+
name: `<#${ticket.id}>`,
212+
},
213+
userId: interaction.user.id,
214+
});
215+
}
196216

197217
}
198218
};

src/i18n/en-GB.yml

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ buttons:
2323
reject_close_request:
2424
emoji: ✖️
2525
text: Reject
26+
transcript:
27+
emoji: 📄
28+
text: Transcript
2629
unclaim:
2730
emoji: ♻️
2831
text: Release
@@ -193,6 +196,28 @@ commands:
193196
success:
194197
description: "{member} has been removed from {ticket}."
195198
title: ✅ Removed
199+
rename:
200+
description: Rename a ticket channel
201+
error: There was an error while renaming the channel.
202+
invalid:
203+
description: The name must be between 1 and 100 characters in length.
204+
title: Invalid name
205+
name: rename
206+
not_staff:
207+
description: Only staff members can rename tickets.
208+
title: ❌ Error
209+
options:
210+
name:
211+
description: The new name for the ticket channel.
212+
name: name
213+
ratelimited:
214+
description:
215+
You have already renamed this channel twice within the last 10
216+
minutes. Please wait before trying again.
217+
title: Rate Limit Reached
218+
success:
219+
description: The ticket channel has been renamed to `{name}`.
220+
title: Channel renamed
196221
tag:
197222
description: Use a tag
198223
name: tag
@@ -234,6 +259,9 @@ commands:
234259
transcript:
235260
description: Get the transcript of a ticket
236261
name: transcript
262+
not_staff:
263+
description: Only staff members can read the transcripts of others' tickets.
264+
title: ❌ Error
237265
options:
238266
member:
239267
description: The member to search for tickets of
@@ -264,11 +292,12 @@ commands:
264292
title: ✅ Prompt sent
265293
dm:
266294
closed:
267-
archived: Use the `/transcript` command in **{guild}** to view the archived messages.
268295
fields:
269296
closed:
270297
name: Closed at
271-
value: "{timestamp} (after {duration})"
298+
value: |-
299+
{timestamp}
300+
(after {duration})
272301
closed_by: Closed by
273302
created: Created at
274303
feedback: Your feedback
@@ -310,7 +339,8 @@ log:
310339
delete: deleted
311340
update: updated
312341
ticket:
313-
added: Added members
342+
addedMember: Added member
343+
addedRole: Added role
314344
description: "{user} {verb} a ticket"
315345
removed: Removed members
316346
ticket: Ticket
@@ -343,7 +373,6 @@ misc:
343373
Sorry, an unexpected error occurred.
344374
Please give this information to an administrator.
345375
fields:
346-
code: Error code
347376
identifier: Identifier
348377
title: ⚠️ Something went wrong
349378
expired:
@@ -368,14 +397,33 @@ misc:
368397
this category.
369398
title: ❌ Insufficient roles
370399
no_categories:
371-
description: No ticket categories have been configured.
400+
description: |-
401+
No ticket categories have been configured.
402+
Configure your server at {url}.
372403
title: ❌ There are no ticket categories
373404
not_ticket:
374405
description: You can only use this command in tickets.
375406
title: ❌ This isn't a ticket channel
407+
permissions_error:
408+
description: Sorry, the operation failed due to insufficient permissions.
409+
fields:
410+
for_admins:
411+
name: For server administrators
412+
value: >
413+
[Click here]({url}) for resolution instructions.
414+
title: ⚠️ Something went wrong
376415
ratelimited:
377416
description: Try again in a few seconds.
378417
title: 🐢 Please slow down
418+
role_error:
419+
description: Sorry, the operation failed because of an invalid configuration.
420+
fields:
421+
for_admins:
422+
name: For server administrators
423+
value: >
424+
An invalid user or role was supplied, which usually means a staff role
425+
has been deleted. [Click here]({url}) for resolution instructions.
426+
title: ⚠️ Something went wrong
379427
unknown_category:
380428
description: Please try a different category.
381429
title: ❌ That ticket category doesn't exist

0 commit comments

Comments
 (0)