2023-05-05 14:28:31 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module ::Jobs
|
|
|
|
class CreateAiReply < ::Jobs::Base
|
|
|
|
sidekiq_options retry: false
|
|
|
|
|
|
|
|
def execute(args)
|
2023-05-11 09:03:03 -04:00
|
|
|
return unless bot_user = User.find_by(id: args[:bot_user_id])
|
|
|
|
return unless bot = DiscourseAi::AiBot::Bot.as(bot_user)
|
2023-05-05 14:28:31 -04:00
|
|
|
return unless post = Post.includes(:topic).find_by(id: args[:post_id])
|
|
|
|
|
2023-05-11 09:03:03 -04:00
|
|
|
bot.reply_to(post)
|
2023-05-05 14:28:31 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|