def handle(m, text)
plan = IsitCore.dispatch(
text: text,
ai_allowed: AiAccess.user_allowed?(
channel: m.channel,
user: m.user,
network: bot.config.server,
nick: m.user.nick,
irc: true
),
channel: m.channel&.name,
asker: m.user.nick,
network: bot.config.server,
rand: ->(max) { Random.rand(0...max) },
runner: AiAgent.method(:default_runner),
yaml_default: bot.config.shared[:ai_model]
)
return if plan[:reply].nil? && !plan[:async]
if plan[:async]
AsyncJob.run(label: "isit") do
themed_flood_safe_reply(m, plan[:run].call, with_progress: false)
end
else
themed_flood_safe_reply(m, plan[:reply], with_progress: false)
end
end