From 4f164f3adb44899a2dc93199d8750583ae4dae9f Mon Sep 17 00:00:00 2001 From: pineafan Date: Sat, 26 Feb 2022 22:07:12 +0000 Subject: [PATCH] guess who forgot to add files --- .vscode/launch.json | 27 +++ src/commands/help.ts | 19 ++ src/commands/mod/_meta.ts | 4 + src/commands/mod/ban.ts | 98 +++++++++ src/commands/mod/clear.ts | 20 ++ src/commands/mod/kick.ts | 20 ++ src/commands/mod/lock.ts | 20 ++ src/commands/mod/purge.ts | 20 ++ src/commands/mod/slowmode.ts | 20 ++ src/commands/mod/softban.ts | 20 ++ src/commands/mod/unban.ts | 20 ++ src/commands/mod/viewas.ts | 20 ++ src/commands/mod/warn.ts | 20 ++ src/commands/nucleus/_meta.ts | 4 + src/commands/nucleus/ping.ts | 20 ++ src/commands/nucleus/stats.ts | 20 ++ src/commands/nucleus/suggest.ts | 20 ++ src/commands/privacy.ts | 19 ++ src/commands/role/_meta.ts | 4 + src/commands/role/all.ts | 20 ++ src/commands/role/user.ts | 20 ++ src/commands/settings/_meta.ts | 4 + src/commands/settings/all.ts | 20 ++ src/commands/settings/automation.ts | 20 ++ src/commands/settings/log/_meta.ts | 4 + src/commands/settings/log/channel.ts | 20 ++ src/commands/settings/log/events.ts | 20 ++ src/commands/settings/log/ignore.ts | 20 ++ src/commands/settings/log/ignored.ts | 20 ++ src/commands/settings/mod/_meta.ts | 4 + src/commands/settings/mod/channel.ts | 20 ++ src/commands/settings/mod/events.ts | 20 ++ src/commands/settings/tickets.ts | 20 ++ src/commands/settings/verify/_meta.ts | 4 + src/commands/settings/verify/channel.ts | 20 ++ src/commands/settings/verify/role.ts | 20 ++ src/commands/tag.ts | 19 ++ src/commands/ticket/_meta.ts | 4 + src/commands/ticket/close.ts | 20 ++ src/commands/ticket/create.ts | 20 ++ src/commands/ticket/delete.ts | 20 ++ src/commands/user/_meta.ts | 4 + src/commands/user/about.ts | 20 ++ src/commands/user/avatar.ts | 20 ++ src/commands/verify.ts | 19 ++ src/config/emojis.json | 268 ++++++++++++++++++++++++ src/config/main.json | 11 + src/utils/confirmationMessage.ts | 60 ++++++ src/utils/generateEmojiEmbed.ts | 29 +++ src/utils/generateKeyValueList.ts | 14 ++ src/utils/getEmojiByName.ts | 12 ++ 51 files changed, 1231 insertions(+) create mode 100644 .vscode/launch.json create mode 100644 src/commands/help.ts create mode 100644 src/commands/mod/_meta.ts create mode 100644 src/commands/mod/ban.ts create mode 100644 src/commands/mod/clear.ts create mode 100644 src/commands/mod/kick.ts create mode 100644 src/commands/mod/lock.ts create mode 100644 src/commands/mod/purge.ts create mode 100644 src/commands/mod/slowmode.ts create mode 100644 src/commands/mod/softban.ts create mode 100644 src/commands/mod/unban.ts create mode 100644 src/commands/mod/viewas.ts create mode 100644 src/commands/mod/warn.ts create mode 100644 src/commands/nucleus/_meta.ts create mode 100644 src/commands/nucleus/ping.ts create mode 100644 src/commands/nucleus/stats.ts create mode 100644 src/commands/nucleus/suggest.ts create mode 100644 src/commands/privacy.ts create mode 100644 src/commands/role/_meta.ts create mode 100644 src/commands/role/all.ts create mode 100644 src/commands/role/user.ts create mode 100644 src/commands/settings/_meta.ts create mode 100644 src/commands/settings/all.ts create mode 100644 src/commands/settings/automation.ts create mode 100644 src/commands/settings/log/_meta.ts create mode 100644 src/commands/settings/log/channel.ts create mode 100644 src/commands/settings/log/events.ts create mode 100644 src/commands/settings/log/ignore.ts create mode 100644 src/commands/settings/log/ignored.ts create mode 100644 src/commands/settings/mod/_meta.ts create mode 100644 src/commands/settings/mod/channel.ts create mode 100644 src/commands/settings/mod/events.ts create mode 100644 src/commands/settings/tickets.ts create mode 100644 src/commands/settings/verify/_meta.ts create mode 100644 src/commands/settings/verify/channel.ts create mode 100644 src/commands/settings/verify/role.ts create mode 100644 src/commands/tag.ts create mode 100644 src/commands/ticket/_meta.ts create mode 100644 src/commands/ticket/close.ts create mode 100644 src/commands/ticket/create.ts create mode 100644 src/commands/ticket/delete.ts create mode 100644 src/commands/user/_meta.ts create mode 100644 src/commands/user/about.ts create mode 100644 src/commands/user/avatar.ts create mode 100644 src/commands/verify.ts create mode 100644 src/config/emojis.json create mode 100644 src/config/main.json create mode 100644 src/utils/confirmationMessage.ts create mode 100644 src/utils/generateEmojiEmbed.ts create mode 100644 src/utils/generateKeyValueList.ts create mode 100644 src/utils/getEmojiByName.ts diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..2024e73 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,27 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "command": "npm run dev", + "name": "Run npm start", + "request": "launch", + "type": "node-terminal" + }, + { + "type": "pwa-node", + "request": "launch", + "name": "Launch Program", + "skipFiles": [ + "/**" + ], + "program": "${workspaceFolder}/dist/index.js", + "preLaunchTask": "tsc: build - tsconfig.json", + "outFiles": [ + "${workspaceFolder}/dist/**/*.js" + ] + } + ] +} \ No newline at end of file diff --git a/src/commands/help.ts b/src/commands/help.ts new file mode 100644 index 0000000..b326c90 --- /dev/null +++ b/src/commands/help.ts @@ -0,0 +1,19 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = new SlashCommandBuilder() + .setName("help") + .setDescription("Shows help for commands") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("hel p"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/mod/_meta.ts b/src/commands/mod/_meta.ts new file mode 100644 index 0000000..c2a76a9 --- /dev/null +++ b/src/commands/mod/_meta.ts @@ -0,0 +1,4 @@ +const name = "mod"; +const description = "Perform moderator actions"; + +export { name, description }; \ No newline at end of file diff --git a/src/commands/mod/ban.ts b/src/commands/mod/ban.ts new file mode 100644 index 0000000..8946e17 --- /dev/null +++ b/src/commands/mod/ban.ts @@ -0,0 +1,98 @@ +import Discord, { CommandInteraction, GuildMember } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; +import getEmojiByName from "../../utils/getEmojiByName.js"; +import confirmationMessage from "../../utils/confirmationMessage.js"; +import EmojiEmbed from "../../utils/generateEmojiEmbed.js"; +import keyValueList from "../../utils/generateKeyValueList.js"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("ban") + .setDescription("Bans a user from the server") + .addUserOption(option => option.setName("user").setDescription("The user to ban").setRequired(true)) + .addStringOption(option => option.setName("reason").setDescription("The reason for the ban").setRequired(false)) + .addStringOption(option => option.setName("notify").setDescription("If the user should get a message when they are banned | Default yes").setRequired(false) + .addChoices([["Yes", "yes"], ["No", "no"]]) + ) + .addIntegerOption(option => option.setName("delete").setDescription("The days of messages to delete | Default 0").setMinValue(0).setMaxValue(7).setRequired(false)) + +const callback = async (interaction: CommandInteraction) => { + // TODO:[Modals] Replace this with a modal + if (await new confirmationMessage(interaction) + .setEmoji("PUNISH.BAN") + .setTitle("Ban") + .setDescription(keyValueList({ + "user": `<@!${(interaction.options.getMember("user") as GuildMember).id}> (${(interaction.options.getMember("user") as GuildMember).user.username})`, + "reason": `\n> ${interaction.options.getString("reason") ? interaction.options.getString("reason") : "*No reason provided*"}` + }) + + `The user **will${interaction.options.getString("notify") === "no" ? ' not' : ''}** be notified\n` + + `${interaction.options.getInteger("delete") ? interaction.options.getInteger("delete") : 0} day${interaction.options.getInteger("delete") === 1 || interaction.options.getInteger("delete") === null ? "s" : ""} of messages will be deleted\n\n` // TODO:[s addition] + + `Are you sure you want to ban <@!${(interaction.options.getMember("user") as GuildMember).id}>?`) + .setColor("Danger") +// pluralize("day", interaction.options.getInteger("delete")) +// const pluralize = (word: string, count: number) => { return count === 1 ? word : word + "s" } + .send()) { + let dmd = false + try { + if (interaction.options.getString("notify") != "no") { + await (interaction.options.getMember("user") as GuildMember).send({ + embeds: [new EmojiEmbed() + .setEmoji("MEMBER.BAN") + .setTitle("Banned") + .setDescription(`You have been banned in ${interaction.guild.name}` + + (interaction.options.getString("reason") ? ` for:\n> ${interaction.options.getString("reason")}` : " with no reason provided.")) + .setStatus("Danger") + ] + }) + dmd = true + } + } catch {} + try { + (interaction.options.getMember("user") as GuildMember).ban({ + days: Number(interaction.options.getInteger("delete") ?? 0), + reason: interaction.options.getString("reason") + }) + let failed = (dmd == false && interaction.options.getString("notify") != "no") + await interaction.editReply({embeds: [new EmojiEmbed() + .setEmoji(`PUNISH.${failed ? "SOFT" : ""}BAN`) // TODO: Add green ban icon for success + .setTitle(`Ban`) + .setDescription("The member was banned" + (failed ? ", but the user could not be messaged" : "")) + .setStatus(failed ? "Warning" : "Success") + ], components: []}) + } catch { + await interaction.editReply({embeds: [new EmojiEmbed() + .setEmoji("MEMBER.BAN") + .setTitle(`Ban`) + .setDescription("Something went wrong and the user was not banned") + .setStatus("Danger") + ], components: []}) + } + } else { + await interaction.editReply({embeds: [new EmojiEmbed() + .setEmoji("MEMBER.UNBAN") + .setTitle(`Ban`) + .setDescription("No changes were made") + .setStatus("Success") + ], components: []}) + } +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + // Check if Nucleus can ban the member + if (! (interaction.guild.me.roles.highest.position > (interaction.member as GuildMember).roles.highest.position)) throw "I do not have a role higher than that member" + // Check if Nucleus has permission to ban + if (! interaction.guild.me.permissions.has("BAN_MEMBERS")) throw "I do not have the `ban_members` permission"; + // Do not allow banning Nucleus + if ((interaction.member as GuildMember).id == interaction.guild.me.id) throw "I cannot ban myself" + // Allow the owner to ban anyone + if ((interaction.member as GuildMember).id == interaction.guild.ownerId) return true + // Check if the user has ban_members permission + if (! (interaction.member as GuildMember).permissions.has("BAN_MEMBERS")) throw "You do not have the `ban_members` permission"; + // Check if the user is below on the role list + if (! ((interaction.member as GuildMember).roles.highest.position > (interaction.options.getMember("user") as GuildMember).roles.highest.position)) throw "You do not have a role higher than that member" + // Allow ban + return true +} + +export { command, callback, check }; \ No newline at end of file diff --git a/src/commands/mod/clear.ts b/src/commands/mod/clear.ts new file mode 100644 index 0000000..78909a9 --- /dev/null +++ b/src/commands/mod/clear.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("clear") + .setDescription("Clears a users messages in a channel") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [mod/clear]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/mod/kick.ts b/src/commands/mod/kick.ts new file mode 100644 index 0000000..895f035 --- /dev/null +++ b/src/commands/mod/kick.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("kick") + .setDescription("Clears a users messages in a channel") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [mod/kick]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/mod/lock.ts b/src/commands/mod/lock.ts new file mode 100644 index 0000000..ec44493 --- /dev/null +++ b/src/commands/mod/lock.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("lock") + .setDescription("Manages a lock on a channel") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [mod/lock]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/mod/purge.ts b/src/commands/mod/purge.ts new file mode 100644 index 0000000..7c52b13 --- /dev/null +++ b/src/commands/mod/purge.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("purge") + .setDescription("Clears messages in a channel") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [mod/purge]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/mod/slowmode.ts b/src/commands/mod/slowmode.ts new file mode 100644 index 0000000..32624cc --- /dev/null +++ b/src/commands/mod/slowmode.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("slowmode") + .setDescription("Manages slowmode in a channel") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [mod/slowmode]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/mod/softban.ts b/src/commands/mod/softban.ts new file mode 100644 index 0000000..19db3c2 --- /dev/null +++ b/src/commands/mod/softban.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("softban") + .setDescription("Softbans a user") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [mod/softban]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/mod/unban.ts b/src/commands/mod/unban.ts new file mode 100644 index 0000000..fe2133e --- /dev/null +++ b/src/commands/mod/unban.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("unban") + .setDescription("Unbans a user") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [mod/unban]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/mod/viewas.ts b/src/commands/mod/viewas.ts new file mode 100644 index 0000000..12ab7a8 --- /dev/null +++ b/src/commands/mod/viewas.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("viewas") + .setDescription("View the server as a specific member") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [mod/viewas]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/mod/warn.ts b/src/commands/mod/warn.ts new file mode 100644 index 0000000..f050ef2 --- /dev/null +++ b/src/commands/mod/warn.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("warn") + .setDescription("Warns a user") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [mod/warn]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/nucleus/_meta.ts b/src/commands/nucleus/_meta.ts new file mode 100644 index 0000000..df978ba --- /dev/null +++ b/src/commands/nucleus/_meta.ts @@ -0,0 +1,4 @@ +const name = "nucleus"; +const description = "Commands relating to Nucleus itself"; + +export { name, description }; \ No newline at end of file diff --git a/src/commands/nucleus/ping.ts b/src/commands/nucleus/ping.ts new file mode 100644 index 0000000..43a5fd7 --- /dev/null +++ b/src/commands/nucleus/ping.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("ping") + .setDescription("Gets the bot's ping time") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [nucleus/ping]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/nucleus/stats.ts b/src/commands/nucleus/stats.ts new file mode 100644 index 0000000..7f468fa --- /dev/null +++ b/src/commands/nucleus/stats.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("stats") + .setDescription("Gets the bot's statse") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [nucleus/stats]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/nucleus/suggest.ts b/src/commands/nucleus/suggest.ts new file mode 100644 index 0000000..e76d49f --- /dev/null +++ b/src/commands/nucleus/suggest.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("suggest") + .setDescription("Sends a suggestion to the developers") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [nucleus/suggest]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/privacy.ts b/src/commands/privacy.ts new file mode 100644 index 0000000..dc97370 --- /dev/null +++ b/src/commands/privacy.ts @@ -0,0 +1,19 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = new SlashCommandBuilder() + .setName("privacy") + .setDescription("Shows info about Nucleus' privacy options") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [privacy]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/role/_meta.ts b/src/commands/role/_meta.ts new file mode 100644 index 0000000..408576f --- /dev/null +++ b/src/commands/role/_meta.ts @@ -0,0 +1,4 @@ +const name = "role"; +const description = "Change roles for users"; + +export { name, description }; \ No newline at end of file diff --git a/src/commands/role/all.ts b/src/commands/role/all.ts new file mode 100644 index 0000000..0f4c43f --- /dev/null +++ b/src/commands/role/all.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("all") + .setDescription("Gives or removes a role from everyone") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [role/all]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/role/user.ts b/src/commands/role/user.ts new file mode 100644 index 0000000..4229133 --- /dev/null +++ b/src/commands/role/user.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("user") + .setDescription("Gives or removes a role form someone") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [role/user]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/settings/_meta.ts b/src/commands/settings/_meta.ts new file mode 100644 index 0000000..63d726e --- /dev/null +++ b/src/commands/settings/_meta.ts @@ -0,0 +1,4 @@ +const name = "settings"; +const description = "Change bot settings"; + +export { name, description }; \ No newline at end of file diff --git a/src/commands/settings/all.ts b/src/commands/settings/all.ts new file mode 100644 index 0000000..0f17545 --- /dev/null +++ b/src/commands/settings/all.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("all") + .setDescription("Shows a full UI of all settings") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [settings/all]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/settings/automation.ts b/src/commands/settings/automation.ts new file mode 100644 index 0000000..3874f7f --- /dev/null +++ b/src/commands/settings/automation.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("automation") + .setDescription("Shows all automation options") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [settings/automation]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/settings/log/_meta.ts b/src/commands/settings/log/_meta.ts new file mode 100644 index 0000000..15a6fd4 --- /dev/null +++ b/src/commands/settings/log/_meta.ts @@ -0,0 +1,4 @@ +const name = "log"; +const description = "Settings for logging"; + +export { name, description }; \ No newline at end of file diff --git a/src/commands/settings/log/channel.ts b/src/commands/settings/log/channel.ts new file mode 100644 index 0000000..af570a7 --- /dev/null +++ b/src/commands/settings/log/channel.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("channel") + .setDescription("Sets the log channel") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [settings/log/channel]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/settings/log/events.ts b/src/commands/settings/log/events.ts new file mode 100644 index 0000000..4f4c9bd --- /dev/null +++ b/src/commands/settings/log/events.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("events") + .setDescription("Sets what events should be logged") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [settings/log/events]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/settings/log/ignore.ts b/src/commands/settings/log/ignore.ts new file mode 100644 index 0000000..eea7048 --- /dev/null +++ b/src/commands/settings/log/ignore.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("ignore") + .setDescription("Sets which users, channels and roles should be ignored") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [settings/log/ignore]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/settings/log/ignored.ts b/src/commands/settings/log/ignored.ts new file mode 100644 index 0000000..df5f7b6 --- /dev/null +++ b/src/commands/settings/log/ignored.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("ignored") + .setDescription("Gets the ignored users, channels and roles") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [settings/log/ignored]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/settings/mod/_meta.ts b/src/commands/settings/mod/_meta.ts new file mode 100644 index 0000000..713bb48 --- /dev/null +++ b/src/commands/settings/mod/_meta.ts @@ -0,0 +1,4 @@ +const name = "announcements"; +const description = "Settings for mod messages"; + +export { name, description }; \ No newline at end of file diff --git a/src/commands/settings/mod/channel.ts b/src/commands/settings/mod/channel.ts new file mode 100644 index 0000000..16230ba --- /dev/null +++ b/src/commands/settings/mod/channel.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("channel") + .setDescription("Sets the channel for staff messages to go to") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [settings/mod/channel]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/settings/mod/events.ts b/src/commands/settings/mod/events.ts new file mode 100644 index 0000000..3dc5e99 --- /dev/null +++ b/src/commands/settings/mod/events.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("events") + .setDescription("Sets which events mods should be notified about") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [settings/mod/events]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/settings/tickets.ts b/src/commands/settings/tickets.ts new file mode 100644 index 0000000..33e1586 --- /dev/null +++ b/src/commands/settings/tickets.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("tickets") + .setDescription("Shows settings for tickets") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [settings/tickets]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/settings/verify/_meta.ts b/src/commands/settings/verify/_meta.ts new file mode 100644 index 0000000..999c50b --- /dev/null +++ b/src/commands/settings/verify/_meta.ts @@ -0,0 +1,4 @@ +const name = "verify"; +const description = "Settings for verification"; + +export { name, description }; \ No newline at end of file diff --git a/src/commands/settings/verify/channel.ts b/src/commands/settings/verify/channel.ts new file mode 100644 index 0000000..ad881c2 --- /dev/null +++ b/src/commands/settings/verify/channel.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("channel") + .setDescription("Sets the verify channel") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [settings/verify/channel]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/settings/verify/role.ts b/src/commands/settings/verify/role.ts new file mode 100644 index 0000000..3082c71 --- /dev/null +++ b/src/commands/settings/verify/role.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("role") + .setDescription("Sets the role given after verifying") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [settings/verify/role]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/tag.ts b/src/commands/tag.ts new file mode 100644 index 0000000..9a10f5a --- /dev/null +++ b/src/commands/tag.ts @@ -0,0 +1,19 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = new SlashCommandBuilder() + .setName("tag") + .setDescription("Get and manage the servers tags") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [tag]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/ticket/_meta.ts b/src/commands/ticket/_meta.ts new file mode 100644 index 0000000..8c21466 --- /dev/null +++ b/src/commands/ticket/_meta.ts @@ -0,0 +1,4 @@ +const name = "ticket"; +const description = "Manage modmail tickets"; + +export { name, description }; \ No newline at end of file diff --git a/src/commands/ticket/close.ts b/src/commands/ticket/close.ts new file mode 100644 index 0000000..1e0856d --- /dev/null +++ b/src/commands/ticket/close.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("close") + .setDescription("Closes a ticket") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [ticket/close]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/ticket/create.ts b/src/commands/ticket/create.ts new file mode 100644 index 0000000..6f45cc2 --- /dev/null +++ b/src/commands/ticket/create.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("create") + .setDescription("Creates a new modmail ticket") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [ticket/create]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/ticket/delete.ts b/src/commands/ticket/delete.ts new file mode 100644 index 0000000..587ecf4 --- /dev/null +++ b/src/commands/ticket/delete.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("delete") + .setDescription("Deletes a ticket") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [ticket/delete]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/user/_meta.ts b/src/commands/user/_meta.ts new file mode 100644 index 0000000..6c14052 --- /dev/null +++ b/src/commands/user/_meta.ts @@ -0,0 +1,4 @@ +const name = "user"; +const description = "Commands for user info"; + +export { name, description }; \ No newline at end of file diff --git a/src/commands/user/about.ts b/src/commands/user/about.ts new file mode 100644 index 0000000..9015c13 --- /dev/null +++ b/src/commands/user/about.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("about") + .setDescription("Shows info about a user") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [user/about]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/user/avatar.ts b/src/commands/user/avatar.ts new file mode 100644 index 0000000..9e22d0c --- /dev/null +++ b/src/commands/user/avatar.ts @@ -0,0 +1,20 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = (builder: SlashCommandSubcommandBuilder) => + builder + .setName("avatar") + .setDescription("Shows a users avatar") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [user/avatar]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/commands/verify.ts b/src/commands/verify.ts new file mode 100644 index 0000000..bb93dde --- /dev/null +++ b/src/commands/verify.ts @@ -0,0 +1,19 @@ +import { CommandInteraction } from "discord.js"; +import { SlashCommandBuilder } from "@discordjs/builders"; +import { WrappedCheck } from "jshaiku"; + +const command = new SlashCommandBuilder() + .setName("verify") + .setDescription("Get verified in the server") + +const callback = (interaction: CommandInteraction) => { + interaction.reply("Command incomplete [verify]"); +} + +const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => { + return true; +} + +export { command }; +export { callback }; +export { check }; \ No newline at end of file diff --git a/src/config/emojis.json b/src/config/emojis.json new file mode 100644 index 0000000..aecd6ef --- /dev/null +++ b/src/config/emojis.json @@ -0,0 +1,268 @@ +{ + "NUCLEUS": { + "INFO":{ + "HELP":"751751467014029322", + "ABOUT":"751762088346517504", + "COMMANDS": "751762088229339136", + "SUPPORT":"751762087780286495" + }, + "COMMANDS": { + "RAID":"777143043711172608", + "LOCK":"776848800995868682", + "IGNORE":"777520659270074389" + } + }, + + "ICONS": { + "LOADING": "a777130727925219358", + "ADD": "826823514904330251", + "REMOVE": "826823515268186152", + "OPP": { + "ADD":"837355918831124500", + "REMOVE":"837355918420869162" + }, + "CHANNEL": { + "TEXT":"752971441351426089", + "VOICE":"752971441586307091", + "STORE":"853668786925469706", + "ANNOUNCEMENT":"853668786493063169", + "STAGE":"853668786842763294" + } + }, + + "CONTROL": { + "TICK":"729064531107774534", + "CROSS":"729064530310594601", + "LEFT":"877471438263697459", + "RIGHT":"877471438532132874", + "PILL": { + "TICK":"753314339082993832", + "CROSS":"753314339389309100" + } + }, + + "STATUS":{ + "ONLINE":"729064530084102166", + "IDLE":"729064531577536582", + "DND":"729064531057311886", + "STREAMING":"729764055082074153", + "OFFLINE":"729064531271221289" + }, + + "CHANNEL": { + "TEXT": { + "CREATE":"729066924943737033", + "DELETE":"729064529211686922" + }, + "VOICE": { + "CREATE":"729064530830950530", + "DELETE":"729064530981683200" + }, + "STORE": { + "CREATE":"729064530709315715", + "DELETE":"729064530768035922" + }, + "CATEGORY": { + "CREATE":"787987508465238026", + "EDIT":"787987508565770300", + "DELETE":"787987508507967488" + }, + "PURGE":"729064530797133875", + "TITLEUPDATE":"729763053620691044", + "TOPICUPDATE":"729763053477953536", + "SLOWMODE": { + "ON":"777138171301068831", + "OFF":"777138171447869480" + }, + "NSFW": { + "ON":"729064531208175736", + "OFF":"729381430991388752" + } + }, + + "MEMBER": { + "JOIN":"729066519337762878", + "LEAVE":"729064531170558575", + "BOT": { + "JOIN":"729064528666689587", + "LEAVE":"729064528998039633" + }, + "KICK":"729263536785850458", + "BAN":"729263536643112991", + "UNBAN":"729263536840114216", + "NICKNAME":"729064531019694090" + }, + + "INVITE": { + "CREATE":"729064529274601482", + "DELETE":"729064531103580230" + }, + + "WEBHOOK": { + "CREATE":"752070251906203679", + "UPDATE":"752073772823216191", + "DELETE":"752070251948146768" + }, + + "MESSAGE": { + "EDIT":"729065958584614925", + "DELETE":"729064530432360461", + "PIN":"729064530755190894", + "REACTION":{ + "ADD":"", + "REMOVE":"", + "CLEAR":"729064531468353606" + }, + "PING": { + "MASS":"729620608408879124", + "EVERYONE":"729064531073957909", + "ROLE":"729263536915742770" + } + }, + + "PUNISH": { + "WARN":"729764054897524768", + "KICK":"729764053794422896", + "BAN":"729764053861400637", + "MUTE":"729764053865463840", + "SOFTBAN":"729764053941223476", + "VOICEMUTE":"729764054855450697", + "CLEARHISTORY":"729764062270980096" + }, + + "BADGES": { + "NUCLEUSDEVELOPER":"775783766147858534", + "CLICKSDEVELOPER":"776140126156881950", + "HYPESQUAD": { + "BRILLIANCE":"775783766152577095", + "BRAVERY":"775783765930016789", + "BALANCE":"775783766303440937", + "EVENTS":"775783766194126908" + }, + "EARLYSUPPORTER":"775783766055452693", + "BUGHUNTER":[null, "775783766252847154", "775783766130950234"], + "BOOSTER":"775783766131605545", + "PARTNER":"775783766178005033", + "STAFF":"775783766383788082", + "VERIFIEDBOTDEVELOPER":"775783766425600060", + "NITRO":"776149266775146546", + "BOT":"776375959108190239" + }, + + "VOICE": { + "CONNECT":"784785219391193138", + "CHANGE":"784785219353968670", + "LEAVE":"784785219432480808", + "MUTE":"784785219613360149", + "UNMUTE":"784785219441524766", + "DEAFEN":"784785219424747550", + "UNDEAFEN":"784785219324346378", + "STREAM": { + "START":"853519659775819787", + "STOP":"853519660116213780" + }, + "VIDEO": { + "START":"853519659945295873", + "STOP":"853519660116738078" + } + }, + + "GUILD": { + "EMOJIS":"729066518549233795", + "GRAPHS":"752214059159650396", + "SETTINGS":"752570111063228507", + "ICONCHANGE":"729763053612302356", + "MODERATIONUPDATE":"729763053352124529", + "MODMAIL": { + "OPEN":"853245836331188264", + "CLOSE":"853580122506133505", + "ARCHIVE":"853580122636025856" + }, + "ROLES": { + "CREATE":"729064530763579413", + "DELETE":"729064530885476392", + "EDIT":"776109664793919489", + "MEMBERS": "752570111281594509", + "MESSAGES": "752570111373606942", + "VOICE": "752570111088525354" + } + }, + + "MOD": { + "IMAGES": { + "SWEARING":"730438422627614810", + "INVISIBLE":"730438422690398238", + "TOOBIG":"730438422921084998", + "TOOSMALL":"730438422921216150" + }, + "SWEARING":"730438422816096377", + "SPAM":"730438422853845042" + }, + + "NUMBERS": [ + { + "NORMAL": "753259024404840529", + "GREEN": "753312608378945648", + "RED": "753312608890650664" + }, + { + "NORMAL": "753259025990418515", + "GREEN": "753312608550912112", + "RED": "753312609075462246" + }, + { + "NORMAL": "753259024409034896", + "GREEN": "753312608513294366", + "RED": "753312608680935446" + }, + { + "NORMAL": "753259024358703205", + "GREEN": "753312608815284426", + "RED": "753312609377320966" + }, + { + "NORMAL": "753259024555835513", + "GREEN": "753312608735461457", + "RED": "753312609255686223" + }, + { + "NORMAL": "753259024744579283", + "GREEN": "753312608630604017", + "RED": "753312609138376777" + }, + { + "NORMAL": "753259024354639994", + "GREEN": "753312608656031806", + "RED": "753312609465270412" + }, + { + "NORMAL": "753259024530800661", + "GREEN": "753312608718815322", + "RED": "753312609104822313" + }, + { + "NORMAL": "753259024895574037", + "GREEN": "753312608790249646", + "RED": "753312609477984319" + }, + { + "NORMAL": "753259024681533553", + "GREEN": "753312608899170365", + "RED": "753312609557545089" + } + ], + + "BOTS": { + "GPS":"878919163937185803", + "NUCLEUS":"878919163597439016", + "CLICKSFORMS":"878919163337388073", + "CASTAWAY":"878919164255944726", + "CMPING":"878919164125929502", + "HOOKY":"878919164121731082" + }, + + "CFSERVICE": { + "VERIFIED":"881984571242053642", + "UNVERIFIED":"881984571258847232" + } +} \ No newline at end of file diff --git a/src/config/main.json b/src/config/main.json new file mode 100644 index 0000000..14a32a7 --- /dev/null +++ b/src/config/main.json @@ -0,0 +1,11 @@ +{ + "token": "your-token-here", + "developmentToken": "Nzc5Mzg4ODU2NTM2NTMwOTg0.X7f0bw.yzZg659UsLtHTfmeTsDXZa7O8K8", + "managementGuildID": "your-management-guild-id-here", + "developmentGuildID": "864185037078790195", + "enableDevelopment": true, + "owners": [ + "317731855317336067", + "438733159748599813" + ] +} \ No newline at end of file diff --git a/src/utils/confirmationMessage.ts b/src/utils/confirmationMessage.ts new file mode 100644 index 0000000..2b769bb --- /dev/null +++ b/src/utils/confirmationMessage.ts @@ -0,0 +1,60 @@ +import Discord, { CommandInteraction, MessageActionRow, Message } from "discord.js"; +import EmojiEmbed from "./generateEmojiEmbed.js" + +class confirmationMessage { + interaction: CommandInteraction; + title: string; + emoji: string; + description: string; + color: string; + + constructor(interaction: CommandInteraction) { + this.interaction = interaction; + + this.title = ""; + this.emoji = ""; + this.description = ""; + this.color = ""; + } + + setTitle(title: string) { this.title = title; return this } + setEmoji(emoji: string) { this.emoji = emoji; return this } + setDescription(description: string) { this.description = description; return this } + setColor(color: string) { this.color = color; return this } + + async send() { + let m = await this.interaction.reply({ + embeds: [ + new EmojiEmbed() + .setEmoji(this.emoji) + .setTitle(this.title) + .setDescription(this.description) + .setStatus(this.color) + ], + components: [ + new MessageActionRow().addComponents([ + new Discord.MessageButton() + .setCustomId("yes") + .setLabel("Yes") + .setStyle("SUCCESS"), + new Discord.MessageButton() + .setCustomId("no") + .setLabel("Cancel") // TODO: + .setStyle("DANGER") + ]) + ], + ephemeral: true, + fetchReply: true + }) + let component; + try { + component = await (m as Message).awaitMessageComponent({filter: (m) => m.user.id === this.interaction.user.id, time: 2.5 * 60 * 1000}); + } catch (e) { + return false; // TODO: Check the type of the error; change the error message here + } + + return component.customId === "yes" + } +} + +export default confirmationMessage; \ No newline at end of file diff --git a/src/utils/generateEmojiEmbed.ts b/src/utils/generateEmojiEmbed.ts new file mode 100644 index 0000000..8fe594b --- /dev/null +++ b/src/utils/generateEmojiEmbed.ts @@ -0,0 +1,29 @@ +import Discord, { CommandInteraction, ColorResolvable, MessageEmbed } from "discord.js"; +import getEmojiByName from "./getEmojiByName.js"; + +const colors = { + "Danger": 0xF27878, + "Warning": 0xF2D478, + "Success": 0x68D49E +} + +class EmojiEmbed extends MessageEmbed { + _title: string; + _emoji: string; + + // @ts-ignore + // This *is* meant to be an accessor rather than a property + get title() { + return `${getEmojiByName(this._emoji)} ${this._title}`; + } + + set title(title: string) { + this._title = title; + } + + setTitle(title: string) { this._title = title; return this } + setEmoji(emoji: string) { this._emoji = emoji; return this } + setStatus(color: string) { this.setColor(colors[color]); return this } +} + +export default EmojiEmbed; \ No newline at end of file diff --git a/src/utils/generateKeyValueList.ts b/src/utils/generateKeyValueList.ts new file mode 100644 index 0000000..7f77bef --- /dev/null +++ b/src/utils/generateKeyValueList.ts @@ -0,0 +1,14 @@ +function capitalize(s) +{ + return s[0].toUpperCase() + s.slice(1); +} + +function keyValueList(data) { + let out = ""; + Object.entries(data).map(([key, value]) => { + out += `**${capitalize(key)}:** ${value}\n` + }) + return out; +} + +export default keyValueList; \ No newline at end of file diff --git a/src/utils/getEmojiByName.ts b/src/utils/getEmojiByName.ts new file mode 100644 index 0000000..64c7ede --- /dev/null +++ b/src/utils/getEmojiByName.ts @@ -0,0 +1,12 @@ +import emojis from '../config/emojis.json' assert {type: 'json'}; + +function getEmojiByName(name: string): string { + let split = name.split("."); + let id = emojis + split.forEach(part => { + id = id[part]; + }); + return `<:a:${id}>`; +} + +export default getEmojiByName;