Fix a bunch of linter errors
diff --git a/src/actions/createModActionTicket.ts b/src/actions/createModActionTicket.ts
index 1d3406d..41f949c 100644
--- a/src/actions/createModActionTicket.ts
+++ b/src/actions/createModActionTicket.ts
@@ -3,14 +3,35 @@
import getEmojiByName from "../utils/getEmojiByName.js";
import client from "../utils/client.js";
-export async function create(guild: Discord.Guild, member: Discord.User, createdBy: Discord.User, reason: string, customReason?: string) {
+export async function create(
+ guild: Discord.Guild,
+ member: Discord.User,
+ createdBy: Discord.User,
+ reason: string,
+ customReason?: string
+) {
const config = await client.database.guilds.read(guild.id);
- const { log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = client.logger;
- const overwrites = [{
- id: member,
- allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
- type: "member"
- }] as Discord.OverwriteResolvable[];
+ const {
+ log,
+ NucleusColors,
+ entry,
+ renderUser,
+ renderChannel,
+ renderDelta
+ } = client.logger;
+ const overwrites = [
+ {
+ id: member,
+ allow: [
+ "VIEW_CHANNEL",
+ "SEND_MESSAGES",
+ "ATTACH_FILES",
+ "ADD_REACTIONS",
+ "READ_MESSAGE_HISTORY"
+ ],
+ type: "member"
+ }
+ ] as Discord.OverwriteResolvable[];
overwrites.push({
id: guild.roles.everyone,
deny: ["VIEW_CHANNEL"],
@@ -19,7 +40,13 @@
if (config.tickets.supportRole !== null) {
overwrites.push({
id: guild.roles.cache.get(config.tickets.supportRole),
- allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
+ allow: [
+ "VIEW_CHANNEL",
+ "SEND_MESSAGES",
+ "ATTACH_FILES",
+ "ADD_REACTIONS",
+ "READ_MESSAGE_HISTORY"
+ ],
type: "role"
});
}
@@ -31,40 +58,59 @@
topic: `${member.id} Active`,
parent: config.tickets.category,
nsfw: false,
- permissionOverwrites: (overwrites as Discord.OverwriteResolvable[]),
+ permissionOverwrites: overwrites as Discord.OverwriteResolvable[],
reason: "Creating ticket"
});
} catch (e) {
return null;
}
try {
- await c.send(
- {
- content: (`<@${member.id}>` + (config.tickets.supportRole !== null ? ` • <@&${config.tickets.supportRole}>` : "")),
- allowedMentions: {
- users: [member.id],
- roles: (config.tickets.supportRole !== null ? [config.tickets.supportRole] : [])
- }
+ await c.send({
+ content:
+ `<@${member.id}>` +
+ (config.tickets.supportRole !== null
+ ? ` • <@&${config.tickets.supportRole}>`
+ : ""),
+ allowedMentions: {
+ users: [member.id],
+ roles:
+ config.tickets.supportRole !== null
+ ? [config.tickets.supportRole]
+ : []
}
- );
- await c.send({ embeds: [new EmojiEmbed()
- .setTitle("New Ticket")
- .setDescription(
- "Ticket created by a Moderator\n" +
- `**Support type:** ${customReason ? customReason : "Appeal submission"}\n` + (reason !== null ? `**Reason:**\n> ${reason}\n` : "") +
- `**Ticket ID:** \`${c.id}\`\n` +
- "Type `/ticket close` to close this ticket."
- )
- .setStatus("Success")
- .setEmoji("GUILD.TICKET.OPEN")
- ], components: [new MessageActionRow().addComponents([new MessageButton()
- .setLabel("Close")
- .setStyle("DANGER")
- .setCustomId("closeticket")
- .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
- ])]});
+ });
+ await c.send({
+ embeds: [
+ new EmojiEmbed()
+ .setTitle("New Ticket")
+ .setDescription(
+ "Ticket created by a Moderator\n" +
+ `**Support type:** ${
+ customReason
+ ? customReason
+ : "Appeal submission"
+ }\n` +
+ (reason !== null
+ ? `**Reason:**\n> ${reason}\n`
+ : "") +
+ `**Ticket ID:** \`${c.id}\`\n` +
+ "Type `/ticket close` to close this ticket."
+ )
+ .setStatus("Success")
+ .setEmoji("GUILD.TICKET.OPEN")
+ ],
+ components: [
+ new MessageActionRow().addComponents([
+ new MessageButton()
+ .setLabel("Close")
+ .setStyle("DANGER")
+ .setCustomId("closeticket")
+ .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+ ])
+ ]
+ });
const data = {
- meta:{
+ meta: {
type: "ticketCreate",
displayName: "Ticket Created",
calculateType: "ticketUpdate",
@@ -75,7 +121,10 @@
list: {
ticketFor: entry(member.id, renderUser(member)),
createdBy: entry(createdBy.id, renderUser(createdBy)),
- created: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+ created: entry(
+ new Date().getTime(),
+ renderDelta(new Date().getTime())
+ ),
ticketChannel: entry(c.id, renderChannel(c))
},
hidden: {
@@ -83,11 +132,14 @@
}
};
log(data);
- } catch (e) { console.log(e); return null; }
+ } catch (e) {
+ console.log(e);
+ return null;
+ }
return c.id;
}
export async function areTicketsEnabled(guild: string) {
const config = await client.database.guilds.read(guild);
return config.tickets.enabled;
-}
\ No newline at end of file
+}