discourse-ai/lib/toxicity/entry_point.rb

21 lines
618 B
Ruby

# frozen_string_literal: true
module DiscourseAi
module Toxicity
class EntryPoint
def inject_into(plugin)
post_analysis_cb = Proc.new { |post| DiscourseAi::Toxicity::ScanQueue.enqueue_post(post) }
plugin.on(:post_created, &post_analysis_cb)
plugin.on(:post_edited, &post_analysis_cb)
chat_message_analysis_cb =
Proc.new { |message| DiscourseAi::Toxicity::ScanQueue.enqueue_chat_message(message) }
plugin.on(:chat_message_created, &chat_message_analysis_cb)
plugin.on(:chat_message_edited, &chat_message_analysis_cb)
end
end
end
end