i have not committed in years
diff --git a/src/commands/mod/ban.ts b/src/commands/mod/ban.ts
index 92ed3a7..e94035e 100644
--- a/src/commands/mod/ban.ts
+++ b/src/commands/mod/ban.ts
@@ -1,9 +1,10 @@
-import { CommandInteraction, GuildMember } from "discord.js";
+import { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
import confirmationMessage from "../../utils/confirmationMessage.js";
-import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
+import generateEmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
+import readConfig from '../../utils/readConfig.js'
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
@@ -18,7 +19,7 @@
const callback = async (interaction: CommandInteraction) => {
// TODO:[Modals] Replace this with a modal
- if (await new confirmationMessage(interaction)
+ let confirmation = await new confirmationMessage(interaction)
.setEmoji("PUNISH.BAN.RED")
.setTitle("Ban")
.setDescription(keyValueList({
@@ -31,19 +32,26 @@
.setColor("Danger")
// pluralize("day", interaction.options.getInteger("delete"))
// const pluralize = (word: string, count: number) => { return count === 1 ? word : word + "s" }
- .send()) {
+ .send()
+ if (confirmation.success) {
let dmd = false
let dm;
+ let config = await readConfig(interaction.guild.id);
try {
if (interaction.options.getString("notify") != "no") {
dm = await (interaction.options.getMember("user") as GuildMember).send({
- embeds: [new EmojiEmbed()
+ embeds: [new generateEmojiEmbed()
.setEmoji("PUNISH.BAN.RED")
.setTitle("Banned")
.setDescription(`You have been banned in ${interaction.guild.name}` +
(interaction.options.getString("reason") ? ` for:\n> ${interaction.options.getString("reason")}` : "."))
.setStatus("Danger")
- ]
+ ],
+ components: [new MessageActionRow().addComponents(config.moderation.ban.text ? [new MessageButton()
+ .setStyle("LINK")
+ .setLabel(config.moderation.ban.text)
+ .setURL(config.moderation.ban.link)
+ ] : [])]
})
dmd = true
}
@@ -54,7 +62,7 @@
reason: interaction.options.getString("reason") ?? "No reason provided"
})
} catch {
- await interaction.editReply({embeds: [new EmojiEmbed()
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji("PUNISH.BAN.RED")
.setTitle(`Ban`)
.setDescription("Something went wrong and the user was not banned")
@@ -64,14 +72,14 @@
return
}
let failed = (dmd == false && interaction.options.getString("notify") != "no")
- await interaction.editReply({embeds: [new EmojiEmbed()
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji(`PUNISH.BAN.${failed ? "YELLOW" : "GREEN"}`)
.setTitle(`Ban`)
.setDescription("The member was banned" + (failed ? ", but could not be notified" : ""))
.setStatus(failed ? "Warning" : "Success")
], components: []})
} else {
- await interaction.editReply({embeds: [new EmojiEmbed()
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji("PUNISH.BAN.GREEN")
.setTitle(`Ban`)
.setDescription("No changes were made")
diff --git a/src/commands/mod/kick.ts b/src/commands/mod/kick.ts
index 08beaa5..34a1571 100644
--- a/src/commands/mod/kick.ts
+++ b/src/commands/mod/kick.ts
@@ -1,9 +1,10 @@
-import { CommandInteraction, GuildMember } from "discord.js";
+import { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
import confirmationMessage from "../../utils/confirmationMessage.js";
-import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
+import generateEmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
+import readConfig from '../../utils/readConfig.js'
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
@@ -17,7 +18,7 @@
const callback = async (interaction: CommandInteraction) => {
// TODO:[Modals] Replace this with a modal
- if (await new confirmationMessage(interaction)
+ let confirmation = await new confirmationMessage(interaction)
.setEmoji("PUNISH.KICK.RED")
.setTitle("Kick")
.setDescription(keyValueList({
@@ -29,19 +30,26 @@
.setColor("Danger")
// pluralize("day", interaction.options.getInteger("delete"))
// const pluralize = (word: string, count: number) => { return count === 1 ? word : word + "s" }
- .send()) {
+ .send()
+ if (confirmation.success) {
let dmd = false
let dm;
+ let config = await readConfig(interaction.guild.id);
try {
if (interaction.options.getString("notify") != "no") {
dm = await (interaction.options.getMember("user") as GuildMember).send({
- embeds: [new EmojiEmbed()
+ embeds: [new generateEmojiEmbed()
.setEmoji("PUNISH.KICK.RED")
.setTitle("Kicked")
.setDescription(`You have been kicked in ${interaction.guild.name}` +
(interaction.options.getString("reason") ? ` for:\n> ${interaction.options.getString("reason")}` : "."))
.setStatus("Danger")
- ]
+ ],
+ components: [new MessageActionRow().addComponents(config.moderation.kick.text ? [new MessageButton()
+ .setStyle("LINK")
+ .setLabel(config.moderation.kick.text)
+ .setURL(config.moderation.kick.link)
+ ] : [])]
})
dmd = true
}
@@ -49,7 +57,7 @@
try {
(interaction.options.getMember("user") as GuildMember).kick(interaction.options.getString("reason") ?? "No reason provided.")
} catch {
- await interaction.editReply({embeds: [new EmojiEmbed()
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji("PUNISH.KICK.RED")
.setTitle(`Kick`)
.setDescription("Something went wrong and the user was not kicked")
@@ -59,14 +67,14 @@
return
}
let failed = (dmd == false && interaction.options.getString("notify") != "no")
- await interaction.editReply({embeds: [new EmojiEmbed()
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji(`PUNISH.KICK.${failed ? "YELLOW" : "GREEN"}`)
.setTitle(`Kick`)
.setDescription("The member was kicked" + (failed ? ", but could not be notified" : ""))
.setStatus(failed ? "Warning" : "Success")
], components: []})
} else {
- await interaction.editReply({embeds: [new EmojiEmbed()
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji("PUNISH.KICK.GREEN")
.setTitle(`Kick`)
.setDescription("No changes were made")
diff --git a/src/commands/mod/lock.ts b/src/commands/mod/lock.ts
index dbc7b6c..9199cd4 100644
--- a/src/commands/mod/lock.ts
+++ b/src/commands/mod/lock.ts
@@ -8,7 +8,7 @@
.setDescription("Manages a lock on a channel")
const callback = (interaction: CommandInteraction) => {
- interaction.reply("Command incomplete [mod/lock]");
+ interaction.reply("This command is not yet finished [mod/lock]");
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/mod/mute.ts b/src/commands/mod/mute.ts
index 02d2531..165d906 100644
--- a/src/commands/mod/mute.ts
+++ b/src/commands/mod/mute.ts
@@ -1,11 +1,13 @@
-import Discord, { CommandInteraction, GuildMember, MessageActionRow } from "discord.js";
+import Discord, { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
-import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
+import generateEmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import keyValueList from "../../utils/generateKeyValueList.js";
import humanizeDuration from "humanize-duration";
+import { create, areTicketsEnabled } from "../../automations/createModActionTicket.js";
+import readConfig from "../../utils/readConfig.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
@@ -17,11 +19,13 @@
.addIntegerOption(option => option.setName("minutes").setDescription("The number of minutes to mute the user for | Default 0").setMinValue(0).setMaxValue(59).setRequired(false))
.addIntegerOption(option => option.setName("seconds").setDescription("The number of seconds to mute the user for | Default 0").setMinValue(0).setMaxValue(59).setRequired(false))
.addStringOption(option => option.setName("reason").setDescription("The reason for the mute").setRequired(false))
- .addStringOption(option => option.setName("notify").setDescription("If the user should get a message when they are kicked | Default yes").setRequired(false)
+ .addStringOption(option => option.setName("notify").setDescription("If the user should get a message when they are muted | Default yes").setRequired(false)
.addChoices([["Yes", "yes"], ["No", "no"]]))
// TODO: notify the user when the mute is lifted
const callback = async (interaction: CommandInteraction) => {
+ // @ts-ignore
+ const { log, NucleusColors, renderUser, entry } = interaction.client.logger
const user = interaction.options.getMember("user") as GuildMember
const reason = interaction.options.getString("reason")
const time = {
@@ -33,7 +37,7 @@
let muteTime = (time.days * 24 * 60 * 60) + (time.hours * 60 * 60) + (time.minutes * 60) + time.seconds
if (muteTime == 0) {
let m = await interaction.reply({embeds: [
- new EmojiEmbed()
+ new generateEmojiEmbed()
.setEmoji("PUNISH.MUTE.GREEN")
.setTitle("Mute")
.setDescription("How long should the user be muted")
@@ -88,7 +92,7 @@
component = await (m as Discord.Message).awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 2.5 * 60 * 1000});
} catch { return }
component.deferUpdate();
- if (component.customId == "cancel") return interaction.editReply({embeds: [new EmojiEmbed()
+ if (component.customId == "cancel") return interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji("PUNISH.MUTE.RED")
.setTitle("Mute")
.setDescription("Mute cancelled")
@@ -106,7 +110,7 @@
}
} else {
await interaction.reply({embeds: [
- new EmojiEmbed()
+ new generateEmojiEmbed()
.setEmoji("PUNISH.MUTE.GREEN")
.setTitle("Mute")
.setDescription("Loading...")
@@ -114,7 +118,7 @@
], ephemeral: true, fetchReply: true})
}
// TODO:[Modals] Replace this with a modal
- if (await new confirmationMessage(interaction)
+ let confirmation = await new confirmationMessage(interaction)
.setEmoji("PUNISH.MUTE.RED")
.setTitle("Mute")
.setDescription(keyValueList({
@@ -127,20 +131,27 @@
.setColor("Danger")
// pluralize("day", interaction.options.getInteger("delete"))
// const pluralize = (word: string, count: number) => { return count === 1 ? word : word + "s" }
- .send(true)) {
+ .send(true)
+ if (confirmation.success) {
let dmd = false
let dm;
+ let config = await readConfig(interaction.guild.id);
try {
if (interaction.options.getString("notify") != "no") {
dm = await (interaction.options.getMember("user") as GuildMember).send({
- embeds: [new EmojiEmbed()
+ embeds: [new generateEmojiEmbed()
.setEmoji("PUNISH.MUTE.RED")
.setTitle("Muted")
.setDescription(`You have been muted in ${interaction.guild.name}` +
(interaction.options.getString("reason") ? ` for:\n> ${interaction.options.getString("reason")}` : ".\n\n" +
`You will be unmuted at: <t:${Math.round((new Date).getTime() / 1000) + muteTime}:D> at <t:${Math.round((new Date).getTime() / 1000) + muteTime}:T> (<t:${Math.round((new Date).getTime() / 1000) + muteTime}:R>)`))
.setStatus("Danger")
- ]
+ ],
+ components: [new MessageActionRow().addComponents(config.moderation.mute.text ? [new MessageButton()
+ .setStyle("LINK")
+ .setLabel(config.moderation.mute.text)
+ .setURL(config.moderation.mute.link)
+ ] : [])]
})
dmd = true
}
@@ -148,24 +159,44 @@
try {
(interaction.options.getMember("user") as GuildMember).timeout(muteTime * 1000, interaction.options.getString("reason") || "No reason provided")
} catch {
- await interaction.editReply({embeds: [new EmojiEmbed()
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji("PUNISH.MUTE.RED")
.setTitle(`Mute`)
- .setDescription("Something went wrong and the user was not kicked")
+ .setDescription("Something went wrong and the user was not mute")
.setStatus("Danger")
], components: []})
if (dmd) await dm.delete()
return
}
let failed = (dmd == false && interaction.options.getString("notify") != "no")
- await interaction.editReply({embeds: [new EmojiEmbed()
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji(`PUNISH.MUTE.${failed ? "YELLOW" : "GREEN"}`)
.setTitle(`Mute`)
.setDescription("The member was muted" + (failed ? ", but could not be notified" : ""))
.setStatus(failed ? "Warning" : "Success")
], components: []})
+ let data = {
+ meta:{
+ type: 'memberMute',
+ displayName: 'Member Muted',
+ calculateType: 'guildMemberPunish',
+ color: NucleusColors.yellow,
+ emoji: 'PUNISH.WARN.YELLOW',
+ timestamp: new Date().getTime()
+ },
+ list: {
+ user: entry((interaction.options.getMember("user") as GuildMember).user.id, renderUser((interaction.options.getMember("user") as GuildMember).user)),
+ mutedBy: entry(interaction.member.user.id, renderUser(interaction.member.user)),
+ time: entry(muteTime, `${humanizeDuration(muteTime * 1000, {round: true})}`),
+ reason: (interaction.options.getString("reason") ? `\n> ${interaction.options.getString("reason")}` : "No reason provided")
+ },
+ hidden: {
+ guild: interaction.guild.id
+ }
+ }
+ log(data, interaction.client);
} else {
- await interaction.editReply({embeds: [new EmojiEmbed()
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji("PUNISH.MUTE.GREEN")
.setTitle(`Mute`)
.setDescription("No changes were made")
diff --git a/src/commands/mod/nick.ts b/src/commands/mod/nick.ts
index d23751c..9584055 100644
--- a/src/commands/mod/nick.ts
+++ b/src/commands/mod/nick.ts
@@ -1,25 +1,108 @@
-import { CommandInteraction, GuildMember } from "discord.js";
+import { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
import confirmationMessage from "../../utils/confirmationMessage.js";
-import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
+import generateEmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
+import readConfig from '../../utils/readConfig.js';
+import { create, areTicketsEnabled } from "../../automations/createModActionTicket.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
.setName("nick")
.setDescription("Changes a users nickname")
.addUserOption(option => option.setName("user").setDescription("The user to change").setRequired(true))
- .addStringOption(option => option.setName("name").setDescription("The name to set").setRequired(false))
+ .addStringOption(option => option.setName("name").setDescription("The name to set | Leave blank to clear").setRequired(false))
.addStringOption(option => option.setName("notify").setDescription("If the user should get a message when their nickname is changed | Default no").setRequired(false)
.addChoices([["Yes", "yes"], ["No", "no"]])
)
const callback = async (interaction: CommandInteraction) => {
+ // TODO:[Modals] Replace this with a modal
+ let confirmation = await new confirmationMessage(interaction)
+ .setEmoji("PUNISH.NICKNAME.RED")
+ .setTitle("Nickname")
+ .setDescription(keyValueList({
+ "user": `<@!${(interaction.options.getMember("user") as GuildMember).id}> (${(interaction.options.getMember("user") as GuildMember).user.username})`,
+ "new nickname": `${interaction.options.getString("name") ? interaction.options.getString("name") : "*No nickname*"}`
+ })
+ + `The user **will${interaction.options.getString("notify") == "yes" ? '' : ' not'}** be notified\n\n`
+ + `Are you sure you want to ${interaction.options.getString("name") ? "change" : "clear"} <@!${(interaction.options.getMember("user") as GuildMember).id}>'s nickname?`)
+ .setColor("Danger")
+ .addCustomCallback(
+ "Create appeal ticket", !(await areTicketsEnabled(interaction.guild.id)),
+ () => { create(interaction.guild, interaction.options.getUser("user"), interaction.client)},
+ "An appeal ticket was created")
+// pluralize("day", interaction.options.getInteger("delete"))
+// const pluralize = (word: string, count: number) => { return count === 1 ? word : word + "s" }
+ .send()
+ if (confirmation.success) {
+ let dmd = false
+ let dm;
+ try {
+ if (interaction.options.getString("notify") == "yes") {
+ dm = await (interaction.options.getMember("user") as GuildMember).send({
+ embeds: [new generateEmojiEmbed()
+ .setEmoji("PUNISH.NICKNAME.RED")
+ .setTitle("Nickname changed")
+ .setDescription(`Your nickname was ${interaction.options.getString("name") ? "changed" : "cleared"} in ${interaction.guild.name}` +
+ (interaction.options.getString("name") ? ` it is now: ${interaction.options.getString("name")}` : ".") + "\n\n" +
+ (confirmation.buttonClicked ? `You can appeal this in this ticket: <#${confirmation.response}>` : ``))
+ .setStatus("Danger")
+ ]
+ })
+ dmd = true
+ }
+ } catch {}
+ try {
+ (interaction.options.getMember("user") as GuildMember).setNickname(interaction.options.getString("name") ?? null, "Nucleus Nickname command")
+ } catch {
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
+ .setEmoji("PUNISH.NICKNAME.RED")
+ .setTitle(`Nickname`)
+ .setDescription("Something went wrong and the users nickname could not be changed.")
+ .setStatus("Danger")
+ ], components: []})
+ if (dmd) await dm.delete()
+ return
+ }
+ let failed = (dmd == false && interaction.options.getString("notify") == "yes")
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
+ .setEmoji(`PUNISH.NICKNAME.${failed ? "YELLOW" : "GREEN"}`)
+ .setTitle(`Nickname`)
+ .setDescription("The members nickname was changed" + (failed ? ", but was not notified" : ""))
+ .setStatus(failed ? "Warning" : "Success")
+ ], components: []})
+ } else {
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
+ .setEmoji("PUNISH.NICKNAME.GREEN")
+ .setTitle(`Nickname`)
+ .setDescription("No changes were made")
+ .setStatus("Success")
+ ], components: []})
+ }
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
- return true;
+ let member = (interaction.member as GuildMember)
+ let me = (interaction.guild.me as GuildMember)
+ let apply = (interaction.options.getMember("user") as GuildMember)
+ if (member == null || me == null || apply == null) throw "That member is not in the server"
+ let memberPos = member.roles ? member.roles.highest.position : 0
+ let mePos = me.roles ? me.roles.highest.position : 0
+ let applyPos = apply.roles ? apply.roles.highest.position : 0
+ // Check if Nucleus can change the nickname
+ if (! (mePos > applyPos)) throw "I do not have a role higher than that member"
+ // Check if Nucleus has permission to change the nickname
+ if (! interaction.guild.me.permissions.has("MANAGE_NICKNAMES")) throw "I do not have the `manage_nicknames` permission";
+ // Allow the owner to change anyone's nickname
+ if ((interaction.member as GuildMember).id == interaction.guild.ownerId) return true
+ // Check if the user has manage_nicknames permission
+ if (! (interaction.member as GuildMember).permissions.has("MANAGE_NICKNAMES")) throw "You do not have the `manage_nicknames` permission";
+ // Check if the user is below on the role list
+ if (! (memberPos > applyPos)) throw "You do not have a role higher than that member"
+ // Allow change
+ return true
}
export { command, callback, check };
\ No newline at end of file
diff --git a/src/commands/mod/purge.ts b/src/commands/mod/purge.ts
index aa2f405..29c228f 100644
--- a/src/commands/mod/purge.ts
+++ b/src/commands/mod/purge.ts
@@ -2,9 +2,10 @@
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
import confirmationMessage from "../../utils/confirmationMessage.js";
-import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
+import generateEmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
+import { create, areTicketsEnabled } from "../../automations/createModActionTicket.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
@@ -16,23 +17,16 @@
.setRequired(false)
.setMinValue(1)
.setMaxValue(100))
- .addChannelOption(option => option.setName("channel").setDescription("The channel to purge messages from").setRequired(false))
.addUserOption(option => option.setName("user").setDescription("The user to purge messages from").setRequired(false))
.addStringOption(option => option.setName("reason").setDescription("The reason for the purge").setRequired(false))
const callback = async (interaction: CommandInteraction) => {
let user = interaction.options.getMember("user") as GuildMember ?? null
- let channel = (interaction.options.getChannel("channel") as GuildChannel) ?? interaction.channel
- let thischannel
- if ((interaction.options.getChannel("channel") as GuildChannel) == null) {
- thischannel = true
- } else {
- thischannel = (interaction.options.getChannel("channel") as GuildChannel).id == interaction.channel.id
- }
+ let channel = (interaction.channel as GuildChannel)
if (!(["GUILD_TEXT", "GUILD_NEWS", "GUILD_NEWS_THREAD", "GUILD_PUBLIC_THREAD", "GUILD_PRIVATE_THREAD"].includes(channel.type.toString()))) {
return await interaction.reply({
embeds: [
- new EmojiEmbed()
+ new generateEmojiEmbed()
.setEmoji("CHANNEL.PURGE.RED")
.setTitle("Purge")
.setDescription("You cannot purge this channel")
@@ -46,7 +40,7 @@
if ( !interaction.options.getInteger("amount") ) {
await interaction.reply({
embeds: [
- new EmojiEmbed()
+ new generateEmojiEmbed()
.setEmoji("CHANNEL.PURGE.RED")
.setTitle("Purge")
.setDescription("Select how many messages to delete")
@@ -60,7 +54,7 @@
while (true) {
let m = await interaction.editReply({
embeds: [
- new EmojiEmbed()
+ new generateEmojiEmbed()
.setEmoji("CHANNEL.PURGE.RED")
.setTitle("Purge")
.setDescription("Select how many messages to delete. You can continue clicking until all messages are cleared.")
@@ -119,12 +113,11 @@
}
messages = await (channel as TextChannel).bulkDelete(ms, true);
})
- deleted = deleted.concat(messages.map(m => m)) // TODO: .values doesnt work so using .map
- // TODO: Support for users
+ deleted = deleted.concat(messages.map(m => m))
}
if (deleted.length === 0) return await interaction.editReply({
embeds: [
- new EmojiEmbed()
+ new generateEmojiEmbed()
.setEmoji("CHANNEL.PURGE.RED")
.setTitle("Purge")
.setDescription("No messages were deleted")
@@ -147,7 +140,7 @@
description: "Purge log"
}
} catch {}
- let m = await interaction.editReply({embeds: [new EmojiEmbed()
+ let m = await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji(`CHANNEL.PURGE.GREEN`)
.setTitle(`Purge`)
.setDescription("Messages cleared")
@@ -164,14 +157,14 @@
component = await (m as Discord.Message).awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 2.5 * 60 * 1000});
} catch {}
if (component && component.customId === "download") {
- interaction.editReply({embeds: [new EmojiEmbed()
+ interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji("CHANNEL.PURGE.GREEN")
.setTitle(`Purge`)
.setDescription("Uploaded")
.setStatus("Success")
], components: [], files: [attachmentObject]})
} else {
- interaction.editReply({embeds: [new EmojiEmbed()
+ interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji("CHANNEL.PURGE.GREEN")
.setTitle(`Purge`)
.setDescription("Messages cleared")
@@ -180,29 +173,31 @@
}
return
} else {
- if (await new confirmationMessage(interaction)
+ let confirmation = await new confirmationMessage(interaction)
.setEmoji("CHANNEL.PURGE.RED")
.setTitle("Purge")
.setDescription(keyValueList({
- "channel": `<#${channel.id}> (${(channel as GuildChannel).name})` + (thischannel ? " [This channel]" : ""),
+ "channel": `<#${channel.id}> (${(channel as GuildChannel).name})` + ("[This channel]"),
"amount": interaction.options.getInteger("amount").toString(),
"reason": `\n> ${interaction.options.getString("reason") ? interaction.options.getString("reason") : "*No reason provided*"}`
}))
.setColor("Danger")
// pluralize("day", interaction.options.getInteger("amount"))
// const pluralize = (word: string, count: number) => { return count === 1 ? word : word + "s" }
- .send()) {
+ .send()
+ if (confirmation.success) {
let messages;
try {
- (interaction.channel as TextChannel).messages.fetch({limit: interaction.options.getInteger("amount")}).then(async (ms) => {
- if (user) {
- ms = ms.filter(m => m.author.id === user.id)
- }
- messages = await (channel as TextChannel).bulkDelete(ms, true);
- }) // TODO: fix for purge amount by user, not just checking x
+ if (!user) {
+ let toDelete = await (interaction.channel as TextChannel).messages.fetch({limit: interaction.options.getInteger("amount")})
+ messages = await (channel as TextChannel).bulkDelete(toDelete, true);
+ } else {
+ let toDelete = (await (await (interaction.channel as TextChannel).messages.fetch({limit: 100}))
+ .filter(m => m.author.id === user.id)).first(interaction.options.getInteger("amount"))
+ messages = await (channel as TextChannel).bulkDelete(toDelete, true);
+ }
} catch(e) {
- console.log(e)
- await interaction.editReply({embeds: [new EmojiEmbed()
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji("CHANNEL.PURGE.RED")
.setTitle(`Purge`)
.setDescription("Something went wrong and no messages were deleted")
@@ -224,7 +219,7 @@
description: `Purge log`
}
} catch {}
- let m = await interaction.editReply({embeds: [new EmojiEmbed()
+ let m = await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji(`CHANNEL.PURGE.GREEN`)
.setTitle(`Purge`)
.setDescription("Messages cleared")
@@ -241,14 +236,14 @@
component = await (m as Discord.Message).awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 2.5 * 60 * 1000});
} catch {}
if (component && component.customId === "download") {
- interaction.editReply({embeds: [new EmojiEmbed()
+ interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji("CHANNEL.PURGE.GREEN")
.setTitle(`Purge`)
- .setDescription("Uploaded")
+ .setDescription("Transcript uploaded above")
.setStatus("Success")
], components: [], files: [attachmentObject]})
} else {
- interaction.editReply({embeds: [new EmojiEmbed()
+ interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji("CHANNEL.PURGE.GREEN")
.setTitle(`Purge`)
.setDescription("Messages cleared")
@@ -256,7 +251,7 @@
], components: []})
}
} else {
- await interaction.editReply({embeds: [new EmojiEmbed()
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji("CHANNEL.PURGE.GREEN")
.setTitle(`Purge`)
.setDescription("No changes were made")
diff --git a/src/commands/mod/slowmode.ts b/src/commands/mod/slowmode.ts
index 52ab1bd..8f6f323 100644
--- a/src/commands/mod/slowmode.ts
+++ b/src/commands/mod/slowmode.ts
@@ -8,7 +8,7 @@
.setDescription("Manages slowmode in a channel")
const callback = (interaction: CommandInteraction) => {
- interaction.reply("Command incomplete [mod/slowmode]");
+ interaction.reply("This command is not yet finished [mod/slowmode]");
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/mod/softban.ts b/src/commands/mod/softban.ts
index 233b7f2..44d425a 100644
--- a/src/commands/mod/softban.ts
+++ b/src/commands/mod/softban.ts
@@ -1,9 +1,10 @@
-import { CommandInteraction, GuildMember } from "discord.js";
+import { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
import confirmationMessage from "../../utils/confirmationMessage.js";
-import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
+import generateEmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
+import readConfig from '../../utils/readConfig.js'
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
@@ -11,14 +12,14 @@
.setDescription("Kicks a user and deletes their messages")
.addUserOption(option => option.setName("user").setDescription("The user to softban").setRequired(true))
.addStringOption(option => option.setName("reason").setDescription("The reason for the softban").setRequired(false))
- .addStringOption(option => option.setName("notify").setDescription("If the user should get a message when they are banbanned | Default yes").setRequired(false)
+ .addStringOption(option => option.setName("notify").setDescription("If the user should get a message when they are softbanned | 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)
+ let confirmation = await new confirmationMessage(interaction)
.setEmoji("PUNISH.BAN.RED")
.setTitle("Softban")
.setDescription(keyValueList({
@@ -31,18 +32,25 @@
.setColor("Danger")
// pluralize("day", interaction.options.getInteger("delete"))
// const pluralize = (word: string, count: number) => { return count === 1 ? word : word + "s" }
- .send()) {
- let dmd = false
+ .send()
+ if (confirmation.success) {
+ let dmd = false;
+ let config = await readConfig(interaction.guild.id);
try {
if (interaction.options.getString("notify") != "no") {
await (interaction.options.getMember("user") as GuildMember).send({
- embeds: [new EmojiEmbed()
+ embeds: [new generateEmojiEmbed()
.setEmoji("PUNISH.BAN.RED")
.setTitle("Softbanned")
.setDescription(`You have been softbanned from ${interaction.guild.name}` +
(interaction.options.getString("reason") ? ` for:\n> ${interaction.options.getString("reason")}` : "."))
.setStatus("Danger")
- ]
+ ],
+ components: [new MessageActionRow().addComponents(config.moderation.ban.text ? [new MessageButton()
+ .setStyle("LINK")
+ .setLabel(config.moderation.ban.text)
+ .setURL(config.moderation.ban.link)
+ ] : [])]
})
dmd = true
}
@@ -54,7 +62,7 @@
});
await interaction.guild.members.unban(interaction.options.getMember("user") as GuildMember, "Softban");
} catch {
- await interaction.editReply({embeds: [new EmojiEmbed()
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji("PUNISH.BAN.RED")
.setTitle(`Softban`)
.setDescription("Something went wrong and the user was not softbanned")
@@ -62,14 +70,14 @@
], components: []})
}
let failed = (dmd == false && interaction.options.getString("notify") != "no")
- await interaction.editReply({embeds: [new EmojiEmbed()
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji(`PUNISH.BAN.${failed ? "YELLOW" : "GREEN"}`)
.setTitle(`Softban`)
.setDescription("The member was softbanned" + (failed ? ", but could not be notified" : ""))
.setStatus(failed ? "Warning" : "Success")
], components: []})
} else {
- await interaction.editReply({embeds: [new EmojiEmbed()
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji("PUNISH.BAN.GREEN")
.setTitle(`Softban`)
.setDescription("No changes were made")
diff --git a/src/commands/mod/unban.ts b/src/commands/mod/unban.ts
index 6477bb3..3ffc001 100644
--- a/src/commands/mod/unban.ts
+++ b/src/commands/mod/unban.ts
@@ -8,7 +8,7 @@
.setDescription("Unbans a user")
const callback = (interaction: CommandInteraction) => {
- interaction.reply("Command incomplete [mod/unban]");
+ interaction.reply("This command is not yet finished [mod/unban]");
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/mod/unmute.ts b/src/commands/mod/unmute.ts
index 2c522a4..65e5e97 100644
--- a/src/commands/mod/unmute.ts
+++ b/src/commands/mod/unmute.ts
@@ -2,7 +2,7 @@
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
import confirmationMessage from "../../utils/confirmationMessage.js";
-import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
+import generateEmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
@@ -17,7 +17,7 @@
const callback = async (interaction: CommandInteraction) => {
// TODO:[Modals] Replace this with a modal
- if (await new confirmationMessage(interaction)
+ let confirmation = await new confirmationMessage(interaction)
.setEmoji("PUNISH.MUTE.RED")
.setTitle("Unmute")
.setDescription(keyValueList({
@@ -29,13 +29,14 @@
.setColor("Danger")
// pluralize("day", interaction.options.getInteger("delete"))
// const pluralize = (word: string, count: number) => { return count === 1 ? word : word + "s" }
- .send()) {
+ .send()
+ if (confirmation.success) {
let dmd = false
let dm;
try {
if (interaction.options.getString("notify") != "no") {
dm = await (interaction.options.getMember("user") as GuildMember).send({
- embeds: [new EmojiEmbed()
+ embeds: [new generateEmojiEmbed()
.setEmoji("PUNISH.MUTE.GREEN")
.setTitle("Unmuted")
.setDescription(`You have been unmuted in ${interaction.guild.name}` +
@@ -49,7 +50,7 @@
try {
(interaction.options.getMember("user") as GuildMember).timeout(0, interaction.options.getString("reason") || "No reason provided")
} catch {
- await interaction.editReply({embeds: [new EmojiEmbed()
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji("PUNISH.MUTE.RED")
.setTitle(`Unmute`)
.setDescription("Something went wrong and the user was not unmuted")
@@ -59,14 +60,14 @@
return
}
let failed = (dmd == false && interaction.options.getString("notify") != "no")
- await interaction.editReply({embeds: [new EmojiEmbed()
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji(`PUNISH.MUTE.${failed ? "YELLOW" : "GREEN"}`)
.setTitle(`Unmute`)
.setDescription("The member was unmuted" + (failed ? ", but could not be notified" : ""))
.setStatus(failed ? "Warning" : "Success")
], components: []})
} else {
- await interaction.editReply({embeds: [new EmojiEmbed()
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji("PUNISH.MUTE.GREEN")
.setTitle(`Unmute`)
.setDescription("No changes were made")
diff --git a/src/commands/mod/viewas.ts b/src/commands/mod/viewas.ts
index c7bd4b1..5f7c7de 100644
--- a/src/commands/mod/viewas.ts
+++ b/src/commands/mod/viewas.ts
@@ -1,4 +1,4 @@
-import { CommandInteraction } from "discord.js";
+import { CategoryChannel, CommandInteraction } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
@@ -6,9 +6,13 @@
builder
.setName("viewas")
.setDescription("View the server as a specific member")
+ .addUserOption(option => option.setName("member").setDescription("The member to view as").setRequired(true))
const callback = (interaction: CommandInteraction) => {
- interaction.reply("Command incomplete [mod/viewas]");
+ let channels = interaction.guild.channels.cache
+ .filter(c => c.type === "GUILD_CATEGORY")
+ .map(c => (c as CategoryChannel).children.map(c => c))
+ console.log(channels)
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/mod/warn.ts b/src/commands/mod/warn.ts
index 3662896..d89a778 100644
--- a/src/commands/mod/warn.ts
+++ b/src/commands/mod/warn.ts
@@ -2,8 +2,9 @@
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
import confirmationMessage from "../../utils/confirmationMessage.js";
-import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
+import generateEmojiEmbed from "../../utils/generateEmojiEmbed.js";
import keyValueList from "../../utils/generateKeyValueList.js";
+import { create, areTicketsEnabled } from "../../automations/createModActionTicket.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
@@ -17,9 +18,9 @@
const callback = async (interaction: CommandInteraction) => {
// @ts-ignore
- const { log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = interaction.client.logger
+ const { log, NucleusColors, renderUser, entry } = interaction.client.logger
// TODO:[Modals] Replace this with a modal
- if (await new confirmationMessage(interaction)
+ let confirmation = await new confirmationMessage(interaction)
.setEmoji("PUNISH.WARN.RED")
.setTitle("Warn")
.setDescription(keyValueList({
@@ -29,25 +30,31 @@
+ `The user **will${interaction.options.getString("notify") === "no" ? ' not' : ''}** be notified\n\n`
+ `Are you sure you want to warn <@!${(interaction.options.getMember("user") as GuildMember).id}>?`)
.setColor("Danger")
+ .addCustomCallback(
+ "Create appeal ticket", !(await areTicketsEnabled(interaction.guild.id)),
+ () => { create(interaction.guild, interaction.options.getUser("user"), interaction.client)},
+ "An appeal ticket was created")
// pluralize("day", interaction.options.getInteger("delete"))
// const pluralize = (word: string, count: number) => { return count === 1 ? word : word + "s" }
- .send()) {
+ .send()
+ if (confirmation.success) {
let dmd = false
try {
if (interaction.options.getString("notify") != "no") {
await (interaction.options.getMember("user") as GuildMember).send({
- embeds: [new EmojiEmbed()
+ embeds: [new generateEmojiEmbed()
.setEmoji("PUNISH.WARN.RED")
.setTitle("Warned")
.setDescription(`You have been warned in ${interaction.guild.name}` +
- (interaction.options.getString("reason") ? ` for:\n> ${interaction.options.getString("reason")}` : "."))
+ (interaction.options.getString("reason") ? ` for:\n> ${interaction.options.getString("reason")}` : ".") + "\n\n" +
+ (confirmation.buttonClicked ? `You can appeal this in this ticket: <#${confirmation.response}>` : ``))
.setStatus("Danger")
]
})
dmd = true
}
} catch {
- await interaction.editReply({embeds: [new EmojiEmbed()
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji("PUNISH.WARN.RED")
.setTitle(`Warn`)
.setDescription("Something went wrong and the user was not warned")
@@ -64,8 +71,8 @@
timestamp: new Date().getTime()
},
list: {
- user: renderUser((interaction.options.getMember("user") as GuildMember).user.id, (interaction.options.getMember("user") as GuildMember).user),
- warnedBy: renderUser(interaction.member.user.id, interaction.member.user),
+ user: entry((interaction.options.getMember("user") as GuildMember).user.id, renderUser((interaction.options.getMember("user") as GuildMember).user)),
+ warnedBy: entry(interaction.member.user.id, renderUser(interaction.member.user)),
reason: (interaction.options.getString("reason") ? `\n> ${interaction.options.getString("reason")}` : "No reason provided")
},
hidden: {
@@ -75,7 +82,7 @@
log(data, interaction.client);
let failed = (dmd == false && interaction.options.getString("notify") != "no")
if (!failed) {
- await interaction.editReply({embeds: [new EmojiEmbed()
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji(`PUNISH.WARN.GREEN`)
.setTitle(`Warn`)
.setDescription("The user was warned")
@@ -83,7 +90,7 @@
], components: []})
} else {
let m = await interaction.editReply({
- embeds: [new EmojiEmbed()
+ embeds: [new generateEmojiEmbed()
.setEmoji(`PUNISH.WARN.RED`)
.setTitle(`Warn`)
.setDescription("The user's DMs are not open\n\nWhat would you like to do?")
@@ -106,7 +113,7 @@
try {
component = await (m as Discord.Message).awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 2.5 * 60 * 1000});
} catch (e) {
- return await interaction.editReply({embeds: [new EmojiEmbed()
+ return await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji(`PUNISH.WARN.GREEN`)
.setTitle(`Warn`)
.setDescription("No changes were made")
@@ -115,7 +122,7 @@
}
if ( component.customId == "here" ) {
await interaction.channel.send({
- embeds: [new EmojiEmbed()
+ embeds: [new generateEmojiEmbed()
.setEmoji(`PUNISH.WARN.RED`)
.setTitle(`Warn`)
.setDescription(`You have been warned` +
@@ -125,14 +132,14 @@
content: `<@!${(interaction.options.getMember("user") as GuildMember).id}>`,
allowedMentions: {users: [(interaction.options.getMember("user") as GuildMember).id]}
})
- return await interaction.editReply({embeds: [new EmojiEmbed()
+ return await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji(`PUNISH.WARN.GREEN`)
.setTitle(`Warn`)
.setDescription("The user was warned")
.setStatus("Success")
], components: []})
} else {
- await interaction.editReply({embeds: [new EmojiEmbed()
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji(`PUNISH.WARN.GREEN`)
.setTitle(`Warn`)
.setDescription("The warn was logged")
@@ -141,7 +148,7 @@
}
}
} else {
- await interaction.editReply({embeds: [new EmojiEmbed()
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji("PUNISH.WARN.GREEN")
.setTitle(`Warn`)
.setDescription("No changes were made")
diff --git a/src/commands/nucleus/ping.ts b/src/commands/nucleus/ping.ts
index 43a5fd7..ab23bf7 100644
--- a/src/commands/nucleus/ping.ts
+++ b/src/commands/nucleus/ping.ts
@@ -1,5 +1,6 @@
import { CommandInteraction } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import generateEmojiEmbed from "../../utils/generateEmojiEmbed.js";
import { WrappedCheck } from "jshaiku";
const command = (builder: SlashCommandSubcommandBuilder) =>
@@ -7,8 +8,27 @@
.setName("ping")
.setDescription("Gets the bot's ping time")
-const callback = (interaction: CommandInteraction) => {
- interaction.reply("Command incomplete [nucleus/ping]");
+const callback = async (interaction: CommandInteraction) => {
+ // WEBSOCKET | Nucleus -> Discord
+ // EDITING | Nucleus -> discord -> nucleus | edit time / 2
+ let initial = new Date().getTime();
+ await interaction.reply({embeds: [new generateEmojiEmbed()
+ .setTitle("Ping")
+ .setDescription(`Checking ping times...`)
+ .setEmoji("NUCLEUS.LOADING")
+ .setStatus("Danger")
+ ], ephemeral: true});
+ let ping = new Date().getTime() - initial;
+ interaction.editReply({embeds: [new generateEmojiEmbed()
+ .setTitle("Ping")
+ .setDescription(
+ `**Ping:** \`${ping}ms\`\n` +
+ `**To Discord:** \`${interaction.client.ws.ping}ms\`\n` +
+ `**From Expected:** \`±${Math.abs((ping / 2) - interaction.client.ws.ping)}ms\``
+ )
+ .setEmoji("CHANNEL.SLOWMODE.OFF")
+ .setStatus("Danger")
+ ]})
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/nucleus/stats.ts b/src/commands/nucleus/stats.ts
index 7f468fa..c12b950 100644
--- a/src/commands/nucleus/stats.ts
+++ b/src/commands/nucleus/stats.ts
@@ -1,14 +1,26 @@
import { CommandInteraction } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
+import generateEmojiEmbed from "../../utils/generateEmojiEmbed.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
.setName("stats")
- .setDescription("Gets the bot's statse")
+ .setDescription("Gets the bot's stats")
const callback = (interaction: CommandInteraction) => {
- interaction.reply("Command incomplete [nucleus/stats]");
+ interaction.reply({
+ embeds: [new generateEmojiEmbed()
+ .setTitle("Stats")
+ .setDescription(
+ `**Servers:** ${interaction.client.guilds.cache.size}\n` +
+ `**Ping:** \`${interaction.client.ws.ping*2}ms\``
+ )
+ .setStatus("Success")
+ .setEmoji("GUILD.GRAPHS")
+
+ ], ephemeral: true
+ });
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/nucleus/suggest.ts b/src/commands/nucleus/suggest.ts
index e76d49f..36338dc 100644
--- a/src/commands/nucleus/suggest.ts
+++ b/src/commands/nucleus/suggest.ts
@@ -1,14 +1,50 @@
-import { CommandInteraction } from "discord.js";
+import Discord, { CommandInteraction } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
+import confirmationMessage from "../../utils/confirmationMessage.js";
+import generateEmojiEmbed from "../../utils/generateEmojiEmbed.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
.setName("suggest")
.setDescription("Sends a suggestion to the developers")
+ .addStringOption(option => option.setName("suggestion").setDescription("The suggestion to send").setRequired(true))
-const callback = (interaction: CommandInteraction) => {
- interaction.reply("Command incomplete [nucleus/suggest]");
+const callback = async (interaction: CommandInteraction) => {
+ // @ts-ignore
+ const { renderUser } = interaction.client.logger
+ let suggestion = interaction.options.getString("suggestion");
+ let confirmation = await new confirmationMessage(interaction)
+ .setEmoji("ICONS.OPP.ADD")
+ .setTitle("Suggest")
+ .setDescription(`**Suggestion:**\n> ${suggestion}\n`
+ + `Your username and ID will also be sent with your suggestion.\n\nAre you sure you want to send this suggestion?`)
+ .setColor("Danger")
+ .send()
+ if (confirmation.success) {
+ await (interaction.client.channels.cache.get('955161206459600976') as Discord.TextChannel).send({
+ embeds: [
+ new generateEmojiEmbed()
+ .setTitle(`Suggestion`)
+ .setDescription(`**From:** ${renderUser(interaction.member.user)}\n**Suggestion:**\n> ${suggestion}`)
+ .setStatus("Danger")
+ .setEmoji("NUCLEUS.LOGO")
+ ]
+ })
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
+ .setEmoji("ICONS.ADD")
+ .setTitle(`Suggest`)
+ .setDescription("Your suggestion was sent successfully")
+ .setStatus("Success")
+ ], components: []})
+ } else {
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
+ .setEmoji("ICONS.OPP.ADD")
+ .setTitle(`Suggest`)
+ .setDescription("No changes were made")
+ .setStatus("Danger")
+ ], components: []})
+ }
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/privacy.ts b/src/commands/privacy.ts
index 063f195..3174421 100644
--- a/src/commands/privacy.ts
+++ b/src/commands/privacy.ts
@@ -1,4 +1,4 @@
-import { CommandInteraction } from "discord.js";
+import Discord, { CommandInteraction } from "discord.js";
import { SlashCommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
import { testLink, testMalware, testNSFW } from '../utils/scanners.js';
diff --git a/src/commands/role/all.ts b/src/commands/role/all.ts
index 0f4c43f..44e77fd 100644
--- a/src/commands/role/all.ts
+++ b/src/commands/role/all.ts
@@ -8,7 +8,7 @@
.setDescription("Gives or removes a role from everyone")
const callback = (interaction: CommandInteraction) => {
- interaction.reply("Command incomplete [role/all]");
+ interaction.reply("This command is not yet finished [role/all]");
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/role/user.ts b/src/commands/role/user.ts
index 4229133..b45e1d1 100644
--- a/src/commands/role/user.ts
+++ b/src/commands/role/user.ts
@@ -5,10 +5,10 @@
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
.setName("user")
- .setDescription("Gives or removes a role form someone")
+ .setDescription("Gives or removes a role from someone")
const callback = (interaction: CommandInteraction) => {
- interaction.reply("Command incomplete [role/user]");
+ interaction.reply("This command is not yet finished [role/user]");
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/server.ts b/src/commands/server.ts
deleted file mode 100644
index 27d0373..0000000
--- a/src/commands/server.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { CommandInteraction } from "discord.js";
-import { SlashCommandBuilder } from "@discordjs/builders";
-import { WrappedCheck } from "jshaiku";
-
-const command = new SlashCommandBuilder()
- .setName("server")
- .setDescription("Shows info about the server")
-
-const callback = (interaction: CommandInteraction) => {
- interaction.reply("Command incomplete [server]");
-}
-
-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
index 3874f7f..0053f76 100644
--- a/src/commands/settings/automation.ts
+++ b/src/commands/settings/automation.ts
@@ -8,7 +8,7 @@
.setDescription("Shows all automation options")
const callback = (interaction: CommandInteraction) => {
- interaction.reply("Command incomplete [settings/automation]");
+ interaction.reply("This command is not yet finished [settings/automation]");
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/settings/log/channel.ts b/src/commands/settings/log/channel.ts
index af570a7..5843438 100644
--- a/src/commands/settings/log/channel.ts
+++ b/src/commands/settings/log/channel.ts
@@ -8,7 +8,7 @@
.setDescription("Sets the log channel")
const callback = (interaction: CommandInteraction) => {
- interaction.reply("Command incomplete [settings/log/channel]");
+ interaction.reply("This command is not yet finished [settings/log/channel]");
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/settings/log/events.ts b/src/commands/settings/log/events.ts
index 4f4c9bd..dac200c 100644
--- a/src/commands/settings/log/events.ts
+++ b/src/commands/settings/log/events.ts
@@ -8,7 +8,7 @@
.setDescription("Sets what events should be logged")
const callback = (interaction: CommandInteraction) => {
- interaction.reply("Command incomplete [settings/log/events]");
+ interaction.reply("This command is not yet finished [settings/log/events]");
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/settings/log/ignore.ts b/src/commands/settings/log/ignore.ts
index eea7048..1b4d245 100644
--- a/src/commands/settings/log/ignore.ts
+++ b/src/commands/settings/log/ignore.ts
@@ -8,7 +8,7 @@
.setDescription("Sets which users, channels and roles should be ignored")
const callback = (interaction: CommandInteraction) => {
- interaction.reply("Command incomplete [settings/log/ignore]");
+ interaction.reply("This command is not yet finished [settings/log/ignore]");
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/settings/log/ignored.ts b/src/commands/settings/log/ignored.ts
index df5f7b6..bf4a30c 100644
--- a/src/commands/settings/log/ignored.ts
+++ b/src/commands/settings/log/ignored.ts
@@ -8,7 +8,7 @@
.setDescription("Gets the ignored users, channels and roles")
const callback = (interaction: CommandInteraction) => {
- interaction.reply("Command incomplete [settings/log/ignored]");
+ interaction.reply("This command is not yet finished [settings/log/ignored]");
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/settings/menu.ts b/src/commands/settings/menu.ts
index c7269c7..9950fe4 100644
--- a/src/commands/settings/menu.ts
+++ b/src/commands/settings/menu.ts
@@ -35,13 +35,13 @@
}
let toLogDropdown = new MessageSelectMenu()
- .setCustomId("tolog")
+ .setCustomId("log")
.setMaxValues(22)
.addOptions()
let embed = new MessageEmbed()
- interaction.reply("Command incomplete [settings/all]");
+ interaction.reply("This command is not yet finished [settings/all]");
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/settings/mod/_meta.ts b/src/commands/settings/mod/_meta.ts
index 713bb48..9c3cd62 100644
--- a/src/commands/settings/mod/_meta.ts
+++ b/src/commands/settings/mod/_meta.ts
@@ -1,4 +1,4 @@
-const name = "announcements";
-const description = "Settings for mod messages";
+const name = "warnings";
+const description = "Settings for mod warnings";
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
index 16230ba..88c8396 100644
--- a/src/commands/settings/mod/channel.ts
+++ b/src/commands/settings/mod/channel.ts
@@ -8,7 +8,7 @@
.setDescription("Sets the channel for staff messages to go to")
const callback = (interaction: CommandInteraction) => {
- interaction.reply("Command incomplete [settings/mod/channel]");
+ interaction.reply("This command is not yet finished [settings/mod/channel]");
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/settings/mod/events.ts b/src/commands/settings/mod/events.ts
index 3dc5e99..be5de57 100644
--- a/src/commands/settings/mod/events.ts
+++ b/src/commands/settings/mod/events.ts
@@ -8,7 +8,7 @@
.setDescription("Sets which events mods should be notified about")
const callback = (interaction: CommandInteraction) => {
- interaction.reply("Command incomplete [settings/mod/events]");
+ interaction.reply("This command is not yet finished [settings/mod/events]");
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/settings/tickets.ts b/src/commands/settings/tickets.ts
index 2c2b806..64dc980 100644
--- a/src/commands/settings/tickets.ts
+++ b/src/commands/settings/tickets.ts
@@ -14,7 +14,7 @@
.addRoleOption(option => option.setName("supportping").setDescription("The role pinged when a ticket is created").setRequired(false))
const callback = (interaction: CommandInteraction) => {
- interaction.reply("Command incomplete [settings/tickets]");
+ interaction.reply("This command is not yet finished [settings/tickets]");
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/settings/verify/channel.ts b/src/commands/settings/verify/channel.ts
deleted file mode 100644
index ad881c2..0000000
--- a/src/commands/settings/verify/channel.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-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
index 3082c71..c4de7af 100644
--- a/src/commands/settings/verify/role.ts
+++ b/src/commands/settings/verify/role.ts
@@ -8,7 +8,7 @@
.setDescription("Sets the role given after verifying")
const callback = (interaction: CommandInteraction) => {
- interaction.reply("Command incomplete [settings/verify/role]");
+ interaction.reply("This command is not yet finished [settings/verify/role]");
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/tag.ts b/src/commands/tag.ts
index 9a10f5a..a5fcfc1 100644
--- a/src/commands/tag.ts
+++ b/src/commands/tag.ts
@@ -7,7 +7,7 @@
.setDescription("Get and manage the servers tags")
const callback = (interaction: CommandInteraction) => {
- interaction.reply("Command incomplete [tag]");
+ interaction.reply("This command is not yet finished [tag]");
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/ticket/close.ts b/src/commands/ticket/close.ts
index 7b9d1c2..237623d 100644
--- a/src/commands/ticket/close.ts
+++ b/src/commands/ticket/close.ts
@@ -1,9 +1,7 @@
-import Discord, { CommandInteraction } from "discord.js";
+import { CommandInteraction } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
-import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
-import readConfig from "../../utils/readConfig.js";
-import getEmojiByName from "../../utils/getEmojiByName.js";
+import close from "../../automations/tickets/delete.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
@@ -11,89 +9,7 @@
.setDescription("Closes a ticket")
const callback = async (interaction: CommandInteraction) => {
- // @ts-ignore
- const { log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = interaction.client.logger
-
- let config = await readConfig(interaction.guild.id);
- let channel = (interaction.channel as Discord.TextChannel)
- if (config.tickets.category != channel.parent.id) {
- return interaction.reply({embeds: [new EmojiEmbed()
- .setTitle("Close Ticket")
- .setDescription("This ticket is not in your tickets category, so cannot be deleted.")
- .setStatus("Danger")
- .setEmoji("CONTROL.BLOCKCROSS")
- ], ephemeral: true});
- }
- let status = channel.topic.split(" ")[1];
- if (status == "Archived") {
- interaction.reply({embeds: [new EmojiEmbed()
- .setTitle("Close Ticket")
- .setDescription("This ticket will be deleted in 3 seconds.")
- .setStatus("Danger")
- .setEmoji("GUILD.TICKET.CLOSE")
- ]});
- setTimeout(async () => {
- let data = {
- meta:{
- type: 'ticketClosed',
- displayName: 'Ticket Closed',
- calculateType: true,
- color: NucleusColors.red,
- emoji: 'GUILD.TICKET.CLOSE',
- timestamp: new Date().getTime()
- },
- list: {
- ticketFor: entry(channel.topic.split(" ")[0], renderUser((await interaction.guild.members.fetch(channel.topic.split(" ")[0])).user)),
- closedBy: entry(interaction.member.user.id, renderUser(interaction.member.user)),
- closedAt: entry(new Date().getTime(), renderDelta(new Date().getTime()))
- },
- hidden: {
- guild: interaction.guild.id
- }
- }
- log(data, interaction.client);
- interaction.channel.delete();
- }, 3000);
- return;
- } else if (status == "Active") {
- interaction.reply({embeds: [new EmojiEmbed()
- .setTitle("Close Ticket")
- .setDescription("This ticket will be archived in 3 seconds.")
- .setStatus("Warning")
- .setEmoji("GUILD.TICKET.ARCHIVED")
- ]});
- setTimeout(async () =>{
- channel.permissionsFor(await interaction.guild.members.fetch(channel.topic.split(" ")[0])).remove("VIEW_CHANNEL");
- channel.setTopic(`${channel.topic.split(" ")[0]} Archived`);
- let data = {
- meta:{
- type: 'ticketArchive',
- displayName: 'Ticket Archived',
- calculateType: true,
- color: NucleusColors.yellow,
- emoji: 'GUILD.TICKET.ARCHIVED',
- timestamp: new Date().getTime()
- },
- list: {
- ticketFor: entry(channel.topic.split(" ")[0], renderUser((await interaction.guild.members.fetch(channel.topic.split(" ")[0])).user)),
- archivedBy: entry(interaction.member.user.id, renderUser(interaction.member.user)),
- archivedAt: entry(new Date().getTime(), renderDelta(new Date().getTime())),
- ticketChannel: entry(channel.id, renderChannel(channel)),
- },
- hidden: {
- guild: interaction.guild.id
- }
- }
- log(data, interaction.client);
- await interaction.editReply({embeds: [new EmojiEmbed()
- .setTitle("Close Ticket")
- .setDescription("This ticket has been archived.\nType `/ticket close` to delete it.")
- .setStatus("Warning")
- .setEmoji("GUILD.TICKET.ARCHIVED") // TODO:[Premium] Add a transcript option ||\----/|| <- the bridge we will cross when we come to it
- ]});
- }, 3000);
- return;
- }
+ await close(interaction);
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/ticket/create.ts b/src/commands/ticket/create.ts
index 4f58aa0..6567c49 100644
--- a/src/commands/ticket/create.ts
+++ b/src/commands/ticket/create.ts
@@ -1,15 +1,7 @@
-import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
+import { CommandInteraction } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
-import { tickets, toHexArray, toHexInteger } from "../../utils/calculate.js";
-import readConfig from "../../utils/readConfig.js";
-import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
-import getEmojiByName from "../../utils/getEmojiByName.js";
-
-function capitalize(s: string) {
- s = s.replace(/([A-Z])/g, ' $1');
- return s.length < 3 ? s.toUpperCase() : s[0].toUpperCase() + s.slice(1).toLowerCase();
-}
+import create from "../../automations/tickets/create.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
@@ -18,155 +10,7 @@
.addStringOption(option => option.setName("message").setDescription("The content of the ticket").setRequired(false))
const callback = async (interaction: CommandInteraction) => {
- // @ts-ignore
- const { log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = interaction.client.logger
-
- let config = await readConfig(interaction.guild.id);
- if (!config.tickets.enabled || !config.tickets.category) {
- return await interaction.reply({embeds: [new EmojiEmbed()
- .setTitle("Tickets are disabled")
- .setDescription("Please enable tickets in the configuration to use this command.")
- .setStatus("Danger")
- .setEmoji("CONTROL.BLOCKCROSS")
- ], ephemeral: true});
- }
- let category = interaction.guild.channels.cache.get(config.tickets.category) as Discord.CategoryChannel;
- let count = 0;
- category.children.forEach(element => {
- if (!(element.type == "GUILD_TEXT")) return;
- if ((element as Discord.TextChannel).topic.includes(`${interaction.member.user.id}`)) {
- if ((element as Discord.TextChannel).topic.endsWith("Active")) {
- count++;
- }
- }
- });
- if (count >= config.tickets.maxTickets) {
- return await interaction.reply({embeds: [new EmojiEmbed()
- .setTitle("Create Ticket")
- .setDescription(`You have reached the maximum amount of tickets (${config.tickets.maxTickets}). Please close one of your active tickets before creating a new one.`)
- .setStatus("Danger")
- .setEmoji("CONTROL.BLOCKCROSS")
- ], ephemeral: true});
- }
- let ticketTypes
- if (config.tickets.customTypes) ticketTypes = config.tickets.customTypes;
- else if (config.tickets.types) ticketTypes = toHexArray(config.tickets.types, tickets);
- else ticketTypes = [];
- let chosenType;
- if (ticketTypes.length > 0) {
- let splitFormattedTicketTypes = [];
- let formattedTicketTypes = [];
- formattedTicketTypes = ticketTypes.map(type => {
- return new MessageButton()
- .setLabel(capitalize(type))
- .setStyle("PRIMARY")
- .setCustomId(type)
- .setEmoji(getEmojiByName(("TICKETS." + type.toString().toUpperCase()), "id"));
- });
- for (let i = 0; i < formattedTicketTypes.length; i += 4) {
- splitFormattedTicketTypes.push(new MessageActionRow().addComponents(formattedTicketTypes.slice(i, i + 4)));
- }
- let m = await interaction.reply({embeds: [new EmojiEmbed()
- .setTitle("Create Ticket")
- .setDescription("Please select a ticket type")
- .setStatus("Success")
- .setEmoji("GUILD.TICKET.OPEN")
- ], ephemeral: true, fetchReply: true, components: splitFormattedTicketTypes});
- let component;
- try {
- component = await (m as Discord.Message).awaitMessageComponent({time: 2.5 * 60 * 1000});
- } catch (e) {
- return;
- }
- component.deferUpdate();
- chosenType = component.customId;
- } else {
- chosenType = null
- await interaction.reply({embeds: [new EmojiEmbed()
- .setTitle("Create Ticket")
- .setEmoji("GUILD.TICKET.OPEN")
- ], ephemeral: true})
- }
- let overwrites = [{
- id: interaction.member,
- allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
- type: "member"
- }] as Discord.OverwriteResolvable[];
- if (config.tickets.supportRole != null) {
- overwrites.push({
- id: interaction.guild.roles.cache.get(config.tickets.supportRole),
- allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
- type: "role"
- })
- }
-
- let c;
- try {
- c = await interaction.guild.channels.create(interaction.member.user.username, {
- type: "GUILD_TEXT",
- topic: `${interaction.member.user.id} Active`,
- parent: config.tickets.category,
- nsfw: false,
- permissionOverwrites: (overwrites as Discord.OverwriteResolvable[]),
- reason: "Creating ticket"
- })
- } catch (e) {
- return await interaction.editReply({embeds: [new EmojiEmbed()
- .setTitle("Create Ticket")
- .setDescription("Failed to create ticket")
- .setStatus("Danger")
- .setEmoji("CONTROL.BLOCKCROSS")
- ]});
- }
- try {
- await c.send(
- {
- content: (`<@${interaction.member.user.id}>` + (config.tickets.supportRole != null ? ` • <@&${config.tickets.supportRole}>` : "")),
- allowedMentions: {
- users: [(interaction.member as Discord.GuildMember).id],
- roles: (config.tickets.supportRole != null ? [config.tickets.supportRole] : [])
- }
- }
- )
- let content = interaction.options.getString("message") || "";
- if (content) content = `**Message:**\n> ${content}\n`;
- await c.send({ embeds: [new EmojiEmbed()
- .setTitle("New Ticket")
- .setDescription(
- `Ticket created by <@${interaction.member.user.id}>\n` +
- `**Support type:** ${chosenType != null ? (getEmojiByName("TICKETS." + chosenType.toUpperCase()) + " " + capitalize(chosenType)) : "General"}\n` +
- `**Ticket ID:** \`${c.id}\`\n${content}\n` +
- `Type \`/ticket close\` to archive this ticket.`,
- )
- .setStatus("Success")
- .setEmoji("GUILD.TICKET.OPEN")
- ]})
- let data = {
- meta:{
- type: 'ticketCreate',
- displayName: 'Ticket Created',
- calculateType: true,
- color: NucleusColors.green,
- emoji: 'GUILD.TICKET.OPEN',
- timestamp: new Date().getTime()
- },
- list: {
- ticketFor: entry(interaction.member.user.id, renderUser(interaction.member.user)),
- createdAt: entry(new Date().getTime(), renderDelta(new Date().getTime())),
- ticketChannel: entry(c.id, renderChannel(c)),
- },
- hidden: {
- guild: interaction.guild.id
- }
- }
- log(data, interaction.client);
- } catch (e) { console.log(e)}
- await interaction.editReply({embeds: [new EmojiEmbed()
- .setTitle("Create Ticket")
- .setDescription(`Ticket created. You can view it here: <#${c.id}>`)
- .setStatus("Success")
- .setEmoji("GUILD.TICKET.OPEN")
- ], components: []});
+ await create(interaction)
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/user/about.ts b/src/commands/user/about.ts
index 9015c13..b6e2aee 100644
--- a/src/commands/user/about.ts
+++ b/src/commands/user/about.ts
@@ -1,14 +1,195 @@
-import { CommandInteraction } from "discord.js";
+import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
+import generateEmojiEmbed from "../../utils/generateEmojiEmbed.js";
+import getEmojiByName from "../../utils/getEmojiByName.js";
+import generateKeyValueList from "../../utils/generateKeyValueList.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
.setName("about")
.setDescription("Shows info about a user")
+ .addUserOption(option => option.setName("user").setDescription("The user to get info about | Default: Yourself"))
-const callback = (interaction: CommandInteraction) => {
- interaction.reply("Command incomplete [user/about]");
+const callback = async (interaction: CommandInteraction) => {
+ // @ts-ignore
+ const { renderUser, renderDelta } = interaction.client.logger
+ let member = (interaction.options.getMember("user") || interaction.member) as Discord.GuildMember;
+ let flags: string[] = [];
+ if ([
+ "438733159748599813", // Pinea
+ "317731855317336067", // Mini
+ "261900651230003201", // Coded
+ "511655498676699136", // Zan
+ ].includes(member.user.id)) { flags.push("NUCLEUSDEVELOPER") }
+ if ((await interaction.client.guilds.cache.get("684492926528651336")?.members.fetch())?.filter(m => m.roles.cache.has("760896837866749972"))?.map(m => m.id).includes(member.user.id)) { flags.push("CLICKSDEVELOPER") }
+ member.user.flags.toArray().map(flag => {
+ flags.push(flag.toString())
+ })
+ if (member.user.bot === true) { flags.push("BOT") }
+ // Check if they are boosting the server
+ if (member.premiumSince) { flags.push("BOOSTER") }
+ let nameReplacements = {
+ "NUCLEUSDEVELOPER": "**Nucleus Developer**",
+ "CLICKSDEVELOPER": "Clicks Developer",
+ "HOUSE_BRAVERY": "Hypesquad Bravery",
+ "HOUSE_BRILLIANCE": "Hypesquad Brilliance",
+ "HOUSE_BALANCE": "Hypesquad Balance",
+ "HYPESQUAD_EVENTS": "Hypesquad Events",
+ "EARLY_SUPPORTER": "Early Supporter",
+ "BUGHUNTER_LEVEL_1": "Bug Hunter Level 1",
+ "BUGHUNTER_LEVEL_2": "Bug Hunter Level 2",
+ "PARTNERED_SERVER_OWNER": "Partnered Server Owner",
+ "DISCORD_EMPLOYEE": "Discord Staff",
+ "EARLY_VERIFIED_BOT_DEVELOPER": "Verified Bot Developer",
+ "BOT": "Bot",
+ "BOOSTER": "Server Booster"
+ }
+ let members = await interaction.guild.members.fetch()
+ let membersArray = [...members.values()]
+ membersArray.sort((a, b) => a.joinedTimestamp - b.joinedTimestamp)
+ let joinPos = membersArray.findIndex(m => m.id === member.user.id)
+
+ let roles = member.roles.cache.filter(r => r.id != interaction.guild.id).sort()
+ let s = "";
+ let count = 0;
+ let ended = false
+ roles.map(item => {
+ if (ended) return;
+ let string = `<@&${item.id}>, `
+ if(s.length + string.length > 1000) {
+ ended = true
+ s += `and ${roles.size - count} more`
+ return
+ };
+ count ++
+ s += string;
+ })
+ if(s.length > 0 && !ended) s = s.slice(0, -2);
+
+ let perms = ""
+ let permsArray = {
+ "ADMINISTRATOR": "Administrator",
+ "MANAGE_GUILD": "Manage Server",
+ "MANAGE_ROLES": "Manage Roles",
+ "MANAGE_CHANNELS": "Manage Channels",
+ "KICK_MEMBERS": "Kick Members",
+ "BAN_MEMBERS": "Ban Members",
+ "MODERATE_MEMBERS": "Moderate Members",
+ "MANAGE_NICKNAMES": "Manage Nicknames",
+ "MANAGE_WEBHOOKS": "Manage Webhooks",
+ "MANAGE_MESSAGES": "Manage Messages",
+ "VIEW_AUDIT_LOG": "View Audit Log",
+ "MENTION_EVERYONE": "Mention Everyone"
+ }
+ Object.keys(permsArray).map(perm => {
+ let hasPerm = member.permissions.has(perm as Discord.PermissionString)
+ perms += `${getEmojiByName("CONTROL." + (hasPerm ? "TICK" : "CROSS"))} ${permsArray[perm]}\n`
+ })
+
+ let embeds = [
+ new generateEmojiEmbed()
+ .setTitle("User Info: General")
+ .setStatus("Success")
+ .setEmoji("MEMBER.JOIN")
+ .setDescription(
+ flags.map(flag => {
+ if (nameReplacements[flag]) {
+ return getEmojiByName(`BADGES.${flag}`) + " " + nameReplacements[flag];
+ }
+ }).join("\n") + "\n\n" +
+ generateKeyValueList({
+ "member": renderUser(member.user),
+ "nickname": member.nickname || "*None set*",
+ "id": `\`${member.id}\``,
+ "joined the server": renderDelta(member.joinedTimestamp),
+ "joined discord": renderDelta(member.user.createdTimestamp),
+ "boost status": member.premiumSince ? `Started boosting ${renderDelta(member.premiumSinceTimestamp)}` : "*Not boosting*",
+ "join position": `${joinPos + 1}`
+ })
+ )
+ .setThumbnail(await member.user.displayAvatarURL({dynamic: true}))
+ .setImage((await member.user.fetch()).bannerURL({format: "gif"})),
+ new generateEmojiEmbed()
+ .setTitle("User Info: Roles")
+ .setStatus("Success")
+ .setEmoji("GUILD.ROLES.CREATE")
+ .setDescription(
+ generateKeyValueList({
+ "member": renderUser(member.user),
+ "id": `\`${member.id}\``,
+ "roles": `${member.roles.cache.size - 1}`,
+ }) + "\n" +
+ (s.length > 0 ? s : "*None*")
+ )
+ .setThumbnail(await member.user.displayAvatarURL({dynamic: true})),
+ new generateEmojiEmbed()
+ .setTitle("User Info: Key Permissions")
+ .setStatus("Success")
+ .setEmoji("GUILD.ROLES.CREATE")
+ .setDescription(
+ generateKeyValueList({
+ "member": renderUser(member.user),
+ "id": `\`${member.id}\``,
+ }) + "\n" + perms
+ )
+ .setThumbnail(await member.user.displayAvatarURL({dynamic: true}))
+ ]
+ let m
+ m = await interaction.reply({embeds: [new generateEmojiEmbed().setTitle("Loading").setEmoji("NUCLEUS.LOADING").setStatus("Danger")], fetchReply: true, ephemeral: true});
+ let page = 0
+ while (true) {
+ await interaction.editReply({
+ embeds: [embeds[page].setFooter({text: `Page ${page + 1} of ${embeds.length}`})],
+ components: [new MessageActionRow().addComponents([
+ new MessageButton()
+ .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+ .setStyle("SECONDARY")
+ .setCustomId("left")
+ .setDisabled(page === 0),
+ new MessageButton()
+ .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
+ .setCustomId("right")
+ .setStyle("SECONDARY")
+ .setDisabled(page === embeds.length - 1),
+ new MessageButton()
+ .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+ .setCustomId("close")
+ .setStyle("DANGER")
+ ])]
+ })
+ let i
+ try {
+ i = await m.awaitMessageComponent({componentType: "BUTTON", time: 600000});
+ } catch { break }
+ i.deferUpdate()
+ if (i.component.customId == "left") {
+ if (page > 0) page--;
+ } else if (i.component.customId == "right") {
+ if (page < embeds.length - 1) page++;
+ } else if (i.component.customId == "close") {
+ break;
+ } else {
+ break;
+ }
+ }
+ await interaction.editReply({embeds: [m.embeds[0]], components: [new MessageActionRow().addComponents([
+ new MessageButton()
+ .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+ .setStyle("SECONDARY")
+ .setCustomId("left")
+ .setDisabled(true),
+ new MessageButton()
+ .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
+ .setCustomId("right")
+ .setStyle("SECONDARY")
+ .setDisabled(true),
+ new MessageButton()
+ .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+ .setCustomId("close")
+ .setStyle("PRIMARY")
+ .setDisabled(true)
+ ])]})
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/user/avatar.ts b/src/commands/user/avatar.ts
index 9e22d0c..eb9042a 100644
--- a/src/commands/user/avatar.ts
+++ b/src/commands/user/avatar.ts
@@ -1,14 +1,32 @@
-import { CommandInteraction } from "discord.js";
+import Discord, { CommandInteraction } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
+import generateEmojiEmbed from "../../utils/generateEmojiEmbed.js";
+import getEmojiByName from "../../utils/getEmojiByName.js";
+import generateKeyValueList from "../../utils/generateKeyValueList.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
.setName("avatar")
- .setDescription("Shows a users avatar")
+ .setDescription("Shows the avatar of a user")
+ .addUserOption(option => option.setName("user").setDescription("The user to get the avatar of | Default: Yourself"))
-const callback = (interaction: CommandInteraction) => {
- interaction.reply("Command incomplete [user/avatar]");
+const callback = async (interaction: CommandInteraction) => {
+ // @ts-ignore
+ const { renderUser } = interaction.client.logger
+ let member = (interaction.options.getMember("user") || interaction.member) as Discord.GuildMember;
+ await interaction.reply({embeds: [new generateEmojiEmbed()
+ .setTitle("User Info")
+ .setStatus("Success")
+ .setEmoji("MEMBER.JOIN")
+ .setDescription(
+ generateKeyValueList({
+ "member": renderUser(member.user),
+ "url": member.user.displayAvatarURL({dynamic: true}),
+ })
+ )
+ .setImage(await member.user.displayAvatarURL({dynamic: true}))
+ ], ephemeral: true, fetchReply: true});
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/verify.ts b/src/commands/verify.ts
index 489a109..c9abb77 100644
--- a/src/commands/verify.ts
+++ b/src/commands/verify.ts
@@ -1,144 +1,14 @@
-import Discord, { CommandInteraction, GuildMember } from "discord.js";
+import { CommandInteraction } from "discord.js";
import { SlashCommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
-import generateEmojiEmbed from "../utils/generateEmojiEmbed.js";
-import readConfig from "../utils/readConfig.js";
-import fetch from "node-fetch";
-import { TestString, NSFWCheck } from "../automations/unscan.js";
+import verify from "../automations/verify.js";
const command = new SlashCommandBuilder()
.setName("verify")
.setDescription("Get verified in the server")
const callback = async (interaction: CommandInteraction) => {
- // @ts-ignore
- let verify = interaction.client.verify
- await interaction.reply({embeds: [new generateEmojiEmbed()
- .setTitle("Loading")
- .setStatus("Danger")
- .setEmoji("NUCLEUS.LOADING")
- ], ephemeral: true, fetchReply: true});
- let config = await readConfig(interaction.guild.id);
- if ((interaction.member as GuildMember).roles.cache.has(config.verify.role)) {
- return await interaction.editReply({embeds: [new generateEmojiEmbed()
- .setTitle("Verify")
- .setDescription(`You already have the <@&${config.verify.role}> role`)
- .setStatus("Danger")
- .setEmoji("CONTROL.BLOCKCROSS")
- ]});
- } else if (interaction.channel.id != config.verify.channel) {
- return await interaction.editReply({embeds: [new generateEmojiEmbed()
- .setTitle("Verify")
- .setDescription(`You can only use this command in <#${config.verify.channel}>`)
- .setStatus("Danger")
- .setEmoji("CONTROL.BLOCKCROSS")
- ]});
- }
- await interaction.editReply({embeds: [new generateEmojiEmbed()
- .setTitle("Verify")
- .setDescription(`Checking our servers are up`)
- .setStatus("Warning")
- .setEmoji("NUCLEUS.LOADING")
- ]});
- try {
- let status = await fetch(`https://clicksminuteper.net`).then(res => res.status);
- if (status != 200) {
- return await interaction.editReply({embeds: [new generateEmojiEmbed()
- .setTitle("Verify")
- .setDescription(`Our servers appear to be down, please try again later`)
- .setStatus("Danger")
- .setEmoji("CONTROL.BLOCKCROSS")
- ]});
- }
- } catch {
- return await interaction.editReply({embeds: [new generateEmojiEmbed()
- .setTitle("Verify")
- .setDescription(`Our servers appear to be down, please try again later`)
- .setStatus("Danger")
- .setEmoji("CONTROL.BLOCKCROSS")
- ], components: [new Discord.MessageActionRow().addComponents([
- new Discord.MessageButton()
- .setLabel("Open webpage")
- .setStyle("LINK")
- .setURL("https://clicksminuteper.net/"),
- new Discord.MessageButton()
- .setLabel("Support")
- .setStyle("LINK")
- .setURL("https://discord.gg/bPaNnxe")
- ])]});
- }
- if (config.filters.images.NSFW) {
- await interaction.editReply({embeds: [new generateEmojiEmbed()
- .setTitle("Verify")
- .setDescription(`Checking your avatar is safe for work`)
- .setStatus("Warning")
- .setEmoji("NUCLEUS.LOADING")
- ]});
- if (await NSFWCheck((interaction.member as GuildMember).user.avatarURL({format: "png"}))) {
- return await interaction.editReply({embeds: [new generateEmojiEmbed()
- .setTitle("Verify")
- .setDescription(`Your avatar was detected as NSFW, which we do not allow in this server.\nPlease contact one of our staff members if you believe this is a mistake`)
- .setStatus("Danger")
- .setEmoji("CONTROL.BLOCKCROSS")
- ]});
- }
- }
- if (config.filters.wordFilter) {
- await interaction.editReply({embeds: [new generateEmojiEmbed()
- .setTitle("Verify")
- .setDescription(`Checking your name is allowed`)
- .setStatus("Warning")
- .setEmoji("NUCLEUS.LOADING")
- ]});
- if (TestString((interaction.member as Discord.GuildMember).displayName, config.filters.wordFilter.words.loose, config.filters.wordFilter.words.strict) != "none") {
- return await interaction.editReply({embeds: [new generateEmojiEmbed()
- .setTitle("Verify")
- .setDescription(`Your name contained a word we do not allow in this server.\nPlease contact one of our staff members if you believe this is a mistake`)
- .setStatus("Danger")
- .setEmoji("CONTROL.BLOCKCROSS")
- ]});
- }
- }
- await interaction.editReply({embeds: [new generateEmojiEmbed()
- .setTitle("Verify")
- .setDescription(`One moment...`)
- .setStatus("Warning")
- .setEmoji("NUCLEUS.LOADING")
- ]});
- let code = ""
- let length = 5
- let itt = 0
- const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
- while (true) {
- itt += 1
- code = ""
- for (let i = 0; i < length; i++) { code += chars.charAt(Math.floor(Math.random() * chars.length)); }
- if (code in verify) continue;
- if (itt > 1000) {
- itt = 0
- length += 1
- continue
- }
- break;
- }
- verify[code] = {
- uID: interaction.member.user.id,
- gID: interaction.guild.id,
- rName: (await interaction.guild.roles.fetch(config.verify.role)).name,
- mCount: interaction.guild.memberCount,
- gName: interaction.guild.name,
- guildIcon: interaction.guild.iconURL({format: "png"})
- }
- await interaction.editReply({embeds: [new generateEmojiEmbed()
- .setTitle("Verify")
- .setDescription(`Looking good!\nClick the button below to get verified`)
- .setStatus("Success")
- .setEmoji("MEMBER.JOIN")
- ], components: [new Discord.MessageActionRow().addComponents([new Discord.MessageButton()
- .setLabel("Verify")
- .setStyle("LINK")
- .setURL(`https://clicksminuteper.net/nucleus/verify?code=${code}`)
- ])]});
+ verify(interaction);
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {