Fix a bunch of linter errors
diff --git a/src/commands/privacy.ts b/src/commands/privacy.ts
index 8fb6b40..3c36ea1 100644
--- a/src/commands/privacy.ts
+++ b/src/commands/privacy.ts
@@ -1,5 +1,9 @@
import { LoadingEmbed } from "./../utils/defaultEmbeds.js";
-import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
+import Discord, {
+ CommandInteraction,
+ MessageActionRow,
+ MessageButton
+} from "discord.js";
import { SelectMenuOption, SlashCommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
@@ -10,7 +14,9 @@
const command = new SlashCommandBuilder()
.setName("privacy")
- .setDescription("Information and options for you and your server's settings");
+ .setDescription(
+ "Information and options for you and your server's settings"
+ );
class Embed {
embed: Discord.MessageEmbed;
@@ -18,61 +24,111 @@
description = "";
pageId = 0;
components?: MessageActionRow[] = [];
- setEmbed(embed: Discord.MessageEmbed) { this.embed = embed; return this; }
- setTitle(title: string) { this.title = title; return this; }
- setDescription(description: string) { this.description = description; return this; }
- setPageId(pageId: number) { this.pageId = pageId; return this; }
- setComponents(components: MessageActionRow[]) { this.components = components; return this; }
+ setEmbed(embed: Discord.MessageEmbed) {
+ this.embed = embed;
+ return this;
+ }
+ setTitle(title: string) {
+ this.title = title;
+ return this;
+ }
+ setDescription(description: string) {
+ this.description = description;
+ return this;
+ }
+ setPageId(pageId: number) {
+ this.pageId = pageId;
+ return this;
+ }
+ setComponents(components: MessageActionRow[]) {
+ this.components = components;
+ return this;
+ }
}
const callback = async (interaction: CommandInteraction): Promise<void> => {
const pages = [
new Embed()
- .setEmbed(new EmojiEmbed()
- .setTitle("Nucleus Privacy")
- .setDescription(
- "Nucleus is a bot that naturally needs to store data about servers.\n" +
- "We are entirely [open source](https://github.com/ClicksMinutePer/Nucleus), so you can check exactly what we store, and how it works.\n\n" +
- "If you are a server administrator, you can view the options page in the dropdown under this message.\n\n" +
- "Any questions about Nucleus, how it works and data stored can be asked in [our server](https://discord.gg/bPaNnxe)."
- )
- .setEmoji("NUCLEUS.LOGO")
- .setStatus("Danger")
- ).setTitle("Welcome").setDescription("General privacy information").setPageId(0),
- new Embed()
- .setEmbed(new EmojiEmbed()
- .setTitle("Scanners")
- .setDescription(
- "Nucleus uses [unscan](https://unscan.co) to scan links, images and files for malware and other threats.\n" +
- "This service's [privacy policy](https://unscan.co/policies) is public, and they \"do not store or sell your data.\""
- )
- .setEmoji("NUCLEUS.LOGO")
- .setStatus("Danger")
- ).setTitle("Scanners").setDescription("About Unscan").setPageId(1),
- new Embed()
- .setEmbed(new EmojiEmbed()
- .setTitle("Link scanning and Transcripts")
- .setDescription(
- "**Facebook** - Facebook trackers include data such as your date of birth, and guess your age if not entered, your preferences, who you interact with and more.\n" +
- "**AMP** - AMP is a technology that allows websites to be served by Google. This means Google can store and track data, and are pushing this to as many pages as possible.\n\n" +
- "Transcripts allow you to store all messages sent in a channel. This could be an issue in some cases, as they are hosted on [Pastebin](https://pastebin.com), so a leaked link could show all messages sent in the channel.\n"
- )
- .setEmoji("NUCLEUS.LOGO")
- .setStatus("Danger")
- ).setTitle("Link scanning and Transcripts").setDescription("Regarding Facebook and AMP filter types, and ticket transcripts").setPageId(2)
- ].concat((interaction.member as Discord.GuildMember).permissions.has("ADMINISTRATOR") ? [new Embed()
- .setEmbed(new EmojiEmbed()
- .setTitle("Options")
- .setDescription(
- "Below are buttons for controlling this servers privacy settings"
+ .setEmbed(
+ new EmojiEmbed()
+ .setTitle("Nucleus Privacy")
+ .setDescription(
+ "Nucleus is a bot that naturally needs to store data about servers.\n" +
+ "We are entirely [open source](https://github.com/ClicksMinutePer/Nucleus), so you can check exactly what we store, and how it works.\n\n" +
+ "If you are a server administrator, you can view the options page in the dropdown under this message.\n\n" +
+ "Any questions about Nucleus, how it works and data stored can be asked in [our server](https://discord.gg/bPaNnxe)."
+ )
+ .setEmoji("NUCLEUS.LOGO")
+ .setStatus("Danger")
)
- .setEmoji("NUCLEUS.LOGO")
- .setStatus("Danger")
- ).setTitle("Options").setDescription("Options").setPageId(3).setComponents([new MessageActionRow().addComponents([
- new MessageButton().setLabel("Clear all data").setCustomId("clear-all-data").setStyle("DANGER")
- ])])
- ] : []);
- const m = await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true});
+ .setTitle("Welcome")
+ .setDescription("General privacy information")
+ .setPageId(0),
+ new Embed()
+ .setEmbed(
+ new EmojiEmbed()
+ .setTitle("Scanners")
+ .setDescription(
+ "Nucleus uses [unscan](https://unscan.co) to scan links, images and files for malware and other threats.\n" +
+ 'This service\'s [privacy policy](https://unscan.co/policies) is public, and they "do not store or sell your data."'
+ )
+ .setEmoji("NUCLEUS.LOGO")
+ .setStatus("Danger")
+ )
+ .setTitle("Scanners")
+ .setDescription("About Unscan")
+ .setPageId(1),
+ new Embed()
+ .setEmbed(
+ new EmojiEmbed()
+ .setTitle("Link scanning and Transcripts")
+ .setDescription(
+ "**Facebook** - Facebook trackers include data such as your date of birth, and guess your age if not entered, your preferences, who you interact with and more.\n" +
+ "**AMP** - AMP is a technology that allows websites to be served by Google. This means Google can store and track data, and are pushing this to as many pages as possible.\n\n" +
+ "Transcripts allow you to store all messages sent in a channel. This could be an issue in some cases, as they are hosted on [Pastebin](https://pastebin.com), so a leaked link could show all messages sent in the channel.\n"
+ )
+ .setEmoji("NUCLEUS.LOGO")
+ .setStatus("Danger")
+ )
+ .setTitle("Link scanning and Transcripts")
+ .setDescription(
+ "Regarding Facebook and AMP filter types, and ticket transcripts"
+ )
+ .setPageId(2)
+ ].concat(
+ (interaction.member as Discord.GuildMember).permissions.has(
+ "ADMINISTRATOR"
+ )
+ ? [
+ new Embed()
+ .setEmbed(
+ new EmojiEmbed()
+ .setTitle("Options")
+ .setDescription(
+ "Below are buttons for controlling this servers privacy settings"
+ )
+ .setEmoji("NUCLEUS.LOGO")
+ .setStatus("Danger")
+ )
+ .setTitle("Options")
+ .setDescription("Options")
+ .setPageId(3)
+ .setComponents([
+ new MessageActionRow().addComponents([
+ new MessageButton()
+ .setLabel("Clear all data")
+ .setCustomId("clear-all-data")
+ .setStyle("DANGER")
+ ])
+ ])
+ ]
+ : []
+ );
+ const m = await interaction.reply({
+ embeds: LoadingEmbed,
+ fetchReply: true,
+ ephemeral: true
+ });
let page = 0;
let selectPaneOpen = false;
@@ -83,37 +139,59 @@
if (selectPaneOpen) {
const options = [];
- pages.forEach(embed => {
- options.push(new SelectMenuOption({
- label: embed.title,
- value: embed.pageId.toString(),
- description: embed.description || ""
- }));
+ pages.forEach((embed) => {
+ options.push(
+ new SelectMenuOption({
+ label: embed.title,
+ value: embed.pageId.toString(),
+ description: embed.description || ""
+ })
+ );
});
- selectPane = [new MessageActionRow().addComponents([
- new Discord.MessageSelectMenu()
- .addOptions(options)
- .setCustomId("page")
- .setMaxValues(1)
- .setPlaceholder("Choose a page...")
- ])];
+ selectPane = [
+ new MessageActionRow().addComponents([
+ new Discord.MessageSelectMenu()
+ .addOptions(options)
+ .setCustomId("page")
+ .setMaxValues(1)
+ .setPlaceholder("Choose a page...")
+ ])
+ ];
}
- const components = selectPane.concat([new MessageActionRow().addComponents([
- new MessageButton().setCustomId("left").setEmoji(getEmojiByName("CONTROL.LEFT", "id")).setStyle("SECONDARY").setDisabled(page === 0),
- new MessageButton().setCustomId("select").setEmoji(getEmojiByName("CONTROL.MENU", "id")).setStyle(selectPaneOpen ? "PRIMARY" : "SECONDARY").setDisabled(false),
- new MessageButton().setCustomId("right").setEmoji(getEmojiByName("CONTROL.RIGHT", "id")).setStyle("SECONDARY").setDisabled(page === pages.length - 1)
- ])]);
+ const components = selectPane.concat([
+ new MessageActionRow().addComponents([
+ new MessageButton()
+ .setCustomId("left")
+ .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+ .setStyle("SECONDARY")
+ .setDisabled(page === 0),
+ new MessageButton()
+ .setCustomId("select")
+ .setEmoji(getEmojiByName("CONTROL.MENU", "id"))
+ .setStyle(selectPaneOpen ? "PRIMARY" : "SECONDARY")
+ .setDisabled(false),
+ new MessageButton()
+ .setCustomId("right")
+ .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
+ .setStyle("SECONDARY")
+ .setDisabled(page === pages.length - 1)
+ ])
+ ]);
const em = new Discord.MessageEmbed(pages[page].embed);
- em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
- em.setFooter({text: nextFooter ?? ""});
+ em.setDescription(
+ em.description + "\n\n" + createPageIndicator(pages.length, page)
+ );
+ em.setFooter({ text: nextFooter ?? "" });
await interaction.editReply({
embeds: [em],
components: components.concat(pages[page].components)
});
let i;
try {
- i = await m.awaitMessageComponent({time: 300000});
- } catch(e) { break; }
+ i = await m.awaitMessageComponent({ time: 300000 });
+ } catch (e) {
+ break;
+ }
nextFooter = null;
i.deferUpdate();
if (i.component.customId === "left") {
@@ -133,11 +211,13 @@
.setTitle("Clear All Data")
.setDescription(
"Are you sure you want to delete all data on this server? This includes your settings and all punishment histories.\n\n" +
- "**This cannot be undone.**"
+ "**This cannot be undone.**"
)
.setColor("Danger")
.send(true);
- if (confirmation.cancelled) { break; }
+ if (confirmation.cancelled) {
+ break;
+ }
if (confirmation.success) {
client.database.guilds.delete(interaction.guild.id);
client.database.history.delete(interaction.guild.id);
@@ -149,25 +229,34 @@
}
} else {
const em = new Discord.MessageEmbed(pages[page].embed);
- em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
- em.setFooter({text: "Message closed"});
- interaction.editReply({embeds: [em], components: []});
+ em.setDescription(
+ em.description +
+ "\n\n" +
+ createPageIndicator(pages.length, page)
+ );
+ em.setFooter({ text: "Message closed" });
+ interaction.editReply({ embeds: [em], components: [] });
return;
}
}
const em = new Discord.MessageEmbed(pages[page].embed);
- em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
- em.setFooter({text: "Message timed out"});
+ em.setDescription(
+ em.description + "\n\n" + createPageIndicator(pages.length, page)
+ );
+ em.setFooter({ text: "Message timed out" });
await interaction.editReply({
embeds: [em],
components: []
});
};
-const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
+const check = (
+ _interaction: CommandInteraction,
+ _defaultCheck: WrappedCheck
+) => {
return true;
};
export { command };
export { callback };
-export { check };
\ No newline at end of file
+export { check };