# Reply bot for Discourse?

**URL:** <https://meta.discourse.org/t/reply-bot-for-discourse/71928>\
**Category:** Feature\
**Tags:** automation, ai\
**Created:** [2017 年 10 月 12 日午前 10:57 UTC](https://meta.discourse.org/t/reply-bot-for-discourse/71928 "2017-10-12T10:57:37Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)\
**Post date:** [2023 年 8 月 22 日午前 2:10 UTC](https://meta.discourse.org/t/reply-bot-for-discourse/71928/12 "2023-08-22T02:10:35Z")

</div>

Rubyプログラミングの経験がある人にとっては、技術的には簡単です。`:post_created`イベントに応答するプラグインを書き、次のようなコードを記述します。

```ruby
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

```

---

_[View the full topic](https://meta.discourse.org/t/reply-bot-for-discourse/71928)._
