aboutsummaryrefslogtreecommitdiff
path: root/174bg/discord-bot/commands/close.js
diff options
context:
space:
mode:
authorAlex Pooley (@zuedev) <zuedev@gmail.com>2026-07-16 16:43:48 +0100
committerAlex Pooley (@zuedev) <zuedev@gmail.com>2026-07-16 16:43:48 +0100
commitd723827b91cbe59a7ccbb12942172ed00cc2006e (patch)
treec1ed40cbcfef8009c7e0ab28f6df62d98fd1a7f1 /174bg/discord-bot/commands/close.js
parent0b8d4e34e064a847bed236808c0873ce727bccf0 (diff)
downloadunnamed-group-d723827b91cbe59a7ccbb12942172ed00cc2006e.tar
unnamed-group-d723827b91cbe59a7ccbb12942172ed00cc2006e.tar.gz
unnamed-group-d723827b91cbe59a7ccbb12942172ed00cc2006e.tar.bz2
unnamed-group-d723827b91cbe59a7ccbb12942172ed00cc2006e.tar.xz
unnamed-group-d723827b91cbe59a7ccbb12942172ed00cc2006e.zip
replace close command with close-ticket command and update exports
Diffstat (limited to '174bg/discord-bot/commands/close.js')
-rw-r--r--174bg/discord-bot/commands/close.js55
1 files changed, 0 insertions, 55 deletions
diff --git a/174bg/discord-bot/commands/close.js b/174bg/discord-bot/commands/close.js
deleted file mode 100644
index 25bdd41..0000000
--- a/174bg/discord-bot/commands/close.js
+++ /dev/null
@@ -1,55 +0,0 @@
-import { SlashCommandBuilder, PermissionFlagsBits } from "discord.js";
-
-export default {
- data: new SlashCommandBuilder()
- .setName("close")
- .setDescription(
- "Closes the current ticket by logging the contents and deleting the channel.",
- )
- .setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
- execute: async (interaction) => {
- const channel = interaction.channel;
-
- if (!channel || !channel.name.startsWith("ticket-")) {
- return await interaction.reply({
- content: "This command can only be used in a ticket channel.",
- ephemeral: true,
- });
- }
-
- // log the contents of the ticket and send to the logs channel if it exists
- const messages = await channel.messages.fetch({ limit: 100 });
- const log = messages
- .map((message) => `${message.author.tag}: ${message.content}`)
- .reverse()
- .join("\n");
-
- console.log(`Ticket log for ${channel.name}:\n${log}`);
-
- const logsChannel = interaction.guild.channels.cache.find(
- (ch) => ch.name === "logs" && ch.isTextBased(),
- );
-
- if (logsChannel)
- await logsChannel.send({
- content: `# Ticket log for ${channel.name}`,
- files: [
- {
- name: `${channel.name}.txt`,
- attachment: Buffer.from(
- messages
- .map(
- (message) =>
- `${message.author.tag}/${message.author.id}: ${message.content}`,
- )
- .reverse()
- .join("\n"),
- ),
- },
- ],
- });
-
- // delete the channel
- await channel.delete();
- },
-};