Skip to content

Instantly share code, notes, and snippets.

@rboyd
Created October 18, 2009 00:34
Show Gist options
  • Save rboyd/212502 to your computer and use it in GitHub Desktop.
Save rboyd/212502 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'cmdparse'
require 'OpenMetaverse'
require 'OpenMetaverseTypes'
include OpenMetaverse
class SayCmd < CmdParse::Command
def initialize(client)
super('say', false)
@client = client
end
def numeric?(object)
true if Float(object) rescue false
end
def execute(args)
channel = 0
if args.length > 1 then
if numeric?(args[0]) then
channel = args[0].to_i
args.slice!(0)
end
end
message = args.join(' ')
@client.Self.Chat(message, channel, ChatType.Normal);
puts "Said #{message} on #{channel}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment