예제 #1
0
 internal void OnChannelMessage(BotShell sender, SlaveArgs slave, ChannelMessageArgs e)
 {
     if (this.ChannelMessageEvent != null)
     {
         try { this.ChannelMessageEvent(sender, slave, e); }
         catch { }
     }
 }
예제 #2
0
 internal void OnPrivateMessage(BotShell sender, SlaveArgs slave, PrivateMessageArgs e)
 {
     if (this.PrivateMessageEvent != null)
     {
         try { this.PrivateMessageEvent(sender, slave, e); }
         catch { }
     }
 }
예제 #3
0
 internal void OnUserLeaveChannel(BotShell sender, SlaveArgs slave, UserLeaveChannelArgs e)
 {
     if (this.UserLeaveChannelEvent != null)
     {
         try { this.UserLeaveChannelEvent(sender, slave, e); }
         catch { }
     }
 }
예제 #4
0
        private void SlaveEvents_PrivateMessageEvent(BotShell bot, SlaveArgs slave, PrivateMessageArgs e)
        {
            string prepend = string.Empty;

            if (e.Self)
            {
                prepend = "To ";
            }
            this.Output("Tells", String.Format("{0}[{1}]: {2}", prepend, e.Sender, HTML.UnescapeString(HTML.StripTags(e.Message))));
        }
예제 #5
0
        private static SlaveArgs ParseArgs(string[] args)
        {
            bool invalidOptions = false;
            var  argsOption     = new SlaveArgs();
            var  result         = Parser.Default.ParseArguments <SlaveArgs>(args)
                                  .WithParsed(options => argsOption = options)
                                  .WithNotParsed(error => {
                Console.WriteLine($"Fail to parse the options: {error}");
                invalidOptions = true;
            });

            if (invalidOptions)
            {
                return(null);
            }
            return(argsOption);
        }
예제 #6
0
 private void SlaveEvents_PrivateChannelMessageEvent(BotShell bot, SlaveArgs slave, PrivateChannelMessageArgs e)
 {
     this.Output(e.Channel, String.Format("[{0}] {1}: {2}", slave.Slave, e.Sender, HTML.UnescapeString(HTML.StripTags(e.Message))));
 }