SendData() public method

Puts a message on the upstream IRC message buffer.
public SendData ( string p_string ) : void
p_string string The message to put on the upstream IRC message buffer.
return void
Exemplo n.º 1
0
        /// <summary>
        /// Sends the given IRCResponse to the server, using the method specified by the IRCResponse's ResponseType.
        /// </summary>
        /// <param name="response">The IRCResponse to send to the server.</param>
        /// <returns>Whether or not the send was successful (actually whether or not the given response is valid).</returns>
        bool Send(IRCResponse response)
        {
            if (response == null)
            {
                return(false);
            }

            switch (response.Type)
            {
            case ResponseType.Say:
                Say(response.Response, response.Target);
                break;

            case ResponseType.Do:
                Do(response.Response, response.Target);
                break;

            case ResponseType.Notice:
                Notice(response.Response, response.Target);
                break;

            case ResponseType.Raw:
                cwIRC.SendData(response.Response);
                break;
            }
            return(true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor for MoronBot.
        /// This is where:
        ///  - All of the Bot's Functions are loaded.
        ///  - Settings is initialized from xml.
        ///  - The initial connection to the server is made.
        /// </summary>
        public MoronBot()
        {
            if (!LoadXML("settings.xml"))
            {
                SaveXML("settings.xml");
            }

            LoadFunctions();

            //PluginLoader.WatchDirectory(Settings.Instance.FunctionPath, FuncDirChanged);

            Nick = Settings.Instance.Nick;

            cwIRC = CwIRC.Interface.Instance;

            cwIRC.MessageReceived += CwIRC_MessageReceived;
            cwIRC.Connect(Settings.Instance.Server, Settings.Instance.Port);
            cwIRC.NICK(Nick);
            cwIRC.USER(Nick, "Nope", "Whatever", "MoronBot 0.1.6");
            cwIRC.SendData("PASS mOrOnBoTuS");
            Say("identify mOrOnBoTuS", "NickServ");

            cwIRC.JOIN(Settings.Instance.Channel);

            connectionTimer.Elapsed += new System.Timers.ElapsedEventHandler(connectionTimer_Elapsed);
            connectionTimer.Interval = 120000;
            connectionTimer.Enabled  = true;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Constructor for MoronBot.
        /// This is where: 
        ///  - All of the Bot's Functions are loaded.
        ///  - Settings is initialized from xml.
        ///  - The initial connection to the server is made.
        /// </summary>
        public MoronBot()
        {
            if (!LoadXML("settings.xml"))
            {
                SaveXML("settings.xml");
            }

            LoadFunctions();

            //PluginLoader.WatchDirectory(Settings.Instance.FunctionPath, FuncDirChanged);

            Nick = Settings.Instance.Nick;

            cwIRC = CwIRC.Interface.Instance;

            cwIRC.MessageReceived += CwIRC_MessageReceived;
            cwIRC.Connect(Settings.Instance.Server, Settings.Instance.Port);
            cwIRC.NICK(Nick);
            cwIRC.USER(Nick, "Nope", "Whatever", "MoronBot 0.1.6");
            cwIRC.SendData("PASS mOrOnBoTuS");
            Say("identify mOrOnBoTuS", "NickServ");

            cwIRC.JOIN(Settings.Instance.Channel);

            connectionTimer.Elapsed += new System.Timers.ElapsedEventHandler(connectionTimer_Elapsed);
            connectionTimer.Interval = 120000;
            connectionTimer.Enabled = true;
        }