private void SendFormattedItem(TwitterWrapper twitteraccount, TwitterStatus mention, string sendto) { if (twitteraccount == null || mention == null) { return; } BotMethods.SendMessage(SendType.Message, sendto, MessageFormat.FillKeyword( "%FEEDNAME%", twitteraccount.FriendlyName, "%ACCOUNT%", twitteraccount.User, "%TWEET%", Colorize(mention.Text), "%ID%", mention.Id.ToString(), "%SCREENNAME%", mention.User.ScreenName, "%AUTHOR%", mention.User.Name, "%LOCATION%", mention.Location != null ? mention.Location.ToString() : "nowhere", "%DATE%", mention.CreatedDate.ToString(), "%AGO%", mention.CreatedDate.ToRelativeTime(), "%#FOLLOW%", mention.User.FollowersCount.ToString(), "%#STATUS%", mention.User.StatusesCount.ToString(), "%#FRIENDS%", mention.User.FriendsCount.ToString(), "%#FAVS%", mention.User.FavouritesCount.ToString(), "%#LANG%", mention.User.Language, "%#USERURL%", mention.User.Url )); }
public override void OnTick() { try { foreach (var twitteraccount in twitterAccounts) { foreach (var mention in twitteraccount.Value.GetNewMentions()) { foreach (var channel in BotMethods.JoinedChannels) { SendFormattedItem(twitteraccount.Value, mention, channel); } } } foreach (var tag in TwitterData.TwitterTags.Select(t => t.Tag)) { foreach (var tagStatus in TwitterWrapper.SearchNewTag(tag)) { foreach (var channel in BotMethods.JoinedChannels) { BotMethods.SendMessage(SendType.Message, channel, "Tag: {0} (by {1})".Fill(tagStatus.Text, tagStatus.FromUserScreenName)); } } } } finally { TwitterSettings.Default.Save(); } }
private void TweetTrendsHandler(object sender, IrcEventArgs e) { var sendto = (string.IsNullOrEmpty(e.Data.Channel)) ? e.Data.Nick : e.Data.Channel; var trends = TwitterWrapper.GetTrends(); if (trends != null) { foreach (var line in trends.Trends.Select(trend => trend.Name).ToLines(350, ", ", "Current trends: ", "")) { BotMethods.SendMessage(SendType.Message, sendto, line); } return; } }
private void SendFormattedItem(TwitterWrapper twitteraccount, TwitterStatus mention, string sendto) { if (twitteraccount == null || mention == null) return; BotMethods.SendMessage(SendType.Message, sendto, MessageFormat.FillKeyword( "%FEEDNAME%", twitteraccount.FriendlyName, "%ACCOUNT%", twitteraccount.User, "%TWEET%", Colorize(mention.Text), "%ID%", mention.Id.ToString(), "%SCREENNAME%", mention.User.ScreenName, "%AUTHOR%", mention.User.Name, "%LOCATION%", mention.Location != null ? mention.Location.ToString() : "nowhere", "%DATE%", mention.CreatedDate.ToString(), "%AGO%", mention.CreatedDate.ToRelativeTime(), "%#FOLLOW%", mention.User.FollowersCount.ToString(), "%#STATUS%", mention.User.StatusesCount.ToString(), "%#FRIENDS%", mention.User.FriendsCount.ToString(), "%#FAVS%", mention.User.FavouritesCount.ToString(), "%#LANG%", mention.User.Language, "%#USERURL%", mention.User.Url )); }