示例#1
0
 public override void OnMessageReceived(string sender, string receivedMessage, string channel)
 {
     if (sender == "RockyTV")
     {
         if (receivedMessage.StartsWith("!join "))
         {
             string targetChannel = receivedMessage.Substring(6);
             ModuleHandler.client.JoinChannel(targetChannel);
             ModuleHandler.SendPrivateMessage("Joined " + targetChannel + ".", sender);
         }
     }
 }
示例#2
0
        public override void OnMessageReceived(string sender, string receivedMessage, string channel)
        {
            if (receivedMessage.StartsWith("!time "))
            {
                string trimmedMessage = receivedMessage.Substring(5).Trim();
                if (trimmedMessage.Contains("+"))
                {
                    string utcZone = trimmedMessage.Substring(0, trimmedMessage.IndexOf("+") + 2).ToUpper();
                    Console.WriteLine(trimmedMessage.IndexOf("+").ToString());

                    ModuleHandler.SendMessage(DateTime.UtcNow.ToString("s"), channel);

                    ModuleHandler.SendPrivateMessage("UTC zone: " + utcZone, sender);
                }
            }
        }
示例#3
0
        public override void OnMessageReceived(string sender, string message, string channel)
        {
            if (message == "!hello")
            {
                ModuleHandler.SendMessage("Hello!", channel);
            }

            if (message.StartsWith("!hello "))
            {
                string target = message.Substring(7);
                if (ModuleHandler.client.Channels[channel].Users.Contains(target))
                {
                    ModuleHandler.SendMessage("Hello, " + target + "!", channel);
                }
                else
                {
                    ModuleHandler.SendPrivateMessage("Looks like that the user '" + target + "' is not on the channel '" + channel + "'", sender);
                }
            }
        }