public void GroupRun(SteamFriends.ChatMsgCallback callback, Bot bot, object[] args = null) { Random rnd = new Random(); string result = Util.RandomChoice<string>(Util.eightballAnswers); bot.ChatroomMessage(bot.chatRoomID, result); }
public void GroupRun(SteamFriends.ChatMsgCallback callback, Bot bot, object[] args = null) { List<string> strings = new List<string>(callback.Message.Split(' ')); strings.RemoveAt(0); string company = String.Join(" ", strings.ToArray()); bot.ChatroomMessage(bot.chatRoomID, Util.GetYahooStocks(company)); }
public void GroupRun(SteamFriends.ChatMsgCallback callback, Bot bot, object[] args = null) { List<string> strings = new List<string>(callback.Message.Split(' ')); strings.RemoveAt(0); string term = String.Join(" ", strings.ToArray()); bot.ChatroomMessage(bot.chatRoomID, Util.GetDDGTopicSummary(term)); }
public void GroupRun(SteamFriends.ChatMsgCallback callback, Bot bot, object[] args = null) { List<string> strings = new List<string>(callback.Message.Split(' ')); strings.RemoveAt(0); string user = (String.Join(" ", strings.ToArray())); List<SteamUserInfo> chattingUsers = args[0] as List<SteamUserInfo>; if (chattingUsers.Where(x => x.username.Equals(user)).Count() > 0) { string insult = Util.RandomChoice<string>(Util.insults); bot.ChatroomMessage(bot.chatRoomID, String.Format(insult, user)); } else { bot.ChatroomMessage(bot.chatRoomID, "I'm not going to insult somebody who isn't even here."); } }
public void GroupRun(SteamFriends.ChatMsgCallback callback, Bot bot, Object[] args = null) { if (args == null) { bot.ChatroomMessage(bot.chatRoomID, "List of commands not passed, bot performed an illegal operation."); } else { Dictionary<string, ICommand> commands = args[0] as Dictionary<string, ICommand>; StringBuilder sb = new StringBuilder(); sb.Append("\n"); foreach (ICommand com in commands.Values) { sb.AppendFormat("\t\t\t\t!{0} - {1}\n", com.GetCommandString(), com.GetDescription()); } bot.ChatroomMessage(bot.chatRoomID, sb.ToString()); } }
public void GroupRun(SteamFriends.ChatMsgCallback callback, Bot bot, object[] args = null) { string query = "select * from Jokes"; SQLiteDatabase db = new SQLiteDatabase(); DataTable jokes; jokes = db.GetDataTable(query); List<string> alljokes = new List<string>(); foreach (DataRow dr in jokes.Rows) { alljokes.Add(dr["JokeBody"].ToString()); } bot.ChatroomMessage(bot.chatRoomID, System.Text.RegularExpressions.Regex.Unescape(Util.RandomChoice(alljokes))); }
public void GroupRun(SteamFriends.ChatMsgCallback callback, Bot bot, object[] args = null) { bot.ChatroomMessage(bot.chatRoomID, System.Text.RegularExpressions.Regex.Unescape(Util.RandomChoice(mPhrases))); }
public void GroupRun(SteamFriends.ChatMsgCallback callback, Bot bot, object[] args = null) { List<string> strings = new List<string>(callback.Message.Split(' ')); strings.RemoveAt(0); string user = (String.Join(" ", strings.ToArray())); bool found = false; SteamUserInfo userInfo = new SteamUserInfo(); List<SteamUserInfo> chattingUsers = args[0] as List<SteamUserInfo>; foreach (SteamUserInfo sui in chattingUsers) { if (sui.username.Equals(user)) { found = true; userInfo = sui; break; } } if (found) { string accId = userInfo.id.ConvertToUInt64().ToString(); //Begin building a message StringBuilder sb = new StringBuilder(); sb.Append(String.Format("{0}'s stats:\n", user)); using (dynamic steamPlayerService = WebAPI.GetInterface("IPlayerService")) { Dictionary<string, string> funArgs = new Dictionary<string, string>(); funArgs["steamid"] = accId; funArgs["key"] = bot.apikey; //Get total number of games KeyValue results = steamPlayerService.Call("GetOwnedGames", 1, funArgs); string total = results["game_count"].Value.ToString(); sb.Append(String.Format("Games owned: " + total + "\n")); funArgs.Clear(); funArgs["steamid"] = accId; funArgs["key"] = bot.apikey; //Get info about recently played games results = steamPlayerService.Call("GetRecentlyPlayedGames", 1, funArgs); string totalPlayed = results["total_count"].Value.ToString(); var games = results["games"]; sb.Append(String.Format("Games played: " + totalPlayed + "\n\n")); try { foreach (var child in games.Children) { Dictionary<string, string> gameInfo = new Dictionary<string, string>(); foreach (var elem in child.Children) { gameInfo[elem.Name] = elem.Value; } int playtimeForever = int.Parse(gameInfo["playtime_forever"]); int playtime2weeks = int.Parse(gameInfo["playtime_2weeks"]); sb.Append(gameInfo["name"]); sb.Append(", total time played: "); sb.Append(String.Format("{0} hours {1} minutes", playtimeForever / 60, playtimeForever % 60)); sb.Append(", last two weeks: "); sb.Append(String.Format("{0} hours {1} minutes", playtime2weeks / 60, playtime2weeks % 60)); sb.Append("\n"); } } catch(Exception e) { mLog.Error(String.Format("Exception encountered in Game.GroupRun: {0}", e.ToString())); bot.ChatroomMessage(bot.chatRoomID, String.Format("Could not retrieve info about {0}, profile might be private.", user)); return; } bot.ChatroomMessage(bot.chatRoomID, sb.ToString()); } } }
public void GroupRun(SteamFriends.ChatMsgCallback callback, Bot bot, object[] args = null) { SteamFriends sf = args[0] as SteamFriends; AddNewTrivia(callback.Message, sf.GetFriendPersonaName(callback.ChatterID)); bot.ChatroomMessage(bot.chatRoomID, String.Format("Thank you {0}, trivia added", sf.GetFriendPersonaName(callback.ChatterID))); }
public void GroupRun(SteamFriends.ChatMsgCallback callback, Bot bot, object[] args = null) { AddNewJoke(callback.Message); bot.ChatroomMessage(bot.chatRoomID, "Thank you, joke added"); }