对于有 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