#"Property 'threads' does not exist on type 'GuildChannel'"

1 messages · Page 1 of 1 (latest)

silver forge
#
const COMMAND_forceticket = async (interaction: ChatInputCommandInteraction) => {
  const userId = interaction.options.getUser('user')?.id;
  const channel = interaction.channel as GuildChannel;

  if (!userId) {
      await interaction.reply('Please provide a valid user.');
      return;
  }

  try {
      const thread = await channel.threads.create({
          name: 'Ticket - ' + userId,
          autoArchiveDuration: 60,
          type: 'GUILD_PRIVATE_THREAD',
          startMessage: {
              content: `<@${userId}>`,
          },
      });

      await interaction.reply(`Ticket created: ${thread.toString()}`);
  } catch (error) {
      console.error(error);
      await interaction.reply('An error occurred while creating the ticket.');
  }
};```

im making a command where we open a ticket with a user. the command takes their ID and uses the same channel to create private threads. the issue is that it tells me the title of this post as the error at ```const thread = await channel.threads.create({```
kinda stumped on what to do
#

Ive changed the as GuildChannel to as TextChannel but that's also caused issues.