i have not committed in years
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")