Issues with creating a post and locking the topic via the API

Hi Blake, the topic I was trying it for already exists :slight_smile:

This was my process:

  bot.create_post(topic_id, post_content)
  bot.switch_to_master_bot!("system")
  bot.lock_topic("", topic_id)

  def create_post(topic_id, post_content)
    @client.create_post(
      topic_id: "#{topic_id}",
      raw: "#{post_content}",
    )
  end

  def lock_topic(slug, topic_id)
    params = { status: 'closed', enabled: true }
    @client.change_topic_status(slug, topic_id, params)
  end

I’m using the Discourse API Gem.

Are you saying the above should work (or is working for you)?