Skip to content

Commit

Permalink
try to fix resolve shash command
Browse files Browse the repository at this point in the history
  • Loading branch information
GhomKrosmonaute committed May 5, 2024
1 parent d4efd64 commit ea9fffe
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/slash/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,36 @@ export default new app.SlashCommand({
const forum = topic.parent

if (!interaction.guild)
return interaction.reply({
content: `${app.emote(interaction, "Cross")} Only usable in a guild.`,
return interaction.base.reply({
content: `${app.emote(topic, "Cross")} Only usable in a guild.`,
ephemeral: true,
})

if (!forum || !forum.isThreadOnly())
return interaction.reply({
content: `${app.emote(interaction, "Cross")} Only usable in a forum topic.`,
return interaction.base.reply({
content: `${app.emote(topic, "Cross")} Only usable in a forum topic.`,
ephemeral: true,
})

const { resolved_channel_indicator, resolved_channel_tag } =
await app.getGuild(interaction.guild, true)

if (topic.name.startsWith(resolved_channel_indicator))
return interaction.reply({
content: `${app.emote(interaction, "Cross")} Topic is already resolved.`,
return interaction.base.reply({
content: `${app.emote(topic, "Cross")} Topic is already resolved.`,
ephemeral: true,
})

await topic.setName(`${resolved_channel_indicator} ${topic.name}`)

if (resolved_channel_tag) await topic.setAppliedTags([resolved_channel_tag])
if (resolved_channel_tag) {
try {
await topic.setAppliedTags([resolved_channel_tag])
} catch (err) {}
}

return interaction.reply({
content: `${app.emote(interaction, "CheckMark")} Thread marked as resolved.`,
return interaction.base.reply({
content: `${app.emote(topic, "CheckMark")} Thread marked as resolved.`,
ephemeral: true,
})
},
Expand Down

0 comments on commit ea9fffe

Please sign in to comment.