Fixed welcome
diff --git a/src/commands/settings/logs/_meta.ts b/src/commands/settings/logs/_meta.ts
index 15a6fd4..f46987f 100644
--- a/src/commands/settings/logs/_meta.ts
+++ b/src/commands/settings/logs/_meta.ts
@@ -1,4 +1,4 @@
-const name = "log";
+const name = "logs";
const description = "Settings for logging";
export { name, description };
\ No newline at end of file
diff --git a/src/commands/settings/logs/events.ts b/src/commands/settings/logs/events.ts
index dac200c..ef303cb 100644
--- a/src/commands/settings/logs/events.ts
+++ b/src/commands/settings/logs/events.ts
@@ -1,17 +1,106 @@
-import { CommandInteraction } from "discord.js";
+import { LoadingEmbed } from './../../../utils/defaultEmbeds.js';
+import Discord, { CommandInteraction, MessageActionRow, MessageButton, MessageSelectMenu } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
+import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
+import client from '../../../utils/client.js';
+import { toHexArray, toHexInteger } from "../../../utils/calculate.js";
+
+
+const logs = {
+ "channelUpdate": "Channels created, deleted or modified",
+ "emojiUpdate": "Server emojis modified",
+ "stickerUpdate": "Server stickers modified",
+ "guildUpdate": "Server settings updated",
+ "guildMemberUpdate": "Member updated (i.e. nickname)",
+ "guildMemberPunish": "Members punished (i.e. muted, banned, kicked)",
+ "guildRoleUpdate": "Role settings changed",
+ "guildInviteUpdate": "Server invite created or deleted",
+ "messageUpdate": "Message edited",
+ "messageDelete": "Message deleted",
+ "messageDeleteBulk": "Messages purged",
+ "messageReactionUpdate": "Message reactions cleared",
+ "messageMassPing": "Message pings multiple members at once",
+ "messageAnnounce": "Message published in announcement channel",
+ "threadUpdate": "Thread created or deleted",
+ "webhookUpdate": "Webhooks created or deleted",
+ "guildMemberVerify": "Member runs verify",
+ "autoModeratorDeleted": "Messages auto deleted by Nucleus",
+ "nucleusSettingsUpdated": "Nucleus' settings updated by a moderator",
+ "ticketUpdate": "Tickets created or deleted",
+}
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
.setName("events")
.setDescription("Sets what events should be logged")
-const callback = (interaction: CommandInteraction) => {
- interaction.reply("This command is not yet finished [settings/log/events]");
+const callback = async (interaction: CommandInteraction): Promise<any> => {
+ await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true});
+ let m;
+ while (true) {
+ let config = await client.database.guilds.read(interaction.guild.id)
+ let converted = toHexArray(config.logging.logs.toLog)
+ m = await interaction.editReply({embeds: [new EmojiEmbed()
+ .setTitle("Logging Events")
+ .setDescription("Below are the events being logged in the server. You can toggle them on and off in the dropdown")
+ .setStatus("Success")
+ .setEmoji("CHANNEL.TEXT.CREATE")
+ ], components: [
+ new MessageActionRow().addComponents([new MessageSelectMenu()
+ .setPlaceholder("Set events to log")
+ .setMaxValues(Object.keys(logs).length)
+ .setCustomId("logs")
+ .setMinValues(0)
+ .setOptions(Object.keys(logs).map((e, i) => ({
+ label: logs[e],
+ value: i.toString(),
+ default: converted.includes(e)
+ })))
+ ]),
+ new MessageActionRow().addComponents([
+ new MessageButton()
+ .setLabel("Select all")
+ .setStyle("PRIMARY")
+ .setCustomId("all"),
+ new MessageButton()
+ .setLabel("Select none")
+ .setStyle("DANGER")
+ .setCustomId("none")
+ ])
+ ]})
+ let i;
+ try {
+ i = await m.awaitMessageComponent({ time: 300000 });
+ } catch (e) {
+ break
+ }
+ i.deferUpdate()
+ if (i.customId === "logs") {
+ let selected = i.values;
+ let newLogs = toHexInteger(selected.map(e => Object.keys(logs)[parseInt(e)]))
+ await client.database.guilds.write(interaction.guild.id, {"logging.logs.toLog": newLogs})
+ } else if (i.customId === "all") {
+ let newLogs = toHexInteger(Object.keys(logs).map(e => e))
+ await client.database.guilds.write(interaction.guild.id, {"logging.logs.toLog": newLogs})
+ } else if (i.customId === "none") {
+ await client.database.guilds.write(interaction.guild.id, {"logging.logs.toLog": 0})
+ } else {
+ break
+ }
+ }
+ m = await interaction.editReply({embeds: [new EmojiEmbed()
+ .setTitle("Logging Events")
+ .setDescription("Below are the events being logged in the server. You can toggle them on and off in the dropdown")
+ .setFooter({text: "Message timed out"})
+ .setStatus("Success")
+ .setEmoji("CHANNEL.TEXT.CREATE")
+ ]})
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
+ let member = (interaction.member as Discord.GuildMember)
+ if (!member.permissions.has("MANAGE_GUILD")) throw "You must have the *Manage Server* permission to use this command"
return true;
}