private void Start() { deck.InitDeck(); foreach (var player in players.Where(player => player.State == PlayerState.NotYetPlaying)) { player.State = PlayerState.Playing; } foreach (var line in players.Where(p => p.State == PlayerState.Playing).Select(p => "%1 (%2, %3)".Fill(p.Nick, p.ChipStack, p.State)).ToLines(350, ", ", "{0}New Round{0}: Playing: ".Fill(IrcConstants.IrcBold), "")) { bot.SendMessage(SendType.Notice, channel, line); } foreach (var player in players) { deck.NextCard(); player.PocketCards.Card1 = deck.CurrentCard; deck.NextCard(); player.PocketCards.Card2 = deck.CurrentCard; bot.SendMessage(SendType.Message, player.Nick, "{0}New Round{0}: Your Chips: {3} - Your Hole Cards: {1} {2}" .Fill(IrcConstants.IrcBold, ToIrcCard(player.PocketCards.Card1), ToIrcCard(player.PocketCards.Card2), player.ChipStack)); } }
private void OutputUrlTitle(string url, IrcBot ircBot, string channel) { try { const string twitterStatusRegex = @"twitter.com/\w+/status/\d+"; string message; if (Regex.IsMatch(url, twitterStatusRegex)) { message = GetTwitterMessage(url); } else { message = GetWebPageTitle(url); } if (message != null) { ircBot.SendMessage(channel, message); } } catch { //Console.WriteLine(e.Message); } }
private void ConfigGet(object sender, IrcEventArgs e) { string sendto = e.Data.Channel.IsNullOrEmpty() ? e.Data.Nick : e.Data.Channel; if (e.Data.MessageArray.Length < 2) { foreach (var line in bot.Properties.GetType().GetProperties().Where(property => property.CanRead).Select(property => property.Name).ToLines(350)) { bot.SendMessage(SendType.Message, sendto, line); } } else { var propertyInfos = bot.Properties.GetType().GetProperties().Where(property => property.CanRead && property.Name == e.Data.MessageArray[1]).SingleOrDefault(); if (propertyInfos != null) { bot.SendMessage(SendType.Message, sendto, "Current Value: " + propertyInfos.GetValue(bot.Properties, null)); } else { bot.SendMessage(SendType.Message, sendto, "Dont know that property"); } } }
private void SendReply(string reply, IrcBot server, string user, object source) { server.SendMessage(user, reply); }
private void IDDelegate(object sender, IrcEventArgs e) { string sendto = (string.IsNullOrEmpty(e.Data.Channel)) ? e.Data.Nick : e.Data.Channel; string nicktToID = e.Data.Nick; if (e.Data.MessageArray.Length > 1) { nicktToID = e.Data.MessageArray[1]; } foreach (string line in Identified(nicktToID).ToLines(350, ", ", "IDs of the Nick '" + nicktToID + "': ", " END.")) { bot.SendMessage(SendType.Message, sendto, line); } foreach (string line in GetAllGroups(nicktToID).ToLines(350, ", ", "Nick is in Groups: ", " END.")) { bot.SendMessage(SendType.Message, sendto, line); } }