Reply bot for Discourse?

Ruby 프로그래밍 경험이 있는 사람이라면 기술적으로 쉬운 작업입니다. :post_created 이벤트에 응답하는 플러그인을 작성하고, 다음과 같은 코드를 작성하면 됩니다:

DiscourseEvent.on(:post_created) do |*params|
    post, opt, user = params

    if post.raw.include "foo"
        PostCreator.create!(
             User.find_by(id: bot_id),
             topic_id: post.topic_id,
             raw: "bar",
        )
    end
end
4개의 좋아요