Threads for coursework help channel
parent
d5cd6494e3
commit
aeb8f63ed0
|
@ -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())
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
Loading…
Reference in New Issue