-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ea9c3d
commit f80440d
Showing
4 changed files
with
53 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,37 @@ | ||
// TODO -> Archive by transforming channel into a thread in the 'archives' channel | ||
|
||
const { SlashCommandBuilder } = require('discord.js'); | ||
const { archive } = require('../../utils/archive.js'); | ||
const { SlashCommandBuilder } = require("discord.js"); | ||
const { archive } = require("../../utils/archive.js"); | ||
|
||
// Creates an Object in JSON with the data required by Discord's API to create a SlashCommand | ||
const create = () => { | ||
const command = new SlashCommandBuilder() | ||
.setName('archive') | ||
.setDescription('Archive ce salon') | ||
.setName("archive") | ||
.setDescription("Archive ce salon"); | ||
return command.toJSON(); | ||
}; | ||
|
||
// Called by the interactionCreate event listener when the corresponding command is invoked | ||
const invoke = async (interaction) => { | ||
console.log(`${interaction.user.username} used /archive`); | ||
console.log( | ||
`${interaction.user.username} used /archive on ${interaction.channel.name}` | ||
); | ||
|
||
const allowedCategories = ['🪂 SORTIES', '🏃Sorties pas rapente', '🏆 Compétitions']; | ||
const allowedCategories = [ | ||
"🪂 SORTIES", | ||
"🏃Sorties pas rapente", | ||
"🏆 Compétitions", | ||
]; | ||
if (!allowedCategories.includes(interaction.channel.parent.name)) { | ||
return interaction.reply({ | ||
content: 'Seuls les salons sorties, évenements et compétitions peuvent être archivés !', | ||
content: | ||
"Seuls les salons sorties, évenements et compétitions peuvent être archivés !", | ||
ephemeral: true, | ||
}); | ||
} else { | ||
archive(interaction.channel); | ||
await interaction.reply({ content: 'Salon archivé !', ephemeral: true }); | ||
}; | ||
await interaction.reply({ content: "Salon archivé !", ephemeral: true }); | ||
} | ||
}; | ||
|
||
module.exports = { create, invoke }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters