def on_privmsg(m)
target, message = *m.params
if message =~ / +\//
termtter_command = message.gsub(/ +\//, '')
return unless Termtter::Client.find_command(termtter_command)
post '#termtter', NOTICE, main_channel, '> ' + termtter_command
Termtter::Client.execute(termtter_command)
return
end
config.plugins.irc_gw.command_regexps and
config.plugins.irc_gw.command_regexps.each do |rule|
if message =~ rule
command = message.scan(rule).first.join(' ')
next unless Termtter::Client.find_command(command)
post '#termtter', NOTICE, main_channel, '> ' + command
Termtter::Client.execute(command)
return
end
end
Termtter::Client.execute('update ' + message)
post @prefix, TOPIC, main_channel, message
rescue Exception => e
post '#termtter', NOTICE, main_channel, "#{e.class.to_s}: #{e.message}"
Termtter::Client.handle_error(e)
end