ThreadChannel.setName and .setLocked issue
Trying to set a thread's name and then lock it, but neither of these methods seem to work correctly.
Sample
Full command
setNamesetName works sporadically while setLockedsetLocked nothing at allSample
if (channel.isThread()) {
(await channel.setName('something')).setLocked();
}if (channel.isThread()) {
(await channel.setName('something')).setLocked();
}Full command
module.exports = {
name: `thread`,
description: `Mark threads as solved or closed`,
cooldown: 0,
type: ApplicationCommandType.ChatInput,
options: [{
name: `option`,
description: `Chose to mark the thread as solved or closed`,
type: ApplicationCommandOptionType.String,
required: true,
choices: [{ name: 'Solved', value: 'solved' },
{ name: 'Closed', value: 'closed' }]
}],
async execute(interaction) {
const { options, channel } = interaction;
await interaction.deferReply({ ephemeral: true });
if (!channel.isThread()) {
return interaction.reply({
content: `This is not a thread channel`,
ephemeral: true
});
}
switch (options.getString('option')) {
case 'solved': {
(await channel.setName(`[SOLVED] ${channel.name}`)).setLocked();
interaction.editReply({
content: `Thread has been closed and marked as solved`,
ephemeral: true
});
break;
}
}
}
}module.exports = {
name: `thread`,
description: `Mark threads as solved or closed`,
cooldown: 0,
type: ApplicationCommandType.ChatInput,
options: [{
name: `option`,
description: `Chose to mark the thread as solved or closed`,
type: ApplicationCommandOptionType.String,
required: true,
choices: [{ name: 'Solved', value: 'solved' },
{ name: 'Closed', value: 'closed' }]
}],
async execute(interaction) {
const { options, channel } = interaction;
await interaction.deferReply({ ephemeral: true });
if (!channel.isThread()) {
return interaction.reply({
content: `This is not a thread channel`,
ephemeral: true
});
}
switch (options.getString('option')) {
case 'solved': {
(await channel.setName(`[SOLVED] ${channel.name}`)).setLocked();
interaction.editReply({
content: `Thread has been closed and marked as solved`,
ephemeral: true
});
break;
}
}
}
}