module AutovoiceActivity
AutovoiceActivity — qualify and record trusted human channel activity for polling. Public: qualifies?, record_from_message Depends: ChannelTrust, Normalize, AutovoiceStore Tests: test/lib/autovoice_activity_test.rb, test/plugins/autovoice_test.rb
Constants
- COMMAND_PATTERN
Public Instance Methods
Source
# File lib/autovoice/activity.rb, line 17 def qualifies?(network:, channel:, nick:, text:, channel_obj:, bot_nick:, bot_nicks: ChannelTrust.persona_bot_nicks) cleaned = text.to_s.strip return false if cleaned.empty? return false if cleaned.match?(COMMAND_PATTERN) normalized = Normalize.nick(nick) return false if normalized.casecmp?(bot_nick.to_s) return false if ChannelTrust.bot_nick?(normalized, bot_nicks: bot_nicks) user = Struct.new(:nick).new(normalized) ChannelTrust.trusted_context_nick?( nick: normalized, channel: channel_obj || channel, user: user, network: network, bot_nicks: bot_nicks ) end
Source
# File lib/autovoice/activity.rb, line 37 def record_from_message(network:, channel:, nick:, text:, channel_obj:, bot_nick:, at: Time.now, store: RabbotDb, bot_nicks: ChannelTrust.persona_bot_nicks) return false unless AutovoiceStore.enabled?(network: network, channel: channel, store: store) return false unless qualifies?( network: network, channel: channel, nick: nick, text: text, channel_obj: channel_obj, bot_nick: bot_nick, bot_nicks: bot_nicks ) AutovoiceStore.touch_activity!(network: network, channel: channel, at: at, store: store) true end