Sha256: ec2e5784ed398e6dcbc48431dcf06088efcb871dd7db840e8abd6f31cfdeb16c

Contents?: true

Size: 660 Bytes

Versions: 1

Compression:

Stored size: 660 Bytes

Contents

module Rlyeh
  class Target
    def initialize(env, target)
      @env = env
      @target = target
    end

    def send_message(command, text, prefix)
      prefix = {:nick => prefix.to_s} unless prefix.is_a?(Hash)
      unless prefix.key? :servername
        prefix[:nick] ||= 'rlyeh'
        prefix[:user] ||= 'rlyeh'
        prefix[:host] ||= @env.settings.server_name
      end

      @env.connection.send_message command, @target, ":#{text}", :prefix => prefix
    end

    def privmsg(text, prefix = nil)
      send_message 'PRIVMSG', text, prefix
    end

    def notice(text, prefix = nil)
      send_message 'NOTICE', text, prefix
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rlyeh-0.1.1 lib/rlyeh/target.rb