|
|
|
@ -1,6 +1,6 @@
|
|
|
|
import { LoadingEmbed } from "../../../utils/defaults.js";
|
|
|
|
import { LoadingEmbed } from "../../../utils/defaults.js";
|
|
|
|
import { ChannelType } from "discord-api-types/v9";
|
|
|
|
import { ChannelType } from "discord-api-types/v9";
|
|
|
|
import Discord, { CommandInteraction, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
|
|
|
|
import Discord, { CommandInteraction, ActionRowBuilder, ButtonBuilder, ButtonStyle, ButtonInteraction } from "discord.js";
|
|
|
|
import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
|
|
|
|
import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
|
|
|
|
import confirmationMessage from "../../../utils/confirmationMessage.js";
|
|
|
|
import confirmationMessage from "../../../utils/confirmationMessage.js";
|
|
|
|
import getEmojiByName from "../../../utils/getEmojiByName.js";
|
|
|
|
import getEmojiByName from "../../../utils/getEmojiByName.js";
|
|
|
|
@ -25,10 +25,10 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
|
|
|
|
ephemeral: true,
|
|
|
|
ephemeral: true,
|
|
|
|
fetchReply: true
|
|
|
|
fetchReply: true
|
|
|
|
})) as Discord.Message;
|
|
|
|
})) as Discord.Message;
|
|
|
|
if (interaction.options.getChannel("channel")) {
|
|
|
|
if (interaction.options.get("channel")?.channel) {
|
|
|
|
let channel;
|
|
|
|
let channel;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
channel = interaction.options.getChannel("channel");
|
|
|
|
channel = interaction.options.get("channel")?.channel;
|
|
|
|
} catch {
|
|
|
|
} catch {
|
|
|
|
return await interaction.editReply({
|
|
|
|
return await interaction.editReply({
|
|
|
|
embeds: [
|
|
|
|
embeds: [
|
|
|
|
@ -41,7 +41,7 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
channel = channel as Discord.TextChannel;
|
|
|
|
channel = channel as Discord.TextChannel;
|
|
|
|
if (channel.guild.id !== interaction.guild.id) {
|
|
|
|
if (channel.guild.id !== interaction.guild!.id) {
|
|
|
|
return interaction.editReply({
|
|
|
|
return interaction.editReply({
|
|
|
|
embeds: [
|
|
|
|
embeds: [
|
|
|
|
new EmojiEmbed()
|
|
|
|
new EmojiEmbed()
|
|
|
|
@ -53,19 +53,20 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const confirmation = await new confirmationMessage(interaction)
|
|
|
|
const confirmation = await new confirmationMessage(interaction)
|
|
|
|
.setEmoji("CHANNEL.TEXT.EDIT", "CHANNEL.TEXT.DELETE")
|
|
|
|
.setEmoji("CHANNEL.TEXT.EDIT")
|
|
|
|
.setTitle("Attachment Log Channel")
|
|
|
|
.setTitle("Attachment Log Channel")
|
|
|
|
.setDescription(
|
|
|
|
.setDescription(
|
|
|
|
"This will be the channel all attachments will be sent to.\n\n" +
|
|
|
|
"This will be the channel all attachments will be sent to.\n\n" +
|
|
|
|
`Are you sure you want to set the attachment log channel to <#${channel.id}>?`
|
|
|
|
`Are you sure you want to set the attachment log channel to <#${channel.id}>?`
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.setColor("Warning")
|
|
|
|
.setColor("Warning")
|
|
|
|
|
|
|
|
.setFailedMessage("Attachment log channel not set", "Warning", "CHANNEL.TEXT.DELETE")
|
|
|
|
.setInverted(true)
|
|
|
|
.setInverted(true)
|
|
|
|
.send(true);
|
|
|
|
.send(true);
|
|
|
|
if (confirmation.cancelled) return;
|
|
|
|
if (confirmation.cancelled) return;
|
|
|
|
if (confirmation.success) {
|
|
|
|
if (confirmation.success) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
await client.database.guilds.write(interaction.guild.id, {
|
|
|
|
await client.database.guilds.write(interaction.guild!.id, {
|
|
|
|
"logging.attachments.channel": channel.id
|
|
|
|
"logging.attachments.channel": channel.id
|
|
|
|
});
|
|
|
|
});
|
|
|
|
const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
|
|
|
|
const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
|
|
|
|
@ -84,7 +85,7 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
|
|
|
|
channel: entry(channel.id, renderChannel(channel))
|
|
|
|
channel: entry(channel.id, renderChannel(channel))
|
|
|
|
},
|
|
|
|
},
|
|
|
|
hidden: {
|
|
|
|
hidden: {
|
|
|
|
guild: interaction.guild.id
|
|
|
|
guild: interaction.guild!.id
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
log(data);
|
|
|
|
log(data);
|
|
|
|
@ -114,7 +115,7 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let clicks = 0;
|
|
|
|
let clicks = 0;
|
|
|
|
const data = await client.database.guilds.read(interaction.guild.id);
|
|
|
|
const data = await client.database.guilds.read(interaction.guild!.id);
|
|
|
|
let channel = data.logging.staff.channel;
|
|
|
|
let channel = data.logging.staff.channel;
|
|
|
|
|
|
|
|
|
|
|
|
let timedOut = false;
|
|
|
|
let timedOut = false;
|
|
|
|
@ -127,7 +128,7 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
|
|
|
|
channel
|
|
|
|
channel
|
|
|
|
? `Your attachment log channel is currently set to <#${channel}>`
|
|
|
|
? `Your attachment log channel is currently set to <#${channel}>`
|
|
|
|
: "This server does not have an attachment log channel" +
|
|
|
|
: "This server does not have an attachment log channel" +
|
|
|
|
(client.database.premium.hasPremium(interaction.guild.id)
|
|
|
|
(await client.database.premium.hasPremium(interaction.guild!.id)
|
|
|
|
? ""
|
|
|
|
? ""
|
|
|
|
: "\n\nThis server does not have premium, so this feature is disabled")
|
|
|
|
: "\n\nThis server does not have premium, so this feature is disabled")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -135,7 +136,7 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
|
|
|
|
.setEmoji("CHANNEL.TEXT.CREATE")
|
|
|
|
.setEmoji("CHANNEL.TEXT.CREATE")
|
|
|
|
],
|
|
|
|
],
|
|
|
|
components: [
|
|
|
|
components: [
|
|
|
|
new ActionRowBuilder().addComponents([
|
|
|
|
new ActionRowBuilder<ButtonBuilder>().addComponents([
|
|
|
|
new ButtonBuilder()
|
|
|
|
new ButtonBuilder()
|
|
|
|
.setCustomId("clear")
|
|
|
|
.setCustomId("clear")
|
|
|
|
.setLabel(clicks ? "Click again to confirm" : "Reset channel")
|
|
|
|
.setLabel(clicks ? "Click again to confirm" : "Reset channel")
|
|
|
|
@ -156,12 +157,12 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
i.deferUpdate();
|
|
|
|
i.deferUpdate();
|
|
|
|
if (i.component.customId === "clear") {
|
|
|
|
if ((i.component as unknown as ButtonInteraction).customId === "clear") {
|
|
|
|
clicks += 1;
|
|
|
|
clicks += 1;
|
|
|
|
if (clicks === 2) {
|
|
|
|
if (clicks === 2) {
|
|
|
|
clicks = 0;
|
|
|
|
clicks = 0;
|
|
|
|
await client.database.guilds.write(interaction.guild.id, null, ["logging.announcements.channel"]);
|
|
|
|
await client.database.guilds.write(interaction.guild!.id, null, ["logging.announcements.channel"]);
|
|
|
|
channel = undefined;
|
|
|
|
channel = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -179,7 +180,7 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
|
|
|
|
.setFooter({ text: "Message closed" })
|
|
|
|
.setFooter({ text: "Message closed" })
|
|
|
|
],
|
|
|
|
],
|
|
|
|
components: [
|
|
|
|
components: [
|
|
|
|
new ActionRowBuilder().addComponents([
|
|
|
|
new ActionRowBuilder<ButtonBuilder>().addComponents([
|
|
|
|
new ButtonBuilder()
|
|
|
|
new ButtonBuilder()
|
|
|
|
.setCustomId("clear")
|
|
|
|
.setCustomId("clear")
|
|
|
|
.setLabel("Clear")
|
|
|
|
.setLabel("Clear")
|
|
|
|
|