From 5b6afeafbc249ba88dcc20d1fbc98ce12418b21b Mon Sep 17 00:00:00 2001 From: gareth Date: Tue, 8 May 2007 00:10:04 +0000 Subject: Brought in TestClient code for teh fork --- ExportBot/Commands/Communication/SayCommand.cs | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 ExportBot/Commands/Communication/SayCommand.cs (limited to 'ExportBot/Commands/Communication/SayCommand.cs') diff --git a/ExportBot/Commands/Communication/SayCommand.cs b/ExportBot/Commands/Communication/SayCommand.cs new file mode 100644 index 0000000..d5717a6 --- /dev/null +++ b/ExportBot/Commands/Communication/SayCommand.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; + +namespace libsecondlife.TestClient +{ + public class SayCommand: Command + { + public SayCommand(TestClient testClient) + { + Name = "say"; + Description = "Say something. (usage: say (optional channel) whatever)"; + } + + public override string Execute(string[] args, LLUUID fromAgentID) + { + int channel = 0; + int startIndex = 0; + + if (args.Length < 1) + { + return "usage: say (optional channel) whatever"; + } + else if (args.Length > 1) + { + if (Int32.TryParse(args[0], out channel)) + startIndex = 1; + } + + StringBuilder message = new StringBuilder(); + + for (int i = startIndex; i < args.Length; i++) + { + message.Append(args[i]); + if (i != args.Length - 1) message.Append(" "); + } + + Client.Self.Chat(message.ToString(), channel, MainAvatar.ChatType.Normal); + + return "Said " + message.ToString(); + } + } +} -- cgit v1.1