diff --git a/events/interactionCreate.js b/events/interactionCreate.js index cd9e4e4..34b337d 100644 --- a/events/interactionCreate.js +++ b/events/interactionCreate.js @@ -77,6 +77,15 @@ client.on("interactionCreate", async (interaction) => { await interaction.message.delete(); await interaction.reply({ content: 'Message has been deleted', ephemeral: true}); } + + if(interaction.isButton) + { + if(interaction.customId == "CloseThread") + { + interaction.reply(`This channel has been archived, you can unarchive this thread by sending another message.`) + interaction.channel.setArchived(true) + } + } } if(interaction.isSelectMenu()) diff --git a/events/messageCreate.js b/events/messageCreate.js index 5024bbf..294fc65 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -7,12 +7,31 @@ const discord = require('discord.js'); client.on("messageCreate", async (message) => { if(message.channel.id == "969944638498680875") { - await message.startThread({ - name: `${message.author} - ${messageArgs}`, + const row = new MessageActionRow() + .addComponents( + new MessageButton() + .setCustomId('CloseThread') + .setEmoji('<:archive:937932140014866492> ') + .setLabel('Archive Thread') + .setStyle('SUCCESS') + ) + + const thread = message.startThread({ + name: `${message.author.tag} - ${message}`, autoArchiveDuration: 60, type: 'GUILD_PUBLIC_THREAD' }); + (await thread).send({ + content: `Hey <@${message.author.id}>! I've automatically created this thread from your message to keep the channel clean and keep messages condensed. + \nIt is recommended that you change the Notification Settings for this thread to All Messages so that you get a notification when someone has responded to your query. + \nPinging <@&904354161561309184> so that they see this as well!`, + components: [row] + }); + + (await thread).leave(); + } + if ( message.author.bot || !message.guild || @@ -30,7 +49,4 @@ client.on("messageCreate", async (message) => { if (!command) return; await command.run(client, message, args); - - } - }); \ No newline at end of file