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. setName works sporadically while setLocked nothing at all Sample
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;
}
}
}
}
2 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
probablyraging
I should mention that there are no error logs, it seems like it just hangs at .setName and goes no further Thanks for the info. This is per channel or per guild? Great, thanks again