internal void OnChannelMessage(BotShell sender, SlaveArgs slave, ChannelMessageArgs e) { if (this.ChannelMessageEvent != null) { try { this.ChannelMessageEvent(sender, slave, e); } catch { } } }
internal void OnPrivateMessage(BotShell sender, SlaveArgs slave, PrivateMessageArgs e) { if (this.PrivateMessageEvent != null) { try { this.PrivateMessageEvent(sender, slave, e); } catch { } } }
internal void OnUserLeaveChannel(BotShell sender, SlaveArgs slave, UserLeaveChannelArgs e) { if (this.UserLeaveChannelEvent != null) { try { this.UserLeaveChannelEvent(sender, slave, e); } catch { } } }
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)))); }
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); }
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)))); }