class Wget
Constants
- USER_AGENT
Public Class Methods
Source
# File plugins/wget.rb, line 18 def self.command_pattern /wget(?:\s+(.+))?$/i end
Source
# File plugins/wget.rb, line 46 def self.default_fetch ->(url) { RabbotHttp.fetch(url, user_agent: USER_AGENT) } end
Source
# File plugins/wget.rb, line 24 def self.dispatch(args:, network:, channel:, nick:, ai_allowed:, fetch: nil, runner: nil, storage_root: nil, store: RabbotDb, model: ImageWget::AGENT_MODEL, api_key: nil) parsed = ImageWget.parse_command(args) return { success: false, reply: parsed[:error] } if parsed[:error] ImageWget.dispatch( network: network, channel: channel, nick: nick, url: parsed[:url], question: parsed[:question], ai_allowed: ai_allowed, fetch: fetch || default_fetch, runner: runner, storage_root: storage_root, store: store, model: model, google_drive_api_key: api_key || GoogleDriveApi.api_key ) end
Public Instance Methods
Source
# File plugins/wget.rb, line 50 def execute(m, args = nil) unless m.channel m.reply "Use !wget in a channel" return end result = self.class.dispatch( args: args, network: bot.config.server, channel: m.channel.name, nick: m.user.nick, ai_allowed: AiAccess.user_allowed?( channel: m.channel, user: m.user, network: bot.config.server, nick: m.user.nick ), api_key: GoogleDriveApi.api_key ) flood_safe_reply(m, result[:reply]) end